diff --git a/xdk-gen/src/python/generator.rs b/xdk-gen/src/python/generator.rs index c47f361b..457a08ce 100644 --- a/xdk-gen/src/python/generator.rs +++ b/xdk-gen/src/python/generator.rs @@ -49,7 +49,12 @@ language! { render "paginator" => "xdk/paginator.py", render "init_py" => "xdk/__init__.py", render "pyproject_toml" => "pyproject.toml", - render "readme" => "README.md" + render "sphinx_conf" => "conf.py", + render "generate_docs_simple" => "scripts/generate-docs-simple.py", + render "process_for_mintlify" => "scripts/process-for-mintlify.py", + render "watch_docs" => "scripts/watch-docs.py", + render "readme" => "README.md", + render "gitignore" => ".gitignore" ], tests: [ multiple { diff --git a/xdk-gen/src/typescript/generator.rs b/xdk-gen/src/typescript/generator.rs index 02c2704e..013536e0 100644 --- a/xdk-gen/src/typescript/generator.rs +++ b/xdk-gen/src/typescript/generator.rs @@ -85,7 +85,11 @@ language! { render "tsup.config" => "tsup.config.ts", render "typedoc.json" => "typedoc.json", render "npmignore" => ".npmignore", + render "gitignore" => ".gitignore", render "generate_docs" => "scripts/generate-docs.js", + render "generate_docs_simple" => "scripts/generate-docs-simple.js", + render "watch_docs" => "scripts/watch-docs.js", + render "process_for_mintlify" => "scripts/process-for-mintlify.js", render "readme" => "README.md" ], tests: [ diff --git a/xdk-gen/templates/python/generate_docs_simple.j2 b/xdk-gen/templates/python/generate_docs_simple.j2 new file mode 100644 index 00000000..6caf934a --- /dev/null +++ b/xdk-gen/templates/python/generate_docs_simple.j2 @@ -0,0 +1,151 @@ +#!/usr/bin/env python3 +""" +AUTO-GENERATED FILE - DO NOT EDIT +This file was automatically generated by the XDK build tool. +Any manual changes will be overwritten on the next generation. + +Generate API documentation for the Python SDK using Sphinx with markdown output. +""" + +import os +import sys +import shutil +import subprocess +from pathlib import Path + +print('🚀 Generating X API SDK Documentation...') + +# Try to use virtual environment if available +venv_python = Path('.venv') / 'bin' / 'python' +if venv_python.exists(): + print('📦 Using virtual environment...') + python_exe = str(venv_python) +else: + python_exe = sys.executable + +# Configuration +DOCS_DIR = Path('docs') +SPHINX_SOURCE_DIR = Path('docs_source') +SPHINX_BUILD_DIR = DOCS_DIR / '_build' +SPHINX_MARKDOWN_DIR = DOCS_DIR + +# Clean up old docs +if DOCS_DIR.exists(): + shutil.rmtree(DOCS_DIR) +DOCS_DIR.mkdir(parents=True, exist_ok=True) + +# Clean up old source +if SPHINX_SOURCE_DIR.exists(): + shutil.rmtree(SPHINX_SOURCE_DIR) + +# Create Sphinx source directory structure +SPHINX_SOURCE_DIR.mkdir(parents=True, exist_ok=True) +(SPHINX_SOURCE_DIR / '_static').mkdir(exist_ok=True) +(SPHINX_SOURCE_DIR / '_templates').mkdir(exist_ok=True) + +# Copy conf.py from root (should be generated) +conf_py_path = Path('conf.py') +if conf_py_path.exists(): + shutil.copy(conf_py_path, SPHINX_SOURCE_DIR / 'conf.py') +else: + print('⚠️ Warning: conf.py not found. Sphinx may not work correctly.') + +try: + # Use sphinx-apidoc to auto-generate API documentation + print('📚 Running sphinx-apidoc to generate API documentation structure...') + apidoc_cmd = [ + python_exe, '-m', 'sphinx.ext.apidoc', + '-o', str(SPHINX_SOURCE_DIR), + '-f', # Force overwrite + '--separate', # Put each module in its own file + 'xdk', # Source package + ] + + subprocess.run(apidoc_cmd, check=True, capture_output=True, text=True) + + # Create or update index.rst + index_content = """X API SDK Documentation +========================== + +Welcome to the X API SDK documentation. + +.. toctree:: + :maxdepth: 2 + :caption: API Reference: + + modules + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` +""" + + (SPHINX_SOURCE_DIR / 'index.rst').write_text(index_content) + + # Run Sphinx with markdown builder + print('📚 Running Sphinx to generate markdown documentation...') + + sphinx_cmd = [ + python_exe, '-m', 'sphinx', + '-b', 'markdown', # Use markdown builder + str(SPHINX_SOURCE_DIR), + str(SPHINX_MARKDOWN_DIR), + ] + + result = subprocess.run(sphinx_cmd, check=True, capture_output=True, text=True) + print('✅ Documentation generated successfully in docs/') + + # Clean up build directory + if SPHINX_BUILD_DIR.exists(): + shutil.rmtree(SPHINX_BUILD_DIR) + + # Clean up source directory + if SPHINX_SOURCE_DIR.exists(): + shutil.rmtree(SPHINX_SOURCE_DIR) + +except subprocess.CalledProcessError as e: + print(f'❌ Documentation generation failed: {e}') + if e.stdout: + print(f'stdout: {e.stdout}') + if e.stderr: + print(f'stderr: {e.stderr}') + sys.exit(1) +except FileNotFoundError: + print('❌ Sphinx not found.') + print('💡 Installing dependencies...') + try: + # Try to install using uv if available + if shutil.which('uv'): + subprocess.run(['uv', 'pip', 'install', '-e', '.[dev]'], check=True, shell=False) + else: + # Fallback to pip + subprocess.run([sys.executable, '-m', 'pip', 'install', 'sphinx', 'myst-parser', 'sphinx-markdown-builder'], check=True) + print('✅ Dependencies installed. Please run the script again.') + except subprocess.CalledProcessError: + print('❌ Failed to install dependencies automatically.') + print('💡 Please install manually with:') + print(" uv pip install -e '.[dev]'") + print(' or') + print(' pip install sphinx myst-parser sphinx-markdown-builder') + sys.exit(1) +except ImportError as e: + if 'myst_parser' in str(e) or 'myst-parser' in str(e): + print('❌ myst-parser not found.') + print('💡 Installing dependencies...') + try: + if shutil.which('uv'): + subprocess.run(['uv', 'pip', 'install', '-e', '.[dev]'], check=True, shell=False) + else: + subprocess.run([sys.executable, '-m', 'pip', 'install', 'myst-parser', 'sphinx-markdown-builder'], check=True) + print('✅ Dependencies installed. Please run the script again.') + except subprocess.CalledProcessError: + print('❌ Failed to install dependencies automatically.') + print('💡 Please install manually with:') + print(" uv pip install -e '.[dev]'") + else: + raise + sys.exit(1) + diff --git a/xdk-gen/templates/python/gitignore.j2 b/xdk-gen/templates/python/gitignore.j2 new file mode 100644 index 00000000..33b25094 --- /dev/null +++ b/xdk-gen/templates/python/gitignore.j2 @@ -0,0 +1,44 @@ +# Documentation generation outputs +# These are generated by the docs scripts and should not be committed + +# Sphinx output directories +docs/ +docs/_build/ +docs_source/ + +# Mintlify processed documentation +mintlify-docs/ + +# Python cache +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python + +# Virtual environments +venv/ +env/ +ENV/ +.venv + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# Distribution / packaging +dist/ +build/ +*.egg-info/ + +# Testing +.pytest_cache/ +.coverage +htmlcov/ + +# Type checking +.mypy_cache/ +.pytype/ + diff --git a/xdk-gen/templates/python/process_for_mintlify.j2 b/xdk-gen/templates/python/process_for_mintlify.j2 new file mode 100644 index 00000000..ba970b76 --- /dev/null +++ b/xdk-gen/templates/python/process_for_mintlify.j2 @@ -0,0 +1,1585 @@ +#!/usr/bin/env python3 +""" +AUTO-GENERATED FILE - DO NOT EDIT +This file was automatically generated by the XDK build tool. +Any manual changes will be overwritten on the next generation. + +Process Sphinx-generated markdown documentation for Mintlify. +""" + +import os +import sys +import json +import re +import shutil +from pathlib import Path +from typing import Dict, List, Optional, Set + +print('🚀 Processing X API SDK Documentation for Mintlify...') + +# Mintlify configuration +MINTLIFY_CONFIG = { + 'outputDir': 'mintlify-docs', + 'baseUrl': 'https://docs.x.com', + 'title': 'X API SDK v{{ version }}', + 'description': 'Python SDK for the X API with comprehensive pagination, authentication, and streaming support.', + 'version': '{{ version }}', + 'githubUrl': 'https://github.com/xdevplatform/xdk', +} + +def clean_title(title: str, file_path: str = '', content: str = '') -> str: + """Clean and improve title formatting.""" + if not isinstance(title, str): + title = str(title) + + # Try to extract class name from content first (more reliable) + if content: + # Look for class definition: ### *class* xdk.module.ClassName + class_match = re.search( + r'\*class\*\s+[^\s]*\.([A-Z][a-zA-Z0-9_]*Client|Client|Paginator|OAuth2PKCEAuth)\b', + content + ) + if class_match: + return class_match.group(1) + + # Remove module suffix + title = re.sub(r'\s+module\s*$', '', title, flags=re.IGNORECASE) + + # Extract class name from patterns like "xdk.users.client.UsersClient" + class_match = re.search(r'\.([A-Z][a-zA-Z0-9_]+Client|Paginator|OAuth2PKCEAuth)\b', title) + if class_match: + return class_match.group(1) + # Fallback to generic Client only if no specific client found + if 'Client' in title and not re.search(r'[A-Z][a-zA-Z0-9_]+Client', title): + class_match = re.search(r'\.(Client)\b', title) + if class_match: + return class_match.group(1) + + # Extract class name from patterns like "*class* xdk.users.client.UsersClient" + class_match2 = re.search(r'\*class\*\s+[^\s]*\.([A-Z][a-zA-Z0-9_]*Client|Client|Paginator|OAuth2PKCEAuth)\b', title) + if class_match2: + return class_match2.group(1) + + # Remove xdk. prefix + title = re.sub(r'^xdk\.', '', title) + + # Convert snake_case to PascalCase for module names + if '.' in title and not title[0].isupper(): + parts = title.split('.') + # Capitalize each part + title = '.'.join(p.capitalize() for p in parts) + + # Clean up + title = ( + re.sub(r'<.*?>', '', title) # Remove generic type parameters + .replace('Class: ', '') + .replace('Interface: ', '') + .replace('*class*', '') + .replace('*', '') + .replace('\\', '') + .replace('\n', ' ') + .strip() + ) + + return title + +def generate_frontmatter(title: str, sidebar_title: Optional[str] = None, file_path: str = '') -> str: + """Generate Mintlify frontmatter.""" + cleaned_title = clean_title(title, file_path) + cleaned_sidebar = clean_title(sidebar_title, file_path) if sidebar_title else cleaned_title + + frontmatter = f'title: "{cleaned_title}"\n' + if sidebar_title: + frontmatter += f'sidebarTitle: "{cleaned_sidebar}"\n' + + return f'---\n{frontmatter}---\n\n' + +def reorganize_class_structure(content: str, file_path: str) -> str: + """Reorganize content into proper sections like TypeScript.""" + # Check if this is a class/client file + if 'client' not in file_path.lower() and 'models' not in file_path.lower(): + return content + + # Find class definition - handle both formats + # Pattern 1: ### *class* xdk.module.ClassName(params) + # Pattern 2: ### `*class* xdk.module.ClassName`(params) + class_match = re.search(r'###\s+(?:`?)?\*class\*\s+([^\n(]+)(?:`?)?\s*\(([^)]*)\)', content) + if not class_match: + return content + + class_name_full = class_match.group(1).strip().replace('*', '').replace('`', '') + # Extract just the class name (last part after last dot) + class_name = class_name_full.split('.')[-1] if '.' in class_name_full else class_name_full + class_params = class_match.group(2).strip() + + # Extract description after class definition + class_start = class_match.end() + next_section = content.find('###', class_start) + if next_section == -1: + next_section = len(content) + + description = content[class_start:next_section].strip() + # Extract "Bases:" line for later use as Badge + bases_match = re.search(r'Bases:\s*`([^`]+)`', description, re.IGNORECASE) + bases = bases_match.group(1).strip() if bases_match else None + # Remove "Bases:" line - we'll add it as a Badge + description = re.sub(r'Bases:\s*`[^`]+`\s*\n?', '', description, flags=re.IGNORECASE) + # Remove any stray closing parentheses + description = re.sub(r'^\)\s*\n?', '', description) + description = description.strip() + + # Find all methods and properties + methods = [] + constructors = [] + properties = [] + + # Pattern for methods: ### method_name(params) → ReturnType + method_pattern = r'###\s+`?([^\n(]+)`?\s*\(([^)]*)\)(?:\s*→\s*([^\n]+))?' + for match in re.finditer(method_pattern, content): + method_name = match.group(1).strip().replace('`', '').replace('\\', '').replace('*', '') + params = match.group(2).strip() + return_type = match.group(3).strip() if match.group(3) else None + + # Find method body + method_start = match.start() + next_method = content.find('###', method_start + 1) + if next_method == -1: + method_body = content[method_start:] + else: + method_body = content[method_start:next_method] + + method_info = { + 'name': method_name, + 'params': params, + 'return_type': return_type, + 'body': method_body + } + + if method_name == '__init__' or 'constructor' in method_name.lower(): + constructors.append(method_info) + elif method_name.startswith('property') or 'property' in method_body.lower(): + properties.append(method_info) + else: + methods.append(method_info) + + # Rebuild content with proper sections + sections = [] + + # Class definition and description + sections.append(f'## {class_name}\n\n') + sections.append('Class\n') + if bases: + sections.append(f'\nBases: {bases}\n') + if description: + sections.append(f'\n{description}\n') + + # Constructors section + if constructors: + sections.append('\n## Constructors\n') + for const in constructors: + sections.append(const['body']) + + # Methods section + if methods: + sections.append('\n## Methods\n') + for method in methods: + sections.append(method['body']) + + # Properties section + if properties: + sections.append('\n## Properties\n') + for prop in properties: + sections.append(prop['body']) + + # If we found methods/constructors, rebuild content + if constructors or methods or properties: + before_class = content[:class_match.start()] + # Get remaining content after last method + if methods: + last_method_end = content.rfind(methods[-1]['body']) + remaining = content[last_method_end + len(methods[-1]['body']):] + elif constructors: + last_constructor_end = content.rfind(constructors[-1]['body']) + remaining = content[last_constructor_end + len(constructors[-1]['body']):] + else: + remaining = content[next_section:] + + # Clean up any stray characters and duplicate class definitions + remaining = re.sub(r'^\)\s*\n', '', remaining) + # Remove duplicate class definitions that might have been left behind + # Pattern: ### `class xdk.module.ClassName` followed by description and parameters + # Match the full duplicate class definition block + remaining = re.sub( + r'###\s+`?class\s+xdk\.[^\n]+\n\n[^\n]+\n\n(?:####\s+Parameters[^\n]+\n\n]+>\s*\s*\n)?', + '', + remaining + ) + # Also remove any standalone class definitions without parameters + remaining = re.sub( + r'###\s+`?\*?class\*?\s+xdk\.[^\n]+\n\n[^\n]+\n\n', + '', + remaining + ) + # Remove any remaining class definition patterns (more aggressive) + remaining = re.sub( + r'###\s+`?class\s+[^\n]+\n\n[^\n]+\n\n(?:####\s+Parameters[^\n]+\n\n)?', + '', + remaining + ) + + return before_class + '\n'.join(sections) + remaining + + return content + +def clean_class_definitions(content: str) -> str: + """Clean up class definition headers.""" + # Remove any remaining class definition headers that weren't processed + # Pattern: ### `*class* xdk.module.ClassName`(params) or ## xdk.module.ClassName + # These should already be converted by reorganize_class_structure, but clean up any leftovers + + # Remove any stray class definition patterns + content = re.sub( + r'##\s+xdk\.[^\n]+\n\n\)\s*\n', + '', + content + ) + + # Clean up any remaining "Bases:" lines that weren't converted + content = re.sub(r'^Bases:\s*`[^`]+`\s*\n?', '', content, flags=re.MULTILINE) + + return content + +def fix_method_names(content: str) -> str: + """Fix method names with escaped underscores.""" + # Pattern: ### ``\_\_init_\_`` -> ### `__init__` + # Handle double backticks with escaped underscores + content = re.sub(r'###\s+``\\?(_+[^`]+_+)``', r'### `\1`', content) + + # Pattern: ### ``method\_name`` -> ### `method_name` + content = re.sub(r'###\s+``([^`]*)\\?(_[^`]*)``', r'### `\1\2`', content) + + # Pattern: ### ``\_\_init_\_``(params) -> ### `__init__`(params) + content = re.sub(r'###\s+``([^`]*)\\?(_[^`]*)``\s*\(', r'### `\1\2`(', content) + + # Remove any remaining escaped underscores in method names (single backticks) + content = re.sub(r'###\s+`([^`]*)\\?(_[^`]*)`\s*\(', r'### `\1\2`(', content) + + # Fix any remaining escaped underscores in code blocks + content = re.sub(r'`([^`]*)\\?(_[^`]*)`', r'`\1\2`', content) + + return content + +def improve_method_formatting(content: str) -> str: + """Improve method formatting to match TypeScript style with ParamField components.""" + # Pattern: ### method_name(params) → ReturnType + def convert_method(match): + method_header = match.group(0) + method_name = match.group(1).strip().replace('*', '').replace('`', '').replace('\\', '').replace('_', '_') + params_str = match.group(2).strip() if match.group(2) else '' + return_type = match.group(3).strip() if match.group(3) else None + + # Find method body (until next ### or ####) + method_start = match.start() + next_method = content.find('###', method_start + 1) + if next_method == -1: + method_body = content[method_start:] + else: + method_body = content[method_start:next_method] + + # Extract description (text after method header, before :param) + desc_match = re.search(r'###[^\n]+\n\n([^\n]+(?:\n(?!:param|####|###|####)[^\n]+)*)', method_body, re.MULTILINE) + description = desc_match.group(1).strip() if desc_match else '' + # Remove method name from description if it appears + description = re.sub(r'^' + re.escape(method_name) + r'\s*$', '', description, flags=re.MULTILINE).strip() + + # Parse parameters and convert to ParamField components + param_fields = [] + if params_str: + # Simple parameter parsing (split by comma, but handle type annotations) + params = [] + current = '' + depth = 0 + for char in params_str: + if char in '[(': + depth += 1 + elif char in '])': + depth -= 1 + elif char == ',' and depth == 0: + if current.strip(): + params.append(current.strip()) + current = '' + continue + current += char + if current.strip(): + params.append(current.strip()) + + for param in params: + # Parse: name: type = default + # Handle cases like: client: [Client](xdk.md#xdk.Client) + param_match = re.match(r'(\w+)(?:\s*:\s*([^=]+))?(?:\s*=\s*(.+))?$', param.strip()) + if param_match: + param_name = param_match.group(1) + param_type_raw = param_match.group(2).strip() if param_match.group(2) else 'Any' + param_default = param_match.group(3).strip() if param_match.group(3) else None + + # Clean type - handle markdown links first + # Pattern: [Type](path#anchor) -> extract just "Type" + link_match = re.search(r'\[([^\]]+)\]\(([^\)]+)\)', param_type_raw) + if link_match: + param_type = link_match.group(1) # Use just the link text + else: + # No link, use the raw type but clean it + param_type = param_type_raw + # Remove file references and anchors + param_type = re.sub(r'[a-z_]+\.(md|py)#[^\s]*', '', param_type) + param_type = re.sub(r'#[^\s]*', '', param_type) + # Remove incomplete link patterns like "Client](" + param_type = re.sub(r'\]\([^\)]*$', '', param_type) + param_type = re.sub(r'\]\([^\)]*\)', '', param_type) + + # Clean up the type string + param_type = param_type.replace('|', ' or ').strip() + # Remove any trailing/leading brackets and parentheses + param_type = re.sub(r'^[\[\(]+', '', param_type) + param_type = re.sub(r'[\]\)]+$', '', param_type) + # Remove any remaining incomplete patterns + param_type = re.sub(r'\]\(.*$', '', param_type) + # Escape angle brackets for MDX + param_type = param_type.replace('<', '<').replace('>', '>') + # Clean up extra spaces + param_type = re.sub(r'\s+', ' ', param_type).strip() + # If type is empty or just brackets, default to Any + if not param_type or param_type in ['[', ']', '()', '(', ')', '](']: + param_type = 'Any' + + # Find param description + param_desc_match = re.search(rf':param\s+{param_name}:\s*([^\n]+)', method_body) + param_desc = param_desc_match.group(1).strip() if param_desc_match else '' + + # Build ParamField - use path instead of name + # For Python methods, parameters are function arguments + # Use "path" location for most parameters, or "body" if it's clearly a request body + param_location = 'body' if param_name.lower() in ['body', 'data', 'payload', 'request'] else 'path' + param_field = f'', '>') + param_field += f' default="{param_default_clean}"' + param_field += '>' + if param_desc: + param_field += f'\n{param_desc}\n' + param_field += '' + param_fields.append(param_field) + + # Build new method format + new_method = f'### `{method_name}`\n\n' + if description: + new_method += f'{description}\n\n' + + if param_fields: + new_method += '#### Parameters\n\n' + new_method += '\n\n'.join(param_fields) + '\n\n' + + if return_type: + # Extract return description + return_desc_match = re.search(r':param\s+Returns?:\s*([^\n]+)', method_body) + return_desc = return_desc_match.group(1).strip() if return_desc_match else '' + + # Clean return type - handle markdown links + return_type_clean = re.sub(r'\[([^\]]+)\]\([^\)]+\)', r'\1', return_type) + return_type_clean = re.sub(r'[a-z_]+\.(md|py)#[^\s]+', '', return_type_clean) + return_type_clean = return_type_clean.replace('[', '').replace(']', '') + return_type_clean = return_type_clean.replace('<', '<').replace('>', '>') + return_type_clean = re.sub(r':param\s+\w+:\s*', '', return_type_clean).strip() + return_type_clean = re.sub(r'\s+', ' ', return_type_clean).strip() + + new_method += '#### Returns\n\n' + new_method += f'`{return_type_clean}`' + if return_desc and return_desc != return_type_clean: + new_method += f' - {return_desc}' + new_method += '\n\n' + + return new_method + + # Convert method signatures to use ParamField components + # Match: ### method_name(params) → ReturnType + def process_all_methods(text): + # Find all method definitions + method_pattern = r'###\s+`?([^\n(]+)`?\s*\(([^)]*)\)(?:\s*→\s*([^\n]+))?' + methods = list(re.finditer(method_pattern, text, re.MULTILINE)) + + if not methods: + return text + + # Build result by processing each method and replacing its entire section + result_parts = [] + last_pos = 0 + + for i, match in enumerate(methods): + # Add content before this method + result_parts.append(text[last_pos:match.start()]) + + # Find where this method's body ends (next method or end of content) + method_start = match.start() + if i + 1 < len(methods): + next_method_start = methods[i + 1].start() + else: + next_method_start = len(text) + + # Get the full method section to replace + method_section = text[method_start:next_method_start] + + # Convert this method + converted = convert_method(match) + + # Remove the old method content from the section + result_parts.append(converted) + + last_pos = next_method_start + + # Add remaining content + result_parts.append(text[last_pos:]) + + return ''.join(result_parts) + + content = process_all_methods(content) + + # Clean up any remaining :param lines that weren't converted + content = re.sub(r':param\s+(\w+):\s*([^\n]+)', r'**`\1`** - \2', content) + content = re.sub(r':param\s+Returns?:\s*([^\n]+)', r'**Returns:** \1', content) + + # Remove duplicate return descriptions + content = re.sub( + r'(#### Returns\n\n`[^\n]+`[^\n]+\n\n)(\*\*`[^\n]+\*\*[^\n]+\n)+', + r'\1', + content + ) + + # Remove duplicate method descriptions + content = re.sub( + r'(### `[^\n]+`\n\n[^\n]+\n\n[^\n]+\n\n)(\1)', + r'\1', + content + ) + + # Clean up any remaining old format parameter lines after ParamField sections + content = re.sub( + r'(\n\n)(\*\*`[^\n]+\*\*[^\n]+\n)+', + r'\1', + content + ) + + # Remove duplicate "Returns:" text in return sections + content = re.sub( + r'(#### Returns\n\n`[^\n]+`)\s*-\s*\*\*`[^\n]+\*\*\s*-\s*([^\n]+)', + r'\1 - \2', + content + ) + + # Remove duplicate class definitions that appear after the main class header + # Pattern: ### `class xdk.module.ClassName` followed by description and parameters + # Find the main class header (should be ## ClassName) + main_class_match = re.search(r'##\s+([A-Z][a-zA-Z0-9_]+Client|Client|Paginator|OAuth2PKCEAuth|BaseModel)', content) + if main_class_match: + # Everything after the main class header should not have duplicate class definitions + before_main = content[:main_class_match.end()] + after_main = content[main_class_match.end():] + + # Remove any class definitions from after_main + after_main = re.sub( + r'###\s+`?class\s+xdk\.[^\n]+\n\n[^\n]+\n\n(?:####\s+Parameters[^\n]+\n\n]+>\s*\s*\n)?', + '', + after_main + ) + + content = before_main + after_main + + # Remove duplicate parameter sections (#### Parameters appearing twice in a row) + content = re.sub( + r'(#### Parameters\n\n]+>\s*\s*\n)\1', + r'\1', + content + ) + + return content + +def process_markdown_content(content: str, title: str, current_file_path: str, known_targets: Dict[str, str]) -> str: + """Process and clean markdown content for Mintlify.""" + # Remove Sphinx-specific elements + content = re.sub(r'\[\[include:.*?\]\]', '', content) + + # Fix code block formatting + content = re.sub(r'```python\n', '```python\n', content) + + # Remove Sphinx breadcrumbs + content = re.sub(r'^\[[^\]]+\]\([^\)]+\)\s*/\s*.*\n?', '', content, flags=re.MULTILINE) + + # Remove auto-generated comments at the beginning + # Pattern: "Auto-generated ..." followed by description paragraphs ending with "Generated automatically - do not edit manually." + content = re.sub( + r'^Auto-generated[^\n]+\n\n[^\n]+\n\n[^\n]+\n\nAll methods[^\n]+\n\nGenerated automatically[^\n]+\n\n', + '', + content, + flags=re.MULTILINE + ) + # Also remove variations - single line or multiple paragraphs + content = re.sub( + r'^Auto-generated[^\n]+\n\n', + '', + content, + flags=re.MULTILINE + ) + content = re.sub( + r'^This module provides[^\n]+\n\n', + '', + content, + flags=re.MULTILINE + ) + content = re.sub( + r'^All methods[^\n]+\n\n', + '', + content, + flags=re.MULTILINE + ) + content = re.sub( + r'^Generated automatically[^\n]+\n\n', + '', + content, + flags=re.MULTILINE + ) + + # Fix method names first - remove escaped underscores (before other processing) + content = fix_method_names(content) + + # Reorganize content into proper sections (Constructors, Methods, Properties) + content = reorganize_class_structure(content, current_file_path) + + # Clean up class definitions - remove asterisks, format properly + content = clean_class_definitions(content) + + # Improve method formatting - convert to better structure with ParamField + content = improve_method_formatting(content) + + # Fix internal links to absolute Mintlify paths + def fix_link(match): + text = match.group(1) + raw_link_path = match.group(2) + hash_part = match.group(3) or '' + + # Skip absolute URLs + if re.match(r'^(?:https?:|mailto:|tel:)', raw_link_path, re.I): + return match.group(0) + + link_path = raw_link_path.replace('.md', '').replace('.rst', '') + current_dir = str(Path(current_file_path).parent) if current_file_path else '' + + # Normalize path + if current_dir: + joined = Path(current_dir) / link_path + target_path = str(joined).replace('\\', '/').replace('docs/', '') + else: + target_path = link_path.replace('\\', '/').replace('docs/', '') + + # Use known target if available + base_name = Path(target_path).stem + if base_name in known_targets and '/' not in target_path: + target_path = f"{known_targets[base_name]}/{base_name}" + + return f'[{text}](/xdks/python/reference/{target_path}{hash_part})' + + content = re.sub( + r'\[([^\]]+)\]\(([^)#]+?)(?:\.(?:md|rst))?(#[^)]+)?\)', + fix_link, + content + ) + + # Fix method signatures + content = re.sub(r'### (.*?)\(', r'### `\1`(', content) + + # Add proper spacing + content = re.sub(r'\n\n\n+', '\n\n', content) + + # Remove first H1 header (frontmatter title will be used) + content = re.sub(r'^\s*#\s+[^\n]+\n+', '', content) + + # Escape generic type angle brackets (but preserve component tags) + # Simple approach: escape angle brackets, then fix Badge tags + content = re.sub( + r'\b([A-Z][A-Za-z0-9_]*)<([^>\n]+)>', + lambda m: f"{m.group(1)}<{m.group(2).replace('<', '<').replace('>', '>')}>", + content + ) + + # Fix any escaped Badge tags (they shouldn't have angle brackets anyway) + content = content.replace('</Badge>', '') + content = content.replace('Class</Badge>', 'Class') + content = content.replace('BaseModel</Badge>', 'BaseModel') + + # Remove Table of Contents blocks + content = re.sub(r'(^##\s+Table of contents\n[\s\S]*?)(?=^##\s+|^#\s+|\Z)', '', content, flags=re.MULTILINE | re.IGNORECASE) + + # Fix asterisks around type annotations that break MDX parsing + # Pattern: #### field *: Type* *= value* -> #### field : Type = value + # This handles cases like: model_config *: ClassVar[ConfigDict]* *= {'extra': 'allow', ...}* + # Match: field *: Type* *= value* (where value can contain quotes, commas, etc.) + # Use a more specific pattern that includes the header marker + content = re.sub( + r'(####\s+\w+)\s+\*\s*:\s*([^*]+?)\s*\*\s*\*\s*=\s*([^\n]+?)\s*\*', + r'\1: \2 = \3', + content, + flags=re.MULTILINE + ) + + # Fix asterisks around type annotations without equals (just type) + # Pattern: field *: Type* -> field : Type + content = re.sub(r'(\w+)\s+\*\s*:\s*([^*\n]+?)\s*\*', r'\1: \2', content, flags=re.MULTILINE) + + # Fix remaining asterisks around equals signs (standalone) + # Pattern: *= value* -> = value + content = re.sub(r'\*\s*=\s*([^\n]+?)\s*\*', r'= \1', content, flags=re.MULTILINE) + + # Fix asterisks around class/function names in headers + # Pattern: ### *class* name -> ### class name + content = re.sub(r'###\s+\*\s*(\w+)\s*\*\s+', r'### \1 ', content) + + # Convert property headers with type annotations to Mintlify components + # This must happen AFTER asterisk removal + # Pattern: #### field: Type = value\n\nDescription + # Convert to: Description + def convert_property_header(match): + field_name = match.group(1) + type_and_default = match.group(2).strip() + description = match.group(3).strip() if match.group(3) else '' + + # Split type and default value + # Format: ClassVar[ConfigDict] = {'extra': 'allow', ...} + type_match = re.match(r'([^=]+?)(?:\s*=\s*(.+))?$', type_and_default) + if type_match: + type_annotation = type_match.group(1).strip() + default_value = type_match.group(2).strip() if type_match.group(2) else None + else: + type_annotation = type_and_default + default_value = None + + # Clean up type annotation - remove ClassVar, brackets, etc. + # ClassVar[ConfigDict] -> ConfigDict + type_clean = re.sub(r'ClassVar\[([^\]]+)\]', r'\1', type_annotation) + # Remove any remaining brackets for display + type_clean = type_clean.replace('[', '').replace(']', '').strip() + + # Escape type for MDX + type_clean = type_clean.replace('<', '<').replace('>', '>') + + # Build the component + component = f' str: + """Determine category from file path.""" + if 'client' in file_path.lower() and 'Client' in file_path: + return 'Getting Started' + if 'paginator' in file_path.lower(): + return 'Core Features' + if 'stream' in file_path.lower(): + return 'Core Features' + return 'API Reference' + +def process_docs(): + """Main processing function.""" + try: + # First, try to generate documentation + print('📚 Generating documentation...') + try: + import subprocess + result = subprocess.run( + [sys.executable, 'scripts/generate-docs-simple.py'], + check=True, + capture_output=True, + text=True + ) + print(result.stdout) + except subprocess.CalledProcessError as e: + print('⚠️ Sphinx generation failed, using existing docs if available...') + if not Path('docs').exists() or not any(Path('docs').iterdir()): + raise RuntimeError( + 'No documentation found and Sphinx generation failed. ' + 'Please install Sphinx: pip install sphinx myst-parser sphinx-markdown-builder' + ) + print('✅ Using existing documentation files') + + # Create output directory + output_dir = Path(MINTLIFY_CONFIG['outputDir']) + if output_dir.exists(): + shutil.rmtree(output_dir) + output_dir.mkdir(parents=True, exist_ok=True) + + # Create subdirectories + (output_dir / 'xdks' / 'python' / 'reference').mkdir(parents=True, exist_ok=True) + + print('📝 Processing markdown files...') + + # Get all markdown files + docs_dir = Path('docs') + files = list(docs_dir.rglob('*.md')) + + # Build map of known targets + known_targets = {} + for f in files: + base = f.stem + parent = f.parent.name + if parent and parent != 'docs' and base not in known_targets: + known_targets[base] = parent + + processed_files = [] + navigation = { + 'Getting Started': [], + 'Core Features': [], + 'API Reference': [], + 'Authentication': [], + 'Utilities': [] + } + + for file_path in files: + if file_path.name == 'README.md': + continue + + # Special handling for modules.md - convert to accordion format + if file_path.name == 'modules.md': + continue # Will process separately + + content = file_path.read_text(encoding='utf-8') + + # Extract title + title_match = re.search(r'^#\s+(.+)$', content, re.MULTILINE) + title = title_match.group(1) if title_match else file_path.stem + + # Clean title using improved function (pass content for better extraction) + cleaned_title = clean_title(title, str(file_path), content) + + category = get_category_from_path(str(file_path)) + processed_content = process_markdown_content( + content, cleaned_title, str(file_path.relative_to(docs_dir)), known_targets + ) + + # Generate frontmatter + frontmatter = generate_frontmatter(cleaned_title, cleaned_title, str(file_path)) + final_content = frontmatter + processed_content + + # Determine output path + base_name = file_path.stem + sub_dir = file_path.parent.name if file_path.parent != docs_dir else '' + target_dir = output_dir / 'xdks' / 'python' / 'reference' / sub_dir + target_dir.mkdir(parents=True, exist_ok=True) + output_path = target_dir / f'{base_name}.mdx' + + # Write processed file + output_path.write_text(final_content, encoding='utf-8') + processed_files.append({ + 'title': cleaned_title, + 'category': category, + 'path': str(output_path), + 'originalPath': str(file_path) + }) + + # Add to navigation + if category in navigation: + relative_ref_path = f"{sub_dir}/{base_name}" if sub_dir else base_name + navigation[category].append({ + 'title': cleaned_title, + 'url': f'xdks/python/reference/{relative_ref_path}' + }) + + # Create high-level documentation pages + print('📄 Creating high-level documentation pages...') + + # Overview page + overview_content = '''--- +title: Python XDK +sidebarTitle: Overview +--- + +The Python XDK (X Developer Kit) is our official client library for interacting with the X API v2 using Python. It allows developers to get started with our API quickly and build applications with it. It is generated based on our official [OpenAPI specification](https://api.x.com/2/openapi.json). It abstracts away low-level HTTP details while providing fine-grained control when needed. + +## Key Features + +- 🔐 **OAuth Support**: Full support for Bearer Token (app-only) auth, OAuth 2.0 with PKCE (user context), and OAuth 1.0. + +- 🔄 **Pagination**: Automatically page through large results. The XDK takes care of pagination without requiring you to make multiple API calls using the `next_token`. + +- 📡 **Streaming**: Supports real-time data streaming for endpoints like filtered stream that require persistent http connection. + +- 🎯 **Comprehensive Coverage**: Supports all X API v2 endpoints including such as search, timelines, filtered-stream and more. + +**Version Compatibility**: Python 3.8+. Tested on CPython and PyPy. + +**License**: [MIT License](https://github.com/xdevplatform/xdk/blob/main/LICENSE) +''' + + (output_dir / 'xdks' / 'python' / 'overview.mdx').write_text(overview_content) + + # Install page + install_content = '''--- +title: "Install" +sidebarTitle: "Install" +--- + +The XDK Python SDK is available directly from the GitHub repository and can be installed via `pip`. + +## Prerequisites + +- Python 3.8 or higher. + +- `pip` and `venv` for virtual environments (recommended). + +## Quick Install + +Install the XDK from the GitHub subdirectory: + +```bash +pip install xdk +``` + +This fetches the latest generated version from the `main` branch. + +## Development Install + +For development or contributing: + +1. Clone the repository: + + ```bash + git clone https://github.com/xdevplatform/xdk.git + cd xdk/python + ``` + +2. Install dependencies in editable mode: + + ```bash + pip install -e . + ``` + + This installs the SDK and its runtime dependencies. + +3. (Optional) Install dev dependencies for testing/linting: + + ```bash + pip install -e .[dev] + ``` + +## Verification + +Test the installation: + +```python +import xdk +print(xdk.__version__) # Should print the XDK version +``` + +**Note:** Since the XDK is generated using the OpenAPI spec, always check the [X API changelog](https://docs.x.com/changelog) and XDK release notes in the repo for any changes. +''' + + (output_dir / 'xdks' / 'python' / 'install.mdx').write_text(install_content) + + # Quickstart page + quickstart_content = '''--- +title: Quickstart +sidebarTitle: Quickstart +--- + +This example showcases how to quickly search for Posts using the XDK using Bearer Token authentication. + +## Step 1: Install the SDK + +```bash +pip install xdk +``` + +## Step 2: Get Your Bearer Token + +1. Log in to the [X Developer Portal](https://developer.x.com/en/portal/dashboard). + +2. Create or select an app. + +3. Under "Keys and Tokens," generate a Bearer Token (app-only auth). + +## Step 3: Write and Run Your First Script + +Create a file `quickstart.py`: + +```python +# Import the client +from xdk import Client + +# Replace with your actual Bearer Token +client = Client(bearer_token="YOUR_BEARER_TOKEN_HERE") + +# Fetch recent Posts mentioning "api" +response = client.posts.search_recent(query="api", max_results=10) + +# Print the first Post's text +if response.data: + print(f"Latest Post: {response.data[0]['text']}") +else: + print("No Posts found.") +``` + +Run it: + +```bash +python quickstart.py +``` + +**Expected Output**: + +``` +Latest Post: Exciting updates on XDK Python SDK! +``` + +**Troubleshooting**: If you get a 401 error, double-check your Bearer Token. For rate limits (429), wait and retry. + +## Next Steps + +- Explore [Authentication](/xdks/python/authentication) to understand how to use Bearer Token (app-only) auth, OAuth 2.0 with PKCE (user context), and OAuth 1.0. + +- Learn about [Pagination](/xdks/python/pagination) for use-cases where you want large number of results returned without worrying about making multiple API calls. + +- Dive into [Streaming](/xdks/python/streaming) to learn how to work with real-time data. +''' + + (output_dir / 'xdks' / 'python' / 'quickstart.mdx').write_text(quickstart_content) + + # Authentication page + auth_content = '''--- +title: Authentication +sidebarTitle: Authentication +--- + +The X API requires authentication for all endpoints. The XDK supports three authentication methods: + +1. Bearer Token (app-only) + +2. OAuth 2.0 with PKCE + +3. OAuth 1.0a User Context + +- **Bearer Token**: Use this for read-only access for endpoints that support app-auth (e.g., searching Post's, streaming endpoints). + +- **OAuth 2.0 PKCE**: Secure authentication for scope-based, user-authorized access (e.g. getting authenticated user's Post non_public metrics) + +- **OAuth 1.0a**: Legacy auth for full read/write access, including DMs and media uploads. + +**Note**: We recommend developers move away from OAuth 1.0 and use OAuth 2.0 for user-authorized access. + +Obtain credentials from the [X Developer Portal](https://developer.x.com/en/portal/dashboard). You'll need an approved developer account and an app with appropriate permissions (e.g., Read + Write). + +## Creating a Client + +All authentication flows create a `Client` instance: + +```python +from xdk import Client +``` + +### 1. Bearer Token (App-Only) + +For read-only operations without user context. + +**Steps**: + +1. In the Developer Portal, generate a Bearer Token for your app. + +2. Pass it to the `Client`. + +**Example**: + +```python +client = Client(bearer_token="XXXXX") +``` + +**Usage**: + +```python +response = client.posts.search_recent(query="python", max_results=10) +print(response.data[0]['text']) # Access first Post +``` + +### 2. OAuth 2.0 with PKCE (User Context) + +This example shows how to use OAuth 2.0 with Proof Key for Code Exchange (PKCE). Use this for user-specific access (e.g. posting on behalf of a user), uploading media for a user etc.). + +**Steps**: + +1. In the developer portal, register your app with a redirect URI (e.g., `http://localhost:8080/callback`). + +2. Get Client ID (no secret needed for PKCE). + +3. Initiate the flow, direct user to auth URL and handle callback. + +**Example** (using a web server for callback): + +```python +from xdk.auth import OAuth2PKCE +from urllib.parse import urlparse +import webbrowser + +# Step 1: Create PKCE instance +auth = OAuth2PKCE( + client_id="your_client_id", + redirect_uri="http://localhost:8080/callback", + scopes=["tweet.read", "users.read", "offline.access"] # Adjust scopes as needed +) + +# Step 2: Get authorization URL +auth_url = auth.get_authorization_url() +print(f"Visit this URL to authorize: {auth_url}") +webbrowser.open(auth_url) + +# Step 3: Handle callback (in a real app, use a web framework like Flask) +# Assume callback_url = "http://localhost:8080/callback?code=AUTH_CODE_HERE" +callback_url = input("Paste the full callback URL here: ") +parsed = urlparse(callback_url) +code = parsed.query.split("=")[1] + +# Step 4: Exchange code for tokens +tokens = auth.fetch_token(authorization_code=code) +access_token = tokens["access_token"] +refresh_token = tokens["refresh_token"] # Store for renewal + +# Step 5: Create client +client = Client(oauth2_access_token=access_token) +``` + +**Token Refresh** (automatic in SDK for long-lived sessions): + +```python +# If access token expires, refresh using stored refresh_token +tokens = auth.refresh_token(refresh_token=refresh_token) +client = Client(oauth2_access_token=tokens["access_token"]) +``` + +### 3. OAuth 1.0a User Context + +For legacy endpoints that require OAuth 1.0 support. + +**Steps**: + +1. Generate Consumer Key/Secret and Access Token/Secret via Developer Portal. + +2. Pass it when initializing the client. + +**Example**: + +```python +from xdk.auth import OAuth1User + +auth = OAuth1User( + consumer_key="your_consumer_key", + consumer_secret="your_consumer_secret", + access_token="your_access_token", + access_token_secret="your_access_token_secret" +) + +client = Client(auth=auth) +``` + +**Note**: + +- Never hardcode secrets in production; use environment variables or secret managers (e.g., `os.getenv("X_BEARER_TOKEN")`). + +- For PKCE, ensure HTTPS for redirect URIs in production. + +- The SDK validates tokens and raises `xdk.AuthenticationError` on failures. +''' + + (output_dir / 'xdks' / 'python' / 'authentication.mdx').write_text(auth_content) + + # Pagination page + pagination_content = '''--- +title: Pagination +sidebarTitle: Pagination +--- + +The X API uses pagination for endpoints that return multiple pages of results (e.g. timelines, search etc.). Each API call response includes a `meta` object with `result_count`, `previous_token`, and `next_token`. The XDK takes care of making multiple API calls using the `next_token` so developers can just specify how much data they are looking for without having to make multiple calls. + +The SDK simplifies this with: + +- **Built-in Iterators**: Use generator functions for seamless multi-page fetching. + +- **Explicit Token Handling**: For flexible manual control when needed by passing `pagination_token` when needed. + +- **Max Results Enforcement**: Respect `max_results` per call (up to API limits, e.g., 100 for search). + +## Automatic Pagination (Recommended) + +Use the `iterate()` method on paginated responses to fetch all results lazily. + +**Example: Paginated Search** + +```python +from xdk import Client + +client = Client(bearer_token="your_bearer_token") + +# Search with automatic pagination +all_posts = [] +for page in client.posts.search_recent( + query="python", + max_results=100, # Per page + tweetfields=["created_at", "author_id"] # Optional expansions +): + all_posts.extend(page.data) + print(f"Fetched {len(page.data)} Posts (total: {len(all_posts)})") + +print(f"Total tweets: {len(all_posts)}") +``` + +- The iterator handles `next_token` automatically. + +- Stops when no `next_token` is present. + +- Supports rate limit backoff to avoid 429 errors. + +## Manual Pagination + +If you require control over the results for some custom logic (e.g. processing page-by-page), you can still use the `next_token` and do the pagination manually as shown below: + +```python +response = client.posts.search_recent( + query="xdk python sdk", + max_results=100, + pagination_token=None # First page +) + +print(f"First page: {len(response.data)} Posts") + +next_token = response.meta.next_token +if next_token: + next_response = client.posts.search_recent( + query="xdk python sdk", + max_results=100, + pagination_token=next_token + ) + print(f"Second page: {len(next_response.data)} Posts") +``` + +**Tips**: + +- Always specify `max_results` to optimize (default varies by endpoint). + +- Monitor `meta.result_count` for debugging. + +- For very large queries, consider async iteration to avoid blocking. +''' + + (output_dir / 'xdks' / 'python' / 'pagination.mdx').write_text(pagination_content) + + # Streaming page + streaming_content = '''--- +title: Streaming +sidebarTitle: Streaming +--- + +The X API supports real-time data via endpoints like the [Filtered Stream Endpoint](https://docs.x.com/x-api/posts/filtered-stream/introduction), delivering matching Posts as they occur. This requires making a persistent http connection. + +## Setup and Basic Streaming + +### Synchronous + +```python +from xdk import Client + +# Initialize client +client = Client(bearer_token="your_bearer_token") + +# Stream posts (make sure you have rules set up first) +for post_response in client.stream.posts(): + data = post_response.model_dump() + + if 'data' in data and data['data']: + tweet = data['data'] + print(f"Post: {tweet.get('text', '')}") +``` + +### Async + +```python +import asyncio +from asyncio import Queue +import threading +from xdk import Client + +async def stream_posts_async(client: Client): + queue = Queue() + loop = asyncio.get_event_loop() + stop = threading.Event() + + def run_stream(): + for post in client.stream.posts(): + if stop.is_set(): + break + asyncio.run_coroutine_threadsafe(queue.put(post), loop) + asyncio.run_coroutine_threadsafe(queue.put(None), loop) + + threading.Thread(target=run_stream, daemon=True).start() + + while True: + post = await queue.get() + if post is None: + break + data = post.model_dump() + if 'data' in data and data['data']: + print(f"Post: {data['data'].get('text', '')}") + stop.set() + +async def main(): + client = Client(bearer_token="your_bearer_token") + await stream_posts_async(client) + +asyncio.run(main()) +``` + +## Rule Management + +Rules define filters on what specific data you are looking for(e.g. keywords, users etc). You can learn more about how to build rules using [this guide](https://docs.x.com/x-api/posts/filtered-stream/integrate/build-a-rule) + +**Adding Rules**: + +```python +from xdk.stream.models import UpdateRulesRequest + +# Add a rule +add_rules = { + "add": [ + {"value": "from:xdevelopers", "tag": "official_updates"} + ] +} + +request_body = UpdateRulesRequest(**add_rules) +response = client.stream.update_rules(body=request_body) +``` + +**Deleting Rules**: + +```python +from xdk.stream.models import UpdateRulesRequest + +delete_rules = { + "delete": { + "ids": ["rule_id_1", "rule_id_2"] + } +} + +request_body = UpdateRulesRequest(**delete_rules) +response = client.stream.update_rules(body=request_body) +``` + +**Listing Rules**: + +```python +response = client.stream.get_rules() + +# Print rules +for rule in response.data: + print(f"ID: {rule.id}, Value: {rule.value}, Tag: {rule.tag}") +``` + +For full rule syntax, see [X Streaming Rules Docs](https://developer.x.com/en/docs/twitter-api/tweets/filtered-stream/integrate/build-a-rule). + +## Troubleshooting + +- **403 Forbidden**: Invalid auth or insufficient permissions. + +- **420 Enhance Your Calm**: Rate limited; wait and retry. + +- **No Data**: Check rules with `get_rules()`; ensure matching Posts exist. + +For more examples and API reference, see the inline docstrings (e.g., `help(client.tweets.search_recent)`) or the generated stubs in the source. Contribute feedback via the [GitHub repo](https://github.com/xdevplatform/xdk/tree/main/xdk/python). +''' + + (output_dir / 'xdks' / 'python' / 'streaming.mdx').write_text(streaming_content) + + # Create navigation structure + print('⚙️ Creating navigation structure...') + + # Build API Reference groups + ref_root = output_dir / 'xdks' / 'python' / 'reference' + classes_dir = ref_root / 'classes' + modules_dir = ref_root / 'modules' + + def list_files_no_ext(directory): + try: + return [ + f'xdks/python/reference/{directory.name}/{f.stem}' + for f in directory.glob('*.mdx') + ] + except: + return [] + + classes_pages = list_files_no_ext(classes_dir) if classes_dir.exists() else [] + modules_pages = list_files_no_ext(modules_dir) if modules_dir.exists() else [] + + # Group pages by module prefix + MODULE_PREFIXES = [ + 'AccountActivity', 'Activity', 'Communities', 'CommunityNotes', 'Compliance', + 'Connections', 'DirectMessages', 'General', 'Lists', 'Media', 'Posts', + 'Spaces', 'Stream', 'Trends', 'Usage', 'Users', 'Webhooks', 'Client', + 'Paginator', 'OAuth2' + ] + + def group_pages(pages, kind): + buckets = {} + for p in pages: + name = Path(p).stem + group = None + for pref in MODULE_PREFIXES: + if name.startswith(pref): + group = pref + break + if not group: + if kind == 'classes': + if name.endswith('Client'): + group = 'Clients' + elif 'Stream' in name: + group = 'Streaming' + elif 'Paginator' in name: + group = 'Pagination' + else: + group = 'Core' + else: + group = 'Misc' + if group not in buckets: + buckets[group] = [] + buckets[group].append(p) + + # Sort pages within groups + for group in buckets: + buckets[group].sort() + + return [ + {'group': k, 'pages': v} + for k, v in sorted(buckets.items()) + ] + + class_groups = group_pages(classes_pages, 'classes') + module_groups = group_pages(modules_pages, 'modules') + + # Process modules.md to create accordion structure + modules_md_path = docs_dir / 'modules.md' + if modules_md_path.exists(): + modules_raw = modules_md_path.read_text(encoding='utf-8') + # Extract title + title_match = re.search(r'^#\s+(.+)$', modules_raw, re.MULTILINE) + modules_title = title_match.group(1).strip() if title_match else 'Modules' + + # Parse the modules structure and convert to accordion + # Instead of parsing modules.md, use the actual reference files we have + # Group by package name from actual files + packages = {} + + # Get all reference files + ref_root = output_dir / 'xdks' / 'python' / 'reference' + all_ref_files = [f for f in ref_root.glob('*.mdx') if f.stem not in ['modules', 'index']] + + # Group files by package + for ref_file in all_ref_files: + name = ref_file.stem + # Extract package name + if '.client' in name: + package_name = name.replace('xdk.', '').replace('.client', '') + module_type = 'Client' + elif '.models' in name: + package_name = name.replace('xdk.', '').replace('.models', '') + module_type = 'Models' + else: + # Other modules like xdk.client, xdk.paginator + parts = name.replace('xdk.', '').split('.') + package_name = parts[0] if parts else 'Core' + module_type = parts[-1].capitalize() if len(parts) > 1 else 'Core' + + # Convert to display name + package_display = ' '.join(word.capitalize() for word in package_name.split('_')) + + if package_display not in packages: + packages[package_display] = [] + + # Add module link + packages[package_display].append({ + 'name': module_type, + 'link': f'xdks/python/reference/{name}' + }) + + # Build accordion content + package_accordions = [] + for package_name, modules in sorted(packages.items()): + if modules: + module_items = '\n'.join([ + f' - [{m["name"]}](/{m["link"]})' + for m in sorted(modules, key=lambda x: x['name']) + ]) + package_accordions.append( + f' \n{module_items}\n ' + ) + + # Build final modules content + if package_accordions: + modules_content = f'''--- +title: "{modules_title}" +sidebarTitle: "{modules_title}" +--- + + + + + +{chr(10).join(package_accordions)} + + + + +''' + else: + modules_content = f'''--- +title: "{modules_title}" +sidebarTitle: "{modules_title}" +--- + + + + + + + +''' + + # Write modules.mdx + (output_dir / 'xdks' / 'python' / 'reference' / 'modules.mdx').write_text(modules_content, encoding='utf-8') + + # Get all reference files for navigation + ref_root = output_dir / 'xdks' / 'python' / 'reference' + all_ref_files = [f for f in ref_root.glob('*.mdx') if f.stem != 'modules' and f.stem != 'index'] + + # Separate into clients, models, and other + client_files = [f for f in all_ref_files if f.stem.endswith('.client')] + model_files = [f for f in all_ref_files if f.stem.endswith('.models')] + other_files = [f for f in all_ref_files if not f.stem.endswith('.client') and not f.stem.endswith('.models')] + + # Group by package + def group_by_package(files): + buckets = {} + for f in files: + name = f.stem + if '.client' in name: + package = name.replace('xdk.', '').replace('.client', '') + elif '.models' in name: + package = name.replace('xdk.', '').replace('.models', '') + else: + parts = name.replace('xdk.', '').split('.') + package = parts[0] if parts else 'Core' + + # Convert to display name + package_display = ' '.join(word.capitalize() for word in package.split('_')) + + if package_display not in buckets: + buckets[package_display] = [] + buckets[package_display].append(f'xdks/python/reference/{f.stem}') + + # Sort pages within groups + for group in buckets: + buckets[group].sort() + + return [ + {'group': k, 'pages': v} + for k, v in sorted(buckets.items()) + ] + + client_groups = group_by_package(client_files) + model_groups = group_by_package(model_files) + other_groups = group_by_package(other_files) + + # Generate navigation JSON + # Build navigation structure with packages and modules in sidebar + api_ref_pages = ['xdks/python/reference/modules'] + + # Add client groups + if client_groups: + api_ref_pages.append({ + 'group': 'Clients', + 'pages': client_groups + }) + + # Add model groups + if model_groups: + api_ref_pages.append({ + 'group': 'Models', + 'pages': model_groups + }) + + # Add other groups + if other_groups: + api_ref_pages.append({ + 'group': 'Core', + 'pages': other_groups + }) + + python_sdk_navigation = { + 'tab': 'Python SDK', + 'hidden': True, + 'pages': [ + 'xdks/python/overview', + 'xdks/python/install', + 'xdks/python/quickstart', + 'xdks/python/authentication', + 'xdks/python/pagination', + 'xdks/python/streaming', + { + 'group': 'API Reference', + 'pages': api_ref_pages + } + ] + } + + # Write navigation JSON + nav_json_path = output_dir / 'python-sdk-navigation.json' + nav_json_path.write_text(json.dumps(python_sdk_navigation, indent=2)) + + print('✅ Python SDK documentation processed successfully!') + print(f'📁 Output directory: {output_dir}/') + print(f'📊 Processed {len(processed_files)} files') + print('\n🚀 Integration steps:') + print('1. Copy the \'xdks/\' folder to your existing Mintlify site') + print('2. Add the navigation structure from \'python-sdk-navigation.json\' to your mintlify.json') + print('3. Push to your main branch to deploy') + + except Exception as error: + print(f'❌ Error processing documentation: {error}') + import traceback + traceback.print_exc() + sys.exit(1) + +if __name__ == '__main__': + process_docs() + diff --git a/xdk-gen/templates/python/pyproject_toml.j2 b/xdk-gen/templates/python/pyproject_toml.j2 index b143835e..68db66bf 100644 --- a/xdk-gen/templates/python/pyproject_toml.j2 +++ b/xdk-gen/templates/python/pyproject_toml.j2 @@ -45,6 +45,10 @@ dev = [ "pytest", "pytest-cov", "ruff", + "sphinx>=7.0.0", + "myst-parser>=2.0.0", + "sphinx-markdown-builder>=0.5.5", + "watchdog>=3.0.0", ] [tool.pytest.ini_options] diff --git a/xdk-gen/templates/python/sphinx_conf.j2 b/xdk-gen/templates/python/sphinx_conf.j2 new file mode 100644 index 00000000..ac213277 --- /dev/null +++ b/xdk-gen/templates/python/sphinx_conf.j2 @@ -0,0 +1,99 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. + +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +import sys +from pathlib import Path + +# Add the xdk package to the path so autodoc can find it +sys.path.insert(0, str(Path(__file__).parent.parent)) + +# -- Project information ----------------------------------------------------- + +project = 'X API SDK' +copyright = '2024, X Developer Platform' +author = 'X Developer Platform' +release = '{{ version }}' +version = '{{ version }}' + +# -- General configuration ---------------------------------------------------- + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinx.ext.viewcode', + 'sphinx.ext.napoleon', # Support for Google/NumPy style docstrings + 'myst_parser', # Markdown support +] + +# Napoleon settings for docstring parsing +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_init_with_doc = False +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True + +# Autodoc settings +autodoc_default_options = { + 'members': True, + 'undoc-members': False, + 'show-inheritance': True, + 'inherited-members': False, + 'private-members': False, + 'special-members': '__init__', +} + +autosummary_generate = True + +# MyST parser settings +myst_enable_extensions = [ + "colon_fence", + "deflist", + "dollarmath", + "fieldlist", + "html_admonition", + "html_image", + "linkify", + "replacements", + "smartquotes", + "strikethrough", + "substitution", + "tasklist", +] + +# Templates path +templates_path = ['_templates'] + +# The suffix(es) of source filenames +source_suffix = { + '.rst': 'restructuredtext', + '.md': 'markdown', +} + +# The master toctree document +master_doc = 'index' + +# The language for content autogenerated by Sphinx +language = 'en' + +# -- Options for HTML output -------------------------------------------------- + +html_theme = 'default' +html_static_path = ['_static'] + +# -- Options for Markdown output ---------------------------------------------- + +# Use markdown builder +# This will be set via command line: sphinx-build -b markdown + diff --git a/xdk-gen/templates/python/watch_docs.j2 b/xdk-gen/templates/python/watch_docs.j2 new file mode 100644 index 00000000..e136ceae --- /dev/null +++ b/xdk-gen/templates/python/watch_docs.j2 @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +""" +AUTO-GENERATED FILE - DO NOT EDIT +This file was automatically generated by the XDK build tool. +Any manual changes will be overwritten on the next generation. + +Watch for changes and regenerate documentation automatically. +""" + +import os +import sys +import time +import subprocess +from pathlib import Path +from watchdog.observers import Observer +from watchdog.events import FileSystemEventHandler + +print('🚀 Starting X API SDK Documentation Watch Server...') + +class DocsHandler(FileSystemEventHandler): + """Handle file system events for documentation regeneration.""" + + def __init__(self): + self.last_regeneration = 0 + self.debounce_seconds = 2 + + def on_modified(self, event): + if event.is_directory: + return + + # Only watch Python files + if not event.src_path.endswith('.py'): + return + + # Skip if in docs or build directories + if 'docs' in event.src_path or '__pycache__' in event.src_path: + return + + # Debounce rapid changes + current_time = time.time() + if current_time - self.last_regeneration < self.debounce_seconds: + return + + self.last_regeneration = current_time + print(f'📝 File changed: {event.src_path}') + regenerate_docs() + +def regenerate_docs(): + """Regenerate documentation.""" + print('🔄 Regenerating documentation...') + try: + result = subprocess.run( + [sys.executable, 'scripts/generate-docs-simple.py'], + check=True, + capture_output=True, + text=True + ) + print(result.stdout) + print('✅ Documentation regenerated successfully') + except subprocess.CalledProcessError as e: + print(f'❌ Failed to regenerate documentation: {e}') + print(f'stderr: {e.stderr}') + +def start_server(): + """Start a simple HTTP server for docs.""" + try: + import http.server + import socketserver + import threading + + PORT = 8080 + Handler = http.server.SimpleHTTPRequestHandler + + def run_server(): + with socketserver.TCPServer(("", PORT), Handler) as httpd: + print(f'📚 Starting documentation server on http://localhost:{PORT}') + httpd.serve_forever() + + server_thread = threading.Thread(target=run_server, daemon=True) + server_thread.start() + return server_thread + except Exception as e: + print(f'⚠️ Could not start HTTP server: {e}') + return None + +# Initial documentation generation +regenerate_docs() +server_thread = start_server() + +# Watch for changes +event_handler = DocsHandler() +observer = Observer() + +# Watch xdk directory +xdk_path = Path('xdk') +if xdk_path.exists(): + observer.schedule(event_handler, str(xdk_path), recursive=True) + observer.start() + print('👀 Watching for changes... Press Ctrl+C to stop') + + try: + while True: + time.sleep(1) + except KeyboardInterrupt: + print('\n🛑 Shutting down documentation server...') + observer.stop() + + observer.join() +else: + print('⚠️ xdk directory not found') + diff --git a/xdk-gen/templates/typescript/generate_docs.j2 b/xdk-gen/templates/typescript/generate_docs.j2 index 3402d701..c7d2b490 100644 --- a/xdk-gen/templates/typescript/generate_docs.j2 +++ b/xdk-gen/templates/typescript/generate_docs.j2 @@ -1,5 +1,3 @@ -#!/usr/bin/env node - /** * Documentation generation script for X API SDK * diff --git a/xdk-gen/templates/typescript/generate_docs_simple.j2 b/xdk-gen/templates/typescript/generate_docs_simple.j2 new file mode 100644 index 00000000..09ef998b --- /dev/null +++ b/xdk-gen/templates/typescript/generate_docs_simple.j2 @@ -0,0 +1,62 @@ +import { execSync } from 'child_process'; +import fs from 'fs'; +import path from 'path'; + +console.log('🚀 Generating X API SDK Documentation...'); + +// Create a temporary tsconfig that excludes problematic files +const tsconfig = { + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "allowJs": true, + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "outDir": "./dist", + "rootDir": "./src" + }, + "include": [ + "src/client.ts", + "src/paginator.ts", + "src/index.ts", + "src/http-client.ts" + ], + "exclude": [ + "**/stream_client.ts", + "**/event_driven_stream.ts", + "**/stream_listener.ts", + "**/oauth1_auth.ts", + "**/oauth2_auth.ts", + "**/crypto_utils.ts", + "**/models.ts" + ] +}; + +// Write temporary tsconfig +fs.writeFileSync('tsconfig.docs.json', JSON.stringify(tsconfig, null, 2)); + +try { + // Generate documentation using the temporary tsconfig + execSync('npx typedoc --tsconfig tsconfig.docs.json --out docs --name "X API SDK v{{ version }}" --readme README.md --theme default --includeVersion true --excludePrivate true --excludeProtected true --excludeExternals true --excludeInternal true --searchInComments true --cleanOutputDir true', { stdio: 'inherit' }); + + console.log('✅ Documentation generated successfully in docs/'); + + // Clean up temporary file + fs.unlinkSync('tsconfig.docs.json'); + +} catch (error) { + console.error('❌ Documentation generation failed:', error.message); + + // Clean up temporary file + if (fs.existsSync('tsconfig.docs.json')) { + fs.unlinkSync('tsconfig.docs.json'); + } + + process.exit(1); +} + diff --git a/xdk-gen/templates/typescript/gitignore.j2 b/xdk-gen/templates/typescript/gitignore.j2 new file mode 100644 index 00000000..c09dae3f --- /dev/null +++ b/xdk-gen/templates/typescript/gitignore.j2 @@ -0,0 +1,15 @@ +# Documentation generation outputs +# These are generated by the docs scripts and should not be committed + +# TypeDoc output directories +docs/ +docs/html/ +docs/markdown/ +docs/api/ + +# Mintlify processed documentation +mintlify-docs/ + +# Temporary files created during doc generation +tsconfig.docs.json + diff --git a/xdk-gen/templates/typescript/package_json.j2 b/xdk-gen/templates/typescript/package_json.j2 index 1530112c..c45dcdd4 100644 --- a/xdk-gen/templates/typescript/package_json.j2 +++ b/xdk-gen/templates/typescript/package_json.j2 @@ -102,10 +102,10 @@ "test:coverage": "jest --coverage", "docs": "typedoc", "docs:build": "typedoc && echo \"Documentation generated in docs/\"", - "docs:build-simple": "node generate-docs-simple.js", + "docs:build-simple": "node scripts/generate-docs-simple.js", "docs:serve": "npx http-server docs -p 8080 -o", - "docs:watch": "node watch-docs.js", - "docs:mintlify": "node process-for-mintlify.js" + "docs:watch": "node scripts/watch-docs.js", + "docs:mintlify": "node scripts/process-for-mintlify.js" }, "prettier": { "semi": true, diff --git a/xdk-gen/templates/typescript/process_for_mintlify.j2 b/xdk-gen/templates/typescript/process_for_mintlify.j2 new file mode 100644 index 00000000..33366963 --- /dev/null +++ b/xdk-gen/templates/typescript/process_for_mintlify.j2 @@ -0,0 +1,1240 @@ +import { execSync } from 'child_process'; +import fs from 'fs'; +import path from 'path'; + +console.log('🚀 Processing X API SDK Documentation for Mintlify...'); + +// Mintlify configuration +const MINTLIFY_CONFIG = { + outputDir: 'mintlify-docs', + baseUrl: 'https://docs.x.com', + title: 'X API SDK v{{ version }}', + description: 'TypeScript SDK for the X API with comprehensive pagination, authentication, and streaming support.', + version: '{{ version }}', + githubUrl: 'https://github.com/xdevplatform/xsdk', + logo: { + light: '/logo-light.svg', + dark: '/logo-dark.svg' + } +}; + +// (Removed legacy category mappings and method groups) + +// Helper function to generate Mintlify frontmatter +function generateFrontmatter(title, sidebarTitle = null) { + // Clean up titles by removing generic type parameters for better readability + const cleanTitle = (str) => { + if (typeof str !== 'string') return str; + return str + .replace(/<.*?>/g, '') // Remove all generic type parameters + .replace(/Interface:\s+/, '') // Remove "Interface:" prefix + .replace(/Class:\s+/, '') // Remove "Class:" prefix + .replace(/\\/g, '') // Remove any backslashes + .replace(/\s+/g, ' ') // Normalize whitespace + .trim(); + }; + + const frontmatter = { + title: cleanTitle(title) + }; + + if (sidebarTitle) { + frontmatter.sidebarTitle = cleanTitle(sidebarTitle); + } + + // Use simple quoted strings for clean frontmatter + return `--- +title: "${cleanTitle(title)}" +${sidebarTitle ? `sidebarTitle: "${cleanTitle(sidebarTitle)}"` : ''} +--- + +`; +} + +// Helper function to clean and format markdown content +function processMarkdownContent(content, title, currentFilePath, knownTargets) { + // Remove TypeDoc-specific elements that don't work well in Mintlify + content = content + // Remove TypeDoc navigation elements + .replace(/\[\[include:.*?\]\]/g, '') + .replace(/\[\[include-start:.*?\]\]/g, '') + .replace(/\[\[include-end:.*?\]\]/g, '') + + // Fix code block formatting + .replace(/```typescript\n/g, '```typescript\n') + .replace(/```javascript\n/g, '```javascript\n') + + // Remove TypeDoc breadcrumbs (README/Exports) + .replace(/^\[[^\]]+\]\([^\)]+\)\s*\/\s*\[Exports\]\([^\)]+\)\s*\/.*\n?/m, '') + // Remove modules breadcrumb variant: [..](..)/ Exports + .replace(/^\[[^\]]+\]\([^\)]+\)\s*\/\s*Exports\s*\n?/m, '') + // Fix internal links → absolute Mintlify paths, preserve TypeDoc subdirs + // Examples: + // [Client](classes/Client.md) → /xdks/typescript/reference/classes/Client + // [deleteSubscription](AccountActivityClient.md#deletesubscription) → /xdks/typescript/reference/AccountActivityClient#deletesubscription + .replace(/\[([^\]]+)\]\(([^)#]+?)(?:\.(?:md|mdx))?(#[^)]+)?\)/g, (match, text, rawLinkPath, hash) => { + // Skip absolute URLs (http, https, mailto, tel) + if (/^(?:https?:|mailto:|tel:)/i.test(rawLinkPath)) { + return match; + } + const anchor = hash || ''; + const linkPath = rawLinkPath.replace(/\.(?:md|mdx)$/i, ''); + const currentDir = currentFilePath ? currentFilePath.substring(0, currentFilePath.lastIndexOf('/')) : ''; + // Normalize relative paths + const joined = path.posix.normalize(path.posix.join(currentDir || '', linkPath)); + let targetPath = joined.replace(/^\.\/?/, '').replace(/^docs\//, ''); + // If no directory segment and a known target exists for this base name, use it + if (!targetPath.includes('/') && knownTargets && knownTargets.has(targetPath)) { + targetPath = `${knownTargets.get(targetPath)}/${targetPath}`; + } + return `[${text}](/xdks/typescript/reference/${targetPath}${anchor})`; + }) + + // Fix method signatures + .replace(/### (.*?)\(/g, '### `$1`(') + + // Add proper spacing + .replace(/\n\n\n+/g, '\n\n') + + // Fix parameter formatting + .replace(/\*\*@param\s+(\w+)\s+(.*?)\*\*/g, '**@param** `$1` - $2') + // Replace package placeholder with real npm package + .replace(/@your-org\/x-api-sdk/g, '@xdevplatform/xdk') + .replace(/from\s+['"]x-api-sdk['"]/g, "from '@xdevplatform/xdk'") + .replace(/\*\*@returns\s+(.*?)\*\*/g, '**@returns** $1') + .replace(/\*\*@throws\s+(.*?)\*\*/g, '**@throws** $1'); + + // Remove the first H1 header to avoid duplicate titles (frontmatter title will be used) + content = content.replace(/^\s*#\s+[^\n]+\n+/, ''); + + // Escape generic type angle brackets like PaginatedResponse to avoid MDX JSX parsing + content = content.replace(/\b([A-Z][A-Za-z0-9_]*)<([^>\n]+)>/g, (m, name, inner) => { + const escapedInner = inner.replace(//g, '>'); + return `${name}<${escapedInner}>`; + }); + + // Remove explicit Table of contents blocks; Mintlify renders a sidebar TOC automatically + content = content.replace(/(^##\s+Table of contents\n[\s\S]*?)(?=^##\s+|^#\s+|\Z)/gmi, ''); + + // Convert Properties sections to Mintlify components (ResponseField/ParamField/Expandable) + // Check if this is an interface or class file + const isInterfaceOrClass = currentFilePath && ( + currentFilePath.includes('interfaces/') || + currentFilePath.includes('classes/') + ); + + if (isInterfaceOrClass && content.includes('## Properties')) { + const useParamField = /Options\b/i.test(currentFilePath); + const fieldTag = useParamField ? 'ParamField' : 'ResponseField'; + + // Helper to escape type strings for HTML attributes + const escapeType = (type) => String(type) + .replace(/\"/g, '"') + .replace(/"/g, '"') + .replace(//g, '>') + .replace(/\{/g, '{') + .replace(/\}/g, '}'); + + // Helper to parse inline object type (e.g., "{ name?: string; age: number }") + const parseInlineObject = (objStr) => { + // Remove outer braces and array brackets + let cleaned = objStr.trim().replace(/^\{/, '').replace(/\}\s*\[\]?\s*$/, '').trim(); + if (!cleaned) return []; + + const props = []; + // Split by semicolons, but be careful with nested objects + let depth = 0; + let current = ''; + const parts = []; + + for (let i = 0; i < cleaned.length; i++) { + const char = cleaned[i]; + if (char === '{') depth++; + else if (char === '}') depth--; + else if (char === ';' && depth === 0) { + parts.push(current.trim()); + current = ''; + continue; + } + current += char; + } + if (current.trim()) parts.push(current.trim()); + + for (const part of parts) { + // Match: name?: type or name: type + const match = part.match(/^\s*([^:?]+?)\??\s*:\s*(.+?)\s*$/); + if (match) { + const propName = match[1].trim(); + let propType = match[2].trim(); + const isOptional = part.includes('?') && !propType.includes('?'); + + // Clean up type (remove extra braces if present) + propType = propType.replace(/^\{/, '').replace(/\}$/, ''); + + props.push({ + name: propName, + type: propType, + optional: isOptional + }); + } + } + return props; + }; + + // Convert markdown table to Expandable with child fields + const tableToExpandable = (tableLines, tagName) => { + const children = []; + for (const line of tableLines) { + const trimmed = line.trim(); + // Skip header/separator rows + if (/^\|\s*:?-{2,}\s*\|/.test(trimmed) || /^\|\s*Name\s*\|\s*Type\s*\|\s*$/i.test(trimmed)) continue; + const m = trimmed.match(/^\|\s*`?([^`|]+?)`?\s*\|\s*(.+?)\s*\|$/); + if (!m) continue; + const fname = m[1].trim().replace(/\?$/, ''); + let ftype = m[2].trim(); + const isOptional = m[1].includes('?'); + + // Remove ALL backticks and backslashes from type for parsing + // Backticks might be around the whole type or around individual parts + ftype = ftype.replace(/`/g, '').replace(/\\/g, ''); + + // Check if type is Object[] with inline definition + if (/^\{[\s\S]*\}\s*\[\]\s*$/.test(ftype)) { + const objProps = parseInlineObject(ftype); + if (objProps.length > 0) { + const nested = objProps.map(p => { + const req = p.optional ? '' : ' required'; + const cleanPType = p.type.replace(/\}\s*\[\]\s*$/, '').trim(); + return `<${tagName} name="${p.name}" type="${escapeType(cleanPType)}"${req}>\n`; + }).join('\n\n'); + children.push(`<${tagName} name="${fname}" type="Object[]"${isOptional ? '' : ' required'}>\n\n${nested}\n\n`); + } else { + children.push(`<${tagName} name="${fname}" type="Object[]"${isOptional ? '' : ' required'}>\n`); + } + } else if (/^\{[\s\S]*\}$/.test(ftype)) { + // Nested object + const objProps = parseInlineObject(ftype); + if (objProps.length > 0) { + const nested = objProps.map(p => { + const req = p.optional ? '' : ' required'; + return `<${tagName} name="${p.name}" type="${escapeType(p.type.trim())}"${req}>\n`; + }).join('\n\n'); + children.push(`<${tagName} name="${fname}" type="Object"${isOptional ? '' : ' required'}>\n\n${nested}\n\n`); + } else { + children.push(`<${tagName} name="${fname}" type="Object"${isOptional ? '' : ' required'}>\n`); + } + } else { + // Simple type + const cleanType = ftype; + children.push(`<${tagName} name="${fname}" type="${escapeType(cleanType)}"${isOptional ? '' : ' required'}>\n`); + } + } + return children; + }; + + // Convert each property section + // Find Properties section - match from ## Properties to end of content or next ## section + const propsIndex = content.indexOf('## Properties'); + if (propsIndex !== -1) { + // Find where Properties section ends (next ## or end of content) + const afterProps = content.substring(propsIndex + '## Properties'.length); + const nextSection = afterProps.match(/^\s*\n+(.*?)(?=^##\s+|$)/s); + if (!nextSection) return content; + + const propsSection = nextSection[1]; + const convertedProps = []; + + // Match each property using regex - be more flexible with matching + // Split by ### headers first to ensure we get complete property blocks + const propBlocks = propsSection.split(/(?=^###\s+)/m).filter(b => b.trim().startsWith('###')); + + for (const propBlock of propBlocks) { + const nameMatch = propBlock.match(/^###\s+([^\n]+)\n+/); + if (!nameMatch) continue; + + const propName = nameMatch[1].trim(); + const propBody = propBlock.substring(nameMatch[0].length); + + // Check if optional + const isOptional = /•\s*`?Optional`?/.test(propBody); + + // Extract type first (before description extraction) + // Match: • Optional **name**: `type` or • **name**: type (with or without backticks) + // Handle cases like: `Object`, `\{ ... \}[]`, or inline types without backticks + const typePattern = /:\s*(?:`([^`]+)`|([^\n]+?))(?:\s*\n|$)/; + const typeMatch = propBody.match(typePattern); + let typeStr = 'any'; + + if (typeMatch) { + // Prefer backtick-wrapped type, otherwise use unwrapped + typeStr = (typeMatch[1] || typeMatch[2] || '').trim(); + } + + // Clean up type string - remove backslashes, backticks, and extract from markdown links + // Handle markdown link format: [`Type`](link) -> just use "Type" + typeStr = typeStr.replace(/\[`([^`]+)`\]\([^\)]+\)/g, '$1'); + typeStr = typeStr.replace(/`/g, '').replace(/\\/g, ''); + + // Extract description (text after type line, before "Type declaration" or "Defined in") + // First, find where the type line ends + const typeLineEnd = propBody.indexOf('\n', propBody.indexOf(':')); + const afterTypeLine = typeLineEnd !== -1 ? propBody.substring(typeLineEnd + 1) : propBody; + + // Then extract just the description part (before Type declaration or Defined in) + const descMatch = afterTypeLine.match(/^([\s\S]*?)(?:\n####\s+Type declaration|\n####\s+Defined in|\n___|\n###|$)/); + let description = descMatch ? descMatch[1].trim() : ''; + + // Remove any leftover type line fragments + description = description + .replace(/^•\s*`?Optional`?\s*\*\*[^*]+\*\*:\s*`?[^`\n]+`?\s*\n*/, '') + .replace(/^•\s*\*\*[^*]+\*\*:\s*`?[^`\n]+`?\s*\n*/, '') + .replace(/^•\s*`?Optional`?\s*$/, '') + .trim(); + + // Check if there's a Type declaration table + const typeDeclMatch = propBody.match(/####\s+Type declaration\s*\n+([\s\S]*?)(?=\n####\s+Defined in|\n___|\n###|$)/); + + if (typeDeclMatch) { + // Has table - convert to Expandable + const tableText = typeDeclMatch[1]; + const tableLines = tableText.split('\n').filter(l => l.trim().startsWith('|')); + const children = tableToExpandable(tableLines, fieldTag); + + if (children.length > 0) { + const finalType = typeStr === 'Object' || typeStr.includes('Object') ? 'Object' : typeStr; + const requiredAttr = isOptional ? '' : ' required'; + const expandableContent = children.join('\n\n'); + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="${escapeType(finalType)}"${requiredAttr}>\n${descPart}\n${expandableContent}\n\n`); + } else { + const requiredAttr = isOptional ? '' : ' required'; + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="${escapeType(typeStr)}"${requiredAttr}>\n${descPart}`); + } + } else if (/^\{[\s\S]*\}\s*\[\]\s*$/.test(typeStr.replace(/`/g, ''))) { + // Object[] with inline definition - remove backticks and backslashes + const cleanTypeStr = typeStr.replace(/`/g, '').replace(/\\/g, ''); + const objProps = parseInlineObject(cleanTypeStr); + + // Clean description - remove any type definition remnants + description = description.replace(/\{[\s\S]*\}\s*\[\]\s*$/, '').trim(); + + if (objProps.length > 0) { + const nested = objProps.map(p => { + const req = p.optional ? '' : ' required'; + const cleanPType = p.type.replace(/\}\s*\[\]\s*$/, '').trim(); + return `<${fieldTag} name="${p.name}" type="${escapeType(cleanPType)}"${req}>\n`; + }).join('\n\n'); + const requiredAttr = isOptional ? '' : ' required'; + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="Object[]"${requiredAttr}>\n${descPart}\n${nested}\n\n`); + } else { + const requiredAttr = isOptional ? '' : ' required'; + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="Object[]"${requiredAttr}>\n${descPart}`); + } + } else { + // Simple type or reference type + const cleanType = typeStr.replace(/^`|`$/g, '').replace(/\\/g, ''); + const requiredAttr = isOptional ? '' : ' required'; + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="${escapeType(cleanType)}"${requiredAttr}>\n${descPart}`); + } + } + + if (convertedProps.length > 0) { + // Replace the Properties section with converted content + const convertedContent = convertedProps.join('\n\n'); + const beforeProps = content.substring(0, propsIndex); + const afterPropsStart = propsIndex + '## Properties'.length + nextSection[0].length; + const rest = content.substring(afterPropsStart); + content = beforeProps + '## Properties\n\n' + convertedContent + '\n' + rest; + } + } + + // Clean up "Defined in" sections and separators + content = content + .replace(/^####\s+Defined in[\s\S]*?(?=^###\s+|^##\s+|$)/gm, '') + .replace(/^___\s*$/gm, ''); + + // Escape '<' inside component blocks to avoid MDX JSX parse issues in text like '<=' + // But preserve JSX tags like , , etc. + content = content + .replace(/()([\s\S]*?)(<\/ResponseField>)/g, (m, open, inner, close) => { + // Escape '<' only when it's NOT part of a JSX tag (like or ) + // Pattern: < followed by either a letter (JSX tag start) or /letter (JSX closing tag) + // Escape everything else like '<=' or '< number' + const escaped = inner.replace(/<(?![A-Za-z/])/g, '<'); + return open + escaped + close; + }) + .replace(/()([\s\S]*?)(<\/ParamField>)/g, (m, open, inner, close) => { + const escaped = inner.replace(/<(?![A-Za-z/])/g, '<'); + return open + escaped + close; + }); + } + + return content; +} + +// Helper function to determine category from file path +function getCategoryFromPath(filePath) { + if (filePath.includes('classes/Client')) return 'Getting Started'; + if (filePath.includes('classes/Paginator')) return 'Core Features'; + if (filePath.includes('stream_client')) return 'Core Features'; + if (filePath.includes('interfaces/')) return 'API Reference'; + + return 'API Reference'; +} + +// Main processing function +async function processDocs() { + try { + // First, try to generate the documentation, but skip if it fails (e.g., Node version mismatch) + console.log('📚 Generating documentation...'); + try { + execSync('npm run docs:build', { stdio: 'inherit' }); + } catch (error) { + console.log('⚠️ TypeDoc generation failed (likely Node version issue), using existing docs if available...'); + if (!fs.existsSync('docs') || fs.readdirSync('docs').length === 0) { + throw new Error('No documentation found and TypeDoc generation failed. Please upgrade Node.js to 16+ or generate docs manually.'); + } + console.log('✅ Using existing documentation files'); + } + + // Create output directory + const outputDir = MINTLIFY_CONFIG.outputDir; + if (fs.existsSync(outputDir)) { + fs.rmSync(outputDir, { recursive: true }); + } + fs.mkdirSync(outputDir, { recursive: true }); + + // Create subdirectories with xdks/typescript prefix + fs.mkdirSync(path.join(outputDir, 'xdks', 'typescript', 'reference'), { recursive: true }); + + console.log('📝 Processing markdown files...'); + + // Process all markdown files + const docsDir = 'docs'; + + // Recursive function to get all files (for Node.js < 18) + function getAllFiles(dir, fileList = []) { + const files = fs.readdirSync(dir); + files.forEach(file => { + const filePath = path.join(dir, file); + if (fs.statSync(filePath).isDirectory()) { + getAllFiles(filePath, fileList); + } else if (file.endsWith('.md')) { + // Store relative path from docsDir + fileList.push(path.relative(docsDir, filePath)); + } + }); + return fileList; + } + + const files = getAllFiles(docsDir); + + // Build map of known targets: baseName -> subdirectory (classes/interfaces/modules/enums) + const knownTargets = new Map(); + for (const f of files) { + if (typeof f === 'string' && f.endsWith('.md')) { + const base = path.basename(f, '.md'); + const dir = path.dirname(f).replace(/^\.$/, ''); + if (!knownTargets.has(base) && dir && dir !== 'docs') { + knownTargets.set(base, dir); + } + } + } + + const processedFiles = []; + const navigation = { + 'Getting Started': [], + 'Core Features': [], + 'API Reference': [], + 'Authentication': [], + 'Utilities': [] + }; + + for (const file of files) { + if (file.endsWith('.md') && file !== 'README.md') { + const filePath = path.join(docsDir, file); + const content = fs.readFileSync(filePath, 'utf8'); + + // Extract title from content or filename + let title = path.basename(file, '.md'); + const titleMatch = content.match(/^#\s+(.+)$/m); + if (titleMatch) { + title = titleMatch[1]; + } + + // Clean up title (keep original class/interface names without inserting spaces) + title = title + .replace(/^Class\s+/, '') + .replace(/^Interface\s+/, '') + .replace(/^Type\s+/, '') + .trim(); + + const category = getCategoryFromPath(file); + const processedContent = processMarkdownContent(content, title, file, knownTargets); + + // Generate frontmatter with sidebarTitle + const frontmatter = generateFrontmatter(title, title); + const finalContent = frontmatter + processedContent; + + // Determine output path with xdks/typescript prefix, preserving TypeDoc subdirectories + const baseName = path.basename(file, '.md'); + const subDir = path.dirname(file); // e.g., classes, interfaces, enums + const targetDir = path.join(outputDir, 'xdks', 'typescript', 'reference', subDir); + fs.mkdirSync(targetDir, { recursive: true }); + const outputPath = path.join(targetDir, `${baseName}.mdx`); + + // Write processed file + fs.writeFileSync(outputPath, finalContent); + processedFiles.push({ + title, + category, + path: outputPath, + originalPath: file + }); + + // Add to navigation with xdks/typescript prefix (preserve subdirectory) + if (navigation[category]) { + const relativeRefPath = path.join(subDir, baseName).replace(/\\/g, '/'); + navigation[category].push({ + title, + url: `xdks/typescript/reference/${relativeRefPath}` + }); + } + } + } + + // Create high-level documentation pages + console.log('📄 Creating high-level documentation pages...'); + + // Overview page + const overviewContent = `--- +title: "TypeScript XDK" +sidebarTitle: "Overview" +--- + +A comprehensive TypeScript SDK for the X API (formerly Twitter API) with advanced features including smart pagination, multiple authentication methods, real-time streaming, and full type safety. + +## Key Features + +- **🔐 Authentication**: User Context (OAuth1.0a, OAuth2.0), and App-Only (Bearer token) authentication +- **🔄 Pagination**: Automatic pagination with async iteration support +- **📡 Streaming**: Event-driven streaming with automatic reconnection +- **📚 Type Safety**: Complete TypeScript definitions for all endpoints and parameters +- **🎯 Full X API Support**: Users, Posts, Lists, Bookmarks, Communities, and more + +## Quick Start + + + +\`\`\`typescript quickstart.ts theme={null} +import { + Client, + type ClientConfig, + type Users +} from '@xdevplatform/xdk'; + +const config: ClientConfig = { bearerToken: 'your-bearer-token' }; + +const client: Client = new Client(config); + +async function main(): Promise { + const userResponse: Users.GetByUsernameResponse = await client.users.getByUsername('XDevelopers'); + const username: string = userResponse.data?.username!; + console.log(username); +} + +main(); +\`\`\` + +\`\`\`javascript quickstart.js theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: 'your-bearer-token' }); + +const userResponse = await client.users.getByUsername('XDevelopers'); +const username = userResponse.data.username; +console.log(username); +\`\`\` + + + +## What's Next? + +- [Installation Guide](/xdks/typescript/install) - Set up the SDK in your project +- [Authentication](/xdks/typescript/authentication) - Learn about different auth methods +- [Pagination](/xdks/typescript/pagination) - Learn about data pagination +- [Streaming](/xdks/typescript/streaming) - Learn about real-time data streaming +- [API Reference](/xdks/typescript/reference/Client) - Read the complete API documentation +`; + + fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'overview.mdx'), overviewContent); + + // Install page + const installContent = `--- +title: "Installation" +sidebarTitle: "Installation" +--- + +Get started with the TypeScript SDK for X API in your project. + +## Install + + + +\`\`\`bash npm theme={null} +npm install @xdevplatform/xdk +\`\`\` + +\`\`\`bash yarn theme={null} +yarn add @xdevplatform/xdk +\`\`\` + +\`\`\`bash pnpm theme={null} +pnpm add @xdevplatform/xdk +\`\`\` + + + +## TypeScript Support + +The SDK is written in TypeScript and includes full type definitions. No additional type packages are required. + +## Requirements + +- Node.js 16+ +- TypeScript 4.5+ (if using TypeScript) + +## Next Steps + +- [Authentication](/xdks/typescript/authentication) - Set up authentication +- [Quick Start](/xdks/typescript/overview) - Your first API call +`; + + fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'install.mdx'), installContent); + + // Authentication page + const authContent = `--- +title: "Authentication" +sidebarTitle: "Authentication" +--- + +The TypeScript SDK supports multiple authentication methods for different use cases. + +## Bearer Token (App-Only Auth) + +For read-only operations and public data access: + + + +\`\`\`typescript quickstart.ts theme={null} +import { + Client, + type ClientConfig, + type Users +} from '@xdevplatform/xdk'; + +const config: ClientConfig = { bearerToken: 'your-bearer-token' }; + +const client: Client = new Client(config); + +async function main(): Promise { + const userResponse: Users.GetByUsernameResponse = await client.users.getByUsername('XDevelopers'); + const username: string = userResponse.data?.username!; + console.log(username); +} + +main(); +\`\`\` + +\`\`\`javascript quickstart.js theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: 'your-bearer-token' }); + +const userResponse = await client.users.getByUsername('XDevelopers'); +const username = userResponse.data.username; +console.log(username); +\`\`\` + + + +## OAuth 1.0a (User Context) + +For legacy applications or specific use cases: + + + +\`\`\`typescript oauth1.ts theme={null} +import { + Client, + OAuth1, + type OAuth1Config, + type ClientConfig, + type Users +} from '@xdevplatform/xdk'; + +const oauth1Config: OAuth1Config = { + apiKey: 'your-api-key', + apiSecret: 'your-api-secret', + accessToken: 'user-access-token', + accessTokenSecret: 'user-access-token-secret' +}; + +const oauth1: OAuth1 = new OAuth1(oauth1Config); + +const config: ClientConfig = { + oauth1: oauth1, +}; + +const client: Client = new Client(config); + +async function main(): Promise { + const response: Users.GetMeResponse = await client.users.getMe(); + + const me = response.data; + console.log(me); +} + +main(); + +\`\`\` + +\`\`\`javascript oauth1.js theme={null} +import { + Client, + type ClientConfig, + type Users +} from '@xdevplatform/xdk'; + +const config: ClientConfig = { bearerToken: 'your-bearer-token' }; + +const client: Client = new Client(config); + +async function main(): Promise { + const userResponse: Users.GetByUsernameResponse = await client.users.getByUsername('XDevelopers'); + const username: string = userResponse.data?.username!; + console.log(username); +} + +main(); + +\`\`\` + + + +## OAuth 2.0 (User Context) + +For user-specific operations: + + + +\`\`\`typescript oauth2.ts theme={null} +import { + Client, + OAuth2, + generateCodeVerifier, + generateCodeChallenge, + type OAuth2Config, + type ClientConfig, + type OAuth2Token +} from '@xdevplatform/xdk'; + +(async (): Promise => { + const oauth2Config: OAuth2Config = { + clientId: 'your-client-id', + clientSecret: 'your-client-secret', + redirectUri: 'https://example.com', + scope: ['tweet.read', 'users.read', 'offline.access'], + }; + + const oauth2: OAuth2 = new OAuth2(oauth2Config); + + const state: string = 'example-state'; + const codeVerifier: string = generateCodeVerifier(); + const codeChallenge: string = await generateCodeChallenge(codeVerifier); + + oauth2.setPkceParameters(codeVerifier, codeChallenge); + + const authUrl: string = await oauth2.getAuthorizationUrl(state); + + const tokens: OAuth2Token = await oauth2.exchangeCode(authCode, codeVerifier); + + const config: ClientConfig = { + accessToken: tokens.access_token, + }; + + const client: Client = new Client(config); +}); + +\`\`\` + +\`\`\`javascript oauth2.js theme={null} +import { Client, OAuth2, generateCodeVerifier, generateCodeChallenge } from '@xdevplatform/xdk'; + +(async () => { + const oauth2 = new OAuth2({ + clientId: 'your-client-id', + clientSecret: 'your-client-secret', + redirectUri: 'https://example.com', + scope: ['tweet.read', 'users.read', 'offline.access'], + }); + + const state = 'example-state'; + const codeVerifier = generateCodeVerifier(); + const codeChallenge = await generateCodeChallenge(codeVerifier); + oauth2.setPkceParameters(codeVerifier, codeChallenge); + const authUrl = await oauth2.getAuthorizationUrl(state); + + const tokens = await oauth2.exchangeCode(authCode, codeVerifier); + + const client = new Client({ accessToken: tokens.access_token }); + + const response = await client.users.getMe(); + const me = response.data; + console.log(me); +}); +\`\`\` + + + +## Environment Variables + +Store sensitive credentials in environment variables: + +\`\`\`bash +# .env +X_API_BEARER_TOKEN=your-bearer-token +X_API_CLIENT_ID=your-client-id +X_API_CLIENT_SECRET=your-client-secret +\`\`\` + + + +\`\`\`typescript env.ts theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: process.env.X_API_BEARER_TOKEN }); +\`\`\` + +\`\`\`javascript env.js theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: process.env.X_API_BEARER_TOKEN }); +\`\`\` + + +`; + + fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'authentication.mdx'), authContent); + + // Pagination page + const paginationContent = `--- +title: "Pagination" +sidebarTitle: "Pagination" +--- + +The SDK provides generic paginator utilities you can use with any endpoint that returns paginated responses. Methods return plain responses; you wrap them with a paginator. + +### Basic Pagination + + + +\`\`\`typescript quick-start.ts theme={null} +import { Client, UserPaginator, PaginatedResponse, Schemas } from '@xdevplatform/xdk'; + +const client: Client = new Client({ bearerToken: 'your-bearer-token' }); + +// Wrap any list endpoint with proper typing +const followers: UserPaginator = new UserPaginator( + async (token?: string): Promise> => { + const res = await client.users.getFollowers('', { + maxResults: 100, + paginationToken: token, + userFields: ['id','name','username'], + }); + return { + data: res.data ?? [], + meta: res.meta, + includes: res.includes, + errors: res.errors + }; + } +); +\`\`\` + +\`\`\`javascript quick-start.js theme={null} +import { Client } from '@xdevplatform/xdk'; +import { UserPaginator } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: 'your-bearer-token' }); + +const followers = new UserPaginator(async (token) => { + const res = await client.users.getFollowers('', { + maxResults: 100, + paginationToken: token, + userFields: ['id','name','username'], + }); + return { data: res.data ?? [], meta: res.meta, includes: res.includes, errors: res.errors }; +}); +\`\`\` + + + +### Manual paging + + + +\`\`\`typescript manual.ts theme={null} +import { UserPaginator, Schemas } from '@xdevplatform/xdk'; + +await followers.fetchNext(); // first page +while (!followers.done) { + await followers.fetchNext(); // subsequent pages +} + +const userCount: number = followers.users.length; // all fetched users +const firstUser: Schemas.User | undefined = followers.users[0]; +const nextToken: string | undefined = followers.meta?.next_token; +\`\`\` + +\`\`\`javascript manual.js theme={null} +await followers.fetchNext(); +while (!followers.done) await followers.fetchNext(); +console.log(followers.items.length); +\`\`\` + + + +### Async iteration + + + +\`\`\`typescript async.ts theme={null} +import { Schemas } from '@xdevplatform/xdk'; + +for await (const user of followers) { + const typedUser: Schemas.User = user; + console.log(typedUser.username); // fully typed access +} +\`\`\` + +\`\`\`javascript async.js theme={null} +for await (const user of followers) { + console.log(user.username); +} +\`\`\` + + + +### Next page as a new instance + + + +\`\`\`typescript next.ts theme={null} +import { UserPaginator } from '@xdevplatform/xdk'; + +await followers.fetchNext(); +if (!followers.done) { + const page2: UserPaginator = await followers.next(); // independent paginator starting at next page + await page2.fetchNext(); + console.log(page2.users.length); // items from second page +} +\`\`\` + +\`\`\`javascript next.js theme={null} +await followers.fetchNext(); +if (!followers.done) { + const page2 = await followers.next(); + await page2.fetchNext(); +} +\`\`\` + + + +### Error handling and rate limits + + + +\`\`\`typescript errors.ts theme={null} +import { UserPaginator, Schemas } from '@xdevplatform/xdk'; + +try { + for await (const item of followers) { + const user: Schemas.User = item; + // process user... + } +} catch (err: unknown) { + if (followers.rateLimited) { + console.error('Rate limited, backoff required'); + // backoff / retry later + } else { + console.error('Pagination error:', err); + throw err; + } +} +\`\`\` + +\`\`\`javascript errors.js theme={null} +try { + for await (const item of followers) { + // ... + } +} catch (err) { + if (followers.rateLimited) { + // backoff / retry later + } else { + throw err; + } +} +\`\`\` + + +`; +fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'pagination.mdx'), paginationContent); + +// Streaming page +const streamingContent = `--- +title: "Streaming" +sidebarTitle: "Streaming" +--- + +The TypeScript SDK provides real-time streaming capabilities for live data feeds. + +## Basic Streaming + +Connect to real-time sampled posts: + + + +\`\`\`typescript stream.ts theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client: Client = new Client({ bearerToken: 'your-bearer-token' }); + +// 1% sampled public posts +const stream = await client.stream.postsSample({ + tweetFields: ['id','text','created_at'], + expansions: ['author_id'], + userFields: ['id','username','name'] +}); + +// Listen to events +stream.on('data', (event) => { + // event is the parsed JSON line (data/includes/matching_rules) + console.log('New data:', event); +}); + +stream.on('error', (e) => console.error('Stream error:', e)); +stream.on('close', () => console.log('Stream closed')); +\`\`\` + +\`\`\`javascript stream.js theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: 'your-bearer-token' }); +const stream = await client.stream.postsSample({ tweetfields: ['id','text'] }); + +stream.on('data', (event) => { + console.log('New data:', event); +}); +stream.on('error', (e) => console.error('Stream error:', e)); +stream.on('close', () => console.log('Stream closed')); +\`\`\` + + + +## Async Iteration + +Consume the stream with async iteration: + + + +\`\`\`typescript async.ts theme={null} +const stream = await client.stream.postsSample(); +for await (const event of stream) { + // Each event is a parsed JSON line (data/includes/matching_rules) + console.log(event); +} +\`\`\` + +\`\`\`javascript async.js theme={null} +const stream = await client.stream.postsSample(); +for await (const event of stream) { + console.log(event); +} +\`\`\` + + + +## Stream Management + +Control lifecycle from the event-driven stream: + +\`\`\`typescript +// Close the stream +stream.close(); + +// Auto-reconnect (if enabled by your wrapper) +// The default EventDrivenStream exposes basic reconnect hooks +\`\`\` + +## Error Handling + +Handle streaming errors and reconnections: + +\`\`\`typescript +stream.on('error', (event) => { + const err = event.error || event; + console.error('Stream error:', err); +}); + +stream.on('keepAlive', () => { + // heartbeat event +}); +\`\`\` +`; +fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'streaming.mdx'), streamingContent); + + // Create navigation structure for integration into existing Mintlify site + console.log('⚙️ Creating navigation structure...'); + + // Build API Reference groups from the generated files on disk + const refRoot = path.join(outputDir, 'xdks', 'typescript', 'reference'); + const classesDir = path.join(refRoot, 'classes'); + const interfacesDir = path.join(refRoot, 'interfaces'); + + const listFilesNoExt = (dir) => { + try { + return fs.readdirSync(dir) + .filter(f => f.endsWith('.mdx')) + .map(f => `xdks/typescript/reference/${path.basename(dir)}/${path.basename(f, '.mdx')}`); + } catch (_) { + return []; + } + }; + + const classesPages = listFilesNoExt(classesDir); + const interfacesPages = listFilesNoExt(interfacesDir); + + // Build sub-groups for Classes and Interfaces + const MODULE_PREFIXES = [ + 'AccountActivity','Activity','Communities','CommunityNotes','Compliance','Connections', + 'DirectMessages','General','Lists','Media','Posts','Spaces','Stream','Trends','Usage', + 'Users','Webhooks','Http','OAuth','Client','Paginator','EventDrivenStream','StreamClient' + ]; + + function groupPages(pages, kind) { + const buckets = new Map(); + for (const p of pages) { + const name = p.split('/').pop(); + let group = null; + for (const pref of MODULE_PREFIXES) { + if (name.startsWith(pref)) { group = pref; break; } + } + if (!group) { + if (kind === 'classes') { + if (/Client$/.test(name)) group = 'Clients'; + else if (/Stream/i.test(name)) group = 'Streaming'; + else if (/Paginator$/.test(name)) group = 'Pagination'; + else group = 'Core'; + } else { + // interfaces + group = 'Misc'; + } + } + if (!buckets.has(group)) buckets.set(group, []); + buckets.get(group).push(p); + } + // Sort pages within groups alphabetically + for (const [k, arr] of buckets) arr.sort(); + // Convert to [{group, pages}] + return Array.from(buckets.entries()).sort((a,b)=>a[0].localeCompare(b[0])).map(([group, pages]) => ({ group, pages })); + } + + const classGroups = groupPages(classesPages, 'classes'); + const interfaceGroups = groupPages(interfacesPages, 'interfaces'); + + // Overwrite modules.mdx with an organized, expandable structure + const modulesOut = path.join(refRoot, 'modules.mdx'); + // Derive original TypeDoc modules title from docs/modules.md + let typedocModulesTitle = 'Modules'; + try { + const rawModules = fs.readFileSync(path.join('docs', 'modules.md'), 'utf8'); + const m = rawModules.match(/^#\s+(.+)$/m); + if (m) typedocModulesTitle = m[1].trim(); + } catch (_) {} + const renderGroupList = (groups) => groups.map(g => ( + ` \n` + + g.pages.map(p => ` - [${p.split('/').pop()}](/${p})`).join('\n') + + `\n ` + )).join('\n\n'); + + const modulesContent = `---\n`+ +`title: "${typedocModulesTitle}"\n`+ +`sidebarTitle: "${typedocModulesTitle}"\n`+ +`---\n\n`+ +`\n\n`+ +`\n\n`+ +renderGroupList(interfaceGroups)+`\n\n`+ +`\n\n`+ +`\n\n`+ +renderGroupList(classGroups)+`\n\n`+ +`\n\n`+ +`\n`; + + fs.writeFileSync(modulesOut, modulesContent); + + // Generate the TypeScript SDK navigation tab with requested structure + const typescriptSdkNavigation = { + tab: 'TypeScript SDK', + hidden: true, + pages: [ + 'xdks/typescript/overview', + 'xdks/typescript/install', + 'xdks/typescript/authentication', + 'xdks/typescript/pagination', + 'xdks/typescript/streaming', + { + group: 'API Reference', + pages: [ + 'xdks/typescript/reference/modules', + { + group: 'Interfaces', + pages: interfaceGroups + }, + { + group: 'Classes', + pages: classGroups + } + ] + } + ] + }; + + // Also create a JSON file for easy copy-paste + fs.writeFileSync( + path.join(outputDir, 'typescript-sdk-navigation.json'), + JSON.stringify(typescriptSdkNavigation, null, 2) + ); + + console.log('✅ TypeScript SDK documentation processed successfully!'); + console.log(`📁 Output directory: ${outputDir}/`); + console.log(`📊 Processed ${processedFiles.length} files`); + console.log('\n🚀 Integration steps:'); + console.log('1. Copy the \'xdk/\' folder to your existing Mintlify site'); + console.log('2. Add the navigation structure from \'typescript-sdk-navigation.json\' to your mintlify.json'); + console.log('3. Push to your main branch to deploy'); + + } catch (error) { + console.error('❌ Error processing documentation:', error.message); + process.exit(1); + } +} + +// Run the processing +processDocs(); \ No newline at end of file diff --git a/xdk-gen/templates/typescript/watch_docs.j2 b/xdk-gen/templates/typescript/watch_docs.j2 new file mode 100644 index 00000000..971ac6c6 --- /dev/null +++ b/xdk-gen/templates/typescript/watch_docs.j2 @@ -0,0 +1,68 @@ +import { execSync } from 'child_process'; +import { watch } from 'chokidar'; +import { spawn } from 'child_process'; + +console.log('🚀 Starting X API SDK Documentation Watch Server...'); + +let serverProcess = null; + +function startServer() { + if (serverProcess) { + serverProcess.kill(); + } + + console.log('📚 Starting documentation server on http://localhost:8080'); + serverProcess = spawn('npx', ['http-server', 'docs', '-p', '8080', '-o'], { + stdio: 'inherit' + }); +} + +function regenerateDocs() { + console.log('🔄 Regenerating documentation...'); + try { + execSync('node scripts/generate-docs-simple.js', { stdio: 'inherit' }); + console.log('✅ Documentation regenerated successfully'); + } catch (error) { + console.error('❌ Failed to regenerate documentation:', error.message); + } +} + +// Initial documentation generation +regenerateDocs(); +startServer(); + +// Watch for changes in source files +const watcher = watch([ + 'src/**/*.ts', + '!src/**/stream_client.ts', + '!src/**/event_driven_stream.ts', + '!src/**/stream_listener.ts', + '!src/**/oauth1_auth.ts', + '!src/**/oauth2_auth.ts', + '!src/**/crypto_utils.ts' +], { + ignored: /(^|[\/\\])\../, // ignore dotfiles + persistent: true +}); + +watcher.on('change', (path) => { + console.log(`📝 File changed: ${path}`); + regenerateDocs(); +}); + +watcher.on('error', (error) => { + console.error('❌ Watcher error:', error); +}); + +// Graceful shutdown +process.on('SIGINT', () => { + console.log('\n🛑 Shutting down documentation server...'); + if (serverProcess) { + serverProcess.kill(); + } + watcher.close(); + process.exit(0); +}); + +console.log('👀 Watching for changes... Press Ctrl+C to stop'); + diff --git a/xdk/python/.gitignore b/xdk/python/.gitignore new file mode 100644 index 00000000..74828e39 --- /dev/null +++ b/xdk/python/.gitignore @@ -0,0 +1,46 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +# Documentation generation outputs +# These are generated by the docs scripts and should not be committed + +# Sphinx output directories +docs/ +docs/_build/ +docs_source/ + +# Mintlify processed documentation +mintlify-docs/ + +# Python cache +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python + +# Virtual environments +venv/ +env/ +ENV/ +.venv + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# Distribution / packaging +dist/ +build/ +*.egg-info/ + +# Testing +.pytest_cache/ +.coverage +htmlcov/ + +# Type checking +.mypy_cache/ +.pytype/ diff --git a/xdk/python/conf.py b/xdk/python/conf.py new file mode 100644 index 00000000..91b4962f --- /dev/null +++ b/xdk/python/conf.py @@ -0,0 +1,101 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. + +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +import sys +from pathlib import Path + +# Add the xdk package to the path so autodoc can find it +sys.path.insert(0, str(Path(__file__).parent.parent)) + +# -- Project information ----------------------------------------------------- + +project = "X API SDK" +copyright = "2024, X Developer Platform" +author = "X Developer Platform" +release = "0.2.2-beta" +version = "0.2.2-beta" + +# -- General configuration ---------------------------------------------------- + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", # Support for Google/NumPy style docstrings + "myst_parser", # Markdown support +] + +# Napoleon settings for docstring parsing +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_init_with_doc = False +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True + +# Autodoc settings +autodoc_default_options = { + "members": True, + "undoc-members": False, + "show-inheritance": True, + "inherited-members": False, + "private-members": False, + "special-members": "__init__", +} + +autosummary_generate = True + +# MyST parser settings +myst_enable_extensions = [ + "colon_fence", + "deflist", + "dollarmath", + "fieldlist", + "html_admonition", + "html_image", + "linkify", + "replacements", + "smartquotes", + "strikethrough", + "substitution", + "tasklist", +] + +# Templates path +templates_path = ["_templates"] + +# The suffix(es) of source filenames +source_suffix = { + ".rst": "restructuredtext", + ".md": "markdown", +} + +# The master toctree document +master_doc = "index" + +# The language for content autogenerated by Sphinx +language = "en" + +# -- Options for HTML output -------------------------------------------------- + +html_theme = "default" +html_static_path = ["_static"] + +# -- Options for Markdown output ---------------------------------------------- + +# Use markdown builder +# This will be set via command line: sphinx-build -b markdown diff --git a/xdk/python/pyproject.toml b/xdk/python/pyproject.toml index eeef0ccb..89197666 100644 --- a/xdk/python/pyproject.toml +++ b/xdk/python/pyproject.toml @@ -48,6 +48,10 @@ dev = [ "pytest", "pytest-cov", "ruff", + "sphinx>=7.0.0", + "myst-parser>=2.0.0", + "sphinx-markdown-builder>=0.5.5", + "watchdog>=3.0.0", ] [tool.pytest.ini_options] diff --git a/xdk/python/scripts/generate-docs-simple.py b/xdk/python/scripts/generate-docs-simple.py new file mode 100644 index 00000000..855c7ad2 --- /dev/null +++ b/xdk/python/scripts/generate-docs-simple.py @@ -0,0 +1,184 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +#!/usr/bin/env python3 +""" +AUTO-GENERATED FILE - DO NOT EDIT +This file was automatically generated by the XDK build tool. +Any manual changes will be overwritten on the next generation. + +Generate API documentation for the Python SDK using Sphinx with markdown output. +""" + +import os +import sys +import shutil +import subprocess +from pathlib import Path + +print("🚀 Generating X API SDK Documentation...") + +# Try to use virtual environment if available +venv_python = Path(".venv") / "bin" / "python" +if venv_python.exists(): + print("📦 Using virtual environment...") + python_exe = str(venv_python) +else: + python_exe = sys.executable + +# Configuration +DOCS_DIR = Path("docs") +SPHINX_SOURCE_DIR = Path("docs_source") +SPHINX_BUILD_DIR = DOCS_DIR / "_build" +SPHINX_MARKDOWN_DIR = DOCS_DIR + +# Clean up old docs +if DOCS_DIR.exists(): + shutil.rmtree(DOCS_DIR) +DOCS_DIR.mkdir(parents=True, exist_ok=True) + +# Clean up old source +if SPHINX_SOURCE_DIR.exists(): + shutil.rmtree(SPHINX_SOURCE_DIR) + +# Create Sphinx source directory structure +SPHINX_SOURCE_DIR.mkdir(parents=True, exist_ok=True) +(SPHINX_SOURCE_DIR / "_static").mkdir(exist_ok=True) +(SPHINX_SOURCE_DIR / "_templates").mkdir(exist_ok=True) + +# Copy conf.py from root (should be generated) +conf_py_path = Path("conf.py") +if conf_py_path.exists(): + shutil.copy(conf_py_path, SPHINX_SOURCE_DIR / "conf.py") +else: + print("⚠️ Warning: conf.py not found. Sphinx may not work correctly.") + +try: + # Use sphinx-apidoc to auto-generate API documentation + print("📚 Running sphinx-apidoc to generate API documentation structure...") + apidoc_cmd = [ + python_exe, + "-m", + "sphinx.ext.apidoc", + "-o", + str(SPHINX_SOURCE_DIR), + "-f", # Force overwrite + "--separate", # Put each module in its own file + "xdk", # Source package + ] + + subprocess.run(apidoc_cmd, check=True, capture_output=True, text=True) + + # Create or update index.rst + index_content = """X API SDK Documentation +========================== + +Welcome to the X API SDK documentation. + +.. toctree:: + :maxdepth: 2 + :caption: API Reference: + + modules + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` +""" + + (SPHINX_SOURCE_DIR / "index.rst").write_text(index_content) + + # Run Sphinx with markdown builder + print("📚 Running Sphinx to generate markdown documentation...") + + sphinx_cmd = [ + python_exe, + "-m", + "sphinx", + "-b", + "markdown", # Use markdown builder + str(SPHINX_SOURCE_DIR), + str(SPHINX_MARKDOWN_DIR), + ] + + result = subprocess.run(sphinx_cmd, check=True, capture_output=True, text=True) + print("✅ Documentation generated successfully in docs/") + + # Clean up build directory + if SPHINX_BUILD_DIR.exists(): + shutil.rmtree(SPHINX_BUILD_DIR) + + # Clean up source directory + if SPHINX_SOURCE_DIR.exists(): + shutil.rmtree(SPHINX_SOURCE_DIR) + +except subprocess.CalledProcessError as e: + print(f"❌ Documentation generation failed: {e}") + if e.stdout: + print(f"stdout: {e.stdout}") + if e.stderr: + print(f"stderr: {e.stderr}") + sys.exit(1) +except FileNotFoundError: + print("❌ Sphinx not found.") + print("💡 Installing dependencies...") + try: + # Try to install using uv if available + if shutil.which("uv"): + subprocess.run( + ["uv", "pip", "install", "-e", ".[dev]"], check=True, shell=False + ) + else: + # Fallback to pip + subprocess.run( + [ + sys.executable, + "-m", + "pip", + "install", + "sphinx", + "myst-parser", + "sphinx-markdown-builder", + ], + check=True, + ) + print("✅ Dependencies installed. Please run the script again.") + except subprocess.CalledProcessError: + print("❌ Failed to install dependencies automatically.") + print("💡 Please install manually with:") + print(" uv pip install -e '.[dev]'") + print(" or") + print(" pip install sphinx myst-parser sphinx-markdown-builder") + sys.exit(1) +except ImportError as e: + if "myst_parser" in str(e) or "myst-parser" in str(e): + print("❌ myst-parser not found.") + print("💡 Installing dependencies...") + try: + if shutil.which("uv"): + subprocess.run( + ["uv", "pip", "install", "-e", ".[dev]"], check=True, shell=False + ) + else: + subprocess.run( + [ + sys.executable, + "-m", + "pip", + "install", + "myst-parser", + "sphinx-markdown-builder", + ], + check=True, + ) + print("✅ Dependencies installed. Please run the script again.") + except subprocess.CalledProcessError: + print("❌ Failed to install dependencies automatically.") + print("💡 Please install manually with:") + print(" uv pip install -e '.[dev]'") + else: + raise + sys.exit(1) diff --git a/xdk/python/scripts/process-for-mintlify.py b/xdk/python/scripts/process-for-mintlify.py new file mode 100644 index 00000000..f193e2da --- /dev/null +++ b/xdk/python/scripts/process-for-mintlify.py @@ -0,0 +1,1972 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +#!/usr/bin/env python3 +""" +AUTO-GENERATED FILE - DO NOT EDIT +This file was automatically generated by the XDK build tool. +Any manual changes will be overwritten on the next generation. + +Process Sphinx-generated markdown documentation for Mintlify. +""" + +import os +import sys +import json +import re +import shutil +from pathlib import Path +from typing import Dict, List, Optional, Set + +print("🚀 Processing X API SDK Documentation for Mintlify...") + +# Mintlify configuration +MINTLIFY_CONFIG = { + "outputDir": "mintlify-docs", + "baseUrl": "https://docs.x.com", + "title": "X API SDK v0.2.2-beta", + "description": "Python SDK for the X API with comprehensive pagination, authentication, and streaming support.", + "version": "0.2.2-beta", + "githubUrl": "https://github.com/xdevplatform/xdk", +} + + +def clean_title(title: str, file_path: str = "", content: str = "") -> str: + """Clean and improve title formatting.""" + if not isinstance(title, str): + title = str(title) + # Try to extract class name from content first (more reliable) + if content: + # Look for class definition: ### *class* xdk.module.ClassName + class_match = re.search( + r"\*class\*\s+[^\s]*\.([A-Z][a-zA-Z0-9_]*Client|Client|Paginator|OAuth2PKCEAuth)\b", + content, + ) + if class_match: + return class_match.group(1) + # Remove module suffix + title = re.sub(r"\s+module\s*$", "", title, flags=re.IGNORECASE) + # Extract class name from patterns like "xdk.users.client.UsersClient" + class_match = re.search( + r"\.([A-Z][a-zA-Z0-9_]+Client|Paginator|OAuth2PKCEAuth)\b", title + ) + if class_match: + return class_match.group(1) + # Fallback to generic Client only if no specific client found + if "Client" in title and not re.search(r"[A-Z][a-zA-Z0-9_]+Client", title): + class_match = re.search(r"\.(Client)\b", title) + if class_match: + return class_match.group(1) + # Extract class name from patterns like "*class* xdk.users.client.UsersClient" + class_match2 = re.search( + r"\*class\*\s+[^\s]*\.([A-Z][a-zA-Z0-9_]*Client|Client|Paginator|OAuth2PKCEAuth)\b", + title, + ) + if class_match2: + return class_match2.group(1) + # Remove xdk. prefix + title = re.sub(r"^xdk\.", "", title) + # Convert snake_case to PascalCase for module names + if "." in title and not title[0].isupper(): + parts = title.split(".") + # Capitalize each part + title = ".".join(p.capitalize() for p in parts) + # Clean up + title = ( + re.sub(r"<.*?>", "", title) # Remove generic type parameters + .replace("Class: ", "") + .replace("Interface: ", "") + .replace("*class*", "") + .replace("*", "") + .replace("\\", "") + .replace("\n", " ") + .strip() + ) + return title + + +def generate_frontmatter( + title: str, sidebar_title: Optional[str] = None, file_path: str = "" +) -> str: + """Generate Mintlify frontmatter.""" + cleaned_title = clean_title(title, file_path) + cleaned_sidebar = ( + clean_title(sidebar_title, file_path) if sidebar_title else cleaned_title + ) + frontmatter = f'title: "{cleaned_title}"\n' + if sidebar_title: + frontmatter += f'sidebarTitle: "{cleaned_sidebar}"\n' + return f"---\n{frontmatter}---\n\n" + + +def reorganize_class_structure(content: str, file_path: str) -> str: + """Reorganize content into proper sections like TypeScript.""" + # Check if this is a class/client file + if "client" not in file_path.lower() and "models" not in file_path.lower(): + return content + # Find class definition - handle both formats + # Pattern 1: ### *class* xdk.module.ClassName(params) + # Pattern 2: ### `*class* xdk.module.ClassName`(params) + class_match = re.search( + r"###\s+(?:`?)?\*class\*\s+([^\n(]+)(?:`?)?\s*\(([^)]*)\)", content + ) + if not class_match: + return content + class_name_full = class_match.group(1).strip().replace("*", "").replace("`", "") + # Extract just the class name (last part after last dot) + class_name = ( + class_name_full.split(".")[-1] if "." in class_name_full else class_name_full + ) + class_params = class_match.group(2).strip() + # Extract description after class definition + class_start = class_match.end() + next_section = content.find("###", class_start) + if next_section == -1: + next_section = len(content) + description = content[class_start:next_section].strip() + # Extract "Bases:" line for later use as Badge + bases_match = re.search(r"Bases:\s*`([^`]+)`", description, re.IGNORECASE) + bases = bases_match.group(1).strip() if bases_match else None + # Remove "Bases:" line - we'll add it as a Badge + description = re.sub( + r"Bases:\s*`[^`]+`\s*\n?", "", description, flags=re.IGNORECASE + ) + # Remove any stray closing parentheses + description = re.sub(r"^\)\s*\n?", "", description) + description = description.strip() + # Find all methods and properties + methods = [] + constructors = [] + properties = [] + # Pattern for methods: ### method_name(params) → ReturnType + method_pattern = r"###\s+`?([^\n(]+)`?\s*\(([^)]*)\)(?:\s*→\s*([^\n]+))?" + for match in re.finditer(method_pattern, content): + method_name = ( + match.group(1).strip().replace("`", "").replace("\\", "").replace("*", "") + ) + params = match.group(2).strip() + return_type = match.group(3).strip() if match.group(3) else None + # Find method body + method_start = match.start() + next_method = content.find("###", method_start + 1) + if next_method == -1: + method_body = content[method_start:] + else: + method_body = content[method_start:next_method] + method_info = { + "name": method_name, + "params": params, + "return_type": return_type, + "body": method_body, + } + if method_name == "__init__" or "constructor" in method_name.lower(): + constructors.append(method_info) + elif method_name.startswith("property") or "property" in method_body.lower(): + properties.append(method_info) + else: + methods.append(method_info) + # Rebuild content with proper sections + sections = [] + # Class definition and description + sections.append(f"## {class_name}\n\n") + sections.append('Class\n') + if bases: + sections.append(f'\nBases: {bases}\n') + if description: + sections.append(f"\n{description}\n") + # Constructors section + if constructors: + sections.append("\n## Constructors\n") + for const in constructors: + sections.append(const["body"]) + # Methods section + if methods: + sections.append("\n## Methods\n") + for method in methods: + sections.append(method["body"]) + # Properties section + if properties: + sections.append("\n## Properties\n") + for prop in properties: + sections.append(prop["body"]) + # If we found methods/constructors, rebuild content + if constructors or methods or properties: + before_class = content[: class_match.start()] + # Get remaining content after last method + if methods: + last_method_end = content.rfind(methods[-1]["body"]) + remaining = content[last_method_end + len(methods[-1]["body"]) :] + elif constructors: + last_constructor_end = content.rfind(constructors[-1]["body"]) + remaining = content[last_constructor_end + len(constructors[-1]["body"]) :] + else: + remaining = content[next_section:] + # Clean up any stray characters and duplicate class definitions + remaining = re.sub(r"^\)\s*\n", "", remaining) + # Remove duplicate class definitions that might have been left behind + # Pattern: ### `class xdk.module.ClassName` followed by description and parameters + # Match the full duplicate class definition block + remaining = re.sub( + r"###\s+`?class\s+xdk\.[^\n]+\n\n[^\n]+\n\n(?:####\s+Parameters[^\n]+\n\n]+>\s*\s*\n)?", + "", + remaining, + ) + # Also remove any standalone class definitions without parameters + remaining = re.sub( + r"###\s+`?\*?class\*?\s+xdk\.[^\n]+\n\n[^\n]+\n\n", "", remaining + ) + # Remove any remaining class definition patterns (more aggressive) + remaining = re.sub( + r"###\s+`?class\s+[^\n]+\n\n[^\n]+\n\n(?:####\s+Parameters[^\n]+\n\n)?", + "", + remaining, + ) + return before_class + "\n".join(sections) + remaining + return content + + +def clean_class_definitions(content: str) -> str: + """Clean up class definition headers.""" + # Remove any remaining class definition headers that weren't processed + # Pattern: ### `*class* xdk.module.ClassName`(params) or ## xdk.module.ClassName + # These should already be converted by reorganize_class_structure, but clean up any leftovers + # Remove any stray class definition patterns + content = re.sub(r"##\s+xdk\.[^\n]+\n\n\)\s*\n", "", content) + # Clean up any remaining "Bases:" lines that weren't converted + content = re.sub(r"^Bases:\s*`[^`]+`\s*\n?", "", content, flags=re.MULTILINE) + return content + + +def fix_method_names(content: str) -> str: + """Fix method names with escaped underscores.""" + # Pattern: ### ``\_\_init_\_`` -> ### `__init__` + # Handle double backticks with escaped underscores + content = re.sub(r"###\s+``\\?(_+[^`]+_+)``", r"### `\1`", content) + # Pattern: ### ``method\_name`` -> ### `method_name` + content = re.sub(r"###\s+``([^`]*)\\?(_[^`]*)``", r"### `\1\2`", content) + # Pattern: ### ``\_\_init_\_``(params) -> ### `__init__`(params) + content = re.sub(r"###\s+``([^`]*)\\?(_[^`]*)``\s*\(", r"### `\1\2`(", content) + # Remove any remaining escaped underscores in method names (single backticks) + content = re.sub(r"###\s+`([^`]*)\\?(_[^`]*)`\s*\(", r"### `\1\2`(", content) + # Fix any remaining escaped underscores in code blocks + content = re.sub(r"`([^`]*)\\?(_[^`]*)`", r"`\1\2`", content) + return content + + +def improve_method_formatting(content: str) -> str: + """Improve method formatting to match TypeScript style with ParamField components.""" + # Pattern: ### method_name(params) → ReturnType + def convert_method(match): + method_header = match.group(0) + method_name = ( + match.group(1) + .strip() + .replace("*", "") + .replace("`", "") + .replace("\\", "") + .replace("_", "_") + ) + params_str = match.group(2).strip() if match.group(2) else "" + return_type = match.group(3).strip() if match.group(3) else None + # Find method body (until next ### or ####) + method_start = match.start() + next_method = content.find("###", method_start + 1) + if next_method == -1: + method_body = content[method_start:] + else: + method_body = content[method_start:next_method] + # Extract description (text after method header, before :param) + desc_match = re.search( + r"###[^\n]+\n\n([^\n]+(?:\n(?!:param|####|###|####)[^\n]+)*)", + method_body, + re.MULTILINE, + ) + description = desc_match.group(1).strip() if desc_match else "" + # Remove method name from description if it appears + description = re.sub( + r"^" + re.escape(method_name) + r"\s*$", "", description, flags=re.MULTILINE + ).strip() + # Parse parameters and convert to ParamField components + param_fields = [] + if params_str: + # Simple parameter parsing (split by comma, but handle type annotations) + params = [] + current = "" + depth = 0 + for char in params_str: + if char in "[(": + depth += 1 + elif char in "])": + depth -= 1 + elif char == "," and depth == 0: + if current.strip(): + params.append(current.strip()) + current = "" + continue + current += char + if current.strip(): + params.append(current.strip()) + for param in params: + # Parse: name: type = default + # Handle cases like: client: [Client](xdk.md#xdk.Client) + param_match = re.match( + r"(\w+)(?:\s*:\s*([^=]+))?(?:\s*=\s*(.+))?$", param.strip() + ) + if param_match: + param_name = param_match.group(1) + param_type_raw = ( + param_match.group(2).strip() if param_match.group(2) else "Any" + ) + param_default = ( + param_match.group(3).strip() if param_match.group(3) else None + ) + # Clean type - handle markdown links first + # Pattern: [Type](path#anchor) -> extract just "Type" + link_match = re.search(r"\[([^\]]+)\]\(([^\)]+)\)", param_type_raw) + if link_match: + param_type = link_match.group(1) # Use just the link text + else: + # No link, use the raw type but clean it + param_type = param_type_raw + # Remove file references and anchors + param_type = re.sub(r"[a-z_]+\.(md|py)#[^\s]*", "", param_type) + param_type = re.sub(r"#[^\s]*", "", param_type) + # Remove incomplete link patterns like "Client](" + param_type = re.sub(r"\]\([^\)]*$", "", param_type) + param_type = re.sub(r"\]\([^\)]*\)", "", param_type) + # Clean up the type string + param_type = param_type.replace("|", " or ").strip() + # Remove any trailing/leading brackets and parentheses + param_type = re.sub(r"^[\[\(]+", "", param_type) + param_type = re.sub(r"[\]\)]+$", "", param_type) + # Remove any remaining incomplete patterns + param_type = re.sub(r"\]\(.*$", "", param_type) + # Escape angle brackets for MDX + param_type = param_type.replace("<", "<").replace(">", ">") + # Clean up extra spaces + param_type = re.sub(r"\s+", " ", param_type).strip() + # If type is empty or just brackets, default to Any + if not param_type or param_type in ["[", "]", "()", "(", ")", "]("]: + param_type = "Any" + # Find param description + param_desc_match = re.search( + rf":param\s+{param_name}:\s*([^\n]+)", method_body + ) + param_desc = ( + param_desc_match.group(1).strip() if param_desc_match else "" + ) + # Build ParamField - use path instead of name + # For Python methods, parameters are function arguments + # Use "path" location for most parameters, or "body" if it's clearly a request body + param_location = ( + "body" + if param_name.lower() in ["body", "data", "payload", "request"] + else "path" + ) + param_field = f'", ">") + ) + param_field += f' default="{param_default_clean}"' + param_field += ">" + if param_desc: + param_field += f"\n{param_desc}\n" + param_field += "" + param_fields.append(param_field) + # Build new method format + new_method = f"### `{method_name}`\n\n" + if description: + new_method += f"{description}\n\n" + if param_fields: + new_method += "#### Parameters\n\n" + new_method += "\n\n".join(param_fields) + "\n\n" + if return_type: + # Extract return description + return_desc_match = re.search(r":param\s+Returns?:\s*([^\n]+)", method_body) + return_desc = ( + return_desc_match.group(1).strip() if return_desc_match else "" + ) + # Clean return type - handle markdown links + return_type_clean = re.sub(r"\[([^\]]+)\]\([^\)]+\)", r"\1", return_type) + return_type_clean = re.sub( + r"[a-z_]+\.(md|py)#[^\s]+", "", return_type_clean + ) + return_type_clean = return_type_clean.replace("[", "").replace("]", "") + return_type_clean = return_type_clean.replace("<", "<").replace( + ">", ">" + ) + return_type_clean = re.sub( + r":param\s+\w+:\s*", "", return_type_clean + ).strip() + return_type_clean = re.sub(r"\s+", " ", return_type_clean).strip() + new_method += "#### Returns\n\n" + new_method += f"`{return_type_clean}`" + if return_desc and return_desc != return_type_clean: + new_method += f" - {return_desc}" + new_method += "\n\n" + return new_method + # Convert method signatures to use ParamField components + # Match: ### method_name(params) → ReturnType + def process_all_methods(text): + # Find all method definitions + method_pattern = r"###\s+`?([^\n(]+)`?\s*\(([^)]*)\)(?:\s*→\s*([^\n]+))?" + methods = list(re.finditer(method_pattern, text, re.MULTILINE)) + if not methods: + return text + # Build result by processing each method and replacing its entire section + result_parts = [] + last_pos = 0 + for i, match in enumerate(methods): + # Add content before this method + result_parts.append(text[last_pos : match.start()]) + # Find where this method's body ends (next method or end of content) + method_start = match.start() + if i + 1 < len(methods): + next_method_start = methods[i + 1].start() + else: + next_method_start = len(text) + # Get the full method section to replace + method_section = text[method_start:next_method_start] + # Convert this method + converted = convert_method(match) + # Remove the old method content from the section + result_parts.append(converted) + last_pos = next_method_start + # Add remaining content + result_parts.append(text[last_pos:]) + return "".join(result_parts) + content = process_all_methods(content) + # Clean up any remaining :param lines that weren't converted + content = re.sub(r":param\s+(\w+):\s*([^\n]+)", r"**`\1`** - \2", content) + content = re.sub(r":param\s+Returns?:\s*([^\n]+)", r"**Returns:** \1", content) + # Remove duplicate return descriptions + content = re.sub( + r"(#### Returns\n\n`[^\n]+`[^\n]+\n\n)(\*\*`[^\n]+\*\*[^\n]+\n)+", + r"\1", + content, + ) + # Remove duplicate method descriptions + content = re.sub(r"(### `[^\n]+`\n\n[^\n]+\n\n[^\n]+\n\n)(\1)", r"\1", content) + # Clean up any remaining old format parameter lines after ParamField sections + content = re.sub(r"(\n\n)(\*\*`[^\n]+\*\*[^\n]+\n)+", r"\1", content) + # Remove duplicate "Returns:" text in return sections + content = re.sub( + r"(#### Returns\n\n`[^\n]+`)\s*-\s*\*\*`[^\n]+\*\*\s*-\s*([^\n]+)", + r"\1 - \2", + content, + ) + # Remove duplicate class definitions that appear after the main class header + # Pattern: ### `class xdk.module.ClassName` followed by description and parameters + # Find the main class header (should be ## ClassName) + main_class_match = re.search( + r"##\s+([A-Z][a-zA-Z0-9_]+Client|Client|Paginator|OAuth2PKCEAuth|BaseModel)", + content, + ) + if main_class_match: + # Everything after the main class header should not have duplicate class definitions + before_main = content[: main_class_match.end()] + after_main = content[main_class_match.end() :] + # Remove any class definitions from after_main + after_main = re.sub( + r"###\s+`?class\s+xdk\.[^\n]+\n\n[^\n]+\n\n(?:####\s+Parameters[^\n]+\n\n]+>\s*\s*\n)?", + "", + after_main, + ) + content = before_main + after_main + # Remove duplicate parameter sections (#### Parameters appearing twice in a row) + content = re.sub( + r"(#### Parameters\n\n]+>\s*\s*\n)\1", r"\1", content + ) + return content + + + def convert_method(match): + method_header = match.group(0) + method_name = ( + match.group(1) + .strip() + .replace("*", "") + .replace("`", "") + .replace("\\", "") + .replace("_", "_") + ) + params_str = match.group(2).strip() if match.group(2) else "" + return_type = match.group(3).strip() if match.group(3) else None + # Find method body (until next ### or ####) + method_start = match.start() + next_method = content.find("###", method_start + 1) + if next_method == -1: + method_body = content[method_start:] + else: + method_body = content[method_start:next_method] + # Extract description (text after method header, before :param) + desc_match = re.search( + r"###[^\n]+\n\n([^\n]+(?:\n(?!:param|####|###|####)[^\n]+)*)", + method_body, + re.MULTILINE, + ) + description = desc_match.group(1).strip() if desc_match else "" + # Remove method name from description if it appears + description = re.sub( + r"^" + re.escape(method_name) + r"\s*$", "", description, flags=re.MULTILINE + ).strip() + # Parse parameters and convert to ParamField components + param_fields = [] + if params_str: + # Simple parameter parsing (split by comma, but handle type annotations) + params = [] + current = "" + depth = 0 + for char in params_str: + if char in "[(": + depth += 1 + elif char in "])": + depth -= 1 + elif char == "," and depth == 0: + if current.strip(): + params.append(current.strip()) + current = "" + continue + current += char + if current.strip(): + params.append(current.strip()) + for param in params: + # Parse: name: type = default + # Handle cases like: client: [Client](xdk.md#xdk.Client) + param_match = re.match( + r"(\w+)(?:\s*:\s*([^=]+))?(?:\s*=\s*(.+))?$", param.strip() + ) + if param_match: + param_name = param_match.group(1) + param_type_raw = ( + param_match.group(2).strip() if param_match.group(2) else "Any" + ) + param_default = ( + param_match.group(3).strip() if param_match.group(3) else None + ) + # Clean type - handle markdown links first + # Pattern: [Type](path#anchor) -> extract just "Type" + link_match = re.search(r"\[([^\]]+)\]\(([^\)]+)\)", param_type_raw) + if link_match: + param_type = link_match.group(1) # Use just the link text + else: + # No link, use the raw type but clean it + param_type = param_type_raw + # Remove file references and anchors + param_type = re.sub(r"[a-z_]+\.(md|py)#[^\s]*", "", param_type) + param_type = re.sub(r"#[^\s]*", "", param_type) + # Remove incomplete link patterns like "Client](" + param_type = re.sub(r"\]\([^\)]*$", "", param_type) + param_type = re.sub(r"\]\([^\)]*\)", "", param_type) + # Clean up the type string + param_type = param_type.replace("|", " or ").strip() + # Remove any trailing/leading brackets and parentheses + param_type = re.sub(r"^[\[\(]+", "", param_type) + param_type = re.sub(r"[\]\)]+$", "", param_type) + # Remove any remaining incomplete patterns + param_type = re.sub(r"\]\(.*$", "", param_type) + # Escape angle brackets for MDX + param_type = param_type.replace("<", "<").replace(">", ">") + # Clean up extra spaces + param_type = re.sub(r"\s+", " ", param_type).strip() + # If type is empty or just brackets, default to Any + if not param_type or param_type in ["[", "]", "()", "(", ")", "]("]: + param_type = "Any" + # Find param description + param_desc_match = re.search( + rf":param\s+{param_name}:\s*([^\n]+)", method_body + ) + param_desc = ( + param_desc_match.group(1).strip() if param_desc_match else "" + ) + # Build ParamField - use path instead of name + # For Python methods, parameters are function arguments + # Use "path" location for most parameters, or "body" if it's clearly a request body + param_location = ( + "body" + if param_name.lower() in ["body", "data", "payload", "request"] + else "path" + ) + param_field = f'", ">") + ) + param_field += f' default="{param_default_clean}"' + param_field += ">" + if param_desc: + param_field += f"\n{param_desc}\n" + param_field += "" + param_fields.append(param_field) + # Build new method format + new_method = f"### `{method_name}`\n\n" + if description: + new_method += f"{description}\n\n" + if param_fields: + new_method += "#### Parameters\n\n" + new_method += "\n\n".join(param_fields) + "\n\n" + if return_type: + # Extract return description + return_desc_match = re.search(r":param\s+Returns?:\s*([^\n]+)", method_body) + return_desc = ( + return_desc_match.group(1).strip() if return_desc_match else "" + ) + # Clean return type - handle markdown links + return_type_clean = re.sub(r"\[([^\]]+)\]\([^\)]+\)", r"\1", return_type) + return_type_clean = re.sub( + r"[a-z_]+\.(md|py)#[^\s]+", "", return_type_clean + ) + return_type_clean = return_type_clean.replace("[", "").replace("]", "") + return_type_clean = return_type_clean.replace("<", "<").replace( + ">", ">" + ) + return_type_clean = re.sub( + r":param\s+\w+:\s*", "", return_type_clean + ).strip() + return_type_clean = re.sub(r"\s+", " ", return_type_clean).strip() + new_method += "#### Returns\n\n" + new_method += f"`{return_type_clean}`" + if return_desc and return_desc != return_type_clean: + new_method += f" - {return_desc}" + new_method += "\n\n" + return new_method + + # Convert method signatures to use ParamField components + # Match: ### method_name(params) → ReturnType + + + def process_all_methods(text): + # Find all method definitions + method_pattern = r"###\s+`?([^\n(]+)`?\s*\(([^)]*)\)(?:\s*→\s*([^\n]+))?" + methods = list(re.finditer(method_pattern, text, re.MULTILINE)) + if not methods: + return text + # Build result by processing each method and replacing its entire section + result_parts = [] + last_pos = 0 + for i, match in enumerate(methods): + # Add content before this method + result_parts.append(text[last_pos : match.start()]) + # Find where this method's body ends (next method or end of content) + method_start = match.start() + if i + 1 < len(methods): + next_method_start = methods[i + 1].start() + else: + next_method_start = len(text) + # Get the full method section to replace + method_section = text[method_start:next_method_start] + # Convert this method + converted = convert_method(match) + # Remove the old method content from the section + result_parts.append(converted) + last_pos = next_method_start + # Add remaining content + result_parts.append(text[last_pos:]) + return "".join(result_parts) + + content = process_all_methods(content) + + # Clean up any remaining :param lines that weren't converted + content = re.sub(r":param\s+(\w+):\s*([^\n]+)", r"**`\1`** - \2", content) + content = re.sub(r":param\s+Returns?:\s*([^\n]+)", r"**Returns:** \1", content) + + # Remove duplicate return descriptions + content = re.sub( + r"(#### Returns\n\n`[^\n]+`[^\n]+\n\n)(\*\*`[^\n]+\*\*[^\n]+\n)+", + r"\1", + content, + ) + + # Remove duplicate method descriptions + content = re.sub(r"(### `[^\n]+`\n\n[^\n]+\n\n[^\n]+\n\n)(\1)", r"\1", content) + + # Clean up any remaining old format parameter lines after ParamField sections + content = re.sub(r"(\n\n)(\*\*`[^\n]+\*\*[^\n]+\n)+", r"\1", content) + + # Remove duplicate "Returns:" text in return sections + content = re.sub( + r"(#### Returns\n\n`[^\n]+`)\s*-\s*\*\*`[^\n]+\*\*\s*-\s*([^\n]+)", + r"\1 - \2", + content, + ) + + # Remove duplicate class definitions that appear after the main class header + # Pattern: ### `class xdk.module.ClassName` followed by description and parameters + # Find the main class header (should be ## ClassName) + main_class_match = re.search( + r"##\s+([A-Z][a-zA-Z0-9_]+Client|Client|Paginator|OAuth2PKCEAuth|BaseModel)", + content, + ) + if main_class_match: + # Everything after the main class header should not have duplicate class definitions + before_main = content[: main_class_match.end()] + after_main = content[main_class_match.end() :] + + # Remove any class definitions from after_main + after_main = re.sub( + r"###\s+`?class\s+xdk\.[^\n]+\n\n[^\n]+\n\n(?:####\s+Parameters[^\n]+\n\n]+>\s*\s*\n)?", + "", + after_main, + ) + + content = before_main + after_main + + # Remove duplicate parameter sections (#### Parameters appearing twice in a row) + content = re.sub( + r"(#### Parameters\n\n]+>\s*\s*\n)\1", r"\1", content + ) + + return content + + +def process_markdown_content( + content: str, title: str, current_file_path: str, known_targets: Dict[str, str] +) -> str: + """Process and clean markdown content for Mintlify.""" + # Remove Sphinx-specific elements + content = re.sub(r"\[\[include:.*?\]\]", "", content) + # Fix code block formatting + content = re.sub(r"```python\n", "```python\n", content) + # Remove Sphinx breadcrumbs + content = re.sub( + r"^\[[^\]]+\]\([^\)]+\)\s*/\s*.*\n?", "", content, flags=re.MULTILINE + ) + # Remove auto-generated comments at the beginning + # Pattern: "Auto-generated ..." followed by description paragraphs ending with "Generated automatically - do not edit manually." + content = re.sub( + r"^Auto-generated[^\n]+\n\n[^\n]+\n\n[^\n]+\n\nAll methods[^\n]+\n\nGenerated automatically[^\n]+\n\n", + "", + content, + flags=re.MULTILINE, + ) + # Also remove variations - single line or multiple paragraphs + content = re.sub(r"^Auto-generated[^\n]+\n\n", "", content, flags=re.MULTILINE) + content = re.sub( + r"^This module provides[^\n]+\n\n", "", content, flags=re.MULTILINE + ) + content = re.sub(r"^All methods[^\n]+\n\n", "", content, flags=re.MULTILINE) + content = re.sub( + r"^Generated automatically[^\n]+\n\n", "", content, flags=re.MULTILINE + ) + # Fix method names first - remove escaped underscores (before other processing) + content = fix_method_names(content) + # Reorganize content into proper sections (Constructors, Methods, Properties) + content = reorganize_class_structure(content, current_file_path) + # Clean up class definitions - remove asterisks, format properly + content = clean_class_definitions(content) + # Improve method formatting - convert to better structure with ParamField + content = improve_method_formatting(content) + # Fix internal links to absolute Mintlify paths + def fix_link(match): + text = match.group(1) + raw_link_path = match.group(2) + hash_part = match.group(3) or "" + # Skip absolute URLs + if re.match(r"^(?:https?:|mailto:|tel:)", raw_link_path, re.I): + return match.group(0) + link_path = raw_link_path.replace(".md", "").replace(".rst", "") + current_dir = str(Path(current_file_path).parent) if current_file_path else "" + # Normalize path + if current_dir: + joined = Path(current_dir) / link_path + target_path = str(joined).replace("\\", "/").replace("docs/", "") + else: + target_path = link_path.replace("\\", "/").replace("docs/", "") + # Use known target if available + base_name = Path(target_path).stem + if base_name in known_targets and "/" not in target_path: + target_path = f"{known_targets[base_name]}/{base_name}" + return f"[{text}](/xdks/python/reference/{target_path}{hash_part})" + content = re.sub( + r"\[([^\]]+)\]\(([^)#]+?)(?:\.(?:md|rst))?(#[^)]+)?\)", fix_link, content + ) + # Fix method signatures + content = re.sub(r"### (.*?)\(", r"### `\1`(", content) + # Add proper spacing + content = re.sub(r"\n\n\n+", "\n\n", content) + # Remove first H1 header (frontmatter title will be used) + content = re.sub(r"^\s*#\s+[^\n]+\n+", "", content) + # Escape generic type angle brackets (but preserve component tags) + # Simple approach: escape angle brackets, then fix Badge tags + content = re.sub( + r"\b([A-Z][A-Za-z0-9_]*)<([^>\n]+)>", + lambda m: f"{m.group(1)}<{m.group(2).replace('<', '<').replace('>', '>')}>", + content, + ) + # Fix any escaped Badge tags (they shouldn't have angle brackets anyway) + content = content.replace("</Badge>", "") + content = content.replace("Class</Badge>", "Class") + content = content.replace("BaseModel</Badge>", "BaseModel") + # Remove Table of Contents blocks + content = re.sub( + r"(^##\s+Table of contents\n[\s\S]*?)(?=^##\s+|^#\s+|\Z)", + "", + content, + flags=re.MULTILINE | re.IGNORECASE, + ) + # Fix asterisks around type annotations that break MDX parsing + # Pattern: #### field *: Type* *= value* -> #### field : Type = value + # This handles cases like: model_config *: ClassVar[ConfigDict]* *= {'extra': 'allow', ...}* + # Match: field *: Type* *= value* (where value can contain quotes, commas, etc.) + # Use a more specific pattern that includes the header marker + content = re.sub( + r"(####\s+\w+)\s+\*\s*:\s*([^*]+?)\s*\*\s*\*\s*=\s*([^\n]+?)\s*\*", + r"\1: \2 = \3", + content, + flags=re.MULTILINE, + ) + # Fix asterisks around type annotations without equals (just type) + # Pattern: field *: Type* -> field : Type + content = re.sub( + r"(\w+)\s+\*\s*:\s*([^*\n]+?)\s*\*", r"\1: \2", content, flags=re.MULTILINE + ) + # Fix remaining asterisks around equals signs (standalone) + # Pattern: *= value* -> = value + content = re.sub(r"\*\s*=\s*([^\n]+?)\s*\*", r"= \1", content, flags=re.MULTILINE) + # Fix asterisks around class/function names in headers + # Pattern: ### *class* name -> ### class name + content = re.sub(r"###\s+\*\s*(\w+)\s*\*\s+", r"### \1 ", content) + # Convert property headers with type annotations to Mintlify components + # This must happen AFTER asterisk removal + # Pattern: #### field: Type = value\n\nDescription + # Convert to: Description + def convert_property_header(match): + field_name = match.group(1) + type_and_default = match.group(2).strip() + description = match.group(3).strip() if match.group(3) else "" + # Split type and default value + # Format: ClassVar[ConfigDict] = {'extra': 'allow', ...} + type_match = re.match(r"([^=]+?)(?:\s*=\s*(.+))?$", type_and_default) + if type_match: + type_annotation = type_match.group(1).strip() + default_value = type_match.group(2).strip() if type_match.group(2) else None + else: + type_annotation = type_and_default + default_value = None + # Clean up type annotation - remove ClassVar, brackets, etc. + # ClassVar[ConfigDict] -> ConfigDict + type_clean = re.sub(r"ClassVar\[([^\]]+)\]", r"\1", type_annotation) + # Remove any remaining brackets for display + type_clean = type_clean.replace("[", "").replace("]", "").strip() + # Escape type for MDX + type_clean = type_clean.replace("<", "<").replace(">", ">") + # Build the component + component = f'\n]+)>", + lambda m: f"{m.group(1)}<{m.group(2).replace('<', '<').replace('>', '>')}>", + content, + ) + + # Fix any escaped Badge tags (they shouldn't have angle brackets anyway) + content = content.replace("</Badge>", "") + content = content.replace("Class</Badge>", "Class") + content = content.replace("BaseModel</Badge>", "BaseModel") + + # Remove Table of Contents blocks + content = re.sub( + r"(^##\s+Table of contents\n[\s\S]*?)(?=^##\s+|^#\s+|\Z)", + "", + content, + flags=re.MULTILINE | re.IGNORECASE, + ) + + # Fix asterisks around type annotations that break MDX parsing + # Pattern: #### field *: Type* *= value* -> #### field : Type = value + # This handles cases like: model_config *: ClassVar[ConfigDict]* *= {'extra': 'allow', ...}* + # Match: field *: Type* *= value* (where value can contain quotes, commas, etc.) + # Use a more specific pattern that includes the header marker + content = re.sub( + r"(####\s+\w+)\s+\*\s*:\s*([^*]+?)\s*\*\s*\*\s*=\s*([^\n]+?)\s*\*", + r"\1: \2 = \3", + content, + flags=re.MULTILINE, + ) + + # Fix asterisks around type annotations without equals (just type) + # Pattern: field *: Type* -> field : Type + content = re.sub( + r"(\w+)\s+\*\s*:\s*([^*\n]+?)\s*\*", r"\1: \2", content, flags=re.MULTILINE + ) + + # Fix remaining asterisks around equals signs (standalone) + # Pattern: *= value* -> = value + content = re.sub(r"\*\s*=\s*([^\n]+?)\s*\*", r"= \1", content, flags=re.MULTILINE) + + # Fix asterisks around class/function names in headers + # Pattern: ### *class* name -> ### class name + content = re.sub(r"###\s+\*\s*(\w+)\s*\*\s+", r"### \1 ", content) + + # Convert property headers with type annotations to Mintlify components + # This must happen AFTER asterisk removal + # Pattern: #### field: Type = value\n\nDescription + # Convert to: Description + + + def convert_property_header(match): + field_name = match.group(1) + type_and_default = match.group(2).strip() + description = match.group(3).strip() if match.group(3) else "" + # Split type and default value + # Format: ClassVar[ConfigDict] = {'extra': 'allow', ...} + type_match = re.match(r"([^=]+?)(?:\s*=\s*(.+))?$", type_and_default) + if type_match: + type_annotation = type_match.group(1).strip() + default_value = type_match.group(2).strip() if type_match.group(2) else None + else: + type_annotation = type_and_default + default_value = None + # Clean up type annotation - remove ClassVar, brackets, etc. + # ClassVar[ConfigDict] -> ConfigDict + type_clean = re.sub(r"ClassVar\[([^\]]+)\]", r"\1", type_annotation) + # Remove any remaining brackets for display + type_clean = type_clean.replace("[", "").replace("]", "").strip() + # Escape type for MDX + type_clean = type_clean.replace("<", "<").replace(">", ">") + # Build the component + component = f' str: + """Determine category from file path.""" + if "client" in file_path.lower() and "Client" in file_path: + return "Getting Started" + if "paginator" in file_path.lower(): + return "Core Features" + if "stream" in file_path.lower(): + return "Core Features" + return "API Reference" + + +def process_docs(): + """Main processing function.""" + try: + # First, try to generate documentation + print("📚 Generating documentation...") + try: + import subprocess + result = subprocess.run( + [sys.executable, "scripts/generate-docs-simple.py"], + check=True, + capture_output=True, + text=True, + ) + print(result.stdout) + except subprocess.CalledProcessError as e: + print("⚠️ Sphinx generation failed, using existing docs if available...") + if not Path("docs").exists() or not any(Path("docs").iterdir()): + raise RuntimeError( + "No documentation found and Sphinx generation failed. " + "Please install Sphinx: pip install sphinx myst-parser sphinx-markdown-builder" + ) + print("✅ Using existing documentation files") + # Create output directory + output_dir = Path(MINTLIFY_CONFIG["outputDir"]) + if output_dir.exists(): + shutil.rmtree(output_dir) + output_dir.mkdir(parents=True, exist_ok=True) + # Create subdirectories + (output_dir / "xdks" / "python" / "reference").mkdir( + parents=True, exist_ok=True + ) + print("📝 Processing markdown files...") + # Get all markdown files + docs_dir = Path("docs") + files = list(docs_dir.rglob("*.md")) + # Build map of known targets + known_targets = {} + for f in files: + base = f.stem + parent = f.parent.name + if parent and parent != "docs" and base not in known_targets: + known_targets[base] = parent + processed_files = [] + navigation = { + "Getting Started": [], + "Core Features": [], + "API Reference": [], + "Authentication": [], + "Utilities": [], + } + for file_path in files: + if file_path.name == "README.md": + continue + # Special handling for modules.md - convert to accordion format + if file_path.name == "modules.md": + continue # Will process separately + content = file_path.read_text(encoding="utf-8") + # Extract title + title_match = re.search(r"^#\s+(.+)$", content, re.MULTILINE) + title = title_match.group(1) if title_match else file_path.stem + # Clean title using improved function (pass content for better extraction) + cleaned_title = clean_title(title, str(file_path), content) + category = get_category_from_path(str(file_path)) + processed_content = process_markdown_content( + content, + cleaned_title, + str(file_path.relative_to(docs_dir)), + known_targets, + ) + # Generate frontmatter + frontmatter = generate_frontmatter( + cleaned_title, cleaned_title, str(file_path) + ) + final_content = frontmatter + processed_content + # Determine output path + base_name = file_path.stem + sub_dir = file_path.parent.name if file_path.parent != docs_dir else "" + target_dir = output_dir / "xdks" / "python" / "reference" / sub_dir + target_dir.mkdir(parents=True, exist_ok=True) + output_path = target_dir / f"{base_name}.mdx" + # Write processed file + output_path.write_text(final_content, encoding="utf-8") + processed_files.append( + { + "title": cleaned_title, + "category": category, + "path": str(output_path), + "originalPath": str(file_path), + } + ) + # Add to navigation + if category in navigation: + relative_ref_path = f"{sub_dir}/{base_name}" if sub_dir else base_name + navigation[category].append( + { + "title": cleaned_title, + "url": f"xdks/python/reference/{relative_ref_path}", + } + ) + # Create high-level documentation pages + print("📄 Creating high-level documentation pages...") + # Overview page + overview_content = """--- +title: Python XDK +sidebarTitle: Overview +--- +The Python XDK (X Developer Kit) is our official client library for interacting with the X API v2 using Python. It allows developers to get started with our API quickly and build applications with it. It is generated based on our official [OpenAPI specification](https://api.x.com/2/openapi.json). It abstracts away low-level HTTP details while providing fine-grained control when needed. +## Key Features +- 🔐 **OAuth Support**: Full support for Bearer Token (app-only) auth, OAuth 2.0 with PKCE (user context), and OAuth 1.0. +- 🔄 **Pagination**: Automatically page through large results. The XDK takes care of pagination without requiring you to make multiple API calls using the `next_token`. +- 📡 **Streaming**: Supports real-time data streaming for endpoints like filtered stream that require persistent http connection. +- 🎯 **Comprehensive Coverage**: Supports all X API v2 endpoints including such as search, timelines, filtered-stream and more. +**Version Compatibility**: Python 3.8+. Tested on CPython and PyPy. +**License**: [MIT License](https://github.com/xdevplatform/xdk/blob/main/LICENSE) +""" + (output_dir / "xdks" / "python" / "overview.mdx").write_text(overview_content) + # Install page + install_content = """--- +title: "Install" +sidebarTitle: "Install" +--- +The XDK Python SDK is available directly from the GitHub repository and can be installed via `pip`. +## Prerequisites +- Python 3.8 or higher. +- `pip` and `venv` for virtual environments (recommended). +## Quick Install +Install the XDK from the GitHub subdirectory: +```bash +pip install xdk +``` +This fetches the latest generated version from the `main` branch. +## Development Install +For development or contributing: +1. Clone the repository: + ```bash + git clone https://github.com/xdevplatform/xdk.git + cd xdk/python + ``` +2. Install dependencies in editable mode: + ```bash + pip install -e . + ``` + This installs the SDK and its runtime dependencies. +3. (Optional) Install dev dependencies for testing/linting: + ```bash + pip install -e .[dev] + ``` +## Verification +Test the installation: +```python +import xdk +print(xdk.__version__) # Should print the XDK version +``` +**Note:** Since the XDK is generated using the OpenAPI spec, always check the [X API changelog](https://docs.x.com/changelog) and XDK release notes in the repo for any changes. +""" + (output_dir / "xdks" / "python" / "install.mdx").write_text(install_content) + # Quickstart page + quickstart_content = """--- +title: Quickstart +sidebarTitle: Quickstart +--- +This example showcases how to quickly search for Posts using the XDK using Bearer Token authentication. +## Step 1: Install the SDK +```bash +pip install xdk +``` +## Step 2: Get Your Bearer Token +1. Log in to the [X Developer Portal](https://developer.x.com/en/portal/dashboard). +2. Create or select an app. +3. Under "Keys and Tokens," generate a Bearer Token (app-only auth). +## Step 3: Write and Run Your First Script +Create a file `quickstart.py`: +```python +# Import the client +from xdk import Client +# Replace with your actual Bearer Token +client = Client(bearer_token="YOUR_BEARER_TOKEN_HERE") +# Fetch recent Posts mentioning "api" +response = client.posts.search_recent(query="api", max_results=10) +# Print the first Post's text +if response.data: + print(f"Latest Post: {response.data[0]['text']}") +else: + print("No Posts found.") +``` +Run it: +```bash +python quickstart.py +``` +**Expected Output**: +``` +Latest Post: Exciting updates on XDK Python SDK! +``` +**Troubleshooting**: If you get a 401 error, double-check your Bearer Token. For rate limits (429), wait and retry. +## Next Steps +- Explore [Authentication](/xdks/python/authentication) to understand how to use Bearer Token (app-only) auth, OAuth 2.0 with PKCE (user context), and OAuth 1.0. +- Learn about [Pagination](/xdks/python/pagination) for use-cases where you want large number of results returned without worrying about making multiple API calls. +- Dive into [Streaming](/xdks/python/streaming) to learn how to work with real-time data. +""" + (output_dir / "xdks" / "python" / "quickstart.mdx").write_text( + quickstart_content + ) + # Authentication page + auth_content = """--- +title: Authentication +sidebarTitle: Authentication +--- +The X API requires authentication for all endpoints. The XDK supports three authentication methods: +1. Bearer Token (app-only) +2. OAuth 2.0 with PKCE +3. OAuth 1.0a User Context +- **Bearer Token**: Use this for read-only access for endpoints that support app-auth (e.g., searching Post's, streaming endpoints). +- **OAuth 2.0 PKCE**: Secure authentication for scope-based, user-authorized access (e.g. getting authenticated user's Post non_public metrics) +- **OAuth 1.0a**: Legacy auth for full read/write access, including DMs and media uploads. +**Note**: We recommend developers move away from OAuth 1.0 and use OAuth 2.0 for user-authorized access. +Obtain credentials from the [X Developer Portal](https://developer.x.com/en/portal/dashboard). You'll need an approved developer account and an app with appropriate permissions (e.g., Read + Write). +## Creating a Client +All authentication flows create a `Client` instance: +```python +from xdk import Client +``` +### 1. Bearer Token (App-Only) +For read-only operations without user context. +**Steps**: +1. In the Developer Portal, generate a Bearer Token for your app. +2. Pass it to the `Client`. +**Example**: +```python +client = Client(bearer_token="XXXXX") +``` +**Usage**: +```python +response = client.posts.search_recent(query="python", max_results=10) +print(response.data[0]['text']) # Access first Post +``` +### 2. OAuth 2.0 with PKCE (User Context) +This example shows how to use OAuth 2.0 with Proof Key for Code Exchange (PKCE). Use this for user-specific access (e.g. posting on behalf of a user), uploading media for a user etc.). +**Steps**: +1. In the developer portal, register your app with a redirect URI (e.g., `http://localhost:8080/callback`). +2. Get Client ID (no secret needed for PKCE). +3. Initiate the flow, direct user to auth URL and handle callback. +**Example** (using a web server for callback): +```python +from xdk.auth import OAuth2PKCE +from urllib.parse import urlparse +import webbrowser +# Step 1: Create PKCE instance +auth = OAuth2PKCE( + client_id="your_client_id", + redirect_uri="http://localhost:8080/callback", + scopes=["tweet.read", "users.read", "offline.access"] # Adjust scopes as needed +) +# Step 2: Get authorization URL +auth_url = auth.get_authorization_url() +print(f"Visit this URL to authorize: {auth_url}") +webbrowser.open(auth_url) +# Step 3: Handle callback (in a real app, use a web framework like Flask) +# Assume callback_url = "http://localhost:8080/callback?code=AUTH_CODE_HERE" +callback_url = input("Paste the full callback URL here: ") +parsed = urlparse(callback_url) +code = parsed.query.split("=")[1] +# Step 4: Exchange code for tokens +tokens = auth.fetch_token(authorization_code=code) +access_token = tokens["access_token"] +refresh_token = tokens["refresh_token"] # Store for renewal +# Step 5: Create client +client = Client(oauth2_access_token=access_token) +``` +**Token Refresh** (automatic in SDK for long-lived sessions): +```python +# If access token expires, refresh using stored refresh_token +tokens = auth.refresh_token(refresh_token=refresh_token) +client = Client(oauth2_access_token=tokens["access_token"]) +``` +### 3. OAuth 1.0a User Context +For legacy endpoints that require OAuth 1.0 support. +**Steps**: +1. Generate Consumer Key/Secret and Access Token/Secret via Developer Portal. +2. Pass it when initializing the client. +**Example**: +```python +from xdk.auth import OAuth1User +auth = OAuth1User( + consumer_key="your_consumer_key", + consumer_secret="your_consumer_secret", + access_token="your_access_token", + access_token_secret="your_access_token_secret" +) +client = Client(auth=auth) +``` +**Note**: +- Never hardcode secrets in production; use environment variables or secret managers (e.g., `os.getenv("X_BEARER_TOKEN")`). +- For PKCE, ensure HTTPS for redirect URIs in production. +- The SDK validates tokens and raises `xdk.AuthenticationError` on failures. +""" + (output_dir / "xdks" / "python" / "authentication.mdx").write_text(auth_content) + # Pagination page + pagination_content = """--- +title: Pagination +sidebarTitle: Pagination +--- +The X API uses pagination for endpoints that return multiple pages of results (e.g. timelines, search etc.). Each API call response includes a `meta` object with `result_count`, `previous_token`, and `next_token`. The XDK takes care of making multiple API calls using the `next_token` so developers can just specify how much data they are looking for without having to make multiple calls. +The SDK simplifies this with: +- **Built-in Iterators**: Use generator functions for seamless multi-page fetching. +- **Explicit Token Handling**: For flexible manual control when needed by passing `pagination_token` when needed. +- **Max Results Enforcement**: Respect `max_results` per call (up to API limits, e.g., 100 for search). +## Automatic Pagination (Recommended) +Use the `iterate()` method on paginated responses to fetch all results lazily. +**Example: Paginated Search** +```python +from xdk import Client +client = Client(bearer_token="your_bearer_token") +# Search with automatic pagination +all_posts = [] +for page in client.posts.search_recent( + query="python", + max_results=100, # Per page + tweetfields=["created_at", "author_id"] # Optional expansions +): + all_posts.extend(page.data) + print(f"Fetched {len(page.data)} Posts (total: {len(all_posts)})") +print(f"Total tweets: {len(all_posts)}") +``` +- The iterator handles `next_token` automatically. +- Stops when no `next_token` is present. +- Supports rate limit backoff to avoid 429 errors. +## Manual Pagination +If you require control over the results for some custom logic (e.g. processing page-by-page), you can still use the `next_token` and do the pagination manually as shown below: +```python +response = client.posts.search_recent( + query="xdk python sdk", + max_results=100, + pagination_token=None # First page +) +print(f"First page: {len(response.data)} Posts") +next_token = response.meta.next_token +if next_token: + next_response = client.posts.search_recent( + query="xdk python sdk", + max_results=100, + pagination_token=next_token + ) + print(f"Second page: {len(next_response.data)} Posts") +``` +**Tips**: +- Always specify `max_results` to optimize (default varies by endpoint). +- Monitor `meta.result_count` for debugging. +- For very large queries, consider async iteration to avoid blocking. +""" + (output_dir / "xdks" / "python" / "pagination.mdx").write_text( + pagination_content + ) + # Streaming page + streaming_content = """--- +title: Streaming +sidebarTitle: Streaming +--- +The X API supports real-time data via endpoints like the [Filtered Stream Endpoint](https://docs.x.com/x-api/posts/filtered-stream/introduction), delivering matching Posts as they occur. This requires making a persistent http connection. +## Setup and Basic Streaming +### Synchronous +```python +from xdk import Client +# Initialize client +client = Client(bearer_token="your_bearer_token") +# Stream posts (make sure you have rules set up first) +for post_response in client.stream.posts(): + data = post_response.model_dump() + if 'data' in data and data['data']: + tweet = data['data'] + print(f"Post: {tweet.get('text', '')}") +``` +### Async +```python +import asyncio +from asyncio import Queue +import threading +from xdk import Client +async def stream_posts_async(client: Client): + queue = Queue() + loop = asyncio.get_event_loop() + stop = threading.Event() + def run_stream(): + for post in client.stream.posts(): + if stop.is_set(): + break + asyncio.run_coroutine_threadsafe(queue.put(post), loop) + asyncio.run_coroutine_threadsafe(queue.put(None), loop) + threading.Thread(target=run_stream, daemon=True).start() + while True: + post = await queue.get() + if post is None: + break + data = post.model_dump() + if 'data' in data and data['data']: + print(f"Post: {data['data'].get('text', '')}") + stop.set() +async def main(): + client = Client(bearer_token="your_bearer_token") + await stream_posts_async(client) +asyncio.run(main()) +``` +## Rule Management +Rules define filters on what specific data you are looking for(e.g. keywords, users etc). You can learn more about how to build rules using [this guide](https://docs.x.com/x-api/posts/filtered-stream/integrate/build-a-rule) +**Adding Rules**: +```python +from xdk.stream.models import UpdateRulesRequest +# Add a rule +add_rules = { + "add": [ + {"value": "from:xdevelopers", "tag": "official_updates"} + ] +} +request_body = UpdateRulesRequest(**add_rules) +response = client.stream.update_rules(body=request_body) +``` +**Deleting Rules**: +```python +from xdk.stream.models import UpdateRulesRequest +delete_rules = { + "delete": { + "ids": ["rule_id_1", "rule_id_2"] + } +} +request_body = UpdateRulesRequest(**delete_rules) +response = client.stream.update_rules(body=request_body) +``` +**Listing Rules**: +```python +response = client.stream.get_rules() +# Print rules +for rule in response.data: + print(f"ID: {rule.id}, Value: {rule.value}, Tag: {rule.tag}") +``` +For full rule syntax, see [X Streaming Rules Docs](https://developer.x.com/en/docs/twitter-api/tweets/filtered-stream/integrate/build-a-rule). +## Troubleshooting +- **403 Forbidden**: Invalid auth or insufficient permissions. +- **420 Enhance Your Calm**: Rate limited; wait and retry. +- **No Data**: Check rules with `get_rules()`; ensure matching Posts exist. +For more examples and API reference, see the inline docstrings (e.g., `help(client.tweets.search_recent)`) or the generated stubs in the source. Contribute feedback via the [GitHub repo](https://github.com/xdevplatform/xdk/tree/main/xdk/python). +""" + (output_dir / "xdks" / "python" / "streaming.mdx").write_text(streaming_content) + # Create navigation structure + print("⚙️ Creating navigation structure...") + # Build API Reference groups + ref_root = output_dir / "xdks" / "python" / "reference" + classes_dir = ref_root / "classes" + modules_dir = ref_root / "modules" + def list_files_no_ext(directory): + try: + return [ + f"xdks/python/reference/{directory.name}/{f.stem}" + for f in directory.glob("*.mdx") + ] + except: + return [] + classes_pages = list_files_no_ext(classes_dir) if classes_dir.exists() else [] + modules_pages = list_files_no_ext(modules_dir) if modules_dir.exists() else [] + # Group pages by module prefix + MODULE_PREFIXES = [ + "AccountActivity", + "Activity", + "Communities", + "CommunityNotes", + "Compliance", + "Connections", + "DirectMessages", + "General", + "Lists", + "Media", + "Posts", + "Spaces", + "Stream", + "Trends", + "Usage", + "Users", + "Webhooks", + "Client", + "Paginator", + "OAuth2", + ] + def group_pages(pages, kind): + buckets = {} + for p in pages: + name = Path(p).stem + group = None + for pref in MODULE_PREFIXES: + if name.startswith(pref): + group = pref + break + if not group: + if kind == "classes": + if name.endswith("Client"): + group = "Clients" + elif "Stream" in name: + group = "Streaming" + elif "Paginator" in name: + group = "Pagination" + else: + group = "Core" + else: + group = "Misc" + if group not in buckets: + buckets[group] = [] + buckets[group].append(p) + # Sort pages within groups + for group in buckets: + buckets[group].sort() + return [{"group": k, "pages": v} for k, v in sorted(buckets.items())] + class_groups = group_pages(classes_pages, "classes") + module_groups = group_pages(modules_pages, "modules") + # Process modules.md to create accordion structure + modules_md_path = docs_dir / "modules.md" + if modules_md_path.exists(): + modules_raw = modules_md_path.read_text(encoding="utf-8") + # Extract title + title_match = re.search(r"^#\s+(.+)$", modules_raw, re.MULTILINE) + modules_title = title_match.group(1).strip() if title_match else "Modules" + # Parse the modules structure and convert to accordion + # Instead of parsing modules.md, use the actual reference files we have + # Group by package name from actual files + packages = {} + # Get all reference files + ref_root = output_dir / "xdks" / "python" / "reference" + all_ref_files = [ + f for f in ref_root.glob("*.mdx") if f.stem not in ["modules", "index"] + ] + # Group files by package + for ref_file in all_ref_files: + name = ref_file.stem + # Extract package name + if ".client" in name: + package_name = name.replace("xdk.", "").replace(".client", "") + module_type = "Client" + elif ".models" in name: + package_name = name.replace("xdk.", "").replace(".models", "") + module_type = "Models" + else: + # Other modules like xdk.client, xdk.paginator + parts = name.replace("xdk.", "").split(".") + package_name = parts[0] if parts else "Core" + module_type = parts[-1].capitalize() if len(parts) > 1 else "Core" + # Convert to display name + package_display = " ".join( + word.capitalize() for word in package_name.split("_") + ) + if package_display not in packages: + packages[package_display] = [] + # Add module link + packages[package_display].append( + {"name": module_type, "link": f"xdks/python/reference/{name}"} + ) + # Build accordion content + package_accordions = [] + for package_name, modules in sorted(packages.items()): + if modules: + module_items = "\n".join( + [ + f' - [{m["name"]}](/{m["link"]})' + for m in sorted(modules, key=lambda x: x["name"]) + ] + ) + package_accordions.append( + f' \n{module_items}\n ' + ) + # Build final modules content + if package_accordions: + modules_content = f"""--- +title: "{modules_title}" +sidebarTitle: "{modules_title}" +--- + + +{chr(10).join(package_accordions)} + + +""" + else: + modules_content = f"""--- +title: "{modules_title}" +sidebarTitle: "{modules_title}" +--- + + + + +""" + # Write modules.mdx + (output_dir / "xdks" / "python" / "reference" / "modules.mdx").write_text( + modules_content, encoding="utf-8" + ) + # Get all reference files for navigation + ref_root = output_dir / "xdks" / "python" / "reference" + all_ref_files = [ + f + for f in ref_root.glob("*.mdx") + if f.stem != "modules" and f.stem != "index" + ] + # Separate into clients, models, and other + client_files = [f for f in all_ref_files if f.stem.endswith(".client")] + model_files = [f for f in all_ref_files if f.stem.endswith(".models")] + other_files = [ + f + for f in all_ref_files + if not f.stem.endswith(".client") and not f.stem.endswith(".models") + ] + # Group by package + def group_by_package(files): + buckets = {} + for f in files: + name = f.stem + if ".client" in name: + package = name.replace("xdk.", "").replace(".client", "") + elif ".models" in name: + package = name.replace("xdk.", "").replace(".models", "") + else: + parts = name.replace("xdk.", "").split(".") + package = parts[0] if parts else "Core" + # Convert to display name + package_display = " ".join( + word.capitalize() for word in package.split("_") + ) + if package_display not in buckets: + buckets[package_display] = [] + buckets[package_display].append(f"xdks/python/reference/{f.stem}") + # Sort pages within groups + for group in buckets: + buckets[group].sort() + return [{"group": k, "pages": v} for k, v in sorted(buckets.items())] + client_groups = group_by_package(client_files) + model_groups = group_by_package(model_files) + other_groups = group_by_package(other_files) + # Generate navigation JSON + # Build navigation structure with packages and modules in sidebar + api_ref_pages = ["xdks/python/reference/modules"] + # Add client groups + if client_groups: + api_ref_pages.append({"group": "Clients", "pages": client_groups}) + # Add model groups + if model_groups: + api_ref_pages.append({"group": "Models", "pages": model_groups}) + # Add other groups + if other_groups: + api_ref_pages.append({"group": "Core", "pages": other_groups}) + python_sdk_navigation = { + "tab": "Python SDK", + "hidden": True, + "pages": [ + "xdks/python/overview", + "xdks/python/install", + "xdks/python/quickstart", + "xdks/python/authentication", + "xdks/python/pagination", + "xdks/python/streaming", + {"group": "API Reference", "pages": api_ref_pages}, + ], + } + # Write navigation JSON + nav_json_path = output_dir / "python-sdk-navigation.json" + nav_json_path.write_text(json.dumps(python_sdk_navigation, indent=2)) + print("✅ Python SDK documentation processed successfully!") + print(f"📁 Output directory: {output_dir}/") + print(f"📊 Processed {len(processed_files)} files") + print("\n🚀 Integration steps:") + print("1. Copy the 'xdks/' folder to your existing Mintlify site") + print( + "2. Add the navigation structure from 'python-sdk-navigation.json' to your mintlify.json" + ) + print("3. Push to your main branch to deploy") + except Exception as error: + print(f"❌ Error processing documentation: {error}") + import traceback + traceback.print_exc() + sys.exit(1) + + + def list_files_no_ext(directory): + try: + return [ + f"xdks/python/reference/{directory.name}/{f.stem}" + for f in directory.glob("*.mdx") + ] + except: + return [] + + classes_pages = list_files_no_ext(classes_dir) if classes_dir.exists() else [] + modules_pages = list_files_no_ext(modules_dir) if modules_dir.exists() else [] + + # Group pages by module prefix + MODULE_PREFIXES = [ + "AccountActivity", + "Activity", + "Communities", + "CommunityNotes", + "Compliance", + "Connections", + "DirectMessages", + "General", + "Lists", + "Media", + "Posts", + "Spaces", + "Stream", + "Trends", + "Usage", + "Users", + "Webhooks", + "Client", + "Paginator", + "OAuth2", + ] + + + def group_pages(pages, kind): + buckets = {} + for p in pages: + name = Path(p).stem + group = None + for pref in MODULE_PREFIXES: + if name.startswith(pref): + group = pref + break + if not group: + if kind == "classes": + if name.endswith("Client"): + group = "Clients" + elif "Stream" in name: + group = "Streaming" + elif "Paginator" in name: + group = "Pagination" + else: + group = "Core" + else: + group = "Misc" + if group not in buckets: + buckets[group] = [] + buckets[group].append(p) + # Sort pages within groups + for group in buckets: + buckets[group].sort() + return [{"group": k, "pages": v} for k, v in sorted(buckets.items())] + + class_groups = group_pages(classes_pages, "classes") + module_groups = group_pages(modules_pages, "modules") + + # Process modules.md to create accordion structure + modules_md_path = docs_dir / "modules.md" + if modules_md_path.exists(): + modules_raw = modules_md_path.read_text(encoding="utf-8") + # Extract title + title_match = re.search(r"^#\s+(.+)$", modules_raw, re.MULTILINE) + modules_title = title_match.group(1).strip() if title_match else "Modules" + + # Parse the modules structure and convert to accordion + # Instead of parsing modules.md, use the actual reference files we have + # Group by package name from actual files + packages = {} + + # Get all reference files + ref_root = output_dir / "xdks" / "python" / "reference" + all_ref_files = [ + f for f in ref_root.glob("*.mdx") if f.stem not in ["modules", "index"] + ] + + # Group files by package + for ref_file in all_ref_files: + name = ref_file.stem + # Extract package name + if ".client" in name: + package_name = name.replace("xdk.", "").replace(".client", "") + module_type = "Client" + elif ".models" in name: + package_name = name.replace("xdk.", "").replace(".models", "") + module_type = "Models" + else: + # Other modules like xdk.client, xdk.paginator + parts = name.replace("xdk.", "").split(".") + package_name = parts[0] if parts else "Core" + module_type = parts[-1].capitalize() if len(parts) > 1 else "Core" + + # Convert to display name + package_display = " ".join( + word.capitalize() for word in package_name.split("_") + ) + + if package_display not in packages: + packages[package_display] = [] + + # Add module link + packages[package_display].append( + {"name": module_type, "link": f"xdks/python/reference/{name}"} + ) + + # Build accordion content + package_accordions = [] + for package_name, modules in sorted(packages.items()): + if modules: + module_items = "\n".join( + [ + f' - [{m["name"]}](/{m["link"]})' + for m in sorted(modules, key=lambda x: x["name"]) + ] + ) + package_accordions.append( + f' \n{module_items}\n ' + ) + + # Build final modules content + if package_accordions: + modules_content = f"""--- +title: "{modules_title}" +sidebarTitle: "{modules_title}" +--- + + + + + +{chr(10).join(package_accordions)} + + + + +""" + else: + modules_content = f"""--- +title: "{modules_title}" +sidebarTitle: "{modules_title}" +--- + + + + + + + +""" + + # Write modules.mdx + (output_dir / "xdks" / "python" / "reference" / "modules.mdx").write_text( + modules_content, encoding="utf-8" + ) + + # Get all reference files for navigation + ref_root = output_dir / "xdks" / "python" / "reference" + all_ref_files = [ + f + for f in ref_root.glob("*.mdx") + if f.stem != "modules" and f.stem != "index" + ] + + # Separate into clients, models, and other + client_files = [f for f in all_ref_files if f.stem.endswith(".client")] + model_files = [f for f in all_ref_files if f.stem.endswith(".models")] + other_files = [ + f + for f in all_ref_files + if not f.stem.endswith(".client") and not f.stem.endswith(".models") + ] + + # Group by package + + + def group_by_package(files): + buckets = {} + for f in files: + name = f.stem + if ".client" in name: + package = name.replace("xdk.", "").replace(".client", "") + elif ".models" in name: + package = name.replace("xdk.", "").replace(".models", "") + else: + parts = name.replace("xdk.", "").split(".") + package = parts[0] if parts else "Core" + # Convert to display name + package_display = " ".join( + word.capitalize() for word in package.split("_") + ) + if package_display not in buckets: + buckets[package_display] = [] + buckets[package_display].append(f"xdks/python/reference/{f.stem}") + # Sort pages within groups + for group in buckets: + buckets[group].sort() + return [{"group": k, "pages": v} for k, v in sorted(buckets.items())] + + client_groups = group_by_package(client_files) + model_groups = group_by_package(model_files) + other_groups = group_by_package(other_files) + + # Generate navigation JSON + # Build navigation structure with packages and modules in sidebar + api_ref_pages = ["xdks/python/reference/modules"] + + # Add client groups + if client_groups: + api_ref_pages.append({"group": "Clients", "pages": client_groups}) + + # Add model groups + if model_groups: + api_ref_pages.append({"group": "Models", "pages": model_groups}) + + # Add other groups + if other_groups: + api_ref_pages.append({"group": "Core", "pages": other_groups}) + + python_sdk_navigation = { + "tab": "Python SDK", + "hidden": True, + "pages": [ + "xdks/python/overview", + "xdks/python/install", + "xdks/python/quickstart", + "xdks/python/authentication", + "xdks/python/pagination", + "xdks/python/streaming", + {"group": "API Reference", "pages": api_ref_pages}, + ], + } + + # Write navigation JSON + nav_json_path = output_dir / "python-sdk-navigation.json" + nav_json_path.write_text(json.dumps(python_sdk_navigation, indent=2)) + + print("✅ Python SDK documentation processed successfully!") + print(f"📁 Output directory: {output_dir}/") + print(f"📊 Processed {len(processed_files)} files") + print("\n🚀 Integration steps:") + print("1. Copy the 'xdks/' folder to your existing Mintlify site") + print( + "2. Add the navigation structure from 'python-sdk-navigation.json' to your mintlify.json" + ) + print("3. Push to your main branch to deploy") + + except Exception as error: + print(f"❌ Error processing documentation: {error}") + import traceback + + traceback.print_exc() + sys.exit(1) + + +if __name__ == "__main__": + process_docs() diff --git a/xdk/python/scripts/watch-docs.py b/xdk/python/scripts/watch-docs.py new file mode 100644 index 00000000..f580f03a --- /dev/null +++ b/xdk/python/scripts/watch-docs.py @@ -0,0 +1,125 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +#!/usr/bin/env python3 +""" +AUTO-GENERATED FILE - DO NOT EDIT +This file was automatically generated by the XDK build tool. +Any manual changes will be overwritten on the next generation. + +Watch for changes and regenerate documentation automatically. +""" + +import os +import sys +import time +import subprocess +from pathlib import Path +from watchdog.observers import Observer +from watchdog.events import FileSystemEventHandler + +print("🚀 Starting X API SDK Documentation Watch Server...") + + +class DocsHandler(FileSystemEventHandler): + """Handle file system events for documentation regeneration.""" + + + def __init__(self): + self.last_regeneration = 0 + self.debounce_seconds = 2 + + + def on_modified(self, event): + if event.is_directory: + return + # Only watch Python files + if not event.src_path.endswith(".py"): + return + # Skip if in docs or build directories + if "docs" in event.src_path or "__pycache__" in event.src_path: + return + # Debounce rapid changes + current_time = time.time() + if current_time - self.last_regeneration < self.debounce_seconds: + return + self.last_regeneration = current_time + print(f"📝 File changed: {event.src_path}") + regenerate_docs() + + +def regenerate_docs(): + """Regenerate documentation.""" + print("🔄 Regenerating documentation...") + try: + result = subprocess.run( + [sys.executable, "scripts/generate-docs-simple.py"], + check=True, + capture_output=True, + text=True, + ) + print(result.stdout) + print("✅ Documentation regenerated successfully") + except subprocess.CalledProcessError as e: + print(f"❌ Failed to regenerate documentation: {e}") + print(f"stderr: {e.stderr}") + + +def start_server(): + """Start a simple HTTP server for docs.""" + try: + import http.server + import socketserver + import threading + PORT = 8080 + Handler = http.server.SimpleHTTPRequestHandler + def run_server(): + with socketserver.TCPServer(("", PORT), Handler) as httpd: + print(f"📚 Starting documentation server on http://localhost:{PORT}") + httpd.serve_forever() + server_thread = threading.Thread(target=run_server, daemon=True) + server_thread.start() + return server_thread + except Exception as e: + print(f"⚠️ Could not start HTTP server: {e}") + return None + + + def run_server(): + with socketserver.TCPServer(("", PORT), Handler) as httpd: + print(f"📚 Starting documentation server on http://localhost:{PORT}") + httpd.serve_forever() + + server_thread = threading.Thread(target=run_server, daemon=True) + server_thread.start() + return server_thread + except Exception as e: + print(f"⚠️ Could not start HTTP server: {e}") + return None + + +# Initial documentation generation +regenerate_docs() +server_thread = start_server() + +# Watch for changes +event_handler = DocsHandler() +observer = Observer() + +# Watch xdk directory +xdk_path = Path("xdk") +if xdk_path.exists(): + observer.schedule(event_handler, str(xdk_path), recursive=True) + observer.start() + print("👀 Watching for changes... Press Ctrl+C to stop") + + try: + while True: + time.sleep(1) + except KeyboardInterrupt: + print("\n🛑 Shutting down documentation server...") + observer.stop() + + observer.join() +else: + print("⚠️ xdk directory not found") diff --git a/xdk/python/tests/account_activity/test_contracts.py b/xdk/python/tests/account_activity/test_contracts.py index 6932e06f..4dd1ff11 100644 --- a/xdk/python/tests/account_activity/test_contracts.py +++ b/xdk/python/tests/account_activity/test_contracts.py @@ -27,8 +27,8 @@ def setup_class(self): self.account_activity_client = getattr(self.client, "account_activity") - def test_validate_subscription_request_structure(self): - """Test validate_subscription request structure.""" + def test_delete_subscription_request_structure(self): + """Test delete_subscription request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -37,15 +37,16 @@ def test_validate_subscription_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["webhook_id"] = "test_value" + kwargs["user_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.account_activity_client, "validate_subscription") + method = getattr(self.account_activity_client, "delete_subscription") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -64,7 +65,7 @@ def test_validate_subscription_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -73,16 +74,14 @@ def test_validate_subscription_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = ( - "/2/account_activity/webhooks/{webhook_id}/subscriptions/all" - ) + expected_path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -98,12 +97,12 @@ def test_validate_subscription_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for validate_subscription: {e}") + pytest.fail(f"Contract test failed for delete_subscription: {e}") - def test_validate_subscription_required_parameters(self): - """Test that validate_subscription handles parameters correctly.""" - method = getattr(self.account_activity_client, "validate_subscription") + def test_delete_subscription_required_parameters(self): + """Test that delete_subscription handles parameters correctly.""" + method = getattr(self.account_activity_client, "delete_subscription") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -111,14 +110,14 @@ def test_validate_subscription_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_validate_subscription_response_structure(self): - """Test validate_subscription response structure validation.""" + def test_delete_subscription_response_structure(self): + """Test delete_subscription response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -128,13 +127,14 @@ def test_validate_subscription_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["webhook_id"] = "test" + kwargs["user_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.account_activity_client, "validate_subscription") + method = getattr(self.account_activity_client, "delete_subscription") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -146,8 +146,8 @@ def test_validate_subscription_response_structure(self): ) - def test_create_subscription_request_structure(self): - """Test create_subscription request structure.""" + def test_get_subscription_count_request_structure(self): + """Test get_subscription_count request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -156,19 +156,14 @@ def test_create_subscription_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["webhook_id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.account_activity.models import CreateSubscriptionRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateSubscriptionRequest() # Call the method try: - method = getattr(self.account_activity_client, "create_subscription") + method = getattr(self.account_activity_client, "get_subscription_count") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -187,7 +182,7 @@ def test_create_subscription_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -196,16 +191,14 @@ def test_create_subscription_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = ( - "/2/account_activity/webhooks/{webhook_id}/subscriptions/all" - ) + expected_path = "/2/account_activity/subscriptions/count" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -221,27 +214,27 @@ def test_create_subscription_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create_subscription: {e}") + pytest.fail(f"Contract test failed for get_subscription_count: {e}") - def test_create_subscription_required_parameters(self): - """Test that create_subscription handles parameters correctly.""" - method = getattr(self.account_activity_client, "create_subscription") - # Test with missing required parameters - mock the request to avoid network calls + def test_get_subscription_count_required_parameters(self): + """Test that get_subscription_count handles parameters correctly.""" + method = getattr(self.account_activity_client, "get_subscription_count") + # No required parameters, method should be callable without args with patch.object(self.client, "session") as mock_session: - # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 400 - mock_response.json.return_value = {"error": "Missing required parameters"} - mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response - # Call without required parameters should either raise locally or via server response - with pytest.raises((TypeError, ValueError, Exception)): + mock_response.status_code = 200 + mock_response.json.return_value = {} + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + try: method() + except Exception as e: + pytest.fail(f"Method with no required params should be callable: {e}") - def test_create_subscription_response_structure(self): - """Test create_subscription response structure validation.""" + def test_get_subscription_count_response_structure(self): + """Test get_subscription_count response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -251,17 +244,12 @@ def test_create_subscription_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["webhook_id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.account_activity.models import CreateSubscriptionRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateSubscriptionRequest() # Call method and verify response structure - method = getattr(self.account_activity_client, "create_subscription") + method = getattr(self.account_activity_client, "get_subscription_count") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -273,8 +261,8 @@ def test_create_subscription_response_structure(self): ) - def test_delete_subscription_request_structure(self): - """Test delete_subscription request structure.""" + def test_create_replay_job_request_structure(self): + """Test create_replay_job request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -283,16 +271,17 @@ def test_delete_subscription_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["webhook_id"] = "test_value" - kwargs["user_id"] = "test_value" + kwargs["from_date"] = "test_from_date" + kwargs["to_date"] = "test_to_date" # Add request body if required # Call the method try: - method = getattr(self.account_activity_client, "delete_subscription") + method = getattr(self.account_activity_client, "create_replay_job") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -311,7 +300,7 @@ def test_delete_subscription_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -320,14 +309,16 @@ def test_delete_subscription_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all" + expected_path = ( + "/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all" + ) assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -343,12 +334,12 @@ def test_delete_subscription_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for delete_subscription: {e}") + pytest.fail(f"Contract test failed for create_replay_job: {e}") - def test_delete_subscription_required_parameters(self): - """Test that delete_subscription handles parameters correctly.""" - method = getattr(self.account_activity_client, "delete_subscription") + def test_create_replay_job_required_parameters(self): + """Test that create_replay_job handles parameters correctly.""" + method = getattr(self.account_activity_client, "create_replay_job") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -356,14 +347,14 @@ def test_delete_subscription_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_delete_subscription_response_structure(self): - """Test delete_subscription response structure validation.""" + def test_create_replay_job_response_structure(self): + """Test create_replay_job response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -373,14 +364,15 @@ def test_delete_subscription_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["webhook_id"] = "test" - kwargs["user_id"] = "test" + kwargs["from_date"] = "test_value" + kwargs["to_date"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.account_activity_client, "delete_subscription") + method = getattr(self.account_activity_client, "create_replay_job") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -392,8 +384,8 @@ def test_delete_subscription_response_structure(self): ) - def test_get_subscriptions_request_structure(self): - """Test get_subscriptions request structure.""" + def test_validate_subscription_request_structure(self): + """Test validate_subscription request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -410,7 +402,7 @@ def test_get_subscriptions_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.account_activity_client, "get_subscriptions") + method = getattr(self.account_activity_client, "validate_subscription") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -446,7 +438,7 @@ def test_get_subscriptions_request_structure(self): call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) expected_path = ( - "/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list" + "/2/account_activity/webhooks/{webhook_id}/subscriptions/all" ) assert expected_path.replace("{", "").replace( "}", "" @@ -463,12 +455,12 @@ def test_get_subscriptions_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_subscriptions: {e}") + pytest.fail(f"Contract test failed for validate_subscription: {e}") - def test_get_subscriptions_required_parameters(self): - """Test that get_subscriptions handles parameters correctly.""" - method = getattr(self.account_activity_client, "get_subscriptions") + def test_validate_subscription_required_parameters(self): + """Test that validate_subscription handles parameters correctly.""" + method = getattr(self.account_activity_client, "validate_subscription") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -482,8 +474,8 @@ def test_get_subscriptions_required_parameters(self): method() - def test_get_subscriptions_response_structure(self): - """Test get_subscriptions response structure validation.""" + def test_validate_subscription_response_structure(self): + """Test validate_subscription response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -499,7 +491,7 @@ def test_get_subscriptions_response_structure(self): kwargs["webhook_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.account_activity_client, "get_subscriptions") + method = getattr(self.account_activity_client, "validate_subscription") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -511,8 +503,8 @@ def test_get_subscriptions_response_structure(self): ) - def test_create_replay_job_request_structure(self): - """Test create_replay_job request structure.""" + def test_create_subscription_request_structure(self): + """Test create_subscription request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -526,12 +518,14 @@ def test_create_replay_job_request_structure(self): kwargs = {} # Add required parameters kwargs["webhook_id"] = "test_value" - kwargs["from_date"] = "test_from_date" - kwargs["to_date"] = "test_to_date" # Add request body if required + # Import and create proper request model instance + from xdk.account_activity.models import CreateSubscriptionRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateSubscriptionRequest() # Call the method try: - method = getattr(self.account_activity_client, "create_replay_job") + method = getattr(self.account_activity_client, "create_subscription") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -567,7 +561,7 @@ def test_create_replay_job_request_structure(self): call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) expected_path = ( - "/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all" + "/2/account_activity/webhooks/{webhook_id}/subscriptions/all" ) assert expected_path.replace("{", "").replace( "}", "" @@ -584,12 +578,12 @@ def test_create_replay_job_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create_replay_job: {e}") + pytest.fail(f"Contract test failed for create_subscription: {e}") - def test_create_replay_job_required_parameters(self): - """Test that create_replay_job handles parameters correctly.""" - method = getattr(self.account_activity_client, "create_replay_job") + def test_create_subscription_required_parameters(self): + """Test that create_subscription handles parameters correctly.""" + method = getattr(self.account_activity_client, "create_subscription") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -603,8 +597,8 @@ def test_create_replay_job_required_parameters(self): method() - def test_create_replay_job_response_structure(self): - """Test create_replay_job response structure validation.""" + def test_create_subscription_response_structure(self): + """Test create_subscription response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -618,11 +612,13 @@ def test_create_replay_job_response_structure(self): # Prepare minimal valid parameters kwargs = {} kwargs["webhook_id"] = "test" - kwargs["from_date"] = "test_value" - kwargs["to_date"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.account_activity.models import CreateSubscriptionRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateSubscriptionRequest() # Call method and verify response structure - method = getattr(self.account_activity_client, "create_replay_job") + method = getattr(self.account_activity_client, "create_subscription") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -634,8 +630,8 @@ def test_create_replay_job_response_structure(self): ) - def test_get_subscription_count_request_structure(self): - """Test get_subscription_count request structure.""" + def test_get_subscriptions_request_structure(self): + """Test get_subscriptions request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -648,10 +644,11 @@ def test_get_subscription_count_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters + kwargs["webhook_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.account_activity_client, "get_subscription_count") + method = getattr(self.account_activity_client, "get_subscriptions") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -686,7 +683,9 @@ def test_get_subscription_count_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/account_activity/subscriptions/count" + expected_path = ( + "/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list" + ) assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -702,27 +701,27 @@ def test_get_subscription_count_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_subscription_count: {e}") + pytest.fail(f"Contract test failed for get_subscriptions: {e}") - def test_get_subscription_count_required_parameters(self): - """Test that get_subscription_count handles parameters correctly.""" - method = getattr(self.account_activity_client, "get_subscription_count") - # No required parameters, method should be callable without args + def test_get_subscriptions_required_parameters(self): + """Test that get_subscriptions handles parameters correctly.""" + method = getattr(self.account_activity_client, "get_subscriptions") + # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 200 - mock_response.json.return_value = {} - mock_response.raise_for_status.return_value = None + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") mock_session.get.return_value = mock_response - try: + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): method() - except Exception as e: - pytest.fail(f"Method with no required params should be callable: {e}") - def test_get_subscription_count_response_structure(self): - """Test get_subscription_count response structure validation.""" + def test_get_subscriptions_response_structure(self): + """Test get_subscriptions response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -735,9 +734,10 @@ def test_get_subscription_count_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["webhook_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.account_activity_client, "get_subscription_count") + method = getattr(self.account_activity_client, "get_subscriptions") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/account_activity/test_structure.py b/xdk/python/tests/account_activity/test_structure.py index 4bc5323c..5bcd8215 100644 --- a/xdk/python/tests/account_activity/test_structure.py +++ b/xdk/python/tests/account_activity/test_structure.py @@ -28,33 +28,34 @@ def setup_class(self): self.account_activity_client = getattr(self.client, "account_activity") - def test_validate_subscription_exists(self): - """Test that validate_subscription method exists with correct signature.""" + def test_delete_subscription_exists(self): + """Test that delete_subscription method exists with correct signature.""" # Check method exists - method = getattr(AccountActivityClient, "validate_subscription", None) + method = getattr(AccountActivityClient, "delete_subscription", None) assert ( method is not None - ), f"Method validate_subscription does not exist on AccountActivityClient" + ), f"Method delete_subscription does not exist on AccountActivityClient" # Check method is callable - assert callable(method), f"validate_subscription is not callable" + assert callable(method), f"delete_subscription is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"validate_subscription should have at least 'self' parameter" + ), f"delete_subscription should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "webhook_id", + "user_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from validate_subscription" + ), f"Required parameter '{required_param}' missing from delete_subscription" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -65,43 +66,41 @@ def test_validate_subscription_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_validate_subscription_return_annotation(self): - """Test that validate_subscription has proper return type annotation.""" - method = getattr(AccountActivityClient, "validate_subscription") + def test_delete_subscription_return_annotation(self): + """Test that delete_subscription has proper return type annotation.""" + method = getattr(AccountActivityClient, "delete_subscription") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method validate_subscription should have return type annotation" + ), f"Method delete_subscription should have return type annotation" - def test_create_subscription_exists(self): - """Test that create_subscription method exists with correct signature.""" + def test_get_subscription_count_exists(self): + """Test that get_subscription_count method exists with correct signature.""" # Check method exists - method = getattr(AccountActivityClient, "create_subscription", None) + method = getattr(AccountActivityClient, "get_subscription_count", None) assert ( method is not None - ), f"Method create_subscription does not exist on AccountActivityClient" + ), f"Method get_subscription_count does not exist on AccountActivityClient" # Check method is callable - assert callable(method), f"create_subscription is not callable" + assert callable(method), f"get_subscription_count is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"create_subscription should have at least 'self' parameter" + ), f"get_subscription_count should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "webhook_id", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from create_subscription" + ), f"Required parameter '{required_param}' missing from get_subscription_count" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -112,44 +111,45 @@ def test_create_subscription_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_create_subscription_return_annotation(self): - """Test that create_subscription has proper return type annotation.""" - method = getattr(AccountActivityClient, "create_subscription") + def test_get_subscription_count_return_annotation(self): + """Test that get_subscription_count has proper return type annotation.""" + method = getattr(AccountActivityClient, "get_subscription_count") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method create_subscription should have return type annotation" + ), f"Method get_subscription_count should have return type annotation" - def test_delete_subscription_exists(self): - """Test that delete_subscription method exists with correct signature.""" + def test_create_replay_job_exists(self): + """Test that create_replay_job method exists with correct signature.""" # Check method exists - method = getattr(AccountActivityClient, "delete_subscription", None) + method = getattr(AccountActivityClient, "create_replay_job", None) assert ( method is not None - ), f"Method delete_subscription does not exist on AccountActivityClient" + ), f"Method create_replay_job does not exist on AccountActivityClient" # Check method is callable - assert callable(method), f"delete_subscription is not callable" + assert callable(method), f"create_replay_job is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"delete_subscription should have at least 'self' parameter" + ), f"create_replay_job should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "webhook_id", - "user_id", + "from_date", + "to_date", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from delete_subscription" + ), f"Required parameter '{required_param}' missing from create_replay_job" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -160,32 +160,32 @@ def test_delete_subscription_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_delete_subscription_return_annotation(self): - """Test that delete_subscription has proper return type annotation.""" - method = getattr(AccountActivityClient, "delete_subscription") + def test_create_replay_job_return_annotation(self): + """Test that create_replay_job has proper return type annotation.""" + method = getattr(AccountActivityClient, "create_replay_job") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method delete_subscription should have return type annotation" + ), f"Method create_replay_job should have return type annotation" - def test_get_subscriptions_exists(self): - """Test that get_subscriptions method exists with correct signature.""" + def test_validate_subscription_exists(self): + """Test that validate_subscription method exists with correct signature.""" # Check method exists - method = getattr(AccountActivityClient, "get_subscriptions", None) + method = getattr(AccountActivityClient, "validate_subscription", None) assert ( method is not None - ), f"Method get_subscriptions does not exist on AccountActivityClient" + ), f"Method validate_subscription does not exist on AccountActivityClient" # Check method is callable - assert callable(method), f"get_subscriptions is not callable" + assert callable(method), f"validate_subscription is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_subscriptions should have at least 'self' parameter" + ), f"validate_subscription should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -196,7 +196,7 @@ def test_get_subscriptions_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_subscriptions" + ), f"Required parameter '{required_param}' missing from validate_subscription" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -207,45 +207,43 @@ def test_get_subscriptions_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_subscriptions_return_annotation(self): - """Test that get_subscriptions has proper return type annotation.""" - method = getattr(AccountActivityClient, "get_subscriptions") + def test_validate_subscription_return_annotation(self): + """Test that validate_subscription has proper return type annotation.""" + method = getattr(AccountActivityClient, "validate_subscription") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_subscriptions should have return type annotation" + ), f"Method validate_subscription should have return type annotation" - def test_create_replay_job_exists(self): - """Test that create_replay_job method exists with correct signature.""" + def test_create_subscription_exists(self): + """Test that create_subscription method exists with correct signature.""" # Check method exists - method = getattr(AccountActivityClient, "create_replay_job", None) + method = getattr(AccountActivityClient, "create_subscription", None) assert ( method is not None - ), f"Method create_replay_job does not exist on AccountActivityClient" + ), f"Method create_subscription does not exist on AccountActivityClient" # Check method is callable - assert callable(method), f"create_replay_job is not callable" + assert callable(method), f"create_subscription is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"create_replay_job should have at least 'self' parameter" + ), f"create_subscription should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "webhook_id", - "from_date", - "to_date", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from create_replay_job" + ), f"Required parameter '{required_param}' missing from create_subscription" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -256,41 +254,43 @@ def test_create_replay_job_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_create_replay_job_return_annotation(self): - """Test that create_replay_job has proper return type annotation.""" - method = getattr(AccountActivityClient, "create_replay_job") + def test_create_subscription_return_annotation(self): + """Test that create_subscription has proper return type annotation.""" + method = getattr(AccountActivityClient, "create_subscription") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method create_replay_job should have return type annotation" + ), f"Method create_subscription should have return type annotation" - def test_get_subscription_count_exists(self): - """Test that get_subscription_count method exists with correct signature.""" + def test_get_subscriptions_exists(self): + """Test that get_subscriptions method exists with correct signature.""" # Check method exists - method = getattr(AccountActivityClient, "get_subscription_count", None) + method = getattr(AccountActivityClient, "get_subscriptions", None) assert ( method is not None - ), f"Method get_subscription_count does not exist on AccountActivityClient" + ), f"Method get_subscriptions does not exist on AccountActivityClient" # Check method is callable - assert callable(method), f"get_subscription_count is not callable" + assert callable(method), f"get_subscriptions is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_subscription_count should have at least 'self' parameter" + ), f"get_subscriptions should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "webhook_id", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_subscription_count" + ), f"Required parameter '{required_param}' missing from get_subscriptions" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -301,25 +301,25 @@ def test_get_subscription_count_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_subscription_count_return_annotation(self): - """Test that get_subscription_count has proper return type annotation.""" - method = getattr(AccountActivityClient, "get_subscription_count") + def test_get_subscriptions_return_annotation(self): + """Test that get_subscriptions has proper return type annotation.""" + method = getattr(AccountActivityClient, "get_subscriptions") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_subscription_count should have return type annotation" + ), f"Method get_subscriptions should have return type annotation" def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ + "delete_subscription", + "get_subscription_count", + "create_replay_job", "validate_subscription", "create_subscription", - "delete_subscription", "get_subscriptions", - "create_replay_job", - "get_subscription_count", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/activity/test_contracts.py b/xdk/python/tests/activity/test_contracts.py index 3658ccd6..bfd27472 100644 --- a/xdk/python/tests/activity/test_contracts.py +++ b/xdk/python/tests/activity/test_contracts.py @@ -142,8 +142,8 @@ def test_stream_response_structure(self): ) - def test_get_subscriptions_request_structure(self): - """Test get_subscriptions request structure.""" + def test_update_subscription_request_structure(self): + """Test update_subscription request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -152,14 +152,19 @@ def test_get_subscriptions_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.put.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["subscription_id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.activity.models import UpdateSubscriptionRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = UpdateSubscriptionRequest() # Call the method try: - method = getattr(self.activity_client, "get_subscriptions") + method = getattr(self.activity_client, "update_subscription") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -178,7 +183,7 @@ def test_get_subscriptions_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.put.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -187,14 +192,14 @@ def test_get_subscriptions_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.put.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.put.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/activity/subscriptions" + expected_path = "/2/activity/subscriptions/{subscription_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -210,27 +215,27 @@ def test_get_subscriptions_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_subscriptions: {e}") + pytest.fail(f"Contract test failed for update_subscription: {e}") - def test_get_subscriptions_required_parameters(self): - """Test that get_subscriptions handles parameters correctly.""" - method = getattr(self.activity_client, "get_subscriptions") - # No required parameters, method should be callable without args + def test_update_subscription_required_parameters(self): + """Test that update_subscription handles parameters correctly.""" + method = getattr(self.activity_client, "update_subscription") + # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 200 - mock_response.json.return_value = {} - mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response - try: + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") + mock_session.put.return_value = mock_response + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): method() - except Exception as e: - pytest.fail(f"Method with no required params should be callable: {e}") - def test_get_subscriptions_response_structure(self): - """Test get_subscriptions response structure validation.""" + def test_update_subscription_response_structure(self): + """Test update_subscription response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -240,12 +245,17 @@ def test_get_subscriptions_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.put.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["subscription_id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.activity.models import UpdateSubscriptionRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = UpdateSubscriptionRequest() # Call method and verify response structure - method = getattr(self.activity_client, "get_subscriptions") + method = getattr(self.activity_client, "update_subscription") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -257,8 +267,8 @@ def test_get_subscriptions_response_structure(self): ) - def test_create_subscription_request_structure(self): - """Test create_subscription request structure.""" + def test_delete_subscription_request_structure(self): + """Test delete_subscription request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -267,18 +277,15 @@ def test_create_subscription_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["subscription_id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.activity.models import CreateSubscriptionRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateSubscriptionRequest() # Call the method try: - method = getattr(self.activity_client, "create_subscription") + method = getattr(self.activity_client, "delete_subscription") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -297,7 +304,7 @@ def test_create_subscription_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -306,14 +313,14 @@ def test_create_subscription_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/activity/subscriptions" + expected_path = "/2/activity/subscriptions/{subscription_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -329,12 +336,12 @@ def test_create_subscription_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create_subscription: {e}") + pytest.fail(f"Contract test failed for delete_subscription: {e}") - def test_create_subscription_required_parameters(self): - """Test that create_subscription handles parameters correctly.""" - method = getattr(self.activity_client, "create_subscription") + def test_delete_subscription_required_parameters(self): + """Test that delete_subscription handles parameters correctly.""" + method = getattr(self.activity_client, "delete_subscription") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -342,14 +349,14 @@ def test_create_subscription_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_create_subscription_response_structure(self): - """Test create_subscription response structure validation.""" + def test_delete_subscription_response_structure(self): + """Test delete_subscription response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -359,16 +366,13 @@ def test_create_subscription_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["subscription_id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.activity.models import CreateSubscriptionRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateSubscriptionRequest() # Call method and verify response structure - method = getattr(self.activity_client, "create_subscription") + method = getattr(self.activity_client, "delete_subscription") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -380,8 +384,8 @@ def test_create_subscription_response_structure(self): ) - def test_update_subscription_request_structure(self): - """Test update_subscription request structure.""" + def test_get_subscriptions_request_structure(self): + """Test get_subscriptions request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -390,19 +394,14 @@ def test_update_subscription_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.put.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["subscription_id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.activity.models import UpdateSubscriptionRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = UpdateSubscriptionRequest() # Call the method try: - method = getattr(self.activity_client, "update_subscription") + method = getattr(self.activity_client, "get_subscriptions") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -421,7 +420,7 @@ def test_update_subscription_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.put.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -430,14 +429,14 @@ def test_update_subscription_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.put.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.put.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/activity/subscriptions/{subscription_id}" + expected_path = "/2/activity/subscriptions" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -453,27 +452,27 @@ def test_update_subscription_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for update_subscription: {e}") + pytest.fail(f"Contract test failed for get_subscriptions: {e}") - def test_update_subscription_required_parameters(self): - """Test that update_subscription handles parameters correctly.""" - method = getattr(self.activity_client, "update_subscription") - # Test with missing required parameters - mock the request to avoid network calls + def test_get_subscriptions_required_parameters(self): + """Test that get_subscriptions handles parameters correctly.""" + method = getattr(self.activity_client, "get_subscriptions") + # No required parameters, method should be callable without args with patch.object(self.client, "session") as mock_session: - # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 400 - mock_response.json.return_value = {"error": "Missing required parameters"} - mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.put.return_value = mock_response - # Call without required parameters should either raise locally or via server response - with pytest.raises((TypeError, ValueError, Exception)): + mock_response.status_code = 200 + mock_response.json.return_value = {} + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + try: method() + except Exception as e: + pytest.fail(f"Method with no required params should be callable: {e}") - def test_update_subscription_response_structure(self): - """Test update_subscription response structure validation.""" + def test_get_subscriptions_response_structure(self): + """Test get_subscriptions response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -483,17 +482,12 @@ def test_update_subscription_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.put.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["subscription_id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.activity.models import UpdateSubscriptionRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = UpdateSubscriptionRequest() # Call method and verify response structure - method = getattr(self.activity_client, "update_subscription") + method = getattr(self.activity_client, "get_subscriptions") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -505,8 +499,8 @@ def test_update_subscription_response_structure(self): ) - def test_delete_subscription_request_structure(self): - """Test delete_subscription request structure.""" + def test_create_subscription_request_structure(self): + """Test create_subscription request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -515,15 +509,18 @@ def test_delete_subscription_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["subscription_id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.activity.models import CreateSubscriptionRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateSubscriptionRequest() # Call the method try: - method = getattr(self.activity_client, "delete_subscription") + method = getattr(self.activity_client, "create_subscription") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -542,7 +539,7 @@ def test_delete_subscription_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -551,14 +548,14 @@ def test_delete_subscription_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/activity/subscriptions/{subscription_id}" + expected_path = "/2/activity/subscriptions" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -574,12 +571,12 @@ def test_delete_subscription_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for delete_subscription: {e}") + pytest.fail(f"Contract test failed for create_subscription: {e}") - def test_delete_subscription_required_parameters(self): - """Test that delete_subscription handles parameters correctly.""" - method = getattr(self.activity_client, "delete_subscription") + def test_create_subscription_required_parameters(self): + """Test that create_subscription handles parameters correctly.""" + method = getattr(self.activity_client, "create_subscription") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -587,14 +584,14 @@ def test_delete_subscription_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_delete_subscription_response_structure(self): - """Test delete_subscription response structure validation.""" + def test_create_subscription_response_structure(self): + """Test create_subscription response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -604,13 +601,16 @@ def test_delete_subscription_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["subscription_id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.activity.models import CreateSubscriptionRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateSubscriptionRequest() # Call method and verify response structure - method = getattr(self.activity_client, "delete_subscription") + method = getattr(self.activity_client, "create_subscription") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/activity/test_structure.py b/xdk/python/tests/activity/test_structure.py index 3a8e58f4..d507d30c 100644 --- a/xdk/python/tests/activity/test_structure.py +++ b/xdk/python/tests/activity/test_structure.py @@ -73,31 +73,33 @@ def test_stream_return_annotation(self): ), f"Method stream should have return type annotation" - def test_get_subscriptions_exists(self): - """Test that get_subscriptions method exists with correct signature.""" + def test_update_subscription_exists(self): + """Test that update_subscription method exists with correct signature.""" # Check method exists - method = getattr(ActivityClient, "get_subscriptions", None) + method = getattr(ActivityClient, "update_subscription", None) assert ( method is not None - ), f"Method get_subscriptions does not exist on ActivityClient" + ), f"Method update_subscription does not exist on ActivityClient" # Check method is callable - assert callable(method), f"get_subscriptions is not callable" + assert callable(method), f"update_subscription is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_subscriptions should have at least 'self' parameter" + ), f"update_subscription should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "subscription_id", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_subscriptions" + ), f"Required parameter '{required_param}' missing from update_subscription" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -108,41 +110,43 @@ def test_get_subscriptions_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_subscriptions_return_annotation(self): - """Test that get_subscriptions has proper return type annotation.""" - method = getattr(ActivityClient, "get_subscriptions") + def test_update_subscription_return_annotation(self): + """Test that update_subscription has proper return type annotation.""" + method = getattr(ActivityClient, "update_subscription") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_subscriptions should have return type annotation" + ), f"Method update_subscription should have return type annotation" - def test_create_subscription_exists(self): - """Test that create_subscription method exists with correct signature.""" + def test_delete_subscription_exists(self): + """Test that delete_subscription method exists with correct signature.""" # Check method exists - method = getattr(ActivityClient, "create_subscription", None) + method = getattr(ActivityClient, "delete_subscription", None) assert ( method is not None - ), f"Method create_subscription does not exist on ActivityClient" + ), f"Method delete_subscription does not exist on ActivityClient" # Check method is callable - assert callable(method), f"create_subscription is not callable" + assert callable(method), f"delete_subscription is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"create_subscription should have at least 'self' parameter" + ), f"delete_subscription should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "subscription_id", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from create_subscription" + ), f"Required parameter '{required_param}' missing from delete_subscription" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -153,43 +157,41 @@ def test_create_subscription_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_create_subscription_return_annotation(self): - """Test that create_subscription has proper return type annotation.""" - method = getattr(ActivityClient, "create_subscription") + def test_delete_subscription_return_annotation(self): + """Test that delete_subscription has proper return type annotation.""" + method = getattr(ActivityClient, "delete_subscription") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method create_subscription should have return type annotation" + ), f"Method delete_subscription should have return type annotation" - def test_update_subscription_exists(self): - """Test that update_subscription method exists with correct signature.""" + def test_get_subscriptions_exists(self): + """Test that get_subscriptions method exists with correct signature.""" # Check method exists - method = getattr(ActivityClient, "update_subscription", None) + method = getattr(ActivityClient, "get_subscriptions", None) assert ( method is not None - ), f"Method update_subscription does not exist on ActivityClient" + ), f"Method get_subscriptions does not exist on ActivityClient" # Check method is callable - assert callable(method), f"update_subscription is not callable" + assert callable(method), f"get_subscriptions is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"update_subscription should have at least 'self' parameter" + ), f"get_subscriptions should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "subscription_id", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from update_subscription" + ), f"Required parameter '{required_param}' missing from get_subscriptions" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -200,43 +202,41 @@ def test_update_subscription_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_update_subscription_return_annotation(self): - """Test that update_subscription has proper return type annotation.""" - method = getattr(ActivityClient, "update_subscription") + def test_get_subscriptions_return_annotation(self): + """Test that get_subscriptions has proper return type annotation.""" + method = getattr(ActivityClient, "get_subscriptions") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method update_subscription should have return type annotation" + ), f"Method get_subscriptions should have return type annotation" - def test_delete_subscription_exists(self): - """Test that delete_subscription method exists with correct signature.""" + def test_create_subscription_exists(self): + """Test that create_subscription method exists with correct signature.""" # Check method exists - method = getattr(ActivityClient, "delete_subscription", None) + method = getattr(ActivityClient, "create_subscription", None) assert ( method is not None - ), f"Method delete_subscription does not exist on ActivityClient" + ), f"Method create_subscription does not exist on ActivityClient" # Check method is callable - assert callable(method), f"delete_subscription is not callable" + assert callable(method), f"create_subscription is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"delete_subscription should have at least 'self' parameter" + ), f"create_subscription should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "subscription_id", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from delete_subscription" + ), f"Required parameter '{required_param}' missing from create_subscription" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -247,24 +247,24 @@ def test_delete_subscription_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_delete_subscription_return_annotation(self): - """Test that delete_subscription has proper return type annotation.""" - method = getattr(ActivityClient, "delete_subscription") + def test_create_subscription_return_annotation(self): + """Test that create_subscription has proper return type annotation.""" + method = getattr(ActivityClient, "create_subscription") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method delete_subscription should have return type annotation" + ), f"Method create_subscription should have return type annotation" def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ "stream", - "get_subscriptions", - "create_subscription", "update_subscription", "delete_subscription", + "get_subscriptions", + "create_subscription", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/community_notes/test_contracts.py b/xdk/python/tests/community_notes/test_contracts.py index f0779e21..418e7bd4 100644 --- a/xdk/python/tests/community_notes/test_contracts.py +++ b/xdk/python/tests/community_notes/test_contracts.py @@ -261,8 +261,8 @@ def test_delete_response_structure(self): ) - def test_evaluate_request_structure(self): - """Test evaluate request structure.""" + def test_search_written_request_structure(self): + """Test search_written request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -271,18 +271,15 @@ def test_evaluate_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["test_mode"] = True # Add request body if required - # Import and create proper request model instance - from xdk.community_notes.models import EvaluateRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = EvaluateRequest() # Call the method try: - method = getattr(self.community_notes_client, "evaluate") + method = getattr(self.community_notes_client, "search_written") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -301,7 +298,7 @@ def test_evaluate_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -310,14 +307,14 @@ def test_evaluate_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/evaluate_note" + expected_path = "/2/notes/search/notes_written" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -333,12 +330,12 @@ def test_evaluate_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for evaluate: {e}") + pytest.fail(f"Contract test failed for search_written: {e}") - def test_evaluate_required_parameters(self): - """Test that evaluate handles parameters correctly.""" - method = getattr(self.community_notes_client, "evaluate") + def test_search_written_required_parameters(self): + """Test that search_written handles parameters correctly.""" + method = getattr(self.community_notes_client, "search_written") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -346,14 +343,14 @@ def test_evaluate_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_evaluate_response_structure(self): - """Test evaluate response structure validation.""" + def test_search_written_response_structure(self): + """Test search_written response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -363,16 +360,13 @@ def test_evaluate_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["test_mode"] = True # Add request body if required - # Import and create proper request model instance - from xdk.community_notes.models import EvaluateRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = EvaluateRequest() # Call method and verify response structure - method = getattr(self.community_notes_client, "evaluate") + method = getattr(self.community_notes_client, "search_written") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -507,8 +501,8 @@ def test_create_response_structure(self): ) - def test_search_written_request_structure(self): - """Test search_written request structure.""" + def test_evaluate_request_structure(self): + """Test evaluate request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -517,15 +511,18 @@ def test_search_written_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["test_mode"] = True # Add request body if required + # Import and create proper request model instance + from xdk.community_notes.models import EvaluateRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = EvaluateRequest() # Call the method try: - method = getattr(self.community_notes_client, "search_written") + method = getattr(self.community_notes_client, "evaluate") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -544,7 +541,7 @@ def test_search_written_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -553,14 +550,14 @@ def test_search_written_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/notes/search/notes_written" + expected_path = "/2/evaluate_note" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -576,12 +573,12 @@ def test_search_written_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for search_written: {e}") + pytest.fail(f"Contract test failed for evaluate: {e}") - def test_search_written_required_parameters(self): - """Test that search_written handles parameters correctly.""" - method = getattr(self.community_notes_client, "search_written") + def test_evaluate_required_parameters(self): + """Test that evaluate handles parameters correctly.""" + method = getattr(self.community_notes_client, "evaluate") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -589,14 +586,14 @@ def test_search_written_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_search_written_response_structure(self): - """Test search_written response structure validation.""" + def test_evaluate_response_structure(self): + """Test evaluate response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -606,13 +603,16 @@ def test_search_written_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["test_mode"] = True # Add request body if required + # Import and create proper request model instance + from xdk.community_notes.models import EvaluateRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = EvaluateRequest() # Call method and verify response structure - method = getattr(self.community_notes_client, "search_written") + method = getattr(self.community_notes_client, "evaluate") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/community_notes/test_structure.py b/xdk/python/tests/community_notes/test_structure.py index da78634b..19aae56c 100644 --- a/xdk/python/tests/community_notes/test_structure.py +++ b/xdk/python/tests/community_notes/test_structure.py @@ -59,6 +59,7 @@ def test_search_eligible_posts_exists(self): optional_params = [ "pagination_token", "max_results", + "post_selection", "tweet.fields", "expansions", "media.fields", @@ -148,31 +149,37 @@ def test_delete_return_annotation(self): ), f"Method delete should have return type annotation" - def test_evaluate_exists(self): - """Test that evaluate method exists with correct signature.""" + def test_search_written_exists(self): + """Test that search_written method exists with correct signature.""" # Check method exists - method = getattr(CommunityNotesClient, "evaluate", None) + method = getattr(CommunityNotesClient, "search_written", None) assert ( method is not None - ), f"Method evaluate does not exist on CommunityNotesClient" + ), f"Method search_written does not exist on CommunityNotesClient" # Check method is callable - assert callable(method), f"evaluate is not callable" + assert callable(method), f"search_written is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"evaluate should have at least 'self' parameter" + assert len(params) >= 1, f"search_written should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "test_mode", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from evaluate" + ), f"Required parameter '{required_param}' missing from search_written" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "pagination_token", + "max_results", + "note.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -181,14 +188,33 @@ def test_evaluate_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_evaluate_return_annotation(self): - """Test that evaluate has proper return type annotation.""" - method = getattr(CommunityNotesClient, "evaluate") + def test_search_written_return_annotation(self): + """Test that search_written has proper return type annotation.""" + method = getattr(CommunityNotesClient, "search_written") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method evaluate should have return type annotation" + ), f"Method search_written should have return type annotation" + + + def test_search_written_pagination_params(self): + """Test that search_written has pagination parameters.""" + method = getattr(CommunityNotesClient, "search_written") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method search_written should have pagination parameters" def test_create_exists(self): @@ -234,37 +260,31 @@ def test_create_return_annotation(self): ), f"Method create should have return type annotation" - def test_search_written_exists(self): - """Test that search_written method exists with correct signature.""" + def test_evaluate_exists(self): + """Test that evaluate method exists with correct signature.""" # Check method exists - method = getattr(CommunityNotesClient, "search_written", None) + method = getattr(CommunityNotesClient, "evaluate", None) assert ( method is not None - ), f"Method search_written does not exist on CommunityNotesClient" + ), f"Method evaluate does not exist on CommunityNotesClient" # Check method is callable - assert callable(method), f"search_written is not callable" + assert callable(method), f"evaluate is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"search_written should have at least 'self' parameter" + assert len(params) >= 1, f"evaluate should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "test_mode", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from search_written" + ), f"Required parameter '{required_param}' missing from evaluate" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "pagination_token", - "max_results", - "note.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -273,33 +293,14 @@ def test_search_written_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_search_written_return_annotation(self): - """Test that search_written has proper return type annotation.""" - method = getattr(CommunityNotesClient, "search_written") + def test_evaluate_return_annotation(self): + """Test that evaluate has proper return type annotation.""" + method = getattr(CommunityNotesClient, "evaluate") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method search_written should have return type annotation" - - - def test_search_written_pagination_params(self): - """Test that search_written has pagination parameters.""" - method = getattr(CommunityNotesClient, "search_written") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method search_written should have pagination parameters" + ), f"Method evaluate should have return type annotation" def test_all_expected_methods_exist(self): @@ -307,9 +308,9 @@ def test_all_expected_methods_exist(self): expected_methods = [ "search_eligible_posts", "delete", - "evaluate", - "create", "search_written", + "create", + "evaluate", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/direct_messages/test_contracts.py b/xdk/python/tests/direct_messages/test_contracts.py index 6266dbd9..b99b113e 100644 --- a/xdk/python/tests/direct_messages/test_contracts.py +++ b/xdk/python/tests/direct_messages/test_contracts.py @@ -27,8 +27,8 @@ def setup_class(self): self.direct_messages_client = getattr(self.client, "direct_messages") - def test_get_events_by_participant_id_request_structure(self): - """Test get_events_by_participant_id request structure.""" + def test_get_events_by_conversation_id_request_structure(self): + """Test get_events_by_conversation_id request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -41,12 +41,12 @@ def test_get_events_by_participant_id_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["participant_id"] = "test_value" + kwargs["id"] = "test_value" # Add request body if required # Call the method try: method = getattr( - self.direct_messages_client, "get_events_by_participant_id" + self.direct_messages_client, "get_events_by_conversation_id" ) result = method(**kwargs) # Check if this is a streaming operation (returns Generator) @@ -82,7 +82,7 @@ def test_get_events_by_participant_id_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/dm_conversations/with/{participant_id}/dm_events" + expected_path = "/2/dm_conversations/{id}/dm_events" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -99,13 +99,13 @@ def test_get_events_by_participant_id_request_structure(self): assert result is not None, "Method should return a result" except Exception as e: pytest.fail( - f"Contract test failed for get_events_by_participant_id: {e}" + f"Contract test failed for get_events_by_conversation_id: {e}" ) - def test_get_events_by_participant_id_required_parameters(self): - """Test that get_events_by_participant_id handles parameters correctly.""" - method = getattr(self.direct_messages_client, "get_events_by_participant_id") + def test_get_events_by_conversation_id_required_parameters(self): + """Test that get_events_by_conversation_id handles parameters correctly.""" + method = getattr(self.direct_messages_client, "get_events_by_conversation_id") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -119,8 +119,8 @@ def test_get_events_by_participant_id_required_parameters(self): method() - def test_get_events_by_participant_id_response_structure(self): - """Test get_events_by_participant_id response structure validation.""" + def test_get_events_by_conversation_id_response_structure(self): + """Test get_events_by_conversation_id response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -133,11 +133,11 @@ def test_get_events_by_participant_id_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["participant_id"] = "test" + kwargs["id"] = "test" # Add request body if required # Call method and verify response structure method = getattr( - self.direct_messages_client, "get_events_by_participant_id" + self.direct_messages_client, "get_events_by_conversation_id" ) result = method(**kwargs) # Verify response object has expected attributes @@ -150,12 +150,12 @@ def test_get_events_by_participant_id_response_structure(self): ) - def test_create_by_conversation_id_request_structure(self): - """Test create_by_conversation_id request structure.""" + def test_create_conversation_request_structure(self): + """Test create_conversation request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() - mock_response.status_code = 200 + mock_response.status_code = 201 mock_response.json.return_value = { "data": None, } @@ -164,17 +164,14 @@ def test_create_by_conversation_id_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["dm_conversation_id"] = "test_dm_conversation_id" # Add request body if required # Import and create proper request model instance - from xdk.direct_messages.models import CreateByConversationIdRequest + from xdk.direct_messages.models import CreateConversationRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateByConversationIdRequest() + kwargs["body"] = CreateConversationRequest() # Call the method try: - method = getattr( - self.direct_messages_client, "create_by_conversation_id" - ) + method = getattr(self.direct_messages_client, "create_conversation") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -183,7 +180,7 @@ def test_create_by_conversation_id_request_structure(self): # For streaming operations, we need to set up the mock to handle streaming # Mock the streaming response mock_streaming_response = Mock() - mock_streaming_response.status_code = 200 + mock_streaming_response.status_code = 201 mock_streaming_response.raise_for_status.return_value = None mock_streaming_response.__enter__ = Mock( return_value=mock_streaming_response @@ -209,7 +206,7 @@ def test_create_by_conversation_id_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/dm_conversations/{dm_conversation_id}/messages" + expected_path = "/2/dm_conversations" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -225,12 +222,12 @@ def test_create_by_conversation_id_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create_by_conversation_id: {e}") + pytest.fail(f"Contract test failed for create_conversation: {e}") - def test_create_by_conversation_id_required_parameters(self): - """Test that create_by_conversation_id handles parameters correctly.""" - method = getattr(self.direct_messages_client, "create_by_conversation_id") + def test_create_conversation_required_parameters(self): + """Test that create_conversation handles parameters correctly.""" + method = getattr(self.direct_messages_client, "create_conversation") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -244,28 +241,27 @@ def test_create_by_conversation_id_required_parameters(self): method() - def test_create_by_conversation_id_response_structure(self): - """Test create_by_conversation_id response structure validation.""" + def test_create_conversation_response_structure(self): + """Test create_conversation response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { "data": None, } mock_response = Mock() - mock_response.status_code = 200 + mock_response.status_code = 201 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["dm_conversation_id"] = "test_value" # Add request body if required # Import and create proper request model instance - from xdk.direct_messages.models import CreateByConversationIdRequest + from xdk.direct_messages.models import CreateConversationRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateByConversationIdRequest() + kwargs["body"] = CreateConversationRequest() # Call method and verify response structure - method = getattr(self.direct_messages_client, "create_by_conversation_id") + method = getattr(self.direct_messages_client, "create_conversation") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -277,8 +273,8 @@ def test_create_by_conversation_id_response_structure(self): ) - def test_get_events_by_conversation_id_request_structure(self): - """Test get_events_by_conversation_id request structure.""" + def test_create_by_conversation_id_request_structure(self): + """Test create_by_conversation_id request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -287,16 +283,20 @@ def test_get_events_by_conversation_id_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["dm_conversation_id"] = "test_dm_conversation_id" # Add request body if required + # Import and create proper request model instance + from xdk.direct_messages.models import CreateByConversationIdRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateByConversationIdRequest() # Call the method try: method = getattr( - self.direct_messages_client, "get_events_by_conversation_id" + self.direct_messages_client, "create_by_conversation_id" ) result = method(**kwargs) # Check if this is a streaming operation (returns Generator) @@ -316,7 +316,7 @@ def test_get_events_by_conversation_id_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -325,14 +325,14 @@ def test_get_events_by_conversation_id_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/dm_conversations/{id}/dm_events" + expected_path = "/2/dm_conversations/{dm_conversation_id}/messages" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -348,14 +348,12 @@ def test_get_events_by_conversation_id_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail( - f"Contract test failed for get_events_by_conversation_id: {e}" - ) + pytest.fail(f"Contract test failed for create_by_conversation_id: {e}") - def test_get_events_by_conversation_id_required_parameters(self): - """Test that get_events_by_conversation_id handles parameters correctly.""" - method = getattr(self.direct_messages_client, "get_events_by_conversation_id") + def test_create_by_conversation_id_required_parameters(self): + """Test that create_by_conversation_id handles parameters correctly.""" + method = getattr(self.direct_messages_client, "create_by_conversation_id") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -363,14 +361,14 @@ def test_get_events_by_conversation_id_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_events_by_conversation_id_response_structure(self): - """Test get_events_by_conversation_id response structure validation.""" + def test_create_by_conversation_id_response_structure(self): + """Test create_by_conversation_id response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -380,15 +378,17 @@ def test_get_events_by_conversation_id_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["dm_conversation_id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.direct_messages.models import CreateByConversationIdRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateByConversationIdRequest() # Call method and verify response structure - method = getattr( - self.direct_messages_client, "get_events_by_conversation_id" - ) + method = getattr(self.direct_messages_client, "create_by_conversation_id") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -400,28 +400,27 @@ def test_get_events_by_conversation_id_response_structure(self): ) - def test_create_conversation_request_structure(self): - """Test create_conversation request structure.""" + def test_get_events_by_participant_id_request_structure(self): + """Test get_events_by_participant_id request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() - mock_response.status_code = 201 + mock_response.status_code = 200 mock_response.json.return_value = { "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["participant_id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.direct_messages.models import CreateConversationRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateConversationRequest() # Call the method try: - method = getattr(self.direct_messages_client, "create_conversation") + method = getattr( + self.direct_messages_client, "get_events_by_participant_id" + ) result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -430,7 +429,7 @@ def test_create_conversation_request_structure(self): # For streaming operations, we need to set up the mock to handle streaming # Mock the streaming response mock_streaming_response = Mock() - mock_streaming_response.status_code = 201 + mock_streaming_response.status_code = 200 mock_streaming_response.raise_for_status.return_value = None mock_streaming_response.__enter__ = Mock( return_value=mock_streaming_response @@ -440,7 +439,7 @@ def test_create_conversation_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -449,14 +448,14 @@ def test_create_conversation_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/dm_conversations" + expected_path = "/2/dm_conversations/with/{participant_id}/dm_events" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -472,12 +471,14 @@ def test_create_conversation_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create_conversation: {e}") + pytest.fail( + f"Contract test failed for get_events_by_participant_id: {e}" + ) - def test_create_conversation_required_parameters(self): - """Test that create_conversation handles parameters correctly.""" - method = getattr(self.direct_messages_client, "create_conversation") + def test_get_events_by_participant_id_required_parameters(self): + """Test that get_events_by_participant_id handles parameters correctly.""" + method = getattr(self.direct_messages_client, "get_events_by_participant_id") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -485,33 +486,32 @@ def test_create_conversation_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_create_conversation_response_structure(self): - """Test create_conversation response structure validation.""" + def test_get_events_by_participant_id_response_structure(self): + """Test get_events_by_participant_id response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { "data": None, } mock_response = Mock() - mock_response.status_code = 201 + mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["participant_id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.direct_messages.models import CreateConversationRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateConversationRequest() # Call method and verify response structure - method = getattr(self.direct_messages_client, "create_conversation") + method = getattr( + self.direct_messages_client, "get_events_by_participant_id" + ) result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/direct_messages/test_pagination.py b/xdk/python/tests/direct_messages/test_pagination.py index f3567201..30c5f2e6 100644 --- a/xdk/python/tests/direct_messages/test_pagination.py +++ b/xdk/python/tests/direct_messages/test_pagination.py @@ -27,9 +27,9 @@ def setup_class(self): self.direct_messages_client = getattr(self.client, "direct_messages") - def test_get_events_by_participant_id_cursor_creation(self): - """Test that get_events_by_participant_id can be used with Cursor.""" - method = getattr(self.direct_messages_client, "get_events_by_participant_id") + def test_get_events_by_conversation_id_cursor_creation(self): + """Test that get_events_by_conversation_id can be used with Cursor.""" + method = getattr(self.direct_messages_client, "get_events_by_conversation_id") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) @@ -37,12 +37,12 @@ def test_get_events_by_participant_id_cursor_creation(self): assert isinstance(test_cursor, Cursor) except PaginationError: pytest.fail( - f"Method get_events_by_participant_id should support pagination" + f"Method get_events_by_conversation_id should support pagination" ) - def test_get_events_by_participant_id_cursor_pages(self): - """Test pagination with pages() for get_events_by_participant_id.""" + def test_get_events_by_conversation_id_cursor_pages(self): + """Test pagination with pages() for get_events_by_conversation_id.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -64,7 +64,7 @@ def test_get_events_by_participant_id_cursor_pages(self): mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination method = getattr( - self.direct_messages_client, "get_events_by_participant_id" + self.direct_messages_client, "get_events_by_conversation_id" ) test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages @@ -81,8 +81,8 @@ def test_get_events_by_participant_id_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_events_by_participant_id_cursor_items(self): - """Test pagination with items() for get_events_by_participant_id.""" + def test_get_events_by_conversation_id_cursor_items(self): + """Test pagination with items() for get_events_by_conversation_id.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -102,7 +102,7 @@ def test_get_events_by_participant_id_cursor_items(self): mock_session.get.return_value = mock_response # Test item iteration method = getattr( - self.direct_messages_client, "get_events_by_participant_id" + self.direct_messages_client, "get_events_by_conversation_id" ) test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items @@ -114,8 +114,8 @@ def test_get_events_by_participant_id_cursor_items(self): ), "Items should have 'id' field" - def test_get_events_by_participant_id_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_events_by_participant_id.""" + def test_get_events_by_conversation_id_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_events_by_conversation_id.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 @@ -123,7 +123,7 @@ def test_get_events_by_participant_id_pagination_parameters(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response method = getattr( - self.direct_messages_client, "get_events_by_participant_id" + self.direct_messages_client, "get_events_by_conversation_id" ) # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) @@ -177,9 +177,9 @@ def test_get_events_by_participant_id_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_events_by_conversation_id_cursor_creation(self): - """Test that get_events_by_conversation_id can be used with Cursor.""" - method = getattr(self.direct_messages_client, "get_events_by_conversation_id") + def test_get_events_by_participant_id_cursor_creation(self): + """Test that get_events_by_participant_id can be used with Cursor.""" + method = getattr(self.direct_messages_client, "get_events_by_participant_id") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) @@ -187,12 +187,12 @@ def test_get_events_by_conversation_id_cursor_creation(self): assert isinstance(test_cursor, Cursor) except PaginationError: pytest.fail( - f"Method get_events_by_conversation_id should support pagination" + f"Method get_events_by_participant_id should support pagination" ) - def test_get_events_by_conversation_id_cursor_pages(self): - """Test pagination with pages() for get_events_by_conversation_id.""" + def test_get_events_by_participant_id_cursor_pages(self): + """Test pagination with pages() for get_events_by_participant_id.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -214,7 +214,7 @@ def test_get_events_by_conversation_id_cursor_pages(self): mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination method = getattr( - self.direct_messages_client, "get_events_by_conversation_id" + self.direct_messages_client, "get_events_by_participant_id" ) test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages @@ -231,8 +231,8 @@ def test_get_events_by_conversation_id_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_events_by_conversation_id_cursor_items(self): - """Test pagination with items() for get_events_by_conversation_id.""" + def test_get_events_by_participant_id_cursor_items(self): + """Test pagination with items() for get_events_by_participant_id.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -252,7 +252,7 @@ def test_get_events_by_conversation_id_cursor_items(self): mock_session.get.return_value = mock_response # Test item iteration method = getattr( - self.direct_messages_client, "get_events_by_conversation_id" + self.direct_messages_client, "get_events_by_participant_id" ) test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items @@ -264,8 +264,8 @@ def test_get_events_by_conversation_id_cursor_items(self): ), "Items should have 'id' field" - def test_get_events_by_conversation_id_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_events_by_conversation_id.""" + def test_get_events_by_participant_id_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_events_by_participant_id.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 @@ -273,7 +273,7 @@ def test_get_events_by_conversation_id_pagination_parameters(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response method = getattr( - self.direct_messages_client, "get_events_by_conversation_id" + self.direct_messages_client, "get_events_by_participant_id" ) # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) @@ -480,7 +480,7 @@ def test_pagination_edge_cases(self): mock_session.get.return_value = empty_response # Pick first paginatable method for testing method = getattr( - self.direct_messages_client, "get_events_by_participant_id" + self.direct_messages_client, "get_events_by_conversation_id" ) test_cursor = cursor(method, "test_value", max_results=10) # Should handle empty responses gracefully diff --git a/xdk/python/tests/direct_messages/test_structure.py b/xdk/python/tests/direct_messages/test_structure.py index 92c3ccb9..2122862f 100644 --- a/xdk/python/tests/direct_messages/test_structure.py +++ b/xdk/python/tests/direct_messages/test_structure.py @@ -28,33 +28,33 @@ def setup_class(self): self.direct_messages_client = getattr(self.client, "direct_messages") - def test_get_events_by_participant_id_exists(self): - """Test that get_events_by_participant_id method exists with correct signature.""" + def test_get_events_by_conversation_id_exists(self): + """Test that get_events_by_conversation_id method exists with correct signature.""" # Check method exists - method = getattr(DirectMessagesClient, "get_events_by_participant_id", None) + method = getattr(DirectMessagesClient, "get_events_by_conversation_id", None) assert ( method is not None - ), f"Method get_events_by_participant_id does not exist on DirectMessagesClient" + ), f"Method get_events_by_conversation_id does not exist on DirectMessagesClient" # Check method is callable - assert callable(method), f"get_events_by_participant_id is not callable" + assert callable(method), f"get_events_by_conversation_id is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_events_by_participant_id should have at least 'self' parameter" + ), f"get_events_by_conversation_id should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "participant_id", + "id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_events_by_participant_id" + ), f"Required parameter '{required_param}' missing from get_events_by_conversation_id" # Check optional parameters have defaults (excluding 'self') optional_params = [ "max_results", @@ -74,19 +74,19 @@ def test_get_events_by_participant_id_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_events_by_participant_id_return_annotation(self): - """Test that get_events_by_participant_id has proper return type annotation.""" - method = getattr(DirectMessagesClient, "get_events_by_participant_id") + def test_get_events_by_conversation_id_return_annotation(self): + """Test that get_events_by_conversation_id has proper return type annotation.""" + method = getattr(DirectMessagesClient, "get_events_by_conversation_id") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_events_by_participant_id should have return type annotation" + ), f"Method get_events_by_conversation_id should have return type annotation" - def test_get_events_by_participant_id_pagination_params(self): - """Test that get_events_by_participant_id has pagination parameters.""" - method = getattr(DirectMessagesClient, "get_events_by_participant_id") + def test_get_events_by_conversation_id_pagination_params(self): + """Test that get_events_by_conversation_id has pagination parameters.""" + method = getattr(DirectMessagesClient, "get_events_by_conversation_id") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -100,7 +100,52 @@ def test_get_events_by_participant_id_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method get_events_by_participant_id should have pagination parameters" + ), f"Paginated method get_events_by_conversation_id should have pagination parameters" + + + def test_create_conversation_exists(self): + """Test that create_conversation method exists with correct signature.""" + # Check method exists + method = getattr(DirectMessagesClient, "create_conversation", None) + assert ( + method is not None + ), f"Method create_conversation does not exist on DirectMessagesClient" + # Check method is callable + assert callable(method), f"create_conversation is not callable" + # Check method signature + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have 'self' as first parameter + assert ( + len(params) >= 1 + ), f"create_conversation should have at least 'self' parameter" + assert ( + params[0] == "self" + ), f"First parameter should be 'self', got '{params[0]}'" + # Check required parameters exist (excluding 'self') + required_params = [] + for required_param in required_params: + assert ( + required_param in params + ), f"Required parameter '{required_param}' missing from create_conversation" + # Check optional parameters have defaults (excluding 'self') + optional_params = [] + for optional_param in optional_params: + if optional_param in params: + param_obj = sig.parameters[optional_param] + assert ( + param_obj.default is not inspect.Parameter.empty + ), f"Optional parameter '{optional_param}' should have a default value" + + + def test_create_conversation_return_annotation(self): + """Test that create_conversation has proper return type annotation.""" + method = getattr(DirectMessagesClient, "create_conversation") + sig = inspect.signature(method) + # Check return annotation exists + assert ( + sig.return_annotation is not inspect.Signature.empty + ), f"Method create_conversation should have return type annotation" def test_create_by_conversation_id_exists(self): @@ -150,33 +195,33 @@ def test_create_by_conversation_id_return_annotation(self): ), f"Method create_by_conversation_id should have return type annotation" - def test_get_events_by_conversation_id_exists(self): - """Test that get_events_by_conversation_id method exists with correct signature.""" + def test_get_events_by_participant_id_exists(self): + """Test that get_events_by_participant_id method exists with correct signature.""" # Check method exists - method = getattr(DirectMessagesClient, "get_events_by_conversation_id", None) + method = getattr(DirectMessagesClient, "get_events_by_participant_id", None) assert ( method is not None - ), f"Method get_events_by_conversation_id does not exist on DirectMessagesClient" + ), f"Method get_events_by_participant_id does not exist on DirectMessagesClient" # Check method is callable - assert callable(method), f"get_events_by_conversation_id is not callable" + assert callable(method), f"get_events_by_participant_id is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_events_by_conversation_id should have at least 'self' parameter" + ), f"get_events_by_participant_id should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "participant_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_events_by_conversation_id" + ), f"Required parameter '{required_param}' missing from get_events_by_participant_id" # Check optional parameters have defaults (excluding 'self') optional_params = [ "max_results", @@ -196,19 +241,19 @@ def test_get_events_by_conversation_id_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_events_by_conversation_id_return_annotation(self): - """Test that get_events_by_conversation_id has proper return type annotation.""" - method = getattr(DirectMessagesClient, "get_events_by_conversation_id") + def test_get_events_by_participant_id_return_annotation(self): + """Test that get_events_by_participant_id has proper return type annotation.""" + method = getattr(DirectMessagesClient, "get_events_by_participant_id") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_events_by_conversation_id should have return type annotation" + ), f"Method get_events_by_participant_id should have return type annotation" - def test_get_events_by_conversation_id_pagination_params(self): - """Test that get_events_by_conversation_id has pagination parameters.""" - method = getattr(DirectMessagesClient, "get_events_by_conversation_id") + def test_get_events_by_participant_id_pagination_params(self): + """Test that get_events_by_participant_id has pagination parameters.""" + method = getattr(DirectMessagesClient, "get_events_by_participant_id") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -222,52 +267,7 @@ def test_get_events_by_conversation_id_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method get_events_by_conversation_id should have pagination parameters" - - - def test_create_conversation_exists(self): - """Test that create_conversation method exists with correct signature.""" - # Check method exists - method = getattr(DirectMessagesClient, "create_conversation", None) - assert ( - method is not None - ), f"Method create_conversation does not exist on DirectMessagesClient" - # Check method is callable - assert callable(method), f"create_conversation is not callable" - # Check method signature - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"create_conversation should have at least 'self' parameter" - assert ( - params[0] == "self" - ), f"First parameter should be 'self', got '{params[0]}'" - # Check required parameters exist (excluding 'self') - required_params = [] - for required_param in required_params: - assert ( - required_param in params - ), f"Required parameter '{required_param}' missing from create_conversation" - # Check optional parameters have defaults (excluding 'self') - optional_params = [] - for optional_param in optional_params: - if optional_param in params: - param_obj = sig.parameters[optional_param] - assert ( - param_obj.default is not inspect.Parameter.empty - ), f"Optional parameter '{optional_param}' should have a default value" - - - def test_create_conversation_return_annotation(self): - """Test that create_conversation has proper return type annotation.""" - method = getattr(DirectMessagesClient, "create_conversation") - sig = inspect.signature(method) - # Check return annotation exists - assert ( - sig.return_annotation is not inspect.Signature.empty - ), f"Method create_conversation should have return type annotation" + ), f"Paginated method get_events_by_participant_id should have pagination parameters" def test_get_events_exists(self): @@ -489,10 +489,10 @@ def test_delete_events_return_annotation(self): def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ - "get_events_by_participant_id", - "create_by_conversation_id", "get_events_by_conversation_id", "create_conversation", + "create_by_conversation_id", + "get_events_by_participant_id", "get_events", "create_by_participant_id", "get_events_by_id", diff --git a/xdk/python/tests/lists/test_contracts.py b/xdk/python/tests/lists/test_contracts.py index 6bdacf2f..8a091c17 100644 --- a/xdk/python/tests/lists/test_contracts.py +++ b/xdk/python/tests/lists/test_contracts.py @@ -27,8 +27,8 @@ def setup_class(self): self.lists_client = getattr(self.client, "lists") - def test_get_followers_request_structure(self): - """Test get_followers request structure.""" + def test_create_request_structure(self): + """Test create request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -37,15 +37,18 @@ def test_get_followers_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.lists.models import CreateRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateRequest() # Call the method try: - method = getattr(self.lists_client, "get_followers") + method = getattr(self.lists_client, "create") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -64,7 +67,7 @@ def test_get_followers_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -73,14 +76,14 @@ def test_get_followers_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/lists/{id}/followers" + expected_path = "/2/lists" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -96,12 +99,12 @@ def test_get_followers_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_followers: {e}") + pytest.fail(f"Contract test failed for create: {e}") - def test_get_followers_required_parameters(self): - """Test that get_followers handles parameters correctly.""" - method = getattr(self.lists_client, "get_followers") + def test_create_required_parameters(self): + """Test that create handles parameters correctly.""" + method = getattr(self.lists_client, "create") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -109,14 +112,14 @@ def test_get_followers_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_followers_response_structure(self): - """Test get_followers response structure validation.""" + def test_create_response_structure(self): + """Test create response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -126,13 +129,16 @@ def test_get_followers_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.lists.models import CreateRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateRequest() # Call method and verify response structure - method = getattr(self.lists_client, "get_followers") + method = getattr(self.lists_client, "create") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -144,8 +150,8 @@ def test_get_followers_response_structure(self): ) - def test_get_members_request_structure(self): - """Test get_members request structure.""" + def test_get_by_id_request_structure(self): + """Test get_by_id request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -162,7 +168,7 @@ def test_get_members_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.lists_client, "get_members") + method = getattr(self.lists_client, "get_by_id") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -197,7 +203,7 @@ def test_get_members_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/lists/{id}/members" + expected_path = "/2/lists/{id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -213,12 +219,12 @@ def test_get_members_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_members: {e}") + pytest.fail(f"Contract test failed for get_by_id: {e}") - def test_get_members_required_parameters(self): - """Test that get_members handles parameters correctly.""" - method = getattr(self.lists_client, "get_members") + def test_get_by_id_required_parameters(self): + """Test that get_by_id handles parameters correctly.""" + method = getattr(self.lists_client, "get_by_id") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -232,8 +238,8 @@ def test_get_members_required_parameters(self): method() - def test_get_members_response_structure(self): - """Test get_members response structure validation.""" + def test_get_by_id_response_structure(self): + """Test get_by_id response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -249,7 +255,7 @@ def test_get_members_response_structure(self): kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.lists_client, "get_members") + method = getattr(self.lists_client, "get_by_id") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -261,8 +267,8 @@ def test_get_members_response_structure(self): ) - def test_add_member_request_structure(self): - """Test add_member request structure.""" + def test_update_request_structure(self): + """Test update request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -271,19 +277,19 @@ def test_add_member_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.put.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" # Add request body if required # Import and create proper request model instance - from xdk.lists.models import AddMemberRequest + from xdk.lists.models import UpdateRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = AddMemberRequest() + kwargs["body"] = UpdateRequest() # Call the method try: - method = getattr(self.lists_client, "add_member") + method = getattr(self.lists_client, "update") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -302,7 +308,7 @@ def test_add_member_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.put.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -311,14 +317,14 @@ def test_add_member_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.put.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.put.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/lists/{id}/members" + expected_path = "/2/lists/{id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -334,12 +340,12 @@ def test_add_member_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for add_member: {e}") + pytest.fail(f"Contract test failed for update: {e}") - def test_add_member_required_parameters(self): - """Test that add_member handles parameters correctly.""" - method = getattr(self.lists_client, "add_member") + def test_update_required_parameters(self): + """Test that update handles parameters correctly.""" + method = getattr(self.lists_client, "update") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -347,14 +353,14 @@ def test_add_member_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.put.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_add_member_response_structure(self): - """Test add_member response structure validation.""" + def test_update_response_structure(self): + """Test update response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -364,17 +370,17 @@ def test_add_member_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.put.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required # Import and create proper request model instance - from xdk.lists.models import AddMemberRequest + from xdk.lists.models import UpdateRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = AddMemberRequest() + kwargs["body"] = UpdateRequest() # Call method and verify response structure - method = getattr(self.lists_client, "add_member") + method = getattr(self.lists_client, "update") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -386,8 +392,8 @@ def test_add_member_response_structure(self): ) - def test_get_posts_request_structure(self): - """Test get_posts request structure.""" + def test_delete_request_structure(self): + """Test delete request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -396,7 +402,7 @@ def test_get_posts_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters @@ -404,7 +410,7 @@ def test_get_posts_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.lists_client, "get_posts") + method = getattr(self.lists_client, "delete") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -423,7 +429,7 @@ def test_get_posts_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -432,14 +438,14 @@ def test_get_posts_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/lists/{id}/tweets" + expected_path = "/2/lists/{id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -455,12 +461,12 @@ def test_get_posts_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_posts: {e}") + pytest.fail(f"Contract test failed for delete: {e}") - def test_get_posts_required_parameters(self): - """Test that get_posts handles parameters correctly.""" - method = getattr(self.lists_client, "get_posts") + def test_delete_required_parameters(self): + """Test that delete handles parameters correctly.""" + method = getattr(self.lists_client, "delete") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -468,14 +474,14 @@ def test_get_posts_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_posts_response_structure(self): - """Test get_posts response structure validation.""" + def test_delete_response_structure(self): + """Test delete response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -485,13 +491,13 @@ def test_get_posts_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.lists_client, "get_posts") + method = getattr(self.lists_client, "delete") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -503,8 +509,8 @@ def test_get_posts_response_structure(self): ) - def test_create_request_structure(self): - """Test create request structure.""" + def test_get_followers_request_structure(self): + """Test get_followers request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -513,18 +519,15 @@ def test_create_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.lists.models import CreateRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateRequest() # Call the method try: - method = getattr(self.lists_client, "create") + method = getattr(self.lists_client, "get_followers") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -543,7 +546,7 @@ def test_create_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -552,14 +555,14 @@ def test_create_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/lists" + expected_path = "/2/lists/{id}/followers" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -575,12 +578,12 @@ def test_create_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create: {e}") + pytest.fail(f"Contract test failed for get_followers: {e}") - def test_create_required_parameters(self): - """Test that create handles parameters correctly.""" - method = getattr(self.lists_client, "create") + def test_get_followers_required_parameters(self): + """Test that get_followers handles parameters correctly.""" + method = getattr(self.lists_client, "get_followers") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -588,14 +591,14 @@ def test_create_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_create_response_structure(self): - """Test create response structure validation.""" + def test_get_followers_response_structure(self): + """Test get_followers response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -605,16 +608,13 @@ def test_create_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.lists.models import CreateRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateRequest() # Call method and verify response structure - method = getattr(self.lists_client, "create") + method = getattr(self.lists_client, "get_followers") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -745,8 +745,8 @@ def test_remove_member_by_user_id_response_structure(self): ) - def test_get_by_id_request_structure(self): - """Test get_by_id request structure.""" + def test_get_posts_request_structure(self): + """Test get_posts request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -763,7 +763,7 @@ def test_get_by_id_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.lists_client, "get_by_id") + method = getattr(self.lists_client, "get_posts") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -798,7 +798,7 @@ def test_get_by_id_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/lists/{id}" + expected_path = "/2/lists/{id}/tweets" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -814,12 +814,12 @@ def test_get_by_id_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_id: {e}") + pytest.fail(f"Contract test failed for get_posts: {e}") - def test_get_by_id_required_parameters(self): - """Test that get_by_id handles parameters correctly.""" - method = getattr(self.lists_client, "get_by_id") + def test_get_posts_required_parameters(self): + """Test that get_posts handles parameters correctly.""" + method = getattr(self.lists_client, "get_posts") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -833,8 +833,8 @@ def test_get_by_id_required_parameters(self): method() - def test_get_by_id_response_structure(self): - """Test get_by_id response structure validation.""" + def test_get_posts_response_structure(self): + """Test get_posts response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -850,7 +850,7 @@ def test_get_by_id_response_structure(self): kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.lists_client, "get_by_id") + method = getattr(self.lists_client, "get_posts") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -862,8 +862,8 @@ def test_get_by_id_response_structure(self): ) - def test_update_request_structure(self): - """Test update request structure.""" + def test_get_members_request_structure(self): + """Test get_members request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -872,19 +872,15 @@ def test_update_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.put.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.lists.models import UpdateRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = UpdateRequest() # Call the method try: - method = getattr(self.lists_client, "update") + method = getattr(self.lists_client, "get_members") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -903,7 +899,7 @@ def test_update_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.put.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -912,14 +908,14 @@ def test_update_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.put.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.put.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/lists/{id}" + expected_path = "/2/lists/{id}/members" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -935,12 +931,12 @@ def test_update_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for update: {e}") + pytest.fail(f"Contract test failed for get_members: {e}") - def test_update_required_parameters(self): - """Test that update handles parameters correctly.""" - method = getattr(self.lists_client, "update") + def test_get_members_required_parameters(self): + """Test that get_members handles parameters correctly.""" + method = getattr(self.lists_client, "get_members") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -948,14 +944,14 @@ def test_update_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.put.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_update_response_structure(self): - """Test update response structure validation.""" + def test_get_members_response_structure(self): + """Test get_members response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -965,17 +961,13 @@ def test_update_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.put.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.lists.models import UpdateRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = UpdateRequest() # Call method and verify response structure - method = getattr(self.lists_client, "update") + method = getattr(self.lists_client, "get_members") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -987,8 +979,8 @@ def test_update_response_structure(self): ) - def test_delete_request_structure(self): - """Test delete request structure.""" + def test_add_member_request_structure(self): + """Test add_member request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -997,15 +989,19 @@ def test_delete_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.lists.models import AddMemberRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = AddMemberRequest() # Call the method try: - method = getattr(self.lists_client, "delete") + method = getattr(self.lists_client, "add_member") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1024,7 +1020,7 @@ def test_delete_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -1033,14 +1029,14 @@ def test_delete_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/lists/{id}" + expected_path = "/2/lists/{id}/members" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1056,12 +1052,12 @@ def test_delete_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for delete: {e}") + pytest.fail(f"Contract test failed for add_member: {e}") - def test_delete_required_parameters(self): - """Test that delete handles parameters correctly.""" - method = getattr(self.lists_client, "delete") + def test_add_member_required_parameters(self): + """Test that add_member handles parameters correctly.""" + method = getattr(self.lists_client, "add_member") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1069,14 +1065,14 @@ def test_delete_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_delete_response_structure(self): - """Test delete response structure validation.""" + def test_add_member_response_structure(self): + """Test add_member response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1086,13 +1082,17 @@ def test_delete_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.lists.models import AddMemberRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = AddMemberRequest() # Call method and verify response structure - method = getattr(self.lists_client, "delete") + method = getattr(self.lists_client, "add_member") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/lists/test_pagination.py b/xdk/python/tests/lists/test_pagination.py index a6c7d70b..917c561b 100644 --- a/xdk/python/tests/lists/test_pagination.py +++ b/xdk/python/tests/lists/test_pagination.py @@ -169,20 +169,20 @@ def test_get_followers_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_members_cursor_creation(self): - """Test that get_members can be used with Cursor.""" - method = getattr(self.lists_client, "get_members") + def test_get_posts_cursor_creation(self): + """Test that get_posts can be used with Cursor.""" + method = getattr(self.lists_client, "get_posts") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_members should support pagination") + pytest.fail(f"Method get_posts should support pagination") - def test_get_members_cursor_pages(self): - """Test pagination with pages() for get_members.""" + def test_get_posts_cursor_pages(self): + """Test pagination with pages() for get_posts.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -203,7 +203,7 @@ def test_get_members_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.lists_client, "get_members") + method = getattr(self.lists_client, "get_posts") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -219,8 +219,8 @@ def test_get_members_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_members_cursor_items(self): - """Test pagination with items() for get_members.""" + def test_get_posts_cursor_items(self): + """Test pagination with items() for get_posts.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -239,7 +239,7 @@ def test_get_members_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.lists_client, "get_members") + method = getattr(self.lists_client, "get_posts") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -250,15 +250,15 @@ def test_get_members_cursor_items(self): ), "Items should have 'id' field" - def test_get_members_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_members.""" + def test_get_posts_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_posts.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.lists_client, "get_members") + method = getattr(self.lists_client, "get_posts") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -311,20 +311,20 @@ def test_get_members_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_posts_cursor_creation(self): - """Test that get_posts can be used with Cursor.""" - method = getattr(self.lists_client, "get_posts") + def test_get_members_cursor_creation(self): + """Test that get_members can be used with Cursor.""" + method = getattr(self.lists_client, "get_members") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_posts should support pagination") + pytest.fail(f"Method get_members should support pagination") - def test_get_posts_cursor_pages(self): - """Test pagination with pages() for get_posts.""" + def test_get_members_cursor_pages(self): + """Test pagination with pages() for get_members.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -345,7 +345,7 @@ def test_get_posts_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.lists_client, "get_posts") + method = getattr(self.lists_client, "get_members") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -361,8 +361,8 @@ def test_get_posts_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_posts_cursor_items(self): - """Test pagination with items() for get_posts.""" + def test_get_members_cursor_items(self): + """Test pagination with items() for get_members.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -381,7 +381,7 @@ def test_get_posts_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.lists_client, "get_posts") + method = getattr(self.lists_client, "get_members") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -392,15 +392,15 @@ def test_get_posts_cursor_items(self): ), "Items should have 'id' field" - def test_get_posts_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_posts.""" + def test_get_members_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_members.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.lists_client, "get_posts") + method = getattr(self.lists_client, "get_members") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request diff --git a/xdk/python/tests/lists/test_structure.py b/xdk/python/tests/lists/test_structure.py index fb0f0f39..8a60a975 100644 --- a/xdk/python/tests/lists/test_structure.py +++ b/xdk/python/tests/lists/test_structure.py @@ -28,37 +28,29 @@ def setup_class(self): self.lists_client = getattr(self.client, "lists") - def test_get_followers_exists(self): - """Test that get_followers method exists with correct signature.""" + def test_create_exists(self): + """Test that create method exists with correct signature.""" # Check method exists - method = getattr(ListsClient, "get_followers", None) - assert method is not None, f"Method get_followers does not exist on ListsClient" + method = getattr(ListsClient, "create", None) + assert method is not None, f"Method create does not exist on ListsClient" # Check method is callable - assert callable(method), f"get_followers is not callable" + assert callable(method), f"create is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_followers should have at least 'self' parameter" + assert len(params) >= 1, f"create should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "id", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_followers" + ), f"Required parameter '{required_param}' missing from create" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "max_results", - "pagination_token", - "user.fields", - "expansions", - "tweet.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -67,47 +59,28 @@ def test_get_followers_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_followers_return_annotation(self): - """Test that get_followers has proper return type annotation.""" - method = getattr(ListsClient, "get_followers") + def test_create_return_annotation(self): + """Test that create has proper return type annotation.""" + method = getattr(ListsClient, "create") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_followers should have return type annotation" - - - def test_get_followers_pagination_params(self): - """Test that get_followers has pagination parameters.""" - method = getattr(ListsClient, "get_followers") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_followers should have pagination parameters" + ), f"Method create should have return type annotation" - def test_get_members_exists(self): - """Test that get_members method exists with correct signature.""" + def test_get_by_id_exists(self): + """Test that get_by_id method exists with correct signature.""" # Check method exists - method = getattr(ListsClient, "get_members", None) - assert method is not None, f"Method get_members does not exist on ListsClient" + method = getattr(ListsClient, "get_by_id", None) + assert method is not None, f"Method get_by_id does not exist on ListsClient" # Check method is callable - assert callable(method), f"get_members is not callable" + assert callable(method), f"get_by_id is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_members should have at least 'self' parameter" + assert len(params) >= 1, f"get_by_id should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -118,14 +91,12 @@ def test_get_members_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_members" + ), f"Required parameter '{required_param}' missing from get_by_id" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "max_results", - "pagination_token", - "user.fields", + "list.fields", "expansions", - "tweet.fields", + "user.fields", ] for optional_param in optional_params: if optional_param in params: @@ -135,47 +106,28 @@ def test_get_members_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_members_return_annotation(self): - """Test that get_members has proper return type annotation.""" - method = getattr(ListsClient, "get_members") + def test_get_by_id_return_annotation(self): + """Test that get_by_id has proper return type annotation.""" + method = getattr(ListsClient, "get_by_id") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_members should have return type annotation" - - - def test_get_members_pagination_params(self): - """Test that get_members has pagination parameters.""" - method = getattr(ListsClient, "get_members") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_members should have pagination parameters" + ), f"Method get_by_id should have return type annotation" - def test_add_member_exists(self): - """Test that add_member method exists with correct signature.""" + def test_update_exists(self): + """Test that update method exists with correct signature.""" # Check method exists - method = getattr(ListsClient, "add_member", None) - assert method is not None, f"Method add_member does not exist on ListsClient" + method = getattr(ListsClient, "update", None) + assert method is not None, f"Method update does not exist on ListsClient" # Check method is callable - assert callable(method), f"add_member is not callable" + assert callable(method), f"update is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"add_member should have at least 'self' parameter" + assert len(params) >= 1, f"update should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -186,7 +138,7 @@ def test_add_member_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from add_member" + ), f"Required parameter '{required_param}' missing from update" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -197,28 +149,28 @@ def test_add_member_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_add_member_return_annotation(self): - """Test that add_member has proper return type annotation.""" - method = getattr(ListsClient, "add_member") + def test_update_return_annotation(self): + """Test that update has proper return type annotation.""" + method = getattr(ListsClient, "update") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method add_member should have return type annotation" + ), f"Method update should have return type annotation" - def test_get_posts_exists(self): - """Test that get_posts method exists with correct signature.""" + def test_delete_exists(self): + """Test that delete method exists with correct signature.""" # Check method exists - method = getattr(ListsClient, "get_posts", None) - assert method is not None, f"Method get_posts does not exist on ListsClient" + method = getattr(ListsClient, "delete", None) + assert method is not None, f"Method delete does not exist on ListsClient" # Check method is callable - assert callable(method), f"get_posts is not callable" + assert callable(method), f"delete is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_posts should have at least 'self' parameter" + assert len(params) >= 1, f"delete should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -229,18 +181,9 @@ def test_get_posts_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_posts" + ), f"Required parameter '{required_param}' missing from delete" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "max_results", - "pagination_token", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -249,58 +192,47 @@ def test_get_posts_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_posts_return_annotation(self): - """Test that get_posts has proper return type annotation.""" - method = getattr(ListsClient, "get_posts") + def test_delete_return_annotation(self): + """Test that delete has proper return type annotation.""" + method = getattr(ListsClient, "delete") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_posts should have return type annotation" - - - def test_get_posts_pagination_params(self): - """Test that get_posts has pagination parameters.""" - method = getattr(ListsClient, "get_posts") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_posts should have pagination parameters" + ), f"Method delete should have return type annotation" - def test_create_exists(self): - """Test that create method exists with correct signature.""" + def test_get_followers_exists(self): + """Test that get_followers method exists with correct signature.""" # Check method exists - method = getattr(ListsClient, "create", None) - assert method is not None, f"Method create does not exist on ListsClient" + method = getattr(ListsClient, "get_followers", None) + assert method is not None, f"Method get_followers does not exist on ListsClient" # Check method is callable - assert callable(method), f"create is not callable" + assert callable(method), f"get_followers is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"create should have at least 'self' parameter" + assert len(params) >= 1, f"get_followers should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "id", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from create" + ), f"Required parameter '{required_param}' missing from get_followers" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "max_results", + "pagination_token", + "user.fields", + "expansions", + "tweet.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -309,14 +241,33 @@ def test_create_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_create_return_annotation(self): - """Test that create has proper return type annotation.""" - method = getattr(ListsClient, "create") + def test_get_followers_return_annotation(self): + """Test that get_followers has proper return type annotation.""" + method = getattr(ListsClient, "get_followers") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method create should have return type annotation" + ), f"Method get_followers should have return type annotation" + + + def test_get_followers_pagination_params(self): + """Test that get_followers has pagination parameters.""" + method = getattr(ListsClient, "get_followers") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_followers should have pagination parameters" def test_remove_member_by_user_id_exists(self): @@ -367,18 +318,18 @@ def test_remove_member_by_user_id_return_annotation(self): ), f"Method remove_member_by_user_id should have return type annotation" - def test_get_by_id_exists(self): - """Test that get_by_id method exists with correct signature.""" + def test_get_posts_exists(self): + """Test that get_posts method exists with correct signature.""" # Check method exists - method = getattr(ListsClient, "get_by_id", None) - assert method is not None, f"Method get_by_id does not exist on ListsClient" + method = getattr(ListsClient, "get_posts", None) + assert method is not None, f"Method get_posts does not exist on ListsClient" # Check method is callable - assert callable(method), f"get_by_id is not callable" + assert callable(method), f"get_posts is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_by_id should have at least 'self' parameter" + assert len(params) >= 1, f"get_posts should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -389,12 +340,17 @@ def test_get_by_id_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_id" + ), f"Required parameter '{required_param}' missing from get_posts" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "list.fields", + "max_results", + "pagination_token", + "tweet.fields", "expansions", + "media.fields", + "poll.fields", "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -404,28 +360,47 @@ def test_get_by_id_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_id_return_annotation(self): - """Test that get_by_id has proper return type annotation.""" - method = getattr(ListsClient, "get_by_id") + def test_get_posts_return_annotation(self): + """Test that get_posts has proper return type annotation.""" + method = getattr(ListsClient, "get_posts") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_id should have return type annotation" + ), f"Method get_posts should have return type annotation" - def test_update_exists(self): - """Test that update method exists with correct signature.""" + def test_get_posts_pagination_params(self): + """Test that get_posts has pagination parameters.""" + method = getattr(ListsClient, "get_posts") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_posts should have pagination parameters" + + + def test_get_members_exists(self): + """Test that get_members method exists with correct signature.""" # Check method exists - method = getattr(ListsClient, "update", None) - assert method is not None, f"Method update does not exist on ListsClient" + method = getattr(ListsClient, "get_members", None) + assert method is not None, f"Method get_members does not exist on ListsClient" # Check method is callable - assert callable(method), f"update is not callable" + assert callable(method), f"get_members is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"update should have at least 'self' parameter" + assert len(params) >= 1, f"get_members should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -436,9 +411,15 @@ def test_update_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from update" + ), f"Required parameter '{required_param}' missing from get_members" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "max_results", + "pagination_token", + "user.fields", + "expansions", + "tweet.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -447,28 +428,47 @@ def test_update_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_update_return_annotation(self): - """Test that update has proper return type annotation.""" - method = getattr(ListsClient, "update") + def test_get_members_return_annotation(self): + """Test that get_members has proper return type annotation.""" + method = getattr(ListsClient, "get_members") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method update should have return type annotation" + ), f"Method get_members should have return type annotation" - def test_delete_exists(self): - """Test that delete method exists with correct signature.""" + def test_get_members_pagination_params(self): + """Test that get_members has pagination parameters.""" + method = getattr(ListsClient, "get_members") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_members should have pagination parameters" + + + def test_add_member_exists(self): + """Test that add_member method exists with correct signature.""" # Check method exists - method = getattr(ListsClient, "delete", None) - assert method is not None, f"Method delete does not exist on ListsClient" + method = getattr(ListsClient, "add_member", None) + assert method is not None, f"Method add_member does not exist on ListsClient" # Check method is callable - assert callable(method), f"delete is not callable" + assert callable(method), f"add_member is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"delete should have at least 'self' parameter" + assert len(params) >= 1, f"add_member should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -479,7 +479,7 @@ def test_delete_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from delete" + ), f"Required parameter '{required_param}' missing from add_member" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -490,28 +490,28 @@ def test_delete_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_delete_return_annotation(self): - """Test that delete has proper return type annotation.""" - method = getattr(ListsClient, "delete") + def test_add_member_return_annotation(self): + """Test that add_member has proper return type annotation.""" + method = getattr(ListsClient, "add_member") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method delete should have return type annotation" + ), f"Method add_member should have return type annotation" def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ - "get_followers", - "get_members", - "add_member", - "get_posts", "create", - "remove_member_by_user_id", "get_by_id", "update", "delete", + "get_followers", + "remove_member_by_user_id", + "get_posts", + "get_members", + "add_member", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/media/test_contracts.py b/xdk/python/tests/media/test_contracts.py index a1b5a2fd..46021ded 100644 --- a/xdk/python/tests/media/test_contracts.py +++ b/xdk/python/tests/media/test_contracts.py @@ -27,8 +27,8 @@ def setup_class(self): self.media_client = getattr(self.client, "media") - def test_create_subtitles_request_structure(self): - """Test create_subtitles request structure.""" + def test_get_upload_status_request_structure(self): + """Test get_upload_status request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -37,18 +37,15 @@ def test_create_subtitles_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["media_id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.media.models import CreateSubtitlesRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateSubtitlesRequest() # Call the method try: - method = getattr(self.media_client, "create_subtitles") + method = getattr(self.media_client, "get_upload_status") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -67,7 +64,7 @@ def test_create_subtitles_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -76,14 +73,14 @@ def test_create_subtitles_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media/subtitles" + expected_path = "/2/media/upload" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -99,12 +96,12 @@ def test_create_subtitles_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create_subtitles: {e}") + pytest.fail(f"Contract test failed for get_upload_status: {e}") - def test_create_subtitles_required_parameters(self): - """Test that create_subtitles handles parameters correctly.""" - method = getattr(self.media_client, "create_subtitles") + def test_get_upload_status_required_parameters(self): + """Test that get_upload_status handles parameters correctly.""" + method = getattr(self.media_client, "get_upload_status") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -112,14 +109,14 @@ def test_create_subtitles_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_create_subtitles_response_structure(self): - """Test create_subtitles response structure validation.""" + def test_get_upload_status_response_structure(self): + """Test get_upload_status response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -129,16 +126,13 @@ def test_create_subtitles_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["media_id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.media.models import CreateSubtitlesRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateSubtitlesRequest() # Call method and verify response structure - method = getattr(self.media_client, "create_subtitles") + method = getattr(self.media_client, "get_upload_status") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -150,8 +144,8 @@ def test_create_subtitles_response_structure(self): ) - def test_delete_subtitles_request_structure(self): - """Test delete_subtitles request structure.""" + def test_upload_request_structure(self): + """Test upload request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -160,18 +154,18 @@ def test_delete_subtitles_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters # Add request body if required # Import and create proper request model instance - from xdk.media.models import DeleteSubtitlesRequest + from xdk.media.models import UploadRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = DeleteSubtitlesRequest() + kwargs["body"] = UploadRequest() # Call the method try: - method = getattr(self.media_client, "delete_subtitles") + method = getattr(self.media_client, "upload") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -190,7 +184,7 @@ def test_delete_subtitles_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -199,14 +193,14 @@ def test_delete_subtitles_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media/subtitles" + expected_path = "/2/media/upload" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -222,12 +216,12 @@ def test_delete_subtitles_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for delete_subtitles: {e}") + pytest.fail(f"Contract test failed for upload: {e}") - def test_delete_subtitles_required_parameters(self): - """Test that delete_subtitles handles parameters correctly.""" - method = getattr(self.media_client, "delete_subtitles") + def test_upload_required_parameters(self): + """Test that upload handles parameters correctly.""" + method = getattr(self.media_client, "upload") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -235,14 +229,14 @@ def test_delete_subtitles_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_delete_subtitles_response_structure(self): - """Test delete_subtitles response structure validation.""" + def test_upload_response_structure(self): + """Test upload response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -252,16 +246,16 @@ def test_delete_subtitles_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} # Add request body if required # Import and create proper request model instance - from xdk.media.models import DeleteSubtitlesRequest + from xdk.media.models import UploadRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = DeleteSubtitlesRequest() + kwargs["body"] = UploadRequest() # Call method and verify response structure - method = getattr(self.media_client, "delete_subtitles") + method = getattr(self.media_client, "upload") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -273,8 +267,8 @@ def test_delete_subtitles_response_structure(self): ) - def test_get_analytics_request_structure(self): - """Test get_analytics request structure.""" + def test_create_subtitles_request_structure(self): + """Test create_subtitles request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -283,18 +277,18 @@ def test_get_analytics_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["media_keys"] = ["test_item"] - kwargs["end_time"] = "test_end_time" - kwargs["start_time"] = "test_start_time" - kwargs["granularity"] = "test_granularity" # Add request body if required + # Import and create proper request model instance + from xdk.media.models import CreateSubtitlesRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateSubtitlesRequest() # Call the method try: - method = getattr(self.media_client, "get_analytics") + method = getattr(self.media_client, "create_subtitles") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -313,7 +307,7 @@ def test_get_analytics_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -322,14 +316,14 @@ def test_get_analytics_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media/analytics" + expected_path = "/2/media/subtitles" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -345,12 +339,12 @@ def test_get_analytics_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_analytics: {e}") + pytest.fail(f"Contract test failed for create_subtitles: {e}") - def test_get_analytics_required_parameters(self): - """Test that get_analytics handles parameters correctly.""" - method = getattr(self.media_client, "get_analytics") + def test_create_subtitles_required_parameters(self): + """Test that create_subtitles handles parameters correctly.""" + method = getattr(self.media_client, "create_subtitles") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -358,14 +352,14 @@ def test_get_analytics_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_analytics_response_structure(self): - """Test get_analytics response structure validation.""" + def test_create_subtitles_response_structure(self): + """Test create_subtitles response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -375,16 +369,16 @@ def test_get_analytics_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["media_keys"] = ["test"] - kwargs["end_time"] = "test_value" - kwargs["start_time"] = "test_value" - kwargs["granularity"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.media.models import CreateSubtitlesRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateSubtitlesRequest() # Call method and verify response structure - method = getattr(self.media_client, "get_analytics") + method = getattr(self.media_client, "create_subtitles") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -396,8 +390,8 @@ def test_get_analytics_response_structure(self): ) - def test_get_by_keys_request_structure(self): - """Test get_by_keys request structure.""" + def test_delete_subtitles_request_structure(self): + """Test delete_subtitles request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -406,15 +400,18 @@ def test_get_by_keys_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["media_keys"] = ["test_item"] # Add request body if required + # Import and create proper request model instance + from xdk.media.models import DeleteSubtitlesRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = DeleteSubtitlesRequest() # Call the method try: - method = getattr(self.media_client, "get_by_keys") + method = getattr(self.media_client, "delete_subtitles") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -433,7 +430,7 @@ def test_get_by_keys_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -442,14 +439,14 @@ def test_get_by_keys_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media" + expected_path = "/2/media/subtitles" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -465,12 +462,12 @@ def test_get_by_keys_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_keys: {e}") + pytest.fail(f"Contract test failed for delete_subtitles: {e}") - def test_get_by_keys_required_parameters(self): - """Test that get_by_keys handles parameters correctly.""" - method = getattr(self.media_client, "get_by_keys") + def test_delete_subtitles_required_parameters(self): + """Test that delete_subtitles handles parameters correctly.""" + method = getattr(self.media_client, "delete_subtitles") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -478,14 +475,14 @@ def test_get_by_keys_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_by_keys_response_structure(self): - """Test get_by_keys response structure validation.""" + def test_delete_subtitles_response_structure(self): + """Test delete_subtitles response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -495,13 +492,16 @@ def test_get_by_keys_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["media_keys"] = ["test"] # Add request body if required + # Import and create proper request model instance + from xdk.media.models import DeleteSubtitlesRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = DeleteSubtitlesRequest() # Call method and verify response structure - method = getattr(self.media_client, "get_by_keys") + method = getattr(self.media_client, "delete_subtitles") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -513,8 +513,8 @@ def test_get_by_keys_response_structure(self): ) - def test_get_by_key_request_structure(self): - """Test get_by_key request structure.""" + def test_initialize_upload_request_structure(self): + """Test initialize_upload request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -523,15 +523,18 @@ def test_get_by_key_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["media_key"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.media.models import InitializeUploadRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = InitializeUploadRequest() # Call the method try: - method = getattr(self.media_client, "get_by_key") + method = getattr(self.media_client, "initialize_upload") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -550,7 +553,7 @@ def test_get_by_key_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -559,14 +562,14 @@ def test_get_by_key_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media/{media_key}" + expected_path = "/2/media/upload/initialize" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -582,12 +585,12 @@ def test_get_by_key_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_key: {e}") + pytest.fail(f"Contract test failed for initialize_upload: {e}") - def test_get_by_key_required_parameters(self): - """Test that get_by_key handles parameters correctly.""" - method = getattr(self.media_client, "get_by_key") + def test_initialize_upload_required_parameters(self): + """Test that initialize_upload handles parameters correctly.""" + method = getattr(self.media_client, "initialize_upload") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -595,14 +598,14 @@ def test_get_by_key_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_by_key_response_structure(self): - """Test get_by_key response structure validation.""" + def test_initialize_upload_response_structure(self): + """Test initialize_upload response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -612,13 +615,16 @@ def test_get_by_key_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["media_key"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.media.models import InitializeUploadRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = InitializeUploadRequest() # Call method and verify response structure - method = getattr(self.media_client, "get_by_key") + method = getattr(self.media_client, "initialize_upload") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -630,8 +636,8 @@ def test_get_by_key_response_structure(self): ) - def test_finalize_upload_request_structure(self): - """Test finalize_upload request structure.""" + def test_get_by_keys_request_structure(self): + """Test get_by_keys request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -640,15 +646,15 @@ def test_finalize_upload_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["media_keys"] = ["test_item"] # Add request body if required # Call the method try: - method = getattr(self.media_client, "finalize_upload") + method = getattr(self.media_client, "get_by_keys") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -667,7 +673,7 @@ def test_finalize_upload_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -676,14 +682,14 @@ def test_finalize_upload_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media/upload/{id}/finalize" + expected_path = "/2/media" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -699,12 +705,12 @@ def test_finalize_upload_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for finalize_upload: {e}") + pytest.fail(f"Contract test failed for get_by_keys: {e}") - def test_finalize_upload_required_parameters(self): - """Test that finalize_upload handles parameters correctly.""" - method = getattr(self.media_client, "finalize_upload") + def test_get_by_keys_required_parameters(self): + """Test that get_by_keys handles parameters correctly.""" + method = getattr(self.media_client, "get_by_keys") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -712,14 +718,14 @@ def test_finalize_upload_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_finalize_upload_response_structure(self): - """Test finalize_upload response structure validation.""" + def test_get_by_keys_response_structure(self): + """Test get_by_keys response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -729,13 +735,13 @@ def test_finalize_upload_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["media_keys"] = ["test"] # Add request body if required # Call method and verify response structure - method = getattr(self.media_client, "finalize_upload") + method = getattr(self.media_client, "get_by_keys") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -872,8 +878,8 @@ def test_append_upload_response_structure(self): ) - def test_initialize_upload_request_structure(self): - """Test initialize_upload request structure.""" + def test_create_metadata_request_structure(self): + """Test create_metadata request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -888,12 +894,12 @@ def test_initialize_upload_request_structure(self): # Add required parameters # Add request body if required # Import and create proper request model instance - from xdk.media.models import InitializeUploadRequest + from xdk.media.models import CreateMetadataRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = InitializeUploadRequest() + kwargs["body"] = CreateMetadataRequest() # Call the method try: - method = getattr(self.media_client, "initialize_upload") + method = getattr(self.media_client, "create_metadata") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -928,7 +934,7 @@ def test_initialize_upload_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media/upload/initialize" + expected_path = "/2/media/metadata" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -944,12 +950,12 @@ def test_initialize_upload_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for initialize_upload: {e}") + pytest.fail(f"Contract test failed for create_metadata: {e}") - def test_initialize_upload_required_parameters(self): - """Test that initialize_upload handles parameters correctly.""" - method = getattr(self.media_client, "initialize_upload") + def test_create_metadata_required_parameters(self): + """Test that create_metadata handles parameters correctly.""" + method = getattr(self.media_client, "create_metadata") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -963,8 +969,8 @@ def test_initialize_upload_required_parameters(self): method() - def test_initialize_upload_response_structure(self): - """Test initialize_upload response structure validation.""" + def test_create_metadata_response_structure(self): + """Test create_metadata response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -979,11 +985,11 @@ def test_initialize_upload_response_structure(self): kwargs = {} # Add request body if required # Import and create proper request model instance - from xdk.media.models import InitializeUploadRequest + from xdk.media.models import CreateMetadataRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = InitializeUploadRequest() + kwargs["body"] = CreateMetadataRequest() # Call method and verify response structure - method = getattr(self.media_client, "initialize_upload") + method = getattr(self.media_client, "create_metadata") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -995,8 +1001,8 @@ def test_initialize_upload_response_structure(self): ) - def test_create_metadata_request_structure(self): - """Test create_metadata request structure.""" + def test_finalize_upload_request_structure(self): + """Test finalize_upload request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1009,14 +1015,11 @@ def test_create_metadata_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters + kwargs["id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.media.models import CreateMetadataRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateMetadataRequest() # Call the method try: - method = getattr(self.media_client, "create_metadata") + method = getattr(self.media_client, "finalize_upload") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1051,7 +1054,7 @@ def test_create_metadata_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media/metadata" + expected_path = "/2/media/upload/{id}/finalize" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1067,12 +1070,12 @@ def test_create_metadata_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create_metadata: {e}") + pytest.fail(f"Contract test failed for finalize_upload: {e}") - def test_create_metadata_required_parameters(self): - """Test that create_metadata handles parameters correctly.""" - method = getattr(self.media_client, "create_metadata") + def test_finalize_upload_required_parameters(self): + """Test that finalize_upload handles parameters correctly.""" + method = getattr(self.media_client, "finalize_upload") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1086,8 +1089,8 @@ def test_create_metadata_required_parameters(self): method() - def test_create_metadata_response_structure(self): - """Test create_metadata response structure validation.""" + def test_finalize_upload_response_structure(self): + """Test finalize_upload response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1100,13 +1103,10 @@ def test_create_metadata_response_structure(self): mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.media.models import CreateMetadataRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateMetadataRequest() # Call method and verify response structure - method = getattr(self.media_client, "create_metadata") + method = getattr(self.media_client, "finalize_upload") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1118,8 +1118,8 @@ def test_create_metadata_response_structure(self): ) - def test_get_upload_status_request_structure(self): - """Test get_upload_status request structure.""" + def test_get_by_key_request_structure(self): + """Test get_by_key request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1132,11 +1132,11 @@ def test_get_upload_status_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["media_id"] = "test_value" + kwargs["media_key"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.media_client, "get_upload_status") + method = getattr(self.media_client, "get_by_key") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1171,7 +1171,7 @@ def test_get_upload_status_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media/upload" + expected_path = "/2/media/{media_key}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1187,12 +1187,12 @@ def test_get_upload_status_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_upload_status: {e}") + pytest.fail(f"Contract test failed for get_by_key: {e}") - def test_get_upload_status_required_parameters(self): - """Test that get_upload_status handles parameters correctly.""" - method = getattr(self.media_client, "get_upload_status") + def test_get_by_key_required_parameters(self): + """Test that get_by_key handles parameters correctly.""" + method = getattr(self.media_client, "get_by_key") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1206,8 +1206,8 @@ def test_get_upload_status_required_parameters(self): method() - def test_get_upload_status_response_structure(self): - """Test get_upload_status response structure validation.""" + def test_get_by_key_response_structure(self): + """Test get_by_key response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1220,10 +1220,10 @@ def test_get_upload_status_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["media_id"] = "test" + kwargs["media_key"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.media_client, "get_upload_status") + method = getattr(self.media_client, "get_by_key") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1235,8 +1235,8 @@ def test_get_upload_status_response_structure(self): ) - def test_upload_request_structure(self): - """Test upload request structure.""" + def test_get_analytics_request_structure(self): + """Test get_analytics request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1245,18 +1245,18 @@ def test_upload_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["media_keys"] = ["test_item"] + kwargs["end_time"] = "test_end_time" + kwargs["start_time"] = "test_start_time" + kwargs["granularity"] = "test_granularity" # Add request body if required - # Import and create proper request model instance - from xdk.media.models import UploadRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = UploadRequest() # Call the method try: - method = getattr(self.media_client, "upload") + method = getattr(self.media_client, "get_analytics") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1275,7 +1275,7 @@ def test_upload_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -1284,14 +1284,14 @@ def test_upload_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/media/upload" + expected_path = "/2/media/analytics" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1307,12 +1307,12 @@ def test_upload_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for upload: {e}") + pytest.fail(f"Contract test failed for get_analytics: {e}") - def test_upload_required_parameters(self): - """Test that upload handles parameters correctly.""" - method = getattr(self.media_client, "upload") + def test_get_analytics_required_parameters(self): + """Test that get_analytics handles parameters correctly.""" + method = getattr(self.media_client, "get_analytics") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1320,14 +1320,14 @@ def test_upload_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_upload_response_structure(self): - """Test upload response structure validation.""" + def test_get_analytics_response_structure(self): + """Test get_analytics response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1337,16 +1337,16 @@ def test_upload_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["media_keys"] = ["test"] + kwargs["end_time"] = "test_value" + kwargs["start_time"] = "test_value" + kwargs["granularity"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.media.models import UploadRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = UploadRequest() # Call method and verify response structure - method = getattr(self.media_client, "upload") + method = getattr(self.media_client, "get_analytics") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/media/test_structure.py b/xdk/python/tests/media/test_structure.py index 07d8516e..71deb852 100644 --- a/xdk/python/tests/media/test_structure.py +++ b/xdk/python/tests/media/test_structure.py @@ -28,33 +28,37 @@ def setup_class(self): self.media_client = getattr(self.client, "media") - def test_create_subtitles_exists(self): - """Test that create_subtitles method exists with correct signature.""" + def test_get_upload_status_exists(self): + """Test that get_upload_status method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "create_subtitles", None) + method = getattr(MediaClient, "get_upload_status", None) assert ( method is not None - ), f"Method create_subtitles does not exist on MediaClient" + ), f"Method get_upload_status does not exist on MediaClient" # Check method is callable - assert callable(method), f"create_subtitles is not callable" + assert callable(method), f"get_upload_status is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"create_subtitles should have at least 'self' parameter" + ), f"get_upload_status should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "media_id", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from create_subtitles" + ), f"Required parameter '{required_param}' missing from get_upload_status" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "command", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -63,32 +67,28 @@ def test_create_subtitles_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_create_subtitles_return_annotation(self): - """Test that create_subtitles has proper return type annotation.""" - method = getattr(MediaClient, "create_subtitles") + def test_get_upload_status_return_annotation(self): + """Test that get_upload_status has proper return type annotation.""" + method = getattr(MediaClient, "get_upload_status") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method create_subtitles should have return type annotation" + ), f"Method get_upload_status should have return type annotation" - def test_delete_subtitles_exists(self): - """Test that delete_subtitles method exists with correct signature.""" + def test_upload_exists(self): + """Test that upload method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "delete_subtitles", None) - assert ( - method is not None - ), f"Method delete_subtitles does not exist on MediaClient" + method = getattr(MediaClient, "upload", None) + assert method is not None, f"Method upload does not exist on MediaClient" # Check method is callable - assert callable(method), f"delete_subtitles is not callable" + assert callable(method), f"upload is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"delete_subtitles should have at least 'self' parameter" + assert len(params) >= 1, f"upload should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -97,7 +97,7 @@ def test_delete_subtitles_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from delete_subtitles" + ), f"Required parameter '{required_param}' missing from upload" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -108,46 +108,43 @@ def test_delete_subtitles_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_delete_subtitles_return_annotation(self): - """Test that delete_subtitles has proper return type annotation.""" - method = getattr(MediaClient, "delete_subtitles") + def test_upload_return_annotation(self): + """Test that upload has proper return type annotation.""" + method = getattr(MediaClient, "upload") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method delete_subtitles should have return type annotation" + ), f"Method upload should have return type annotation" - def test_get_analytics_exists(self): - """Test that get_analytics method exists with correct signature.""" + def test_create_subtitles_exists(self): + """Test that create_subtitles method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "get_analytics", None) - assert method is not None, f"Method get_analytics does not exist on MediaClient" + method = getattr(MediaClient, "create_subtitles", None) + assert ( + method is not None + ), f"Method create_subtitles does not exist on MediaClient" # Check method is callable - assert callable(method), f"get_analytics is not callable" + assert callable(method), f"create_subtitles is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_analytics should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"create_subtitles should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "media_keys", - "end_time", - "start_time", - "granularity", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_analytics" + ), f"Required parameter '{required_param}' missing from create_subtitles" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "media_analytics.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -156,43 +153,43 @@ def test_get_analytics_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_analytics_return_annotation(self): - """Test that get_analytics has proper return type annotation.""" - method = getattr(MediaClient, "get_analytics") + def test_create_subtitles_return_annotation(self): + """Test that create_subtitles has proper return type annotation.""" + method = getattr(MediaClient, "create_subtitles") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_analytics should have return type annotation" + ), f"Method create_subtitles should have return type annotation" - def test_get_by_keys_exists(self): - """Test that get_by_keys method exists with correct signature.""" + def test_delete_subtitles_exists(self): + """Test that delete_subtitles method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "get_by_keys", None) - assert method is not None, f"Method get_by_keys does not exist on MediaClient" + method = getattr(MediaClient, "delete_subtitles", None) + assert ( + method is not None + ), f"Method delete_subtitles does not exist on MediaClient" # Check method is callable - assert callable(method), f"get_by_keys is not callable" + assert callable(method), f"delete_subtitles is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_by_keys should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"delete_subtitles should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "media_keys", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_keys" + ), f"Required parameter '{required_param}' missing from delete_subtitles" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "media.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -201,43 +198,43 @@ def test_get_by_keys_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_keys_return_annotation(self): - """Test that get_by_keys has proper return type annotation.""" - method = getattr(MediaClient, "get_by_keys") + def test_delete_subtitles_return_annotation(self): + """Test that delete_subtitles has proper return type annotation.""" + method = getattr(MediaClient, "delete_subtitles") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_keys should have return type annotation" + ), f"Method delete_subtitles should have return type annotation" - def test_get_by_key_exists(self): - """Test that get_by_key method exists with correct signature.""" + def test_initialize_upload_exists(self): + """Test that initialize_upload method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "get_by_key", None) - assert method is not None, f"Method get_by_key does not exist on MediaClient" + method = getattr(MediaClient, "initialize_upload", None) + assert ( + method is not None + ), f"Method initialize_upload does not exist on MediaClient" # Check method is callable - assert callable(method), f"get_by_key is not callable" + assert callable(method), f"initialize_upload is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_by_key should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"initialize_upload should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "media_key", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_key" + ), f"Required parameter '{required_param}' missing from initialize_upload" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "media.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -246,45 +243,43 @@ def test_get_by_key_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_key_return_annotation(self): - """Test that get_by_key has proper return type annotation.""" - method = getattr(MediaClient, "get_by_key") + def test_initialize_upload_return_annotation(self): + """Test that initialize_upload has proper return type annotation.""" + method = getattr(MediaClient, "initialize_upload") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_key should have return type annotation" + ), f"Method initialize_upload should have return type annotation" - def test_finalize_upload_exists(self): - """Test that finalize_upload method exists with correct signature.""" + def test_get_by_keys_exists(self): + """Test that get_by_keys method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "finalize_upload", None) - assert ( - method is not None - ), f"Method finalize_upload does not exist on MediaClient" + method = getattr(MediaClient, "get_by_keys", None) + assert method is not None, f"Method get_by_keys does not exist on MediaClient" # Check method is callable - assert callable(method), f"finalize_upload is not callable" + assert callable(method), f"get_by_keys is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"finalize_upload should have at least 'self' parameter" + assert len(params) >= 1, f"get_by_keys should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "media_keys", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from finalize_upload" + ), f"Required parameter '{required_param}' missing from get_by_keys" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "media.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -293,14 +288,14 @@ def test_finalize_upload_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_finalize_upload_return_annotation(self): - """Test that finalize_upload has proper return type annotation.""" - method = getattr(MediaClient, "finalize_upload") + def test_get_by_keys_return_annotation(self): + """Test that get_by_keys has proper return type annotation.""" + method = getattr(MediaClient, "get_by_keys") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method finalize_upload should have return type annotation" + ), f"Method get_by_keys should have return type annotation" def test_append_upload_exists(self): @@ -346,22 +341,22 @@ def test_append_upload_return_annotation(self): ), f"Method append_upload should have return type annotation" - def test_initialize_upload_exists(self): - """Test that initialize_upload method exists with correct signature.""" + def test_create_metadata_exists(self): + """Test that create_metadata method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "initialize_upload", None) + method = getattr(MediaClient, "create_metadata", None) assert ( method is not None - ), f"Method initialize_upload does not exist on MediaClient" + ), f"Method create_metadata does not exist on MediaClient" # Check method is callable - assert callable(method), f"initialize_upload is not callable" + assert callable(method), f"create_metadata is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"initialize_upload should have at least 'self' parameter" + ), f"create_metadata should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -370,7 +365,7 @@ def test_initialize_upload_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from initialize_upload" + ), f"Required parameter '{required_param}' missing from create_metadata" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -381,41 +376,43 @@ def test_initialize_upload_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_initialize_upload_return_annotation(self): - """Test that initialize_upload has proper return type annotation.""" - method = getattr(MediaClient, "initialize_upload") + def test_create_metadata_return_annotation(self): + """Test that create_metadata has proper return type annotation.""" + method = getattr(MediaClient, "create_metadata") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method initialize_upload should have return type annotation" + ), f"Method create_metadata should have return type annotation" - def test_create_metadata_exists(self): - """Test that create_metadata method exists with correct signature.""" + def test_finalize_upload_exists(self): + """Test that finalize_upload method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "create_metadata", None) + method = getattr(MediaClient, "finalize_upload", None) assert ( method is not None - ), f"Method create_metadata does not exist on MediaClient" + ), f"Method finalize_upload does not exist on MediaClient" # Check method is callable - assert callable(method), f"create_metadata is not callable" + assert callable(method), f"finalize_upload is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"create_metadata should have at least 'self' parameter" + ), f"finalize_upload should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "id", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from create_metadata" + ), f"Required parameter '{required_param}' missing from finalize_upload" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -426,46 +423,42 @@ def test_create_metadata_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_create_metadata_return_annotation(self): - """Test that create_metadata has proper return type annotation.""" - method = getattr(MediaClient, "create_metadata") + def test_finalize_upload_return_annotation(self): + """Test that finalize_upload has proper return type annotation.""" + method = getattr(MediaClient, "finalize_upload") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method create_metadata should have return type annotation" + ), f"Method finalize_upload should have return type annotation" - def test_get_upload_status_exists(self): - """Test that get_upload_status method exists with correct signature.""" + def test_get_by_key_exists(self): + """Test that get_by_key method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "get_upload_status", None) - assert ( - method is not None - ), f"Method get_upload_status does not exist on MediaClient" + method = getattr(MediaClient, "get_by_key", None) + assert method is not None, f"Method get_by_key does not exist on MediaClient" # Check method is callable - assert callable(method), f"get_upload_status is not callable" + assert callable(method), f"get_by_key is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_upload_status should have at least 'self' parameter" + assert len(params) >= 1, f"get_by_key should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "media_id", + "media_key", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_upload_status" + ), f"Required parameter '{required_param}' missing from get_by_key" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "command", + "media.fields", ] for optional_param in optional_params: if optional_param in params: @@ -475,39 +468,46 @@ def test_get_upload_status_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_upload_status_return_annotation(self): - """Test that get_upload_status has proper return type annotation.""" - method = getattr(MediaClient, "get_upload_status") + def test_get_by_key_return_annotation(self): + """Test that get_by_key has proper return type annotation.""" + method = getattr(MediaClient, "get_by_key") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_upload_status should have return type annotation" + ), f"Method get_by_key should have return type annotation" - def test_upload_exists(self): - """Test that upload method exists with correct signature.""" + def test_get_analytics_exists(self): + """Test that get_analytics method exists with correct signature.""" # Check method exists - method = getattr(MediaClient, "upload", None) - assert method is not None, f"Method upload does not exist on MediaClient" + method = getattr(MediaClient, "get_analytics", None) + assert method is not None, f"Method get_analytics does not exist on MediaClient" # Check method is callable - assert callable(method), f"upload is not callable" + assert callable(method), f"get_analytics is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"upload should have at least 'self' parameter" + assert len(params) >= 1, f"get_analytics should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "media_keys", + "end_time", + "start_time", + "granularity", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from upload" + ), f"Required parameter '{required_param}' missing from get_analytics" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "media_analytics.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -516,30 +516,30 @@ def test_upload_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_upload_return_annotation(self): - """Test that upload has proper return type annotation.""" - method = getattr(MediaClient, "upload") + def test_get_analytics_return_annotation(self): + """Test that get_analytics has proper return type annotation.""" + method = getattr(MediaClient, "get_analytics") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method upload should have return type annotation" + ), f"Method get_analytics should have return type annotation" def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ + "get_upload_status", + "upload", "create_subtitles", "delete_subtitles", - "get_analytics", + "initialize_upload", "get_by_keys", - "get_by_key", - "finalize_upload", "append_upload", - "initialize_upload", "create_metadata", - "get_upload_status", - "upload", + "finalize_upload", + "get_by_key", + "get_analytics", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/news/__init__.py b/xdk/python/tests/news/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/xdk/python/tests/news/test_contracts.py b/xdk/python/tests/news/test_contracts.py new file mode 100644 index 00000000..964ac823 --- /dev/null +++ b/xdk/python/tests/news/test_contracts.py @@ -0,0 +1,261 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +""" +Auto-generated contract tests for {"class_name": "News", "display_name": "news", "import_name": "news", "original": ["news"], "property_name": "news"} client. + +This module contains tests that validate the request/response contracts +of the {"class_name": "News", "display_name": "news", "import_name": "news", "original": ["news"], "property_name": "news"} client against the OpenAPI specification. + +Generated automatically - do not edit manually. +""" + +import pytest +import json +from unittest.mock import Mock, patch +from xdk.news.client import NewsClient +from xdk import Client + + +class TestNewsContracts: + """Test the API contracts of NewsClient.""" + + + def setup_class(self): + """Set up test fixtures.""" + self.client = Client(base_url="https://api.example.com") + self.news_client = getattr(self.client, "news") + + + def test_search_request_structure(self): + """Test search request structure.""" + # Mock the session to capture request details + with patch.object(self.client, "session") as mock_session: + mock_response = Mock() + mock_response.status_code = 200 + mock_response.json.return_value = { + "data": None, + } + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + # Prepare test parameters + kwargs = {} + # Add required parameters + kwargs["query"] = "test_query" + # Add request body if required + # Call the method + try: + method = getattr(self.news_client, "search") + result = method(**kwargs) + # Check if this is a streaming operation (returns Generator) + import types + is_streaming = isinstance(result, types.GeneratorType) + if is_streaming: + # For streaming operations, we need to set up the mock to handle streaming + # Mock the streaming response + mock_streaming_response = Mock() + mock_streaming_response.status_code = 200 + mock_streaming_response.raise_for_status.return_value = None + mock_streaming_response.__enter__ = Mock( + return_value=mock_streaming_response + ) + mock_streaming_response.__exit__ = Mock(return_value=None) + # Mock iter_content to yield some test data + test_data = '{"data": "test"}\n' + mock_streaming_response.iter_content.return_value = [test_data] + # Update the session mock to return our streaming response + mock_session.get.return_value = mock_streaming_response + # Consume the generator to trigger the HTTP request + try: + next(result) + except StopIteration: + pass # Expected when stream ends + except Exception: + pass # Ignore other exceptions in test data processing + # Verify the request was made + mock_session.get.assert_called_once() + # Verify request structure + call_args = mock_session.get.call_args + # Check URL structure + called_url = ( + call_args[0][0] if call_args[0] else call_args[1].get("url", "") + ) + expected_path = "/2/news/search" + assert expected_path.replace("{", "").replace( + "}", "" + ) in called_url or any( + param in called_url for param in ["test_", "42"] + ), f"URL should contain path template elements: {called_url}" + # Verify response structure + if is_streaming: + # For streaming, verify we got a generator + assert isinstance( + result, types.GeneratorType + ), "Streaming method should return a generator" + else: + # For regular operations, verify we got a result + assert result is not None, "Method should return a result" + except Exception as e: + pytest.fail(f"Contract test failed for search: {e}") + + + def test_search_required_parameters(self): + """Test that search handles parameters correctly.""" + method = getattr(self.news_client, "search") + # Test with missing required parameters - mock the request to avoid network calls + with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) + mock_response = Mock() + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") + mock_session.get.return_value = mock_response + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): + method() + + + def test_search_response_structure(self): + """Test search response structure validation.""" + with patch.object(self.client, "session") as mock_session: + # Create mock response with expected structure + mock_response_data = { + "data": None, + } + mock_response = Mock() + mock_response.status_code = 200 + mock_response.json.return_value = mock_response_data + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + # Prepare minimal valid parameters + kwargs = {} + kwargs["query"] = "test_value" + # Add request body if required + # Call method and verify response structure + method = getattr(self.news_client, "search") + result = method(**kwargs) + # Verify response object has expected attributes + # Optional field - just check it doesn't cause errors if accessed + try: + getattr(result, "data", None) + except Exception as e: + pytest.fail( + f"Accessing optional field 'data' should not cause errors: {e}" + ) + + + def test_get_request_structure(self): + """Test get request structure.""" + # Mock the session to capture request details + with patch.object(self.client, "session") as mock_session: + mock_response = Mock() + mock_response.status_code = 200 + mock_response.json.return_value = { + "data": None, + } + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + # Prepare test parameters + kwargs = {} + # Add required parameters + kwargs["id"] = "test_value" + # Add request body if required + # Call the method + try: + method = getattr(self.news_client, "get") + result = method(**kwargs) + # Check if this is a streaming operation (returns Generator) + import types + is_streaming = isinstance(result, types.GeneratorType) + if is_streaming: + # For streaming operations, we need to set up the mock to handle streaming + # Mock the streaming response + mock_streaming_response = Mock() + mock_streaming_response.status_code = 200 + mock_streaming_response.raise_for_status.return_value = None + mock_streaming_response.__enter__ = Mock( + return_value=mock_streaming_response + ) + mock_streaming_response.__exit__ = Mock(return_value=None) + # Mock iter_content to yield some test data + test_data = '{"data": "test"}\n' + mock_streaming_response.iter_content.return_value = [test_data] + # Update the session mock to return our streaming response + mock_session.get.return_value = mock_streaming_response + # Consume the generator to trigger the HTTP request + try: + next(result) + except StopIteration: + pass # Expected when stream ends + except Exception: + pass # Ignore other exceptions in test data processing + # Verify the request was made + mock_session.get.assert_called_once() + # Verify request structure + call_args = mock_session.get.call_args + # Check URL structure + called_url = ( + call_args[0][0] if call_args[0] else call_args[1].get("url", "") + ) + expected_path = "/2/news/{id}" + assert expected_path.replace("{", "").replace( + "}", "" + ) in called_url or any( + param in called_url for param in ["test_", "42"] + ), f"URL should contain path template elements: {called_url}" + # Verify response structure + if is_streaming: + # For streaming, verify we got a generator + assert isinstance( + result, types.GeneratorType + ), "Streaming method should return a generator" + else: + # For regular operations, verify we got a result + assert result is not None, "Method should return a result" + except Exception as e: + pytest.fail(f"Contract test failed for get: {e}") + + + def test_get_required_parameters(self): + """Test that get handles parameters correctly.""" + method = getattr(self.news_client, "get") + # Test with missing required parameters - mock the request to avoid network calls + with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) + mock_response = Mock() + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") + mock_session.get.return_value = mock_response + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): + method() + + + def test_get_response_structure(self): + """Test get response structure validation.""" + with patch.object(self.client, "session") as mock_session: + # Create mock response with expected structure + mock_response_data = { + "data": None, + } + mock_response = Mock() + mock_response.status_code = 200 + mock_response.json.return_value = mock_response_data + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + # Prepare minimal valid parameters + kwargs = {} + kwargs["id"] = "test" + # Add request body if required + # Call method and verify response structure + method = getattr(self.news_client, "get") + result = method(**kwargs) + # Verify response object has expected attributes + # Optional field - just check it doesn't cause errors if accessed + try: + getattr(result, "data", None) + except Exception as e: + pytest.fail( + f"Accessing optional field 'data' should not cause errors: {e}" + ) diff --git a/xdk/python/tests/news/test_generic.py b/xdk/python/tests/news/test_generic.py new file mode 100644 index 00000000..04ad662d --- /dev/null +++ b/xdk/python/tests/news/test_generic.py @@ -0,0 +1,125 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +""" +Auto-generated generic tests for {"class_name": "News", "display_name": "news", "import_name": "news", "original": ["news"], "property_name": "news"} client. + +This module contains general tests that validate the overall client +functionality, imports, error handling, and common behavior patterns +that apply across all operations without being operation-specific. + +Generated automatically - do not edit manually. +""" + +import pytest +import inspect +from unittest.mock import Mock, patch +from xdk.news.client import NewsClient +from xdk import Client + + +class TestNewsGeneric: + """Generic tests for NewsClient.""" + + + def setup_class(self): + """Set up test fixtures.""" + self.client = Client(base_url="https://api.example.com") + self.news_client = getattr(self.client, "news") + + + def test_client_exists(self): + """Test that NewsClient class exists and is importable.""" + assert NewsClient is not None + assert hasattr(NewsClient, "__name__") + assert NewsClient.__name__ == "NewsClient" + + + def test_client_initialization(self): + """Test that NewsClient can be initialized properly.""" + assert self.news_client is not None + assert isinstance(self.news_client, NewsClient) + + + def test_imports_work(self): + """Test that all expected imports work correctly.""" + expected_imports = ["typing", "requests", "pydantic"] + for import_name in expected_imports: + try: + __import__(import_name) + except ImportError as e: + pytest.fail(f"Expected import '{import_name}' failed: {e}") + + + def test_error_responses_handling(self): + """Test that error responses are handled correctly across all methods.""" + with patch.object(self.client, "session") as mock_session: + # Test 404 response + mock_response = Mock() + mock_response.status_code = 404 + mock_response.raise_for_status.side_effect = Exception("Not Found") + mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response + mock_session.put.return_value = mock_response + mock_session.delete.return_value = mock_response + # Get first available method for testing error handling + client_methods = [ + name + for name in dir(NewsClient) + if not name.startswith("_") and callable(getattr(NewsClient, name)) + ] + if client_methods: + method_name = client_methods[0] + method = getattr(self.news_client, method_name) + # Try calling the method and expect an exception + with pytest.raises(Exception): + try: + # Try with no args first + method() + except TypeError: + # If it needs args, try with basic test args + try: + method("test_id") + except TypeError: + # If it needs more specific args, try with kwargs + method(id="test_id", query="test") + + + def test_client_has_expected_base_functionality(self): + """Test that the client has expected base functionality.""" + # Should be able to access the client through main Client + assert hasattr(self.client, "news") + # Client should have standard Python object features + assert hasattr(self.news_client, "__class__") + assert hasattr(self.news_client, "__dict__") + # Should have at least one public method + public_methods = [ + name + for name in dir(self.news_client) + if not name.startswith("_") and callable(getattr(self.news_client, name)) + ] + assert ( + len(public_methods) > 0 + ), f"NewsClient should have at least one public method" + + + def test_client_method_signatures_are_valid(self): + """Test that all client methods have valid Python signatures.""" + public_methods = [ + name + for name in dir(NewsClient) + if not name.startswith("_") and callable(getattr(NewsClient, name)) + ] + for method_name in public_methods: + method = getattr(NewsClient, method_name) + # Should be able to get signature without error + try: + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have 'self' as first parameter (if it's an instance method) + if params: + assert ( + params[0] == "self" + ), f"Method {method_name} should have 'self' as first parameter" + except (ValueError, TypeError) as e: + pytest.fail(f"Method {method_name} has invalid signature: {e}") diff --git a/xdk/python/tests/news/test_structure.py b/xdk/python/tests/news/test_structure.py new file mode 100644 index 00000000..53e0a39d --- /dev/null +++ b/xdk/python/tests/news/test_structure.py @@ -0,0 +1,135 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +""" +Auto-generated structural tests for {"class_name": "News", "display_name": "news", "import_name": "news", "original": ["news"], "property_name": "news"} client. + +This module contains tests that validate the structure and API surface +of the {"class_name": "News", "display_name": "news", "import_name": "news", "original": ["news"], "property_name": "news"} client. These tests ensure that all expected methods +exist, have correct signatures, and proper type annotations for robust API contracts. + +Generated automatically - do not edit manually. +""" + +import pytest +import inspect +from typing import get_type_hints +from xdk.news.client import NewsClient +from xdk import Client + + +class TestNewsStructure: + """Test the structure of NewsClient.""" + + + def setup_class(self): + """Set up test fixtures.""" + self.client = Client(base_url="https://api.example.com") + self.news_client = getattr(self.client, "news") + + + def test_search_exists(self): + """Test that search method exists with correct signature.""" + # Check method exists + method = getattr(NewsClient, "search", None) + assert method is not None, f"Method search does not exist on NewsClient" + # Check method is callable + assert callable(method), f"search is not callable" + # Check method signature + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have 'self' as first parameter + assert len(params) >= 1, f"search should have at least 'self' parameter" + assert ( + params[0] == "self" + ), f"First parameter should be 'self', got '{params[0]}'" + # Check required parameters exist (excluding 'self') + required_params = [ + "query", + ] + for required_param in required_params: + assert ( + required_param in params + ), f"Required parameter '{required_param}' missing from search" + # Check optional parameters have defaults (excluding 'self') + optional_params = [ + "max_results", + "max_age_hours", + "news.fields", + ] + for optional_param in optional_params: + if optional_param in params: + param_obj = sig.parameters[optional_param] + assert ( + param_obj.default is not inspect.Parameter.empty + ), f"Optional parameter '{optional_param}' should have a default value" + + + def test_search_return_annotation(self): + """Test that search has proper return type annotation.""" + method = getattr(NewsClient, "search") + sig = inspect.signature(method) + # Check return annotation exists + assert ( + sig.return_annotation is not inspect.Signature.empty + ), f"Method search should have return type annotation" + + + def test_get_exists(self): + """Test that get method exists with correct signature.""" + # Check method exists + method = getattr(NewsClient, "get", None) + assert method is not None, f"Method get does not exist on NewsClient" + # Check method is callable + assert callable(method), f"get is not callable" + # Check method signature + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have 'self' as first parameter + assert len(params) >= 1, f"get should have at least 'self' parameter" + assert ( + params[0] == "self" + ), f"First parameter should be 'self', got '{params[0]}'" + # Check required parameters exist (excluding 'self') + required_params = [ + "id", + ] + for required_param in required_params: + assert ( + required_param in params + ), f"Required parameter '{required_param}' missing from get" + # Check optional parameters have defaults (excluding 'self') + optional_params = [ + "news.fields", + ] + for optional_param in optional_params: + if optional_param in params: + param_obj = sig.parameters[optional_param] + assert ( + param_obj.default is not inspect.Parameter.empty + ), f"Optional parameter '{optional_param}' should have a default value" + + + def test_get_return_annotation(self): + """Test that get has proper return type annotation.""" + method = getattr(NewsClient, "get") + sig = inspect.signature(method) + # Check return annotation exists + assert ( + sig.return_annotation is not inspect.Signature.empty + ), f"Method get should have return type annotation" + + + def test_all_expected_methods_exist(self): + """Test that all expected methods exist on the client.""" + expected_methods = [ + "search", + "get", + ] + for expected_method in expected_methods: + assert hasattr( + NewsClient, expected_method + ), f"Expected method '{expected_method}' not found on NewsClient" + assert callable( + getattr(NewsClient, expected_method) + ), f"'{expected_method}' exists but is not callable" diff --git a/xdk/python/tests/posts/test_contracts.py b/xdk/python/tests/posts/test_contracts.py index 571a613e..78f38f59 100644 --- a/xdk/python/tests/posts/test_contracts.py +++ b/xdk/python/tests/posts/test_contracts.py @@ -144,8 +144,8 @@ def test_get_quoted_response_structure(self): ) - def test_get_counts_all_request_structure(self): - """Test get_counts_all request structure.""" + def test_get_analytics_request_structure(self): + """Test get_analytics request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -158,11 +158,14 @@ def test_get_counts_all_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["query"] = "test_query" + kwargs["ids"] = ["test_item"] + kwargs["end_time"] = "test_end_time" + kwargs["start_time"] = "test_start_time" + kwargs["granularity"] = "test_granularity" # Add request body if required # Call the method try: - method = getattr(self.posts_client, "get_counts_all") + method = getattr(self.posts_client, "get_analytics") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -197,7 +200,7 @@ def test_get_counts_all_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/counts/all" + expected_path = "/2/tweets/analytics" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -213,12 +216,12 @@ def test_get_counts_all_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_counts_all: {e}") + pytest.fail(f"Contract test failed for get_analytics: {e}") - def test_get_counts_all_required_parameters(self): - """Test that get_counts_all handles parameters correctly.""" - method = getattr(self.posts_client, "get_counts_all") + def test_get_analytics_required_parameters(self): + """Test that get_analytics handles parameters correctly.""" + method = getattr(self.posts_client, "get_analytics") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -232,8 +235,8 @@ def test_get_counts_all_required_parameters(self): method() - def test_get_counts_all_response_structure(self): - """Test get_counts_all response structure validation.""" + def test_get_analytics_response_structure(self): + """Test get_analytics response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -246,10 +249,13 @@ def test_get_counts_all_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["query"] = "test_value" + kwargs["ids"] = ["test"] + kwargs["end_time"] = "test_value" + kwargs["start_time"] = "test_value" + kwargs["granularity"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "get_counts_all") + method = getattr(self.posts_client, "get_analytics") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -261,8 +267,8 @@ def test_get_counts_all_response_structure(self): ) - def test_get_by_id_request_structure(self): - """Test get_by_id request structure.""" + def test_hide_reply_request_structure(self): + """Test hide_reply request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -271,15 +277,19 @@ def test_get_by_id_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.put.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["tweet_id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.posts.models import HideReplyRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = HideReplyRequest() # Call the method try: - method = getattr(self.posts_client, "get_by_id") + method = getattr(self.posts_client, "hide_reply") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -298,7 +308,7 @@ def test_get_by_id_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.put.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -307,14 +317,14 @@ def test_get_by_id_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.put.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.put.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/{id}" + expected_path = "/2/tweets/{tweet_id}/hidden" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -330,12 +340,12 @@ def test_get_by_id_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_id: {e}") + pytest.fail(f"Contract test failed for hide_reply: {e}") - def test_get_by_id_required_parameters(self): - """Test that get_by_id handles parameters correctly.""" - method = getattr(self.posts_client, "get_by_id") + def test_hide_reply_required_parameters(self): + """Test that hide_reply handles parameters correctly.""" + method = getattr(self.posts_client, "hide_reply") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -343,14 +353,14 @@ def test_get_by_id_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.put.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_by_id_response_structure(self): - """Test get_by_id response structure validation.""" + def test_hide_reply_response_structure(self): + """Test hide_reply response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -360,13 +370,17 @@ def test_get_by_id_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.put.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["tweet_id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.posts.models import HideReplyRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = HideReplyRequest() # Call method and verify response structure - method = getattr(self.posts_client, "get_by_id") + method = getattr(self.posts_client, "hide_reply") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -378,8 +392,8 @@ def test_get_by_id_response_structure(self): ) - def test_delete_request_structure(self): - """Test delete request structure.""" + def test_get_reposted_by_request_structure(self): + """Test get_reposted_by request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -388,7 +402,7 @@ def test_delete_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters @@ -396,7 +410,7 @@ def test_delete_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.posts_client, "delete") + method = getattr(self.posts_client, "get_reposted_by") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -415,7 +429,7 @@ def test_delete_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -424,14 +438,14 @@ def test_delete_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/{id}" + expected_path = "/2/tweets/{id}/retweeted_by" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -447,12 +461,12 @@ def test_delete_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for delete: {e}") + pytest.fail(f"Contract test failed for get_reposted_by: {e}") - def test_delete_required_parameters(self): - """Test that delete handles parameters correctly.""" - method = getattr(self.posts_client, "delete") + def test_get_reposted_by_required_parameters(self): + """Test that get_reposted_by handles parameters correctly.""" + method = getattr(self.posts_client, "get_reposted_by") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -460,14 +474,14 @@ def test_delete_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_delete_response_structure(self): - """Test delete response structure validation.""" + def test_get_reposted_by_response_structure(self): + """Test get_reposted_by response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -477,13 +491,13 @@ def test_delete_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "delete") + method = getattr(self.posts_client, "get_reposted_by") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -495,8 +509,8 @@ def test_delete_response_structure(self): ) - def test_get_insights28hr_request_structure(self): - """Test get_insights28hr request structure.""" + def test_get_reposts_request_structure(self): + """Test get_reposts request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -509,13 +523,11 @@ def test_get_insights28hr_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["tweet_ids"] = ["test_item"] - kwargs["granularity"] = "test_granularity" - kwargs["requested_metrics"] = ["test_item"] + kwargs["id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.posts_client, "get_insights28hr") + method = getattr(self.posts_client, "get_reposts") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -550,7 +562,7 @@ def test_get_insights28hr_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/insights/28hr" + expected_path = "/2/tweets/{id}/retweets" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -566,12 +578,12 @@ def test_get_insights28hr_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_insights28hr: {e}") + pytest.fail(f"Contract test failed for get_reposts: {e}") - def test_get_insights28hr_required_parameters(self): - """Test that get_insights28hr handles parameters correctly.""" - method = getattr(self.posts_client, "get_insights28hr") + def test_get_reposts_required_parameters(self): + """Test that get_reposts handles parameters correctly.""" + method = getattr(self.posts_client, "get_reposts") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -585,8 +597,8 @@ def test_get_insights28hr_required_parameters(self): method() - def test_get_insights28hr_response_structure(self): - """Test get_insights28hr response structure validation.""" + def test_get_reposts_response_structure(self): + """Test get_reposts response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -599,12 +611,10 @@ def test_get_insights28hr_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["tweet_ids"] = ["test"] - kwargs["granularity"] = "test_value" - kwargs["requested_metrics"] = ["test"] + kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "get_insights28hr") + method = getattr(self.posts_client, "get_reposts") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -616,8 +626,8 @@ def test_get_insights28hr_response_structure(self): ) - def test_get_counts_recent_request_structure(self): - """Test get_counts_recent request structure.""" + def test_get_by_ids_request_structure(self): + """Test get_by_ids request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -630,11 +640,11 @@ def test_get_counts_recent_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["query"] = "test_query" + kwargs["ids"] = ["test_item"] # Add request body if required # Call the method try: - method = getattr(self.posts_client, "get_counts_recent") + method = getattr(self.posts_client, "get_by_ids") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -669,7 +679,7 @@ def test_get_counts_recent_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/counts/recent" + expected_path = "/2/tweets" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -685,12 +695,12 @@ def test_get_counts_recent_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_counts_recent: {e}") + pytest.fail(f"Contract test failed for get_by_ids: {e}") - def test_get_counts_recent_required_parameters(self): - """Test that get_counts_recent handles parameters correctly.""" - method = getattr(self.posts_client, "get_counts_recent") + def test_get_by_ids_required_parameters(self): + """Test that get_by_ids handles parameters correctly.""" + method = getattr(self.posts_client, "get_by_ids") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -704,8 +714,8 @@ def test_get_counts_recent_required_parameters(self): method() - def test_get_counts_recent_response_structure(self): - """Test get_counts_recent response structure validation.""" + def test_get_by_ids_response_structure(self): + """Test get_by_ids response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -718,10 +728,10 @@ def test_get_counts_recent_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["query"] = "test_value" + kwargs["ids"] = ["test"] # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "get_counts_recent") + method = getattr(self.posts_client, "get_by_ids") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -733,8 +743,8 @@ def test_get_counts_recent_response_structure(self): ) - def test_search_all_request_structure(self): - """Test search_all request structure.""" + def test_create_request_structure(self): + """Test create request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -743,15 +753,18 @@ def test_search_all_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["query"] = "test_query" # Add request body if required + # Import and create proper request model instance + from xdk.posts.models import CreateRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateRequest() # Call the method try: - method = getattr(self.posts_client, "search_all") + method = getattr(self.posts_client, "create") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -770,7 +783,7 @@ def test_search_all_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -779,14 +792,14 @@ def test_search_all_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/search/all" + expected_path = "/2/tweets" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -802,12 +815,12 @@ def test_search_all_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for search_all: {e}") + pytest.fail(f"Contract test failed for create: {e}") - def test_search_all_required_parameters(self): - """Test that search_all handles parameters correctly.""" - method = getattr(self.posts_client, "search_all") + def test_create_required_parameters(self): + """Test that create handles parameters correctly.""" + method = getattr(self.posts_client, "create") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -815,14 +828,14 @@ def test_search_all_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_search_all_response_structure(self): - """Test search_all response structure validation.""" + def test_create_response_structure(self): + """Test create response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -832,13 +845,16 @@ def test_search_all_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["query"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.posts.models import CreateRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = CreateRequest() # Call method and verify response structure - method = getattr(self.posts_client, "search_all") + method = getattr(self.posts_client, "create") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -850,8 +866,8 @@ def test_search_all_response_structure(self): ) - def test_get_reposted_by_request_structure(self): - """Test get_reposted_by request structure.""" + def test_get_liking_users_request_structure(self): + """Test get_liking_users request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -868,7 +884,7 @@ def test_get_reposted_by_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.posts_client, "get_reposted_by") + method = getattr(self.posts_client, "get_liking_users") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -903,7 +919,7 @@ def test_get_reposted_by_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/{id}/retweeted_by" + expected_path = "/2/tweets/{id}/liking_users" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -919,12 +935,12 @@ def test_get_reposted_by_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_reposted_by: {e}") + pytest.fail(f"Contract test failed for get_liking_users: {e}") - def test_get_reposted_by_required_parameters(self): - """Test that get_reposted_by handles parameters correctly.""" - method = getattr(self.posts_client, "get_reposted_by") + def test_get_liking_users_required_parameters(self): + """Test that get_liking_users handles parameters correctly.""" + method = getattr(self.posts_client, "get_liking_users") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -938,8 +954,8 @@ def test_get_reposted_by_required_parameters(self): method() - def test_get_reposted_by_response_structure(self): - """Test get_reposted_by response structure validation.""" + def test_get_liking_users_response_structure(self): + """Test get_liking_users response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -955,7 +971,7 @@ def test_get_reposted_by_response_structure(self): kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "get_reposted_by") + method = getattr(self.posts_client, "get_liking_users") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -967,8 +983,8 @@ def test_get_reposted_by_response_structure(self): ) - def test_search_recent_request_structure(self): - """Test search_recent request structure.""" + def test_get_counts_recent_request_structure(self): + """Test get_counts_recent request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -985,7 +1001,7 @@ def test_search_recent_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.posts_client, "search_recent") + method = getattr(self.posts_client, "get_counts_recent") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1020,7 +1036,7 @@ def test_search_recent_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/search/recent" + expected_path = "/2/tweets/counts/recent" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1036,12 +1052,12 @@ def test_search_recent_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for search_recent: {e}") + pytest.fail(f"Contract test failed for get_counts_recent: {e}") - def test_search_recent_required_parameters(self): - """Test that search_recent handles parameters correctly.""" - method = getattr(self.posts_client, "search_recent") + def test_get_counts_recent_required_parameters(self): + """Test that get_counts_recent handles parameters correctly.""" + method = getattr(self.posts_client, "get_counts_recent") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1055,8 +1071,8 @@ def test_search_recent_required_parameters(self): method() - def test_search_recent_response_structure(self): - """Test search_recent response structure validation.""" + def test_get_counts_recent_response_structure(self): + """Test get_counts_recent response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1072,7 +1088,7 @@ def test_search_recent_response_structure(self): kwargs["query"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "search_recent") + method = getattr(self.posts_client, "get_counts_recent") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1084,8 +1100,8 @@ def test_search_recent_response_structure(self): ) - def test_get_insights_historical_request_structure(self): - """Test get_insights_historical request structure.""" + def test_get_counts_all_request_structure(self): + """Test get_counts_all request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1098,15 +1114,11 @@ def test_get_insights_historical_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["tweet_ids"] = ["test_item"] - kwargs["end_time"] = "test_end_time" - kwargs["start_time"] = "test_start_time" - kwargs["granularity"] = "test_granularity" - kwargs["requested_metrics"] = ["test_item"] + kwargs["query"] = "test_query" # Add request body if required # Call the method try: - method = getattr(self.posts_client, "get_insights_historical") + method = getattr(self.posts_client, "get_counts_all") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1141,7 +1153,7 @@ def test_get_insights_historical_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/insights/historical" + expected_path = "/2/tweets/counts/all" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1157,12 +1169,12 @@ def test_get_insights_historical_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_insights_historical: {e}") + pytest.fail(f"Contract test failed for get_counts_all: {e}") - def test_get_insights_historical_required_parameters(self): - """Test that get_insights_historical handles parameters correctly.""" - method = getattr(self.posts_client, "get_insights_historical") + def test_get_counts_all_required_parameters(self): + """Test that get_counts_all handles parameters correctly.""" + method = getattr(self.posts_client, "get_counts_all") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1176,8 +1188,8 @@ def test_get_insights_historical_required_parameters(self): method() - def test_get_insights_historical_response_structure(self): - """Test get_insights_historical response structure validation.""" + def test_get_counts_all_response_structure(self): + """Test get_counts_all response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1190,14 +1202,10 @@ def test_get_insights_historical_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["tweet_ids"] = ["test"] - kwargs["end_time"] = "test_value" - kwargs["start_time"] = "test_value" - kwargs["granularity"] = "test_value" - kwargs["requested_metrics"] = ["test"] + kwargs["query"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "get_insights_historical") + method = getattr(self.posts_client, "get_counts_all") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1209,8 +1217,8 @@ def test_get_insights_historical_response_structure(self): ) - def test_get_by_ids_request_structure(self): - """Test get_by_ids request structure.""" + def test_search_all_request_structure(self): + """Test search_all request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1223,11 +1231,11 @@ def test_get_by_ids_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["ids"] = ["test_item"] + kwargs["query"] = "test_query" # Add request body if required # Call the method try: - method = getattr(self.posts_client, "get_by_ids") + method = getattr(self.posts_client, "search_all") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1262,7 +1270,7 @@ def test_get_by_ids_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets" + expected_path = "/2/tweets/search/all" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1278,12 +1286,12 @@ def test_get_by_ids_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_ids: {e}") + pytest.fail(f"Contract test failed for search_all: {e}") - def test_get_by_ids_required_parameters(self): - """Test that get_by_ids handles parameters correctly.""" - method = getattr(self.posts_client, "get_by_ids") + def test_search_all_required_parameters(self): + """Test that search_all handles parameters correctly.""" + method = getattr(self.posts_client, "search_all") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1297,8 +1305,8 @@ def test_get_by_ids_required_parameters(self): method() - def test_get_by_ids_response_structure(self): - """Test get_by_ids response structure validation.""" + def test_search_all_response_structure(self): + """Test search_all response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1311,10 +1319,10 @@ def test_get_by_ids_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["ids"] = ["test"] + kwargs["query"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "get_by_ids") + method = getattr(self.posts_client, "search_all") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1326,8 +1334,8 @@ def test_get_by_ids_response_structure(self): ) - def test_create_request_structure(self): - """Test create request structure.""" + def test_search_recent_request_structure(self): + """Test search_recent request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1336,18 +1344,15 @@ def test_create_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["query"] = "test_query" # Add request body if required - # Import and create proper request model instance - from xdk.posts.models import CreateRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateRequest() # Call the method try: - method = getattr(self.posts_client, "create") + method = getattr(self.posts_client, "search_recent") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1366,7 +1371,7 @@ def test_create_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -1375,14 +1380,14 @@ def test_create_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets" + expected_path = "/2/tweets/search/recent" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1398,12 +1403,12 @@ def test_create_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create: {e}") + pytest.fail(f"Contract test failed for search_recent: {e}") - def test_create_required_parameters(self): - """Test that create handles parameters correctly.""" - method = getattr(self.posts_client, "create") + def test_search_recent_required_parameters(self): + """Test that search_recent handles parameters correctly.""" + method = getattr(self.posts_client, "search_recent") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1411,14 +1416,14 @@ def test_create_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_create_response_structure(self): - """Test create response structure validation.""" + def test_search_recent_response_structure(self): + """Test search_recent response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1428,16 +1433,13 @@ def test_create_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["query"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.posts.models import CreateRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateRequest() # Call method and verify response structure - method = getattr(self.posts_client, "create") + method = getattr(self.posts_client, "search_recent") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1449,8 +1451,8 @@ def test_create_response_structure(self): ) - def test_get_liking_users_request_structure(self): - """Test get_liking_users request structure.""" + def test_get_insights_historical_request_structure(self): + """Test get_insights_historical request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1463,11 +1465,15 @@ def test_get_liking_users_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["tweet_ids"] = ["test_item"] + kwargs["end_time"] = "test_end_time" + kwargs["start_time"] = "test_start_time" + kwargs["granularity"] = "test_granularity" + kwargs["requested_metrics"] = ["test_item"] # Add request body if required # Call the method try: - method = getattr(self.posts_client, "get_liking_users") + method = getattr(self.posts_client, "get_insights_historical") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1502,7 +1508,7 @@ def test_get_liking_users_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/{id}/liking_users" + expected_path = "/2/insights/historical" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1518,12 +1524,12 @@ def test_get_liking_users_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_liking_users: {e}") + pytest.fail(f"Contract test failed for get_insights_historical: {e}") - def test_get_liking_users_required_parameters(self): - """Test that get_liking_users handles parameters correctly.""" - method = getattr(self.posts_client, "get_liking_users") + def test_get_insights_historical_required_parameters(self): + """Test that get_insights_historical handles parameters correctly.""" + method = getattr(self.posts_client, "get_insights_historical") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1537,8 +1543,8 @@ def test_get_liking_users_required_parameters(self): method() - def test_get_liking_users_response_structure(self): - """Test get_liking_users response structure validation.""" + def test_get_insights_historical_response_structure(self): + """Test get_insights_historical response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1551,10 +1557,14 @@ def test_get_liking_users_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["tweet_ids"] = ["test"] + kwargs["end_time"] = "test_value" + kwargs["start_time"] = "test_value" + kwargs["granularity"] = "test_value" + kwargs["requested_metrics"] = ["test"] # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "get_liking_users") + method = getattr(self.posts_client, "get_insights_historical") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1566,8 +1576,8 @@ def test_get_liking_users_response_structure(self): ) - def test_get_analytics_request_structure(self): - """Test get_analytics request structure.""" + def test_get_by_id_request_structure(self): + """Test get_by_id request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1580,14 +1590,11 @@ def test_get_analytics_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["ids"] = ["test_item"] - kwargs["end_time"] = "test_end_time" - kwargs["start_time"] = "test_start_time" - kwargs["granularity"] = "test_granularity" + kwargs["id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.posts_client, "get_analytics") + method = getattr(self.posts_client, "get_by_id") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1622,7 +1629,7 @@ def test_get_analytics_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/analytics" + expected_path = "/2/tweets/{id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1638,12 +1645,12 @@ def test_get_analytics_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_analytics: {e}") + pytest.fail(f"Contract test failed for get_by_id: {e}") - def test_get_analytics_required_parameters(self): - """Test that get_analytics handles parameters correctly.""" - method = getattr(self.posts_client, "get_analytics") + def test_get_by_id_required_parameters(self): + """Test that get_by_id handles parameters correctly.""" + method = getattr(self.posts_client, "get_by_id") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1657,8 +1664,8 @@ def test_get_analytics_required_parameters(self): method() - def test_get_analytics_response_structure(self): - """Test get_analytics response structure validation.""" + def test_get_by_id_response_structure(self): + """Test get_by_id response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1671,13 +1678,10 @@ def test_get_analytics_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["ids"] = ["test"] - kwargs["end_time"] = "test_value" - kwargs["start_time"] = "test_value" - kwargs["granularity"] = "test_value" + kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "get_analytics") + method = getattr(self.posts_client, "get_by_id") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1689,8 +1693,8 @@ def test_get_analytics_response_structure(self): ) - def test_hide_reply_request_structure(self): - """Test hide_reply request structure.""" + def test_delete_request_structure(self): + """Test delete request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1699,19 +1703,15 @@ def test_hide_reply_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.put.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["tweet_id"] = "test_value" + kwargs["id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.posts.models import HideReplyRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = HideReplyRequest() # Call the method try: - method = getattr(self.posts_client, "hide_reply") + method = getattr(self.posts_client, "delete") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1730,7 +1730,7 @@ def test_hide_reply_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.put.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -1739,14 +1739,14 @@ def test_hide_reply_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.put.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.put.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/{tweet_id}/hidden" + expected_path = "/2/tweets/{id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1762,12 +1762,12 @@ def test_hide_reply_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for hide_reply: {e}") + pytest.fail(f"Contract test failed for delete: {e}") - def test_hide_reply_required_parameters(self): - """Test that hide_reply handles parameters correctly.""" - method = getattr(self.posts_client, "hide_reply") + def test_delete_required_parameters(self): + """Test that delete handles parameters correctly.""" + method = getattr(self.posts_client, "delete") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1775,14 +1775,14 @@ def test_hide_reply_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.put.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_hide_reply_response_structure(self): - """Test hide_reply response structure validation.""" + def test_delete_response_structure(self): + """Test delete response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1792,17 +1792,13 @@ def test_hide_reply_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.put.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["tweet_id"] = "test" + kwargs["id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.posts.models import HideReplyRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = HideReplyRequest() # Call method and verify response structure - method = getattr(self.posts_client, "hide_reply") + method = getattr(self.posts_client, "delete") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1814,8 +1810,8 @@ def test_hide_reply_response_structure(self): ) - def test_get_reposts_request_structure(self): - """Test get_reposts request structure.""" + def test_get_insights28hr_request_structure(self): + """Test get_insights28hr request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1828,11 +1824,13 @@ def test_get_reposts_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["tweet_ids"] = ["test_item"] + kwargs["granularity"] = "test_granularity" + kwargs["requested_metrics"] = ["test_item"] # Add request body if required # Call the method try: - method = getattr(self.posts_client, "get_reposts") + method = getattr(self.posts_client, "get_insights28hr") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1867,7 +1865,7 @@ def test_get_reposts_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/{id}/retweets" + expected_path = "/2/insights/28hr" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1883,12 +1881,12 @@ def test_get_reposts_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_reposts: {e}") + pytest.fail(f"Contract test failed for get_insights28hr: {e}") - def test_get_reposts_required_parameters(self): - """Test that get_reposts handles parameters correctly.""" - method = getattr(self.posts_client, "get_reposts") + def test_get_insights28hr_required_parameters(self): + """Test that get_insights28hr handles parameters correctly.""" + method = getattr(self.posts_client, "get_insights28hr") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1902,8 +1900,8 @@ def test_get_reposts_required_parameters(self): method() - def test_get_reposts_response_structure(self): - """Test get_reposts response structure validation.""" + def test_get_insights28hr_response_structure(self): + """Test get_insights28hr response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1916,10 +1914,12 @@ def test_get_reposts_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["tweet_ids"] = ["test"] + kwargs["granularity"] = "test_value" + kwargs["requested_metrics"] = ["test"] # Add request body if required # Call method and verify response structure - method = getattr(self.posts_client, "get_reposts") + method = getattr(self.posts_client, "get_insights28hr") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/posts/test_pagination.py b/xdk/python/tests/posts/test_pagination.py index 5e2d67a1..de0f61e2 100644 --- a/xdk/python/tests/posts/test_pagination.py +++ b/xdk/python/tests/posts/test_pagination.py @@ -169,20 +169,20 @@ def test_get_quoted_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_search_all_cursor_creation(self): - """Test that search_all can be used with Cursor.""" - method = getattr(self.posts_client, "search_all") + def test_get_reposted_by_cursor_creation(self): + """Test that get_reposted_by can be used with Cursor.""" + method = getattr(self.posts_client, "get_reposted_by") # Should be able to create cursor without error try: - test_cursor = cursor(method, "test_query", max_results=10) + test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method search_all should support pagination") + pytest.fail(f"Method get_reposted_by should support pagination") - def test_search_all_cursor_pages(self): - """Test pagination with pages() for search_all.""" + def test_get_reposted_by_cursor_pages(self): + """Test pagination with pages() for get_reposted_by.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -203,8 +203,8 @@ def test_search_all_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.posts_client, "search_all") - test_cursor = cursor(method, "test_query", max_results=2) + method = getattr(self.posts_client, "get_reposted_by") + test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" # Verify first page @@ -219,8 +219,8 @@ def test_search_all_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_search_all_cursor_items(self): - """Test pagination with items() for search_all.""" + def test_get_reposted_by_cursor_items(self): + """Test pagination with items() for get_reposted_by.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -239,8 +239,8 @@ def test_search_all_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.posts_client, "search_all") - test_cursor = cursor(method, "test_query", max_results=10) + method = getattr(self.posts_client, "get_reposted_by") + test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" # Verify items have expected structure @@ -250,17 +250,17 @@ def test_search_all_cursor_items(self): ), "Items should have 'id' field" - def test_search_all_pagination_parameters(self): - """Test that pagination parameters are handled correctly for search_all.""" + def test_get_reposted_by_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_reposted_by.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.posts_client, "search_all") + method = getattr(self.posts_client, "get_reposted_by") # Test with max_results parameter - test_cursor = cursor(method, "test_query", max_results=5) + test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request # Verify max_results was passed in request call_args = mock_session.get.call_args @@ -289,7 +289,7 @@ def test_search_all_pagination_parameters(self): mock_response_with_token, second_page_response, ] - test_cursor = cursor(method, "test_query", max_results=1) + test_cursor = cursor(method, "test_value", max_results=1) pages = list(test_cursor.pages(2)) # Should have made 2 requests assert ( @@ -311,20 +311,20 @@ def test_search_all_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_reposted_by_cursor_creation(self): - """Test that get_reposted_by can be used with Cursor.""" - method = getattr(self.posts_client, "get_reposted_by") + def test_get_reposts_cursor_creation(self): + """Test that get_reposts can be used with Cursor.""" + method = getattr(self.posts_client, "get_reposts") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_reposted_by should support pagination") + pytest.fail(f"Method get_reposts should support pagination") - def test_get_reposted_by_cursor_pages(self): - """Test pagination with pages() for get_reposted_by.""" + def test_get_reposts_cursor_pages(self): + """Test pagination with pages() for get_reposts.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -345,7 +345,7 @@ def test_get_reposted_by_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.posts_client, "get_reposted_by") + method = getattr(self.posts_client, "get_reposts") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -361,8 +361,8 @@ def test_get_reposted_by_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_reposted_by_cursor_items(self): - """Test pagination with items() for get_reposted_by.""" + def test_get_reposts_cursor_items(self): + """Test pagination with items() for get_reposts.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -381,7 +381,7 @@ def test_get_reposted_by_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.posts_client, "get_reposted_by") + method = getattr(self.posts_client, "get_reposts") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -392,15 +392,15 @@ def test_get_reposted_by_cursor_items(self): ), "Items should have 'id' field" - def test_get_reposted_by_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_reposted_by.""" + def test_get_reposts_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_reposts.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.posts_client, "get_reposted_by") + method = getattr(self.posts_client, "get_reposts") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -453,20 +453,20 @@ def test_get_reposted_by_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_search_recent_cursor_creation(self): - """Test that search_recent can be used with Cursor.""" - method = getattr(self.posts_client, "search_recent") + def test_get_liking_users_cursor_creation(self): + """Test that get_liking_users can be used with Cursor.""" + method = getattr(self.posts_client, "get_liking_users") # Should be able to create cursor without error try: - test_cursor = cursor(method, "test_query", max_results=10) + test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method search_recent should support pagination") + pytest.fail(f"Method get_liking_users should support pagination") - def test_search_recent_cursor_pages(self): - """Test pagination with pages() for search_recent.""" + def test_get_liking_users_cursor_pages(self): + """Test pagination with pages() for get_liking_users.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -487,8 +487,8 @@ def test_search_recent_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.posts_client, "search_recent") - test_cursor = cursor(method, "test_query", max_results=2) + method = getattr(self.posts_client, "get_liking_users") + test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" # Verify first page @@ -503,8 +503,8 @@ def test_search_recent_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_search_recent_cursor_items(self): - """Test pagination with items() for search_recent.""" + def test_get_liking_users_cursor_items(self): + """Test pagination with items() for get_liking_users.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -523,8 +523,8 @@ def test_search_recent_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.posts_client, "search_recent") - test_cursor = cursor(method, "test_query", max_results=10) + method = getattr(self.posts_client, "get_liking_users") + test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" # Verify items have expected structure @@ -534,17 +534,17 @@ def test_search_recent_cursor_items(self): ), "Items should have 'id' field" - def test_search_recent_pagination_parameters(self): - """Test that pagination parameters are handled correctly for search_recent.""" + def test_get_liking_users_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_liking_users.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.posts_client, "search_recent") + method = getattr(self.posts_client, "get_liking_users") # Test with max_results parameter - test_cursor = cursor(method, "test_query", max_results=5) + test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request # Verify max_results was passed in request call_args = mock_session.get.call_args @@ -573,7 +573,7 @@ def test_search_recent_pagination_parameters(self): mock_response_with_token, second_page_response, ] - test_cursor = cursor(method, "test_query", max_results=1) + test_cursor = cursor(method, "test_value", max_results=1) pages = list(test_cursor.pages(2)) # Should have made 2 requests assert ( @@ -595,20 +595,20 @@ def test_search_recent_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_liking_users_cursor_creation(self): - """Test that get_liking_users can be used with Cursor.""" - method = getattr(self.posts_client, "get_liking_users") + def test_search_all_cursor_creation(self): + """Test that search_all can be used with Cursor.""" + method = getattr(self.posts_client, "search_all") # Should be able to create cursor without error try: - test_cursor = cursor(method, "test_value", max_results=10) + test_cursor = cursor(method, "test_query", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_liking_users should support pagination") + pytest.fail(f"Method search_all should support pagination") - def test_get_liking_users_cursor_pages(self): - """Test pagination with pages() for get_liking_users.""" + def test_search_all_cursor_pages(self): + """Test pagination with pages() for search_all.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -629,8 +629,8 @@ def test_get_liking_users_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.posts_client, "get_liking_users") - test_cursor = cursor(method, "test_value", max_results=2) + method = getattr(self.posts_client, "search_all") + test_cursor = cursor(method, "test_query", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" # Verify first page @@ -645,8 +645,8 @@ def test_get_liking_users_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_liking_users_cursor_items(self): - """Test pagination with items() for get_liking_users.""" + def test_search_all_cursor_items(self): + """Test pagination with items() for search_all.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -665,8 +665,8 @@ def test_get_liking_users_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.posts_client, "get_liking_users") - test_cursor = cursor(method, "test_value", max_results=10) + method = getattr(self.posts_client, "search_all") + test_cursor = cursor(method, "test_query", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" # Verify items have expected structure @@ -676,17 +676,17 @@ def test_get_liking_users_cursor_items(self): ), "Items should have 'id' field" - def test_get_liking_users_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_liking_users.""" + def test_search_all_pagination_parameters(self): + """Test that pagination parameters are handled correctly for search_all.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.posts_client, "get_liking_users") + method = getattr(self.posts_client, "search_all") # Test with max_results parameter - test_cursor = cursor(method, "test_value", max_results=5) + test_cursor = cursor(method, "test_query", max_results=5) list(test_cursor.pages(1)) # Trigger one request # Verify max_results was passed in request call_args = mock_session.get.call_args @@ -715,7 +715,7 @@ def test_get_liking_users_pagination_parameters(self): mock_response_with_token, second_page_response, ] - test_cursor = cursor(method, "test_value", max_results=1) + test_cursor = cursor(method, "test_query", max_results=1) pages = list(test_cursor.pages(2)) # Should have made 2 requests assert ( @@ -737,20 +737,20 @@ def test_get_liking_users_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_reposts_cursor_creation(self): - """Test that get_reposts can be used with Cursor.""" - method = getattr(self.posts_client, "get_reposts") + def test_search_recent_cursor_creation(self): + """Test that search_recent can be used with Cursor.""" + method = getattr(self.posts_client, "search_recent") # Should be able to create cursor without error try: - test_cursor = cursor(method, "test_value", max_results=10) + test_cursor = cursor(method, "test_query", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_reposts should support pagination") + pytest.fail(f"Method search_recent should support pagination") - def test_get_reposts_cursor_pages(self): - """Test pagination with pages() for get_reposts.""" + def test_search_recent_cursor_pages(self): + """Test pagination with pages() for search_recent.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -771,8 +771,8 @@ def test_get_reposts_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.posts_client, "get_reposts") - test_cursor = cursor(method, "test_value", max_results=2) + method = getattr(self.posts_client, "search_recent") + test_cursor = cursor(method, "test_query", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" # Verify first page @@ -787,8 +787,8 @@ def test_get_reposts_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_reposts_cursor_items(self): - """Test pagination with items() for get_reposts.""" + def test_search_recent_cursor_items(self): + """Test pagination with items() for search_recent.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -807,8 +807,8 @@ def test_get_reposts_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.posts_client, "get_reposts") - test_cursor = cursor(method, "test_value", max_results=10) + method = getattr(self.posts_client, "search_recent") + test_cursor = cursor(method, "test_query", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" # Verify items have expected structure @@ -818,17 +818,17 @@ def test_get_reposts_cursor_items(self): ), "Items should have 'id' field" - def test_get_reposts_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_reposts.""" + def test_search_recent_pagination_parameters(self): + """Test that pagination parameters are handled correctly for search_recent.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.posts_client, "get_reposts") + method = getattr(self.posts_client, "search_recent") # Test with max_results parameter - test_cursor = cursor(method, "test_value", max_results=5) + test_cursor = cursor(method, "test_query", max_results=5) list(test_cursor.pages(1)) # Trigger one request # Verify max_results was passed in request call_args = mock_session.get.call_args @@ -857,7 +857,7 @@ def test_get_reposts_pagination_parameters(self): mock_response_with_token, second_page_response, ] - test_cursor = cursor(method, "test_value", max_results=1) + test_cursor = cursor(method, "test_query", max_results=1) pages = list(test_cursor.pages(2)) # Should have made 2 requests assert ( diff --git a/xdk/python/tests/posts/test_structure.py b/xdk/python/tests/posts/test_structure.py index 6fc5f6e9..4cc55e8f 100644 --- a/xdk/python/tests/posts/test_structure.py +++ b/xdk/python/tests/posts/test_structure.py @@ -100,41 +100,35 @@ def test_get_quoted_pagination_params(self): ), f"Paginated method get_quoted should have pagination parameters" - def test_get_counts_all_exists(self): - """Test that get_counts_all method exists with correct signature.""" + def test_get_analytics_exists(self): + """Test that get_analytics method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "get_counts_all", None) - assert ( - method is not None - ), f"Method get_counts_all does not exist on PostsClient" + method = getattr(PostsClient, "get_analytics", None) + assert method is not None, f"Method get_analytics does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_counts_all is not callable" + assert callable(method), f"get_analytics is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_counts_all should have at least 'self' parameter" + assert len(params) >= 1, f"get_analytics should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "query", + "ids", + "end_time", + "start_time", + "granularity", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_counts_all" + ), f"Required parameter '{required_param}' missing from get_analytics" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "start_time", - "end_time", - "since_id", - "until_id", - "next_token", - "pagination_token", - "granularity", - "search_count.fields", + "analytics.fields", ] for optional_param in optional_params: if optional_param in params: @@ -144,48 +138,41 @@ def test_get_counts_all_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_counts_all_return_annotation(self): - """Test that get_counts_all has proper return type annotation.""" - method = getattr(PostsClient, "get_counts_all") + def test_get_analytics_return_annotation(self): + """Test that get_analytics has proper return type annotation.""" + method = getattr(PostsClient, "get_analytics") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_counts_all should have return type annotation" + ), f"Method get_analytics should have return type annotation" - def test_get_by_id_exists(self): - """Test that get_by_id method exists with correct signature.""" + def test_hide_reply_exists(self): + """Test that hide_reply method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "get_by_id", None) - assert method is not None, f"Method get_by_id does not exist on PostsClient" + method = getattr(PostsClient, "hide_reply", None) + assert method is not None, f"Method hide_reply does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_by_id is not callable" + assert callable(method), f"hide_reply is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_by_id should have at least 'self' parameter" + assert len(params) >= 1, f"hide_reply should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "tweet_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_id" + ), f"Required parameter '{required_param}' missing from hide_reply" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -194,28 +181,32 @@ def test_get_by_id_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_id_return_annotation(self): - """Test that get_by_id has proper return type annotation.""" - method = getattr(PostsClient, "get_by_id") + def test_hide_reply_return_annotation(self): + """Test that hide_reply has proper return type annotation.""" + method = getattr(PostsClient, "hide_reply") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_id should have return type annotation" + ), f"Method hide_reply should have return type annotation" - def test_delete_exists(self): - """Test that delete method exists with correct signature.""" + def test_get_reposted_by_exists(self): + """Test that get_reposted_by method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "delete", None) - assert method is not None, f"Method delete does not exist on PostsClient" + method = getattr(PostsClient, "get_reposted_by", None) + assert ( + method is not None + ), f"Method get_reposted_by does not exist on PostsClient" # Check method is callable - assert callable(method), f"delete is not callable" + assert callable(method), f"get_reposted_by is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"delete should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_reposted_by should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -226,9 +217,15 @@ def test_delete_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from delete" + ), f"Required parameter '{required_param}' missing from get_reposted_by" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "max_results", + "pagination_token", + "user.fields", + "expansions", + "tweet.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -237,48 +234,68 @@ def test_delete_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_delete_return_annotation(self): - """Test that delete has proper return type annotation.""" - method = getattr(PostsClient, "delete") + def test_get_reposted_by_return_annotation(self): + """Test that get_reposted_by has proper return type annotation.""" + method = getattr(PostsClient, "get_reposted_by") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method delete should have return type annotation" + ), f"Method get_reposted_by should have return type annotation" - def test_get_insights28hr_exists(self): - """Test that get_insights28hr method exists with correct signature.""" - # Check method exists - method = getattr(PostsClient, "get_insights28hr", None) + def test_get_reposted_by_pagination_params(self): + """Test that get_reposted_by has pagination parameters.""" + method = getattr(PostsClient, "get_reposted_by") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) assert ( - method is not None - ), f"Method get_insights28hr does not exist on PostsClient" + has_pagination_param + ), f"Paginated method get_reposted_by should have pagination parameters" + + + def test_get_reposts_exists(self): + """Test that get_reposts method exists with correct signature.""" + # Check method exists + method = getattr(PostsClient, "get_reposts", None) + assert method is not None, f"Method get_reposts does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_insights28hr is not callable" + assert callable(method), f"get_reposts is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_insights28hr should have at least 'self' parameter" + assert len(params) >= 1, f"get_reposts should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "tweet_ids", - "granularity", - "requested_metrics", + "id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_insights28hr" + ), f"Required parameter '{required_param}' missing from get_reposts" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "engagement.fields", + "max_results", + "pagination_token", + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -288,53 +305,66 @@ def test_get_insights28hr_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_insights28hr_return_annotation(self): - """Test that get_insights28hr has proper return type annotation.""" - method = getattr(PostsClient, "get_insights28hr") + def test_get_reposts_return_annotation(self): + """Test that get_reposts has proper return type annotation.""" + method = getattr(PostsClient, "get_reposts") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_insights28hr should have return type annotation" + ), f"Method get_reposts should have return type annotation" - def test_get_counts_recent_exists(self): - """Test that get_counts_recent method exists with correct signature.""" - # Check method exists - method = getattr(PostsClient, "get_counts_recent", None) + def test_get_reposts_pagination_params(self): + """Test that get_reposts has pagination parameters.""" + method = getattr(PostsClient, "get_reposts") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) assert ( - method is not None - ), f"Method get_counts_recent does not exist on PostsClient" + has_pagination_param + ), f"Paginated method get_reposts should have pagination parameters" + + + def test_get_by_ids_exists(self): + """Test that get_by_ids method exists with correct signature.""" + # Check method exists + method = getattr(PostsClient, "get_by_ids", None) + assert method is not None, f"Method get_by_ids does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_counts_recent is not callable" + assert callable(method), f"get_by_ids is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_counts_recent should have at least 'self' parameter" + assert len(params) >= 1, f"get_by_ids should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "query", + "ids", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_counts_recent" + ), f"Required parameter '{required_param}' missing from get_by_ids" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "start_time", - "end_time", - "since_id", - "until_id", - "next_token", - "pagination_token", - "granularity", - "search_count.fields", + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -344,56 +374,39 @@ def test_get_counts_recent_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_counts_recent_return_annotation(self): - """Test that get_counts_recent has proper return type annotation.""" - method = getattr(PostsClient, "get_counts_recent") + def test_get_by_ids_return_annotation(self): + """Test that get_by_ids has proper return type annotation.""" + method = getattr(PostsClient, "get_by_ids") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_counts_recent should have return type annotation" + ), f"Method get_by_ids should have return type annotation" - def test_search_all_exists(self): - """Test that search_all method exists with correct signature.""" + def test_create_exists(self): + """Test that create method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "search_all", None) - assert method is not None, f"Method search_all does not exist on PostsClient" + method = getattr(PostsClient, "create", None) + assert method is not None, f"Method create does not exist on PostsClient" # Check method is callable - assert callable(method), f"search_all is not callable" + assert callable(method), f"create is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"search_all should have at least 'self' parameter" + assert len(params) >= 1, f"create should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "query", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from search_all" + ), f"Required parameter '{required_param}' missing from create" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "start_time", - "end_time", - "since_id", - "until_id", - "max_results", - "next_token", - "pagination_token", - "sort_order", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -402,51 +415,32 @@ def test_search_all_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_search_all_return_annotation(self): - """Test that search_all has proper return type annotation.""" - method = getattr(PostsClient, "search_all") + def test_create_return_annotation(self): + """Test that create has proper return type annotation.""" + method = getattr(PostsClient, "create") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method search_all should have return type annotation" - - - def test_search_all_pagination_params(self): - """Test that search_all has pagination parameters.""" - method = getattr(PostsClient, "search_all") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method search_all should have pagination parameters" + ), f"Method create should have return type annotation" - def test_get_reposted_by_exists(self): - """Test that get_reposted_by method exists with correct signature.""" + def test_get_liking_users_exists(self): + """Test that get_liking_users method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "get_reposted_by", None) + method = getattr(PostsClient, "get_liking_users", None) assert ( method is not None - ), f"Method get_reposted_by does not exist on PostsClient" + ), f"Method get_liking_users does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_reposted_by is not callable" + assert callable(method), f"get_liking_users is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_reposted_by should have at least 'self' parameter" + ), f"get_liking_users should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -457,7 +451,7 @@ def test_get_reposted_by_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_reposted_by" + ), f"Required parameter '{required_param}' missing from get_liking_users" # Check optional parameters have defaults (excluding 'self') optional_params = [ "max_results", @@ -474,19 +468,19 @@ def test_get_reposted_by_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_reposted_by_return_annotation(self): - """Test that get_reposted_by has proper return type annotation.""" - method = getattr(PostsClient, "get_reposted_by") + def test_get_liking_users_return_annotation(self): + """Test that get_liking_users has proper return type annotation.""" + method = getattr(PostsClient, "get_liking_users") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_reposted_by should have return type annotation" + ), f"Method get_liking_users should have return type annotation" - def test_get_reposted_by_pagination_params(self): - """Test that get_reposted_by has pagination parameters.""" - method = getattr(PostsClient, "get_reposted_by") + def test_get_liking_users_pagination_params(self): + """Test that get_liking_users has pagination parameters.""" + method = getattr(PostsClient, "get_liking_users") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -500,21 +494,25 @@ def test_get_reposted_by_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method get_reposted_by should have pagination parameters" + ), f"Paginated method get_liking_users should have pagination parameters" - def test_search_recent_exists(self): - """Test that search_recent method exists with correct signature.""" + def test_get_counts_recent_exists(self): + """Test that get_counts_recent method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "search_recent", None) - assert method is not None, f"Method search_recent does not exist on PostsClient" + method = getattr(PostsClient, "get_counts_recent", None) + assert ( + method is not None + ), f"Method get_counts_recent does not exist on PostsClient" # Check method is callable - assert callable(method), f"search_recent is not callable" + assert callable(method), f"get_counts_recent is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"search_recent should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_counts_recent should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -525,23 +523,17 @@ def test_search_recent_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from search_recent" + ), f"Required parameter '{required_param}' missing from get_counts_recent" # Check optional parameters have defaults (excluding 'self') optional_params = [ "start_time", "end_time", "since_id", "until_id", - "max_results", "next_token", "pagination_token", - "sort_order", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", + "granularity", + "search_count.fields", ] for optional_param in optional_params: if optional_param in params: @@ -551,69 +543,51 @@ def test_search_recent_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_search_recent_return_annotation(self): - """Test that search_recent has proper return type annotation.""" - method = getattr(PostsClient, "search_recent") + def test_get_counts_recent_return_annotation(self): + """Test that get_counts_recent has proper return type annotation.""" + method = getattr(PostsClient, "get_counts_recent") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method search_recent should have return type annotation" - - - def test_search_recent_pagination_params(self): - """Test that search_recent has pagination parameters.""" - method = getattr(PostsClient, "search_recent") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method search_recent should have pagination parameters" + ), f"Method get_counts_recent should have return type annotation" - def test_get_insights_historical_exists(self): - """Test that get_insights_historical method exists with correct signature.""" + def test_get_counts_all_exists(self): + """Test that get_counts_all method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "get_insights_historical", None) + method = getattr(PostsClient, "get_counts_all", None) assert ( method is not None - ), f"Method get_insights_historical does not exist on PostsClient" + ), f"Method get_counts_all does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_insights_historical is not callable" + assert callable(method), f"get_counts_all is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_insights_historical should have at least 'self' parameter" + assert len(params) >= 1, f"get_counts_all should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "tweet_ids", - "end_time", - "start_time", - "granularity", - "requested_metrics", + "query", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_insights_historical" + ), f"Required parameter '{required_param}' missing from get_counts_all" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "engagement.fields", + "start_time", + "end_time", + "since_id", + "until_id", + "next_token", + "pagination_token", + "granularity", + "search_count.fields", ] for optional_param in optional_params: if optional_param in params: @@ -623,89 +597,56 @@ def test_get_insights_historical_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_insights_historical_return_annotation(self): - """Test that get_insights_historical has proper return type annotation.""" - method = getattr(PostsClient, "get_insights_historical") + def test_get_counts_all_return_annotation(self): + """Test that get_counts_all has proper return type annotation.""" + method = getattr(PostsClient, "get_counts_all") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_insights_historical should have return type annotation" + ), f"Method get_counts_all should have return type annotation" - def test_get_by_ids_exists(self): - """Test that get_by_ids method exists with correct signature.""" + def test_search_all_exists(self): + """Test that search_all method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "get_by_ids", None) - assert method is not None, f"Method get_by_ids does not exist on PostsClient" + method = getattr(PostsClient, "search_all", None) + assert method is not None, f"Method search_all does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_by_ids is not callable" + assert callable(method), f"search_all is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_by_ids should have at least 'self' parameter" + assert len(params) >= 1, f"search_all should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "ids", + "query", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_ids" + ), f"Required parameter '{required_param}' missing from search_all" # Check optional parameters have defaults (excluding 'self') optional_params = [ + "start_time", + "end_time", + "since_id", + "until_id", + "max_results", + "next_token", + "pagination_token", + "sort_order", "tweet.fields", "expansions", "media.fields", "poll.fields", - "user.fields", - "place.fields", - ] - for optional_param in optional_params: - if optional_param in params: - param_obj = sig.parameters[optional_param] - assert ( - param_obj.default is not inspect.Parameter.empty - ), f"Optional parameter '{optional_param}' should have a default value" - - - def test_get_by_ids_return_annotation(self): - """Test that get_by_ids has proper return type annotation.""" - method = getattr(PostsClient, "get_by_ids") - sig = inspect.signature(method) - # Check return annotation exists - assert ( - sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_ids should have return type annotation" - - - def test_create_exists(self): - """Test that create method exists with correct signature.""" - # Check method exists - method = getattr(PostsClient, "create", None) - assert method is not None, f"Method create does not exist on PostsClient" - # Check method is callable - assert callable(method), f"create is not callable" - # Check method signature - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have 'self' as first parameter - assert len(params) >= 1, f"create should have at least 'self' parameter" - assert ( - params[0] == "self" - ), f"First parameter should be 'self', got '{params[0]}'" - # Check required parameters exist (excluding 'self') - required_params = [] - for required_param in required_params: - assert ( - required_param in params - ), f"Required parameter '{required_param}' missing from create" - # Check optional parameters have defaults (excluding 'self') - optional_params = [] + "user.fields", + "place.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -714,50 +655,74 @@ def test_create_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_create_return_annotation(self): - """Test that create has proper return type annotation.""" - method = getattr(PostsClient, "create") + def test_search_all_return_annotation(self): + """Test that search_all has proper return type annotation.""" + method = getattr(PostsClient, "search_all") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method create should have return type annotation" + ), f"Method search_all should have return type annotation" - def test_get_liking_users_exists(self): - """Test that get_liking_users method exists with correct signature.""" - # Check method exists - method = getattr(PostsClient, "get_liking_users", None) + def test_search_all_pagination_params(self): + """Test that search_all has pagination parameters.""" + method = getattr(PostsClient, "search_all") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) assert ( - method is not None - ), f"Method get_liking_users does not exist on PostsClient" + has_pagination_param + ), f"Paginated method search_all should have pagination parameters" + + + def test_search_recent_exists(self): + """Test that search_recent method exists with correct signature.""" + # Check method exists + method = getattr(PostsClient, "search_recent", None) + assert method is not None, f"Method search_recent does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_liking_users is not callable" + assert callable(method), f"search_recent is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_liking_users should have at least 'self' parameter" + assert len(params) >= 1, f"search_recent should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "query", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_liking_users" + ), f"Required parameter '{required_param}' missing from search_recent" # Check optional parameters have defaults (excluding 'self') optional_params = [ + "start_time", + "end_time", + "since_id", + "until_id", "max_results", + "next_token", "pagination_token", - "user.fields", - "expansions", + "sort_order", "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -767,19 +732,19 @@ def test_get_liking_users_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_liking_users_return_annotation(self): - """Test that get_liking_users has proper return type annotation.""" - method = getattr(PostsClient, "get_liking_users") + def test_search_recent_return_annotation(self): + """Test that search_recent has proper return type annotation.""" + method = getattr(PostsClient, "search_recent") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_liking_users should have return type annotation" + ), f"Method search_recent should have return type annotation" - def test_get_liking_users_pagination_params(self): - """Test that get_liking_users has pagination parameters.""" - method = getattr(PostsClient, "get_liking_users") + def test_search_recent_pagination_params(self): + """Test that search_recent has pagination parameters.""" + method = getattr(PostsClient, "search_recent") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -793,38 +758,43 @@ def test_get_liking_users_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method get_liking_users should have pagination parameters" + ), f"Paginated method search_recent should have pagination parameters" - def test_get_analytics_exists(self): - """Test that get_analytics method exists with correct signature.""" + def test_get_insights_historical_exists(self): + """Test that get_insights_historical method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "get_analytics", None) - assert method is not None, f"Method get_analytics does not exist on PostsClient" + method = getattr(PostsClient, "get_insights_historical", None) + assert ( + method is not None + ), f"Method get_insights_historical does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_analytics is not callable" + assert callable(method), f"get_insights_historical is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_analytics should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_insights_historical should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "ids", + "tweet_ids", "end_time", "start_time", "granularity", + "requested_metrics", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_analytics" + ), f"Required parameter '{required_param}' missing from get_insights_historical" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "analytics.fields", + "engagement.fields", ] for optional_param in optional_params: if optional_param in params: @@ -834,41 +804,48 @@ def test_get_analytics_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_analytics_return_annotation(self): - """Test that get_analytics has proper return type annotation.""" - method = getattr(PostsClient, "get_analytics") + def test_get_insights_historical_return_annotation(self): + """Test that get_insights_historical has proper return type annotation.""" + method = getattr(PostsClient, "get_insights_historical") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_analytics should have return type annotation" + ), f"Method get_insights_historical should have return type annotation" - def test_hide_reply_exists(self): - """Test that hide_reply method exists with correct signature.""" + def test_get_by_id_exists(self): + """Test that get_by_id method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "hide_reply", None) - assert method is not None, f"Method hide_reply does not exist on PostsClient" + method = getattr(PostsClient, "get_by_id", None) + assert method is not None, f"Method get_by_id does not exist on PostsClient" # Check method is callable - assert callable(method), f"hide_reply is not callable" + assert callable(method), f"get_by_id is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"hide_reply should have at least 'self' parameter" + assert len(params) >= 1, f"get_by_id should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "tweet_id", + "id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from hide_reply" + ), f"Required parameter '{required_param}' missing from get_by_id" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -877,28 +854,28 @@ def test_hide_reply_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_hide_reply_return_annotation(self): - """Test that hide_reply has proper return type annotation.""" - method = getattr(PostsClient, "hide_reply") + def test_get_by_id_return_annotation(self): + """Test that get_by_id has proper return type annotation.""" + method = getattr(PostsClient, "get_by_id") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method hide_reply should have return type annotation" + ), f"Method get_by_id should have return type annotation" - def test_get_reposts_exists(self): - """Test that get_reposts method exists with correct signature.""" + def test_delete_exists(self): + """Test that delete method exists with correct signature.""" # Check method exists - method = getattr(PostsClient, "get_reposts", None) - assert method is not None, f"Method get_reposts does not exist on PostsClient" + method = getattr(PostsClient, "delete", None) + assert method is not None, f"Method delete does not exist on PostsClient" # Check method is callable - assert callable(method), f"get_reposts is not callable" + assert callable(method), f"delete is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_reposts should have at least 'self' parameter" + assert len(params) >= 1, f"delete should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -909,18 +886,9 @@ def test_get_reposts_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_reposts" + ), f"Required parameter '{required_param}' missing from delete" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "max_results", - "pagination_token", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -929,54 +897,86 @@ def test_get_reposts_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_reposts_return_annotation(self): - """Test that get_reposts has proper return type annotation.""" - method = getattr(PostsClient, "get_reposts") + def test_delete_return_annotation(self): + """Test that delete has proper return type annotation.""" + method = getattr(PostsClient, "delete") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_reposts should have return type annotation" + ), f"Method delete should have return type annotation" - def test_get_reposts_pagination_params(self): - """Test that get_reposts has pagination parameters.""" - method = getattr(PostsClient, "get_reposts") + def test_get_insights28hr_exists(self): + """Test that get_insights28hr method exists with correct signature.""" + # Check method exists + method = getattr(PostsClient, "get_insights28hr", None) + assert ( + method is not None + ), f"Method get_insights28hr does not exist on PostsClient" + # Check method is callable + assert callable(method), f"get_insights28hr is not callable" + # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", + # Should have 'self' as first parameter + assert ( + len(params) >= 1 + ), f"get_insights28hr should have at least 'self' parameter" + assert ( + params[0] == "self" + ), f"First parameter should be 'self', got '{params[0]}'" + # Check required parameters exist (excluding 'self') + required_params = [ + "tweet_ids", + "granularity", + "requested_metrics", ] - has_pagination_param = any(param in params for param in pagination_params) + for required_param in required_params: + assert ( + required_param in params + ), f"Required parameter '{required_param}' missing from get_insights28hr" + # Check optional parameters have defaults (excluding 'self') + optional_params = [ + "engagement.fields", + ] + for optional_param in optional_params: + if optional_param in params: + param_obj = sig.parameters[optional_param] + assert ( + param_obj.default is not inspect.Parameter.empty + ), f"Optional parameter '{optional_param}' should have a default value" + + + def test_get_insights28hr_return_annotation(self): + """Test that get_insights28hr has proper return type annotation.""" + method = getattr(PostsClient, "get_insights28hr") + sig = inspect.signature(method) + # Check return annotation exists assert ( - has_pagination_param - ), f"Paginated method get_reposts should have pagination parameters" + sig.return_annotation is not inspect.Signature.empty + ), f"Method get_insights28hr should have return type annotation" def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ "get_quoted", - "get_counts_all", - "get_by_id", - "delete", - "get_insights28hr", - "get_counts_recent", - "search_all", + "get_analytics", + "hide_reply", "get_reposted_by", - "search_recent", - "get_insights_historical", + "get_reposts", "get_by_ids", "create", "get_liking_users", - "get_analytics", - "hide_reply", - "get_reposts", + "get_counts_recent", + "get_counts_all", + "search_all", + "search_recent", + "get_insights_historical", + "get_by_id", + "delete", + "get_insights28hr", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/spaces/test_contracts.py b/xdk/python/tests/spaces/test_contracts.py index fbd2780f..14be91d9 100644 --- a/xdk/python/tests/spaces/test_contracts.py +++ b/xdk/python/tests/spaces/test_contracts.py @@ -27,8 +27,8 @@ def setup_class(self): self.spaces_client = getattr(self.client, "spaces") - def test_get_by_creator_ids_request_structure(self): - """Test get_by_creator_ids request structure.""" + def test_get_posts_request_structure(self): + """Test get_posts request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -41,11 +41,11 @@ def test_get_by_creator_ids_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["user_ids"] = ["test_item"] + kwargs["id"] = "test_id" # Add request body if required # Call the method try: - method = getattr(self.spaces_client, "get_by_creator_ids") + method = getattr(self.spaces_client, "get_posts") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -80,7 +80,7 @@ def test_get_by_creator_ids_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/spaces/by/creator_ids" + expected_path = "/2/spaces/{id}/tweets" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -96,12 +96,12 @@ def test_get_by_creator_ids_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_creator_ids: {e}") + pytest.fail(f"Contract test failed for get_posts: {e}") - def test_get_by_creator_ids_required_parameters(self): - """Test that get_by_creator_ids handles parameters correctly.""" - method = getattr(self.spaces_client, "get_by_creator_ids") + def test_get_posts_required_parameters(self): + """Test that get_posts handles parameters correctly.""" + method = getattr(self.spaces_client, "get_posts") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -115,8 +115,8 @@ def test_get_by_creator_ids_required_parameters(self): method() - def test_get_by_creator_ids_response_structure(self): - """Test get_by_creator_ids response structure validation.""" + def test_get_posts_response_structure(self): + """Test get_posts response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -129,10 +129,10 @@ def test_get_by_creator_ids_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["user_ids"] = ["test"] + kwargs["id"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.spaces_client, "get_by_creator_ids") + method = getattr(self.spaces_client, "get_posts") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -144,8 +144,8 @@ def test_get_by_creator_ids_response_structure(self): ) - def test_get_by_id_request_structure(self): - """Test get_by_id request structure.""" + def test_search_request_structure(self): + """Test search request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -158,11 +158,11 @@ def test_get_by_id_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_id" + kwargs["query"] = "test_query" # Add request body if required # Call the method try: - method = getattr(self.spaces_client, "get_by_id") + method = getattr(self.spaces_client, "search") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -197,7 +197,7 @@ def test_get_by_id_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/spaces/{id}" + expected_path = "/2/spaces/search" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -213,12 +213,12 @@ def test_get_by_id_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_id: {e}") + pytest.fail(f"Contract test failed for search: {e}") - def test_get_by_id_required_parameters(self): - """Test that get_by_id handles parameters correctly.""" - method = getattr(self.spaces_client, "get_by_id") + def test_search_required_parameters(self): + """Test that search handles parameters correctly.""" + method = getattr(self.spaces_client, "search") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -232,8 +232,8 @@ def test_get_by_id_required_parameters(self): method() - def test_get_by_id_response_structure(self): - """Test get_by_id response structure validation.""" + def test_search_response_structure(self): + """Test search response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -246,10 +246,10 @@ def test_get_by_id_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test_value" + kwargs["query"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.spaces_client, "get_by_id") + method = getattr(self.spaces_client, "search") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -261,8 +261,8 @@ def test_get_by_id_response_structure(self): ) - def test_get_by_ids_request_structure(self): - """Test get_by_ids request structure.""" + def test_get_buyers_request_structure(self): + """Test get_buyers request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -275,11 +275,11 @@ def test_get_by_ids_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["ids"] = ["test_item"] + kwargs["id"] = "test_id" # Add request body if required # Call the method try: - method = getattr(self.spaces_client, "get_by_ids") + method = getattr(self.spaces_client, "get_buyers") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -314,7 +314,7 @@ def test_get_by_ids_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/spaces" + expected_path = "/2/spaces/{id}/buyers" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -330,12 +330,12 @@ def test_get_by_ids_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_ids: {e}") + pytest.fail(f"Contract test failed for get_buyers: {e}") - def test_get_by_ids_required_parameters(self): - """Test that get_by_ids handles parameters correctly.""" - method = getattr(self.spaces_client, "get_by_ids") + def test_get_buyers_required_parameters(self): + """Test that get_buyers handles parameters correctly.""" + method = getattr(self.spaces_client, "get_buyers") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -349,8 +349,8 @@ def test_get_by_ids_required_parameters(self): method() - def test_get_by_ids_response_structure(self): - """Test get_by_ids response structure validation.""" + def test_get_buyers_response_structure(self): + """Test get_buyers response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -363,10 +363,10 @@ def test_get_by_ids_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["ids"] = ["test"] + kwargs["id"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.spaces_client, "get_by_ids") + method = getattr(self.spaces_client, "get_buyers") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -378,8 +378,8 @@ def test_get_by_ids_response_structure(self): ) - def test_get_posts_request_structure(self): - """Test get_posts request structure.""" + def test_get_by_id_request_structure(self): + """Test get_by_id request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -396,7 +396,7 @@ def test_get_posts_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.spaces_client, "get_posts") + method = getattr(self.spaces_client, "get_by_id") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -431,7 +431,7 @@ def test_get_posts_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/spaces/{id}/tweets" + expected_path = "/2/spaces/{id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -447,12 +447,12 @@ def test_get_posts_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_posts: {e}") + pytest.fail(f"Contract test failed for get_by_id: {e}") - def test_get_posts_required_parameters(self): - """Test that get_posts handles parameters correctly.""" - method = getattr(self.spaces_client, "get_posts") + def test_get_by_id_required_parameters(self): + """Test that get_by_id handles parameters correctly.""" + method = getattr(self.spaces_client, "get_by_id") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -466,8 +466,8 @@ def test_get_posts_required_parameters(self): method() - def test_get_posts_response_structure(self): - """Test get_posts response structure validation.""" + def test_get_by_id_response_structure(self): + """Test get_by_id response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -483,7 +483,7 @@ def test_get_posts_response_structure(self): kwargs["id"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.spaces_client, "get_posts") + method = getattr(self.spaces_client, "get_by_id") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -495,8 +495,8 @@ def test_get_posts_response_structure(self): ) - def test_get_buyers_request_structure(self): - """Test get_buyers request structure.""" + def test_get_by_ids_request_structure(self): + """Test get_by_ids request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -509,11 +509,11 @@ def test_get_buyers_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_id" + kwargs["ids"] = ["test_item"] # Add request body if required # Call the method try: - method = getattr(self.spaces_client, "get_buyers") + method = getattr(self.spaces_client, "get_by_ids") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -548,7 +548,7 @@ def test_get_buyers_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/spaces/{id}/buyers" + expected_path = "/2/spaces" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -564,12 +564,12 @@ def test_get_buyers_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_buyers: {e}") + pytest.fail(f"Contract test failed for get_by_ids: {e}") - def test_get_buyers_required_parameters(self): - """Test that get_buyers handles parameters correctly.""" - method = getattr(self.spaces_client, "get_buyers") + def test_get_by_ids_required_parameters(self): + """Test that get_by_ids handles parameters correctly.""" + method = getattr(self.spaces_client, "get_by_ids") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -583,8 +583,8 @@ def test_get_buyers_required_parameters(self): method() - def test_get_buyers_response_structure(self): - """Test get_buyers response structure validation.""" + def test_get_by_ids_response_structure(self): + """Test get_by_ids response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -597,10 +597,10 @@ def test_get_buyers_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test_value" + kwargs["ids"] = ["test"] # Add request body if required # Call method and verify response structure - method = getattr(self.spaces_client, "get_buyers") + method = getattr(self.spaces_client, "get_by_ids") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -612,8 +612,8 @@ def test_get_buyers_response_structure(self): ) - def test_search_request_structure(self): - """Test search request structure.""" + def test_get_by_creator_ids_request_structure(self): + """Test get_by_creator_ids request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -626,11 +626,11 @@ def test_search_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["query"] = "test_query" + kwargs["user_ids"] = ["test_item"] # Add request body if required # Call the method try: - method = getattr(self.spaces_client, "search") + method = getattr(self.spaces_client, "get_by_creator_ids") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -665,7 +665,7 @@ def test_search_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/spaces/search" + expected_path = "/2/spaces/by/creator_ids" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -681,12 +681,12 @@ def test_search_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for search: {e}") + pytest.fail(f"Contract test failed for get_by_creator_ids: {e}") - def test_search_required_parameters(self): - """Test that search handles parameters correctly.""" - method = getattr(self.spaces_client, "search") + def test_get_by_creator_ids_required_parameters(self): + """Test that get_by_creator_ids handles parameters correctly.""" + method = getattr(self.spaces_client, "get_by_creator_ids") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -700,8 +700,8 @@ def test_search_required_parameters(self): method() - def test_search_response_structure(self): - """Test search response structure validation.""" + def test_get_by_creator_ids_response_structure(self): + """Test get_by_creator_ids response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -714,10 +714,10 @@ def test_search_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["query"] = "test_value" + kwargs["user_ids"] = ["test"] # Add request body if required # Call method and verify response structure - method = getattr(self.spaces_client, "search") + method = getattr(self.spaces_client, "get_by_creator_ids") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/spaces/test_structure.py b/xdk/python/tests/spaces/test_structure.py index 680d91fd..c2d832fb 100644 --- a/xdk/python/tests/spaces/test_structure.py +++ b/xdk/python/tests/spaces/test_structure.py @@ -28,39 +28,38 @@ def setup_class(self): self.spaces_client = getattr(self.client, "spaces") - def test_get_by_creator_ids_exists(self): - """Test that get_by_creator_ids method exists with correct signature.""" + def test_get_posts_exists(self): + """Test that get_posts method exists with correct signature.""" # Check method exists - method = getattr(SpacesClient, "get_by_creator_ids", None) - assert ( - method is not None - ), f"Method get_by_creator_ids does not exist on SpacesClient" + method = getattr(SpacesClient, "get_posts", None) + assert method is not None, f"Method get_posts does not exist on SpacesClient" # Check method is callable - assert callable(method), f"get_by_creator_ids is not callable" + assert callable(method), f"get_posts is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_by_creator_ids should have at least 'self' parameter" + assert len(params) >= 1, f"get_posts should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "user_ids", + "id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_creator_ids" + ), f"Required parameter '{required_param}' missing from get_posts" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "space.fields", + "max_results", + "tweet.fields", "expansions", + "media.fields", + "poll.fields", "user.fields", - "topic.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -70,41 +69,43 @@ def test_get_by_creator_ids_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_creator_ids_return_annotation(self): - """Test that get_by_creator_ids has proper return type annotation.""" - method = getattr(SpacesClient, "get_by_creator_ids") + def test_get_posts_return_annotation(self): + """Test that get_posts has proper return type annotation.""" + method = getattr(SpacesClient, "get_posts") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_creator_ids should have return type annotation" + ), f"Method get_posts should have return type annotation" - def test_get_by_id_exists(self): - """Test that get_by_id method exists with correct signature.""" + def test_search_exists(self): + """Test that search method exists with correct signature.""" # Check method exists - method = getattr(SpacesClient, "get_by_id", None) - assert method is not None, f"Method get_by_id does not exist on SpacesClient" + method = getattr(SpacesClient, "search", None) + assert method is not None, f"Method search does not exist on SpacesClient" # Check method is callable - assert callable(method), f"get_by_id is not callable" + assert callable(method), f"search is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_by_id should have at least 'self' parameter" + assert len(params) >= 1, f"search should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "query", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_id" + ), f"Required parameter '{required_param}' missing from search" # Check optional parameters have defaults (excluding 'self') optional_params = [ + "state", + "max_results", "space.fields", "expansions", "user.fields", @@ -118,45 +119,46 @@ def test_get_by_id_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_id_return_annotation(self): - """Test that get_by_id has proper return type annotation.""" - method = getattr(SpacesClient, "get_by_id") + def test_search_return_annotation(self): + """Test that search has proper return type annotation.""" + method = getattr(SpacesClient, "search") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_id should have return type annotation" + ), f"Method search should have return type annotation" - def test_get_by_ids_exists(self): - """Test that get_by_ids method exists with correct signature.""" + def test_get_buyers_exists(self): + """Test that get_buyers method exists with correct signature.""" # Check method exists - method = getattr(SpacesClient, "get_by_ids", None) - assert method is not None, f"Method get_by_ids does not exist on SpacesClient" + method = getattr(SpacesClient, "get_buyers", None) + assert method is not None, f"Method get_buyers does not exist on SpacesClient" # Check method is callable - assert callable(method), f"get_by_ids is not callable" + assert callable(method), f"get_buyers is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_by_ids should have at least 'self' parameter" + assert len(params) >= 1, f"get_buyers should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "ids", + "id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_ids" + ), f"Required parameter '{required_param}' missing from get_buyers" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "space.fields", - "expansions", + "pagination_token", + "max_results", "user.fields", - "topic.fields", + "expansions", + "tweet.fields", ] for optional_param in optional_params: if optional_param in params: @@ -166,28 +168,47 @@ def test_get_by_ids_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_ids_return_annotation(self): - """Test that get_by_ids has proper return type annotation.""" - method = getattr(SpacesClient, "get_by_ids") + def test_get_buyers_return_annotation(self): + """Test that get_buyers has proper return type annotation.""" + method = getattr(SpacesClient, "get_buyers") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_ids should have return type annotation" + ), f"Method get_buyers should have return type annotation" - def test_get_posts_exists(self): - """Test that get_posts method exists with correct signature.""" + def test_get_buyers_pagination_params(self): + """Test that get_buyers has pagination parameters.""" + method = getattr(SpacesClient, "get_buyers") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_buyers should have pagination parameters" + + + def test_get_by_id_exists(self): + """Test that get_by_id method exists with correct signature.""" # Check method exists - method = getattr(SpacesClient, "get_posts", None) - assert method is not None, f"Method get_posts does not exist on SpacesClient" + method = getattr(SpacesClient, "get_by_id", None) + assert method is not None, f"Method get_by_id does not exist on SpacesClient" # Check method is callable - assert callable(method), f"get_posts is not callable" + assert callable(method), f"get_by_id is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_posts should have at least 'self' parameter" + assert len(params) >= 1, f"get_by_id should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -198,16 +219,13 @@ def test_get_posts_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_posts" + ), f"Required parameter '{required_param}' missing from get_by_id" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "max_results", - "tweet.fields", + "space.fields", "expansions", - "media.fields", - "poll.fields", "user.fields", - "place.fields", + "topic.fields", ] for optional_param in optional_params: if optional_param in params: @@ -217,46 +235,45 @@ def test_get_posts_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_posts_return_annotation(self): - """Test that get_posts has proper return type annotation.""" - method = getattr(SpacesClient, "get_posts") + def test_get_by_id_return_annotation(self): + """Test that get_by_id has proper return type annotation.""" + method = getattr(SpacesClient, "get_by_id") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_posts should have return type annotation" + ), f"Method get_by_id should have return type annotation" - def test_get_buyers_exists(self): - """Test that get_buyers method exists with correct signature.""" + def test_get_by_ids_exists(self): + """Test that get_by_ids method exists with correct signature.""" # Check method exists - method = getattr(SpacesClient, "get_buyers", None) - assert method is not None, f"Method get_buyers does not exist on SpacesClient" + method = getattr(SpacesClient, "get_by_ids", None) + assert method is not None, f"Method get_by_ids does not exist on SpacesClient" # Check method is callable - assert callable(method), f"get_buyers is not callable" + assert callable(method), f"get_by_ids is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_buyers should have at least 'self' parameter" + assert len(params) >= 1, f"get_by_ids should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "ids", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_buyers" + ), f"Required parameter '{required_param}' missing from get_by_ids" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "pagination_token", - "max_results", - "user.fields", + "space.fields", "expansions", - "tweet.fields", + "user.fields", + "topic.fields", ] for optional_param in optional_params: if optional_param in params: @@ -266,62 +283,45 @@ def test_get_buyers_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_buyers_return_annotation(self): - """Test that get_buyers has proper return type annotation.""" - method = getattr(SpacesClient, "get_buyers") + def test_get_by_ids_return_annotation(self): + """Test that get_by_ids has proper return type annotation.""" + method = getattr(SpacesClient, "get_by_ids") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_buyers should have return type annotation" - - - def test_get_buyers_pagination_params(self): - """Test that get_buyers has pagination parameters.""" - method = getattr(SpacesClient, "get_buyers") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_buyers should have pagination parameters" + ), f"Method get_by_ids should have return type annotation" - def test_search_exists(self): - """Test that search method exists with correct signature.""" + def test_get_by_creator_ids_exists(self): + """Test that get_by_creator_ids method exists with correct signature.""" # Check method exists - method = getattr(SpacesClient, "search", None) - assert method is not None, f"Method search does not exist on SpacesClient" + method = getattr(SpacesClient, "get_by_creator_ids", None) + assert ( + method is not None + ), f"Method get_by_creator_ids does not exist on SpacesClient" # Check method is callable - assert callable(method), f"search is not callable" + assert callable(method), f"get_by_creator_ids is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"search should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_by_creator_ids should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "query", + "user_ids", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from search" + ), f"Required parameter '{required_param}' missing from get_by_creator_ids" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "state", - "max_results", "space.fields", "expansions", "user.fields", @@ -335,25 +335,25 @@ def test_search_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_search_return_annotation(self): - """Test that search has proper return type annotation.""" - method = getattr(SpacesClient, "search") + def test_get_by_creator_ids_return_annotation(self): + """Test that get_by_creator_ids has proper return type annotation.""" + method = getattr(SpacesClient, "get_by_creator_ids") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method search should have return type annotation" + ), f"Method get_by_creator_ids should have return type annotation" def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ - "get_by_creator_ids", - "get_by_id", - "get_by_ids", "get_posts", - "get_buyers", "search", + "get_buyers", + "get_by_id", + "get_by_ids", + "get_by_creator_ids", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/stream/test_contracts.py b/xdk/python/tests/stream/test_contracts.py index a5f7038e..78ada05e 100644 --- a/xdk/python/tests/stream/test_contracts.py +++ b/xdk/python/tests/stream/test_contracts.py @@ -27,8 +27,8 @@ def setup_class(self): self.stream_client = getattr(self.client, "stream") - def test_posts_sample_request_structure(self): - """Test posts_sample request structure.""" + def test_likes_firehose_request_structure(self): + """Test likes_firehose request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -41,10 +41,11 @@ def test_posts_sample_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters + kwargs["partition"] = 42 # Add request body if required # Call the method try: - method = getattr(self.stream_client, "posts_sample") + method = getattr(self.stream_client, "likes_firehose") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -79,7 +80,7 @@ def test_posts_sample_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/sample/stream" + expected_path = "/2/likes/firehose/stream" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -95,27 +96,27 @@ def test_posts_sample_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for posts_sample: {e}") + pytest.fail(f"Contract test failed for likes_firehose: {e}") - def test_posts_sample_required_parameters(self): - """Test that posts_sample handles parameters correctly.""" - method = getattr(self.stream_client, "posts_sample") - # No required parameters, method should be callable without args + def test_likes_firehose_required_parameters(self): + """Test that likes_firehose handles parameters correctly.""" + method = getattr(self.stream_client, "likes_firehose") + # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 200 - mock_response.json.return_value = {} - mock_response.raise_for_status.return_value = None + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") mock_session.get.return_value = mock_response - try: + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): method() - except Exception as e: - pytest.fail(f"Method with no required params should be callable: {e}") - def test_posts_sample_response_structure(self): - """Test posts_sample response structure validation.""" + def test_likes_firehose_response_structure(self): + """Test likes_firehose response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -128,9 +129,10 @@ def test_posts_sample_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "posts_sample") + method = getattr(self.stream_client, "likes_firehose") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -142,8 +144,8 @@ def test_posts_sample_response_structure(self): ) - def test_get_rule_counts_request_structure(self): - """Test get_rule_counts request structure.""" + def test_posts_firehose_pt_request_structure(self): + """Test posts_firehose_pt request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -156,10 +158,11 @@ def test_get_rule_counts_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters + kwargs["partition"] = 42 # Add request body if required # Call the method try: - method = getattr(self.stream_client, "get_rule_counts") + method = getattr(self.stream_client, "posts_firehose_pt") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -194,7 +197,7 @@ def test_get_rule_counts_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/search/stream/rules/counts" + expected_path = "/2/tweets/firehose/stream/lang/pt" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -210,27 +213,27 @@ def test_get_rule_counts_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_rule_counts: {e}") + pytest.fail(f"Contract test failed for posts_firehose_pt: {e}") - def test_get_rule_counts_required_parameters(self): - """Test that get_rule_counts handles parameters correctly.""" - method = getattr(self.stream_client, "get_rule_counts") - # No required parameters, method should be callable without args + def test_posts_firehose_pt_required_parameters(self): + """Test that posts_firehose_pt handles parameters correctly.""" + method = getattr(self.stream_client, "posts_firehose_pt") + # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 200 - mock_response.json.return_value = {} - mock_response.raise_for_status.return_value = None + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") mock_session.get.return_value = mock_response - try: + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): method() - except Exception as e: - pytest.fail(f"Method with no required params should be callable: {e}") - def test_get_rule_counts_response_structure(self): - """Test get_rule_counts response structure validation.""" + def test_posts_firehose_pt_response_structure(self): + """Test posts_firehose_pt response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -243,9 +246,10 @@ def test_get_rule_counts_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "get_rule_counts") + method = getattr(self.stream_client, "posts_firehose_pt") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -257,8 +261,8 @@ def test_get_rule_counts_response_structure(self): ) - def test_posts_firehose_request_structure(self): - """Test posts_firehose request structure.""" + def test_posts_firehose_ja_request_structure(self): + """Test posts_firehose_ja request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -275,7 +279,7 @@ def test_posts_firehose_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.stream_client, "posts_firehose") + method = getattr(self.stream_client, "posts_firehose_ja") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -310,7 +314,7 @@ def test_posts_firehose_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/firehose/stream" + expected_path = "/2/tweets/firehose/stream/lang/ja" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -326,12 +330,12 @@ def test_posts_firehose_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for posts_firehose: {e}") + pytest.fail(f"Contract test failed for posts_firehose_ja: {e}") - def test_posts_firehose_required_parameters(self): - """Test that posts_firehose handles parameters correctly.""" - method = getattr(self.stream_client, "posts_firehose") + def test_posts_firehose_ja_required_parameters(self): + """Test that posts_firehose_ja handles parameters correctly.""" + method = getattr(self.stream_client, "posts_firehose_ja") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -345,8 +349,8 @@ def test_posts_firehose_required_parameters(self): method() - def test_posts_firehose_response_structure(self): - """Test posts_firehose response structure validation.""" + def test_posts_firehose_ja_response_structure(self): + """Test posts_firehose_ja response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -362,7 +366,7 @@ def test_posts_firehose_response_structure(self): kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "posts_firehose") + method = getattr(self.stream_client, "posts_firehose_ja") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -374,8 +378,8 @@ def test_posts_firehose_response_structure(self): ) - def test_posts_firehose_pt_request_structure(self): - """Test posts_firehose_pt request structure.""" + def test_labels_compliance_request_structure(self): + """Test labels_compliance request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -388,11 +392,10 @@ def test_posts_firehose_pt_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["partition"] = 42 # Add request body if required # Call the method try: - method = getattr(self.stream_client, "posts_firehose_pt") + method = getattr(self.stream_client, "labels_compliance") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -427,7 +430,7 @@ def test_posts_firehose_pt_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/firehose/stream/lang/pt" + expected_path = "/2/tweets/label/stream" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -443,27 +446,27 @@ def test_posts_firehose_pt_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for posts_firehose_pt: {e}") + pytest.fail(f"Contract test failed for labels_compliance: {e}") - def test_posts_firehose_pt_required_parameters(self): - """Test that posts_firehose_pt handles parameters correctly.""" - method = getattr(self.stream_client, "posts_firehose_pt") - # Test with missing required parameters - mock the request to avoid network calls + def test_labels_compliance_required_parameters(self): + """Test that labels_compliance handles parameters correctly.""" + method = getattr(self.stream_client, "labels_compliance") + # No required parameters, method should be callable without args with patch.object(self.client, "session") as mock_session: - # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 400 - mock_response.json.return_value = {"error": "Missing required parameters"} - mock_response.raise_for_status.side_effect = Exception("Bad Request") + mock_response.status_code = 200 + mock_response.json.return_value = {} + mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - # Call without required parameters should either raise locally or via server response - with pytest.raises((TypeError, ValueError, Exception)): + try: method() + except Exception as e: + pytest.fail(f"Method with no required params should be callable: {e}") - def test_posts_firehose_pt_response_structure(self): - """Test posts_firehose_pt response structure validation.""" + def test_labels_compliance_response_structure(self): + """Test labels_compliance response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -476,10 +479,9 @@ def test_posts_firehose_pt_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "posts_firehose_pt") + method = getattr(self.stream_client, "labels_compliance") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -491,8 +493,8 @@ def test_posts_firehose_pt_response_structure(self): ) - def test_users_compliance_request_structure(self): - """Test users_compliance request structure.""" + def test_posts_firehose_ko_request_structure(self): + """Test posts_firehose_ko request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -509,7 +511,7 @@ def test_users_compliance_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.stream_client, "users_compliance") + method = getattr(self.stream_client, "posts_firehose_ko") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -544,7 +546,7 @@ def test_users_compliance_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/compliance/stream" + expected_path = "/2/tweets/firehose/stream/lang/ko" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -560,12 +562,12 @@ def test_users_compliance_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for users_compliance: {e}") + pytest.fail(f"Contract test failed for posts_firehose_ko: {e}") - def test_users_compliance_required_parameters(self): - """Test that users_compliance handles parameters correctly.""" - method = getattr(self.stream_client, "users_compliance") + def test_posts_firehose_ko_required_parameters(self): + """Test that posts_firehose_ko handles parameters correctly.""" + method = getattr(self.stream_client, "posts_firehose_ko") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -579,8 +581,8 @@ def test_users_compliance_required_parameters(self): method() - def test_users_compliance_response_structure(self): - """Test users_compliance response structure validation.""" + def test_posts_firehose_ko_response_structure(self): + """Test posts_firehose_ko response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -596,7 +598,7 @@ def test_users_compliance_response_structure(self): kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "users_compliance") + method = getattr(self.stream_client, "posts_firehose_ko") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -608,8 +610,8 @@ def test_users_compliance_response_structure(self): ) - def test_posts_sample10_request_structure(self): - """Test posts_sample10 request structure.""" + def test_posts_request_structure(self): + """Test posts request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -622,11 +624,10 @@ def test_posts_sample10_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["partition"] = 42 # Add request body if required # Call the method try: - method = getattr(self.stream_client, "posts_sample10") + method = getattr(self.stream_client, "posts") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -661,7 +662,7 @@ def test_posts_sample10_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/sample10/stream" + expected_path = "/2/tweets/search/stream" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -677,27 +678,27 @@ def test_posts_sample10_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for posts_sample10: {e}") + pytest.fail(f"Contract test failed for posts: {e}") - def test_posts_sample10_required_parameters(self): - """Test that posts_sample10 handles parameters correctly.""" - method = getattr(self.stream_client, "posts_sample10") - # Test with missing required parameters - mock the request to avoid network calls + def test_posts_required_parameters(self): + """Test that posts handles parameters correctly.""" + method = getattr(self.stream_client, "posts") + # No required parameters, method should be callable without args with patch.object(self.client, "session") as mock_session: - # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 400 - mock_response.json.return_value = {"error": "Missing required parameters"} - mock_response.raise_for_status.side_effect = Exception("Bad Request") + mock_response.status_code = 200 + mock_response.json.return_value = {} + mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - # Call without required parameters should either raise locally or via server response - with pytest.raises((TypeError, ValueError, Exception)): + try: method() + except Exception as e: + pytest.fail(f"Method with no required params should be callable: {e}") - def test_posts_sample10_response_structure(self): - """Test posts_sample10 response structure validation.""" + def test_posts_response_structure(self): + """Test posts response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -710,10 +711,9 @@ def test_posts_sample10_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "posts_sample10") + method = getattr(self.stream_client, "posts") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -840,8 +840,8 @@ def test_likes_compliance_response_structure(self): ) - def test_labels_compliance_request_structure(self): - """Test labels_compliance request structure.""" + def test_get_rules_request_structure(self): + """Test get_rules request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -857,7 +857,7 @@ def test_labels_compliance_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.stream_client, "labels_compliance") + method = getattr(self.stream_client, "get_rules") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -892,7 +892,7 @@ def test_labels_compliance_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/label/stream" + expected_path = "/2/tweets/search/stream/rules" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -908,12 +908,12 @@ def test_labels_compliance_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for labels_compliance: {e}") + pytest.fail(f"Contract test failed for get_rules: {e}") - def test_labels_compliance_required_parameters(self): - """Test that labels_compliance handles parameters correctly.""" - method = getattr(self.stream_client, "labels_compliance") + def test_get_rules_required_parameters(self): + """Test that get_rules handles parameters correctly.""" + method = getattr(self.stream_client, "get_rules") # No required parameters, method should be callable without args with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -927,8 +927,8 @@ def test_labels_compliance_required_parameters(self): pytest.fail(f"Method with no required params should be callable: {e}") - def test_labels_compliance_response_structure(self): - """Test labels_compliance response structure validation.""" + def test_get_rules_response_structure(self): + """Test get_rules response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -943,7 +943,7 @@ def test_labels_compliance_response_structure(self): kwargs = {} # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "labels_compliance") + method = getattr(self.stream_client, "get_rules") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -955,8 +955,8 @@ def test_labels_compliance_response_structure(self): ) - def test_posts_firehose_en_request_structure(self): - """Test posts_firehose_en request structure.""" + def test_update_rules_request_structure(self): + """Test update_rules request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -965,15 +965,18 @@ def test_posts_firehose_en_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["partition"] = 42 # Add request body if required + # Import and create proper request model instance + from xdk.stream.models import UpdateRulesRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = UpdateRulesRequest() # Call the method try: - method = getattr(self.stream_client, "posts_firehose_en") + method = getattr(self.stream_client, "update_rules") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -992,7 +995,7 @@ def test_posts_firehose_en_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -1001,14 +1004,14 @@ def test_posts_firehose_en_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/firehose/stream/lang/en" + expected_path = "/2/tweets/search/stream/rules" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1024,12 +1027,12 @@ def test_posts_firehose_en_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for posts_firehose_en: {e}") + pytest.fail(f"Contract test failed for update_rules: {e}") - def test_posts_firehose_en_required_parameters(self): - """Test that posts_firehose_en handles parameters correctly.""" - method = getattr(self.stream_client, "posts_firehose_en") + def test_update_rules_required_parameters(self): + """Test that update_rules handles parameters correctly.""" + method = getattr(self.stream_client, "update_rules") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1037,14 +1040,14 @@ def test_posts_firehose_en_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_posts_firehose_en_response_structure(self): - """Test posts_firehose_en response structure validation.""" + def test_update_rules_response_structure(self): + """Test update_rules response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1054,13 +1057,16 @@ def test_posts_firehose_en_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["partition"] = 1 # Add request body if required + # Import and create proper request model instance + from xdk.stream.models import UpdateRulesRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = UpdateRulesRequest() # Call method and verify response structure - method = getattr(self.stream_client, "posts_firehose_en") + method = getattr(self.stream_client, "update_rules") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1072,8 +1078,8 @@ def test_posts_firehose_en_response_structure(self): ) - def test_posts_request_structure(self): - """Test posts request structure.""" + def test_get_rule_counts_request_structure(self): + """Test get_rule_counts request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1089,7 +1095,7 @@ def test_posts_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.stream_client, "posts") + method = getattr(self.stream_client, "get_rule_counts") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1124,7 +1130,7 @@ def test_posts_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/search/stream" + expected_path = "/2/tweets/search/stream/rules/counts" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1140,12 +1146,12 @@ def test_posts_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for posts: {e}") + pytest.fail(f"Contract test failed for get_rule_counts: {e}") - def test_posts_required_parameters(self): - """Test that posts handles parameters correctly.""" - method = getattr(self.stream_client, "posts") + def test_get_rule_counts_required_parameters(self): + """Test that get_rule_counts handles parameters correctly.""" + method = getattr(self.stream_client, "get_rule_counts") # No required parameters, method should be callable without args with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1159,8 +1165,8 @@ def test_posts_required_parameters(self): pytest.fail(f"Method with no required params should be callable: {e}") - def test_posts_response_structure(self): - """Test posts response structure validation.""" + def test_get_rule_counts_response_structure(self): + """Test get_rule_counts response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1175,7 +1181,7 @@ def test_posts_response_structure(self): kwargs = {} # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "posts") + method = getattr(self.stream_client, "get_rule_counts") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1187,8 +1193,8 @@ def test_posts_response_structure(self): ) - def test_posts_firehose_ko_request_structure(self): - """Test posts_firehose_ko request structure.""" + def test_likes_sample10_request_structure(self): + """Test likes_sample10 request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1205,7 +1211,7 @@ def test_posts_firehose_ko_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.stream_client, "posts_firehose_ko") + method = getattr(self.stream_client, "likes_sample10") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1240,7 +1246,7 @@ def test_posts_firehose_ko_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/firehose/stream/lang/ko" + expected_path = "/2/likes/sample10/stream" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1256,12 +1262,12 @@ def test_posts_firehose_ko_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for posts_firehose_ko: {e}") + pytest.fail(f"Contract test failed for likes_sample10: {e}") - def test_posts_firehose_ko_required_parameters(self): - """Test that posts_firehose_ko handles parameters correctly.""" - method = getattr(self.stream_client, "posts_firehose_ko") + def test_likes_sample10_required_parameters(self): + """Test that likes_sample10 handles parameters correctly.""" + method = getattr(self.stream_client, "likes_sample10") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1275,8 +1281,8 @@ def test_posts_firehose_ko_required_parameters(self): method() - def test_posts_firehose_ko_response_structure(self): - """Test posts_firehose_ko response structure validation.""" + def test_likes_sample10_response_structure(self): + """Test likes_sample10 response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1292,7 +1298,7 @@ def test_posts_firehose_ko_response_structure(self): kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "posts_firehose_ko") + method = getattr(self.stream_client, "likes_sample10") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1304,8 +1310,8 @@ def test_posts_firehose_ko_response_structure(self): ) - def test_likes_sample10_request_structure(self): - """Test likes_sample10 request structure.""" + def test_posts_firehose_request_structure(self): + """Test posts_firehose request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1322,7 +1328,7 @@ def test_likes_sample10_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.stream_client, "likes_sample10") + method = getattr(self.stream_client, "posts_firehose") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1357,7 +1363,7 @@ def test_likes_sample10_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/likes/sample10/stream" + expected_path = "/2/tweets/firehose/stream" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1373,12 +1379,12 @@ def test_likes_sample10_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for likes_sample10: {e}") + pytest.fail(f"Contract test failed for posts_firehose: {e}") - def test_likes_sample10_required_parameters(self): - """Test that likes_sample10 handles parameters correctly.""" - method = getattr(self.stream_client, "likes_sample10") + def test_posts_firehose_required_parameters(self): + """Test that posts_firehose handles parameters correctly.""" + method = getattr(self.stream_client, "posts_firehose") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1392,8 +1398,8 @@ def test_likes_sample10_required_parameters(self): method() - def test_likes_sample10_response_structure(self): - """Test likes_sample10 response structure validation.""" + def test_posts_firehose_response_structure(self): + """Test posts_firehose response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1409,7 +1415,7 @@ def test_likes_sample10_response_structure(self): kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "likes_sample10") + method = getattr(self.stream_client, "posts_firehose") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1421,8 +1427,8 @@ def test_likes_sample10_response_structure(self): ) - def test_posts_compliance_request_structure(self): - """Test posts_compliance request structure.""" + def test_users_compliance_request_structure(self): + """Test users_compliance request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1439,7 +1445,7 @@ def test_posts_compliance_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.stream_client, "posts_compliance") + method = getattr(self.stream_client, "users_compliance") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1474,7 +1480,7 @@ def test_posts_compliance_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/compliance/stream" + expected_path = "/2/users/compliance/stream" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1490,12 +1496,12 @@ def test_posts_compliance_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for posts_compliance: {e}") + pytest.fail(f"Contract test failed for users_compliance: {e}") - def test_posts_compliance_required_parameters(self): - """Test that posts_compliance handles parameters correctly.""" - method = getattr(self.stream_client, "posts_compliance") + def test_users_compliance_required_parameters(self): + """Test that users_compliance handles parameters correctly.""" + method = getattr(self.stream_client, "users_compliance") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1509,8 +1515,8 @@ def test_posts_compliance_required_parameters(self): method() - def test_posts_compliance_response_structure(self): - """Test posts_compliance response structure validation.""" + def test_users_compliance_response_structure(self): + """Test users_compliance response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1526,7 +1532,7 @@ def test_posts_compliance_response_structure(self): kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "posts_compliance") + method = getattr(self.stream_client, "users_compliance") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1538,8 +1544,8 @@ def test_posts_compliance_response_structure(self): ) - def test_get_rules_request_structure(self): - """Test get_rules request structure.""" + def test_posts_compliance_request_structure(self): + """Test posts_compliance request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1552,10 +1558,11 @@ def test_get_rules_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters + kwargs["partition"] = 42 # Add request body if required # Call the method try: - method = getattr(self.stream_client, "get_rules") + method = getattr(self.stream_client, "posts_compliance") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1590,7 +1597,7 @@ def test_get_rules_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/search/stream/rules" + expected_path = "/2/tweets/compliance/stream" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1606,27 +1613,27 @@ def test_get_rules_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_rules: {e}") + pytest.fail(f"Contract test failed for posts_compliance: {e}") - def test_get_rules_required_parameters(self): - """Test that get_rules handles parameters correctly.""" - method = getattr(self.stream_client, "get_rules") - # No required parameters, method should be callable without args + def test_posts_compliance_required_parameters(self): + """Test that posts_compliance handles parameters correctly.""" + method = getattr(self.stream_client, "posts_compliance") + # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 200 - mock_response.json.return_value = {} - mock_response.raise_for_status.return_value = None + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") mock_session.get.return_value = mock_response - try: + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): method() - except Exception as e: - pytest.fail(f"Method with no required params should be callable: {e}") - def test_get_rules_response_structure(self): - """Test get_rules response structure validation.""" + def test_posts_compliance_response_structure(self): + """Test posts_compliance response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1639,9 +1646,10 @@ def test_get_rules_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "get_rules") + method = getattr(self.stream_client, "posts_compliance") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1653,8 +1661,8 @@ def test_get_rules_response_structure(self): ) - def test_update_rules_request_structure(self): - """Test update_rules request structure.""" + def test_posts_sample10_request_structure(self): + """Test posts_sample10 request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1663,18 +1671,15 @@ def test_update_rules_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["partition"] = 42 # Add request body if required - # Import and create proper request model instance - from xdk.stream.models import UpdateRulesRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = UpdateRulesRequest() # Call the method try: - method = getattr(self.stream_client, "update_rules") + method = getattr(self.stream_client, "posts_sample10") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1693,7 +1698,7 @@ def test_update_rules_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -1702,14 +1707,14 @@ def test_update_rules_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/search/stream/rules" + expected_path = "/2/tweets/sample10/stream" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1725,12 +1730,12 @@ def test_update_rules_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for update_rules: {e}") + pytest.fail(f"Contract test failed for posts_sample10: {e}") - def test_update_rules_required_parameters(self): - """Test that update_rules handles parameters correctly.""" - method = getattr(self.stream_client, "update_rules") + def test_posts_sample10_required_parameters(self): + """Test that posts_sample10 handles parameters correctly.""" + method = getattr(self.stream_client, "posts_sample10") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1738,14 +1743,14 @@ def test_update_rules_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_update_rules_response_structure(self): - """Test update_rules response structure validation.""" + def test_posts_sample10_response_structure(self): + """Test posts_sample10 response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1755,16 +1760,13 @@ def test_update_rules_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["partition"] = 1 # Add request body if required - # Import and create proper request model instance - from xdk.stream.models import UpdateRulesRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = UpdateRulesRequest() # Call method and verify response structure - method = getattr(self.stream_client, "update_rules") + method = getattr(self.stream_client, "posts_sample10") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1776,8 +1778,8 @@ def test_update_rules_response_structure(self): ) - def test_posts_firehose_ja_request_structure(self): - """Test posts_firehose_ja request structure.""" + def test_posts_firehose_en_request_structure(self): + """Test posts_firehose_en request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1794,7 +1796,7 @@ def test_posts_firehose_ja_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.stream_client, "posts_firehose_ja") + method = getattr(self.stream_client, "posts_firehose_en") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1829,7 +1831,7 @@ def test_posts_firehose_ja_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/firehose/stream/lang/ja" + expected_path = "/2/tweets/firehose/stream/lang/en" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1845,12 +1847,12 @@ def test_posts_firehose_ja_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for posts_firehose_ja: {e}") + pytest.fail(f"Contract test failed for posts_firehose_en: {e}") - def test_posts_firehose_ja_required_parameters(self): - """Test that posts_firehose_ja handles parameters correctly.""" - method = getattr(self.stream_client, "posts_firehose_ja") + def test_posts_firehose_en_required_parameters(self): + """Test that posts_firehose_en handles parameters correctly.""" + method = getattr(self.stream_client, "posts_firehose_en") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1864,8 +1866,8 @@ def test_posts_firehose_ja_required_parameters(self): method() - def test_posts_firehose_ja_response_structure(self): - """Test posts_firehose_ja response structure validation.""" + def test_posts_firehose_en_response_structure(self): + """Test posts_firehose_en response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1881,7 +1883,7 @@ def test_posts_firehose_ja_response_structure(self): kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "posts_firehose_ja") + method = getattr(self.stream_client, "posts_firehose_en") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1893,8 +1895,8 @@ def test_posts_firehose_ja_response_structure(self): ) - def test_likes_firehose_request_structure(self): - """Test likes_firehose request structure.""" + def test_posts_sample_request_structure(self): + """Test posts_sample request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1907,11 +1909,10 @@ def test_likes_firehose_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["partition"] = 42 # Add request body if required # Call the method try: - method = getattr(self.stream_client, "likes_firehose") + method = getattr(self.stream_client, "posts_sample") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1946,7 +1947,7 @@ def test_likes_firehose_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/likes/firehose/stream" + expected_path = "/2/tweets/sample/stream" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1962,27 +1963,27 @@ def test_likes_firehose_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for likes_firehose: {e}") + pytest.fail(f"Contract test failed for posts_sample: {e}") - def test_likes_firehose_required_parameters(self): - """Test that likes_firehose handles parameters correctly.""" - method = getattr(self.stream_client, "likes_firehose") - # Test with missing required parameters - mock the request to avoid network calls + def test_posts_sample_required_parameters(self): + """Test that posts_sample handles parameters correctly.""" + method = getattr(self.stream_client, "posts_sample") + # No required parameters, method should be callable without args with patch.object(self.client, "session") as mock_session: - # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 400 - mock_response.json.return_value = {"error": "Missing required parameters"} - mock_response.raise_for_status.side_effect = Exception("Bad Request") + mock_response.status_code = 200 + mock_response.json.return_value = {} + mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - # Call without required parameters should either raise locally or via server response - with pytest.raises((TypeError, ValueError, Exception)): + try: method() + except Exception as e: + pytest.fail(f"Method with no required params should be callable: {e}") - def test_likes_firehose_response_structure(self): - """Test likes_firehose response structure validation.""" + def test_posts_sample_response_structure(self): + """Test posts_sample response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1995,10 +1996,9 @@ def test_likes_firehose_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["partition"] = 1 # Add request body if required # Call method and verify response structure - method = getattr(self.stream_client, "likes_firehose") + method = getattr(self.stream_client, "posts_sample") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/stream/test_structure.py b/xdk/python/tests/stream/test_structure.py index 43010e70..93de56ab 100644 --- a/xdk/python/tests/stream/test_structure.py +++ b/xdk/python/tests/stream/test_structure.py @@ -28,36 +28,40 @@ def setup_class(self): self.stream_client = getattr(self.client, "stream") - def test_posts_sample_exists(self): - """Test that posts_sample method exists with correct signature.""" + def test_likes_firehose_exists(self): + """Test that likes_firehose method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "posts_sample", None) - assert method is not None, f"Method posts_sample does not exist on StreamClient" + method = getattr(StreamClient, "likes_firehose", None) + assert ( + method is not None + ), f"Method likes_firehose does not exist on StreamClient" # Check method is callable - assert callable(method), f"posts_sample is not callable" + assert callable(method), f"likes_firehose is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"posts_sample should have at least 'self' parameter" + assert len(params) >= 1, f"likes_firehose should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "partition", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from posts_sample" + ), f"Required parameter '{required_param}' missing from likes_firehose" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", - "tweet.fields", + "start_time", + "end_time", + "like_with_tweet_author.fields", "expansions", - "media.fields", - "poll.fields", "user.fields", - "place.fields", + "tweet.fields", ] for optional_param in optional_params: if optional_param in params: @@ -67,44 +71,54 @@ def test_posts_sample_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_posts_sample_return_annotation(self): - """Test that posts_sample has proper return type annotation.""" - method = getattr(StreamClient, "posts_sample") + def test_likes_firehose_return_annotation(self): + """Test that likes_firehose has proper return type annotation.""" + method = getattr(StreamClient, "likes_firehose") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method posts_sample should have return type annotation" + ), f"Method likes_firehose should have return type annotation" - def test_get_rule_counts_exists(self): - """Test that get_rule_counts method exists with correct signature.""" + def test_posts_firehose_pt_exists(self): + """Test that posts_firehose_pt method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "get_rule_counts", None) + method = getattr(StreamClient, "posts_firehose_pt", None) assert ( method is not None - ), f"Method get_rule_counts does not exist on StreamClient" + ), f"Method posts_firehose_pt does not exist on StreamClient" # Check method is callable - assert callable(method), f"get_rule_counts is not callable" + assert callable(method), f"posts_firehose_pt is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_rule_counts should have at least 'self' parameter" + ), f"posts_firehose_pt should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "partition", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_rule_counts" + ), f"Required parameter '{required_param}' missing from posts_firehose_pt" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "rules_count.fields", + "backfill_minutes", + "start_time", + "end_time", + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -114,30 +128,32 @@ def test_get_rule_counts_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_rule_counts_return_annotation(self): - """Test that get_rule_counts has proper return type annotation.""" - method = getattr(StreamClient, "get_rule_counts") + def test_posts_firehose_pt_return_annotation(self): + """Test that posts_firehose_pt has proper return type annotation.""" + method = getattr(StreamClient, "posts_firehose_pt") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_rule_counts should have return type annotation" + ), f"Method posts_firehose_pt should have return type annotation" - def test_posts_firehose_exists(self): - """Test that posts_firehose method exists with correct signature.""" + def test_posts_firehose_ja_exists(self): + """Test that posts_firehose_ja method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "posts_firehose", None) + method = getattr(StreamClient, "posts_firehose_ja", None) assert ( method is not None - ), f"Method posts_firehose does not exist on StreamClient" + ), f"Method posts_firehose_ja does not exist on StreamClient" # Check method is callable - assert callable(method), f"posts_firehose is not callable" + assert callable(method), f"posts_firehose_ja is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"posts_firehose should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"posts_firehose_ja should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -148,7 +164,7 @@ def test_posts_firehose_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from posts_firehose" + ), f"Required parameter '{required_param}' missing from posts_firehose_ja" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", @@ -169,54 +185,46 @@ def test_posts_firehose_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_posts_firehose_return_annotation(self): - """Test that posts_firehose has proper return type annotation.""" - method = getattr(StreamClient, "posts_firehose") + def test_posts_firehose_ja_return_annotation(self): + """Test that posts_firehose_ja has proper return type annotation.""" + method = getattr(StreamClient, "posts_firehose_ja") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method posts_firehose should have return type annotation" + ), f"Method posts_firehose_ja should have return type annotation" - def test_posts_firehose_pt_exists(self): - """Test that posts_firehose_pt method exists with correct signature.""" + def test_labels_compliance_exists(self): + """Test that labels_compliance method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "posts_firehose_pt", None) + method = getattr(StreamClient, "labels_compliance", None) assert ( method is not None - ), f"Method posts_firehose_pt does not exist on StreamClient" + ), f"Method labels_compliance does not exist on StreamClient" # Check method is callable - assert callable(method), f"posts_firehose_pt is not callable" + assert callable(method), f"labels_compliance is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"posts_firehose_pt should have at least 'self' parameter" + ), f"labels_compliance should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "partition", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from posts_firehose_pt" + ), f"Required parameter '{required_param}' missing from labels_compliance" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", "start_time", "end_time", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -226,32 +234,32 @@ def test_posts_firehose_pt_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_posts_firehose_pt_return_annotation(self): - """Test that posts_firehose_pt has proper return type annotation.""" - method = getattr(StreamClient, "posts_firehose_pt") + def test_labels_compliance_return_annotation(self): + """Test that labels_compliance has proper return type annotation.""" + method = getattr(StreamClient, "labels_compliance") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method posts_firehose_pt should have return type annotation" + ), f"Method labels_compliance should have return type annotation" - def test_users_compliance_exists(self): - """Test that users_compliance method exists with correct signature.""" + def test_posts_firehose_ko_exists(self): + """Test that posts_firehose_ko method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "users_compliance", None) + method = getattr(StreamClient, "posts_firehose_ko", None) assert ( method is not None - ), f"Method users_compliance does not exist on StreamClient" + ), f"Method posts_firehose_ko does not exist on StreamClient" # Check method is callable - assert callable(method), f"users_compliance is not callable" + assert callable(method), f"posts_firehose_ko is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"users_compliance should have at least 'self' parameter" + ), f"posts_firehose_ko should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -262,12 +270,18 @@ def test_users_compliance_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from users_compliance" + ), f"Required parameter '{required_param}' missing from posts_firehose_ko" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", "start_time", "end_time", + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -277,41 +291,37 @@ def test_users_compliance_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_users_compliance_return_annotation(self): - """Test that users_compliance has proper return type annotation.""" - method = getattr(StreamClient, "users_compliance") + def test_posts_firehose_ko_return_annotation(self): + """Test that posts_firehose_ko has proper return type annotation.""" + method = getattr(StreamClient, "posts_firehose_ko") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method users_compliance should have return type annotation" + ), f"Method posts_firehose_ko should have return type annotation" - def test_posts_sample10_exists(self): - """Test that posts_sample10 method exists with correct signature.""" + def test_posts_exists(self): + """Test that posts method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "posts_sample10", None) - assert ( - method is not None - ), f"Method posts_sample10 does not exist on StreamClient" + method = getattr(StreamClient, "posts", None) + assert method is not None, f"Method posts does not exist on StreamClient" # Check method is callable - assert callable(method), f"posts_sample10 is not callable" + assert callable(method), f"posts is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"posts_sample10 should have at least 'self' parameter" + assert len(params) >= 1, f"posts should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "partition", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from posts_sample10" + ), f"Required parameter '{required_param}' missing from posts" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", @@ -332,14 +342,14 @@ def test_posts_sample10_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_posts_sample10_return_annotation(self): - """Test that posts_sample10 has proper return type annotation.""" - method = getattr(StreamClient, "posts_sample10") + def test_posts_return_annotation(self): + """Test that posts has proper return type annotation.""" + method = getattr(StreamClient, "posts") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method posts_sample10 should have return type annotation" + ), f"Method posts should have return type annotation" def test_likes_compliance_exists(self): @@ -391,22 +401,18 @@ def test_likes_compliance_return_annotation(self): ), f"Method likes_compliance should have return type annotation" - def test_labels_compliance_exists(self): - """Test that labels_compliance method exists with correct signature.""" + def test_get_rules_exists(self): + """Test that get_rules method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "labels_compliance", None) - assert ( - method is not None - ), f"Method labels_compliance does not exist on StreamClient" + method = getattr(StreamClient, "get_rules", None) + assert method is not None, f"Method get_rules does not exist on StreamClient" # Check method is callable - assert callable(method), f"labels_compliance is not callable" + assert callable(method), f"get_rules is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"labels_compliance should have at least 'self' parameter" + assert len(params) >= 1, f"get_rules should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -415,12 +421,12 @@ def test_labels_compliance_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from labels_compliance" + ), f"Required parameter '{required_param}' missing from get_rules" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "backfill_minutes", - "start_time", - "end_time", + "ids", + "max_results", + "pagination_token", ] for optional_param in optional_params: if optional_param in params: @@ -430,54 +436,60 @@ def test_labels_compliance_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_labels_compliance_return_annotation(self): - """Test that labels_compliance has proper return type annotation.""" - method = getattr(StreamClient, "labels_compliance") + def test_get_rules_return_annotation(self): + """Test that get_rules has proper return type annotation.""" + method = getattr(StreamClient, "get_rules") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method labels_compliance should have return type annotation" + ), f"Method get_rules should have return type annotation" - def test_posts_firehose_en_exists(self): - """Test that posts_firehose_en method exists with correct signature.""" - # Check method exists - method = getattr(StreamClient, "posts_firehose_en", None) + def test_get_rules_pagination_params(self): + """Test that get_rules has pagination parameters.""" + method = getattr(StreamClient, "get_rules") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) assert ( - method is not None - ), f"Method posts_firehose_en does not exist on StreamClient" + has_pagination_param + ), f"Paginated method get_rules should have pagination parameters" + + + def test_update_rules_exists(self): + """Test that update_rules method exists with correct signature.""" + # Check method exists + method = getattr(StreamClient, "update_rules", None) + assert method is not None, f"Method update_rules does not exist on StreamClient" # Check method is callable - assert callable(method), f"posts_firehose_en is not callable" + assert callable(method), f"update_rules is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"posts_firehose_en should have at least 'self' parameter" + assert len(params) >= 1, f"update_rules should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "partition", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from posts_firehose_en" + ), f"Required parameter '{required_param}' missing from update_rules" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "backfill_minutes", - "start_time", - "end_time", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", + "dry_run", + "delete_all", ] for optional_param in optional_params: if optional_param in params: @@ -487,28 +499,32 @@ def test_posts_firehose_en_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_posts_firehose_en_return_annotation(self): - """Test that posts_firehose_en has proper return type annotation.""" - method = getattr(StreamClient, "posts_firehose_en") + def test_update_rules_return_annotation(self): + """Test that update_rules has proper return type annotation.""" + method = getattr(StreamClient, "update_rules") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method posts_firehose_en should have return type annotation" + ), f"Method update_rules should have return type annotation" - def test_posts_exists(self): - """Test that posts method exists with correct signature.""" + def test_get_rule_counts_exists(self): + """Test that get_rule_counts method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "posts", None) - assert method is not None, f"Method posts does not exist on StreamClient" + method = getattr(StreamClient, "get_rule_counts", None) + assert ( + method is not None + ), f"Method get_rule_counts does not exist on StreamClient" # Check method is callable - assert callable(method), f"posts is not callable" + assert callable(method), f"get_rule_counts is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"posts should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_rule_counts should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -517,18 +533,10 @@ def test_posts_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from posts" + ), f"Required parameter '{required_param}' missing from get_rule_counts" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "backfill_minutes", - "start_time", - "end_time", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", + "rules_count.fields", ] for optional_param in optional_params: if optional_param in params: @@ -538,32 +546,30 @@ def test_posts_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_posts_return_annotation(self): - """Test that posts has proper return type annotation.""" - method = getattr(StreamClient, "posts") + def test_get_rule_counts_return_annotation(self): + """Test that get_rule_counts has proper return type annotation.""" + method = getattr(StreamClient, "get_rule_counts") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method posts should have return type annotation" + ), f"Method get_rule_counts should have return type annotation" - def test_posts_firehose_ko_exists(self): - """Test that posts_firehose_ko method exists with correct signature.""" + def test_likes_sample10_exists(self): + """Test that likes_sample10 method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "posts_firehose_ko", None) + method = getattr(StreamClient, "likes_sample10", None) assert ( method is not None - ), f"Method posts_firehose_ko does not exist on StreamClient" + ), f"Method likes_sample10 does not exist on StreamClient" # Check method is callable - assert callable(method), f"posts_firehose_ko is not callable" + assert callable(method), f"likes_sample10 is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"posts_firehose_ko should have at least 'self' parameter" + assert len(params) >= 1, f"likes_sample10 should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -574,18 +580,16 @@ def test_posts_firehose_ko_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from posts_firehose_ko" + ), f"Required parameter '{required_param}' missing from likes_sample10" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", "start_time", "end_time", - "tweet.fields", + "like_with_tweet_author.fields", "expansions", - "media.fields", - "poll.fields", "user.fields", - "place.fields", + "tweet.fields", ] for optional_param in optional_params: if optional_param in params: @@ -595,30 +599,30 @@ def test_posts_firehose_ko_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_posts_firehose_ko_return_annotation(self): - """Test that posts_firehose_ko has proper return type annotation.""" - method = getattr(StreamClient, "posts_firehose_ko") + def test_likes_sample10_return_annotation(self): + """Test that likes_sample10 has proper return type annotation.""" + method = getattr(StreamClient, "likes_sample10") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method posts_firehose_ko should have return type annotation" + ), f"Method likes_sample10 should have return type annotation" - def test_likes_sample10_exists(self): - """Test that likes_sample10 method exists with correct signature.""" + def test_posts_firehose_exists(self): + """Test that posts_firehose method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "likes_sample10", None) + method = getattr(StreamClient, "posts_firehose", None) assert ( method is not None - ), f"Method likes_sample10 does not exist on StreamClient" + ), f"Method posts_firehose does not exist on StreamClient" # Check method is callable - assert callable(method), f"likes_sample10 is not callable" + assert callable(method), f"posts_firehose is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"likes_sample10 should have at least 'self' parameter" + assert len(params) >= 1, f"posts_firehose should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -629,16 +633,18 @@ def test_likes_sample10_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from likes_sample10" + ), f"Required parameter '{required_param}' missing from posts_firehose" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", "start_time", "end_time", - "like_with_tweet_author.fields", + "tweet.fields", "expansions", + "media.fields", + "poll.fields", "user.fields", - "tweet.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -648,32 +654,32 @@ def test_likes_sample10_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_likes_sample10_return_annotation(self): - """Test that likes_sample10 has proper return type annotation.""" - method = getattr(StreamClient, "likes_sample10") + def test_posts_firehose_return_annotation(self): + """Test that posts_firehose has proper return type annotation.""" + method = getattr(StreamClient, "posts_firehose") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method likes_sample10 should have return type annotation" + ), f"Method posts_firehose should have return type annotation" - def test_posts_compliance_exists(self): - """Test that posts_compliance method exists with correct signature.""" + def test_users_compliance_exists(self): + """Test that users_compliance method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "posts_compliance", None) + method = getattr(StreamClient, "users_compliance", None) assert ( method is not None - ), f"Method posts_compliance does not exist on StreamClient" + ), f"Method users_compliance does not exist on StreamClient" # Check method is callable - assert callable(method), f"posts_compliance is not callable" + assert callable(method), f"users_compliance is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"posts_compliance should have at least 'self' parameter" + ), f"users_compliance should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -684,7 +690,7 @@ def test_posts_compliance_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from posts_compliance" + ), f"Required parameter '{required_param}' missing from users_compliance" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", @@ -699,42 +705,48 @@ def test_posts_compliance_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_posts_compliance_return_annotation(self): - """Test that posts_compliance has proper return type annotation.""" - method = getattr(StreamClient, "posts_compliance") + def test_users_compliance_return_annotation(self): + """Test that users_compliance has proper return type annotation.""" + method = getattr(StreamClient, "users_compliance") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method posts_compliance should have return type annotation" + ), f"Method users_compliance should have return type annotation" - def test_get_rules_exists(self): - """Test that get_rules method exists with correct signature.""" + def test_posts_compliance_exists(self): + """Test that posts_compliance method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "get_rules", None) - assert method is not None, f"Method get_rules does not exist on StreamClient" + method = getattr(StreamClient, "posts_compliance", None) + assert ( + method is not None + ), f"Method posts_compliance does not exist on StreamClient" # Check method is callable - assert callable(method), f"get_rules is not callable" + assert callable(method), f"posts_compliance is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_rules should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"posts_compliance should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "partition", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_rules" + ), f"Required parameter '{required_param}' missing from posts_compliance" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "ids", - "max_results", - "pagination_token", + "backfill_minutes", + "start_time", + "end_time", ] for optional_param in optional_params: if optional_param in params: @@ -744,60 +756,52 @@ def test_get_rules_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_rules_return_annotation(self): - """Test that get_rules has proper return type annotation.""" - method = getattr(StreamClient, "get_rules") + def test_posts_compliance_return_annotation(self): + """Test that posts_compliance has proper return type annotation.""" + method = getattr(StreamClient, "posts_compliance") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_rules should have return type annotation" - - - def test_get_rules_pagination_params(self): - """Test that get_rules has pagination parameters.""" - method = getattr(StreamClient, "get_rules") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_rules should have pagination parameters" + ), f"Method posts_compliance should have return type annotation" - def test_update_rules_exists(self): - """Test that update_rules method exists with correct signature.""" + def test_posts_sample10_exists(self): + """Test that posts_sample10 method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "update_rules", None) - assert method is not None, f"Method update_rules does not exist on StreamClient" + method = getattr(StreamClient, "posts_sample10", None) + assert ( + method is not None + ), f"Method posts_sample10 does not exist on StreamClient" # Check method is callable - assert callable(method), f"update_rules is not callable" + assert callable(method), f"posts_sample10 is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"update_rules should have at least 'self' parameter" + assert len(params) >= 1, f"posts_sample10 should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "partition", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from update_rules" + ), f"Required parameter '{required_param}' missing from posts_sample10" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "dry_run", - "delete_all", + "backfill_minutes", + "start_time", + "end_time", + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -807,32 +811,32 @@ def test_update_rules_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_update_rules_return_annotation(self): - """Test that update_rules has proper return type annotation.""" - method = getattr(StreamClient, "update_rules") + def test_posts_sample10_return_annotation(self): + """Test that posts_sample10 has proper return type annotation.""" + method = getattr(StreamClient, "posts_sample10") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method update_rules should have return type annotation" + ), f"Method posts_sample10 should have return type annotation" - def test_posts_firehose_ja_exists(self): - """Test that posts_firehose_ja method exists with correct signature.""" + def test_posts_firehose_en_exists(self): + """Test that posts_firehose_en method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "posts_firehose_ja", None) + method = getattr(StreamClient, "posts_firehose_en", None) assert ( method is not None - ), f"Method posts_firehose_ja does not exist on StreamClient" + ), f"Method posts_firehose_en does not exist on StreamClient" # Check method is callable - assert callable(method), f"posts_firehose_ja is not callable" + assert callable(method), f"posts_firehose_en is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"posts_firehose_ja should have at least 'self' parameter" + ), f"posts_firehose_en should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -843,7 +847,7 @@ def test_posts_firehose_ja_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from posts_firehose_ja" + ), f"Required parameter '{required_param}' missing from posts_firehose_en" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", @@ -864,50 +868,46 @@ def test_posts_firehose_ja_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_posts_firehose_ja_return_annotation(self): - """Test that posts_firehose_ja has proper return type annotation.""" - method = getattr(StreamClient, "posts_firehose_ja") + def test_posts_firehose_en_return_annotation(self): + """Test that posts_firehose_en has proper return type annotation.""" + method = getattr(StreamClient, "posts_firehose_en") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method posts_firehose_ja should have return type annotation" + ), f"Method posts_firehose_en should have return type annotation" - def test_likes_firehose_exists(self): - """Test that likes_firehose method exists with correct signature.""" + def test_posts_sample_exists(self): + """Test that posts_sample method exists with correct signature.""" # Check method exists - method = getattr(StreamClient, "likes_firehose", None) - assert ( - method is not None - ), f"Method likes_firehose does not exist on StreamClient" + method = getattr(StreamClient, "posts_sample", None) + assert method is not None, f"Method posts_sample does not exist on StreamClient" # Check method is callable - assert callable(method), f"likes_firehose is not callable" + assert callable(method), f"posts_sample is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"likes_firehose should have at least 'self' parameter" + assert len(params) >= 1, f"posts_sample should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "partition", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from likes_firehose" + ), f"Required parameter '{required_param}' missing from posts_sample" # Check optional parameters have defaults (excluding 'self') optional_params = [ "backfill_minutes", - "start_time", - "end_time", - "like_with_tweet_author.fields", + "tweet.fields", "expansions", + "media.fields", + "poll.fields", "user.fields", - "tweet.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -917,36 +917,36 @@ def test_likes_firehose_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_likes_firehose_return_annotation(self): - """Test that likes_firehose has proper return type annotation.""" - method = getattr(StreamClient, "likes_firehose") + def test_posts_sample_return_annotation(self): + """Test that posts_sample has proper return type annotation.""" + method = getattr(StreamClient, "posts_sample") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method likes_firehose should have return type annotation" + ), f"Method posts_sample should have return type annotation" def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ - "posts_sample", - "get_rule_counts", - "posts_firehose", + "likes_firehose", "posts_firehose_pt", - "users_compliance", - "posts_sample10", - "likes_compliance", + "posts_firehose_ja", "labels_compliance", - "posts_firehose_en", - "posts", "posts_firehose_ko", - "likes_sample10", - "posts_compliance", + "posts", + "likes_compliance", "get_rules", "update_rules", - "posts_firehose_ja", - "likes_firehose", + "get_rule_counts", + "likes_sample10", + "posts_firehose", + "users_compliance", + "posts_compliance", + "posts_sample10", + "posts_firehose_en", + "posts_sample", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/trends/test_contracts.py b/xdk/python/tests/trends/test_contracts.py index 99a3229e..9079f75f 100644 --- a/xdk/python/tests/trends/test_contracts.py +++ b/xdk/python/tests/trends/test_contracts.py @@ -27,8 +27,8 @@ def setup_class(self): self.trends_client = getattr(self.client, "trends") - def test_get_personalized_request_structure(self): - """Test get_personalized request structure.""" + def test_get_ai_request_structure(self): + """Test get_ai request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -41,10 +41,11 @@ def test_get_personalized_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters + kwargs["id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.trends_client, "get_personalized") + method = getattr(self.trends_client, "get_ai") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -79,7 +80,7 @@ def test_get_personalized_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/personalized_trends" + expected_path = "/2/ai_trends/{id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -95,27 +96,27 @@ def test_get_personalized_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_personalized: {e}") + pytest.fail(f"Contract test failed for get_ai: {e}") - def test_get_personalized_required_parameters(self): - """Test that get_personalized handles parameters correctly.""" - method = getattr(self.trends_client, "get_personalized") - # No required parameters, method should be callable without args + def test_get_ai_required_parameters(self): + """Test that get_ai handles parameters correctly.""" + method = getattr(self.trends_client, "get_ai") + # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 200 - mock_response.json.return_value = {} - mock_response.raise_for_status.return_value = None + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") mock_session.get.return_value = mock_response - try: + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): method() - except Exception as e: - pytest.fail(f"Method with no required params should be callable: {e}") - def test_get_personalized_response_structure(self): - """Test get_personalized response structure validation.""" + def test_get_ai_response_structure(self): + """Test get_ai response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -128,9 +129,10 @@ def test_get_personalized_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.trends_client, "get_personalized") + method = getattr(self.trends_client, "get_ai") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -257,3 +259,118 @@ def test_get_by_woeid_response_structure(self): pytest.fail( f"Accessing optional field 'data' should not cause errors: {e}" ) + + + def test_get_personalized_request_structure(self): + """Test get_personalized request structure.""" + # Mock the session to capture request details + with patch.object(self.client, "session") as mock_session: + mock_response = Mock() + mock_response.status_code = 200 + mock_response.json.return_value = { + "data": None, + } + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + # Prepare test parameters + kwargs = {} + # Add required parameters + # Add request body if required + # Call the method + try: + method = getattr(self.trends_client, "get_personalized") + result = method(**kwargs) + # Check if this is a streaming operation (returns Generator) + import types + is_streaming = isinstance(result, types.GeneratorType) + if is_streaming: + # For streaming operations, we need to set up the mock to handle streaming + # Mock the streaming response + mock_streaming_response = Mock() + mock_streaming_response.status_code = 200 + mock_streaming_response.raise_for_status.return_value = None + mock_streaming_response.__enter__ = Mock( + return_value=mock_streaming_response + ) + mock_streaming_response.__exit__ = Mock(return_value=None) + # Mock iter_content to yield some test data + test_data = '{"data": "test"}\n' + mock_streaming_response.iter_content.return_value = [test_data] + # Update the session mock to return our streaming response + mock_session.get.return_value = mock_streaming_response + # Consume the generator to trigger the HTTP request + try: + next(result) + except StopIteration: + pass # Expected when stream ends + except Exception: + pass # Ignore other exceptions in test data processing + # Verify the request was made + mock_session.get.assert_called_once() + # Verify request structure + call_args = mock_session.get.call_args + # Check URL structure + called_url = ( + call_args[0][0] if call_args[0] else call_args[1].get("url", "") + ) + expected_path = "/2/users/personalized_trends" + assert expected_path.replace("{", "").replace( + "}", "" + ) in called_url or any( + param in called_url for param in ["test_", "42"] + ), f"URL should contain path template elements: {called_url}" + # Verify response structure + if is_streaming: + # For streaming, verify we got a generator + assert isinstance( + result, types.GeneratorType + ), "Streaming method should return a generator" + else: + # For regular operations, verify we got a result + assert result is not None, "Method should return a result" + except Exception as e: + pytest.fail(f"Contract test failed for get_personalized: {e}") + + + def test_get_personalized_required_parameters(self): + """Test that get_personalized handles parameters correctly.""" + method = getattr(self.trends_client, "get_personalized") + # No required parameters, method should be callable without args + with patch.object(self.client, "session") as mock_session: + mock_response = Mock() + mock_response.status_code = 200 + mock_response.json.return_value = {} + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + try: + method() + except Exception as e: + pytest.fail(f"Method with no required params should be callable: {e}") + + + def test_get_personalized_response_structure(self): + """Test get_personalized response structure validation.""" + with patch.object(self.client, "session") as mock_session: + # Create mock response with expected structure + mock_response_data = { + "data": None, + } + mock_response = Mock() + mock_response.status_code = 200 + mock_response.json.return_value = mock_response_data + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + # Prepare minimal valid parameters + kwargs = {} + # Add request body if required + # Call method and verify response structure + method = getattr(self.trends_client, "get_personalized") + result = method(**kwargs) + # Verify response object has expected attributes + # Optional field - just check it doesn't cause errors if accessed + try: + getattr(result, "data", None) + except Exception as e: + pytest.fail( + f"Accessing optional field 'data' should not cause errors: {e}" + ) diff --git a/xdk/python/tests/trends/test_structure.py b/xdk/python/tests/trends/test_structure.py index 8b9a4652..63042b5f 100644 --- a/xdk/python/tests/trends/test_structure.py +++ b/xdk/python/tests/trends/test_structure.py @@ -28,34 +28,32 @@ def setup_class(self): self.trends_client = getattr(self.client, "trends") - def test_get_personalized_exists(self): - """Test that get_personalized method exists with correct signature.""" + def test_get_ai_exists(self): + """Test that get_ai method exists with correct signature.""" # Check method exists - method = getattr(TrendsClient, "get_personalized", None) - assert ( - method is not None - ), f"Method get_personalized does not exist on TrendsClient" + method = getattr(TrendsClient, "get_ai", None) + assert method is not None, f"Method get_ai does not exist on TrendsClient" # Check method is callable - assert callable(method), f"get_personalized is not callable" + assert callable(method), f"get_ai is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_personalized should have at least 'self' parameter" + assert len(params) >= 1, f"get_ai should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "id", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_personalized" + ), f"Required parameter '{required_param}' missing from get_ai" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "personalized_trend.fields", + "news.fields", ] for optional_param in optional_params: if optional_param in params: @@ -65,14 +63,14 @@ def test_get_personalized_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_personalized_return_annotation(self): - """Test that get_personalized has proper return type annotation.""" - method = getattr(TrendsClient, "get_personalized") + def test_get_ai_return_annotation(self): + """Test that get_ai has proper return type annotation.""" + method = getattr(TrendsClient, "get_ai") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_personalized should have return type annotation" + ), f"Method get_ai should have return type annotation" def test_get_by_woeid_exists(self): @@ -121,11 +119,59 @@ def test_get_by_woeid_return_annotation(self): ), f"Method get_by_woeid should have return type annotation" + def test_get_personalized_exists(self): + """Test that get_personalized method exists with correct signature.""" + # Check method exists + method = getattr(TrendsClient, "get_personalized", None) + assert ( + method is not None + ), f"Method get_personalized does not exist on TrendsClient" + # Check method is callable + assert callable(method), f"get_personalized is not callable" + # Check method signature + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have 'self' as first parameter + assert ( + len(params) >= 1 + ), f"get_personalized should have at least 'self' parameter" + assert ( + params[0] == "self" + ), f"First parameter should be 'self', got '{params[0]}'" + # Check required parameters exist (excluding 'self') + required_params = [] + for required_param in required_params: + assert ( + required_param in params + ), f"Required parameter '{required_param}' missing from get_personalized" + # Check optional parameters have defaults (excluding 'self') + optional_params = [ + "personalized_trend.fields", + ] + for optional_param in optional_params: + if optional_param in params: + param_obj = sig.parameters[optional_param] + assert ( + param_obj.default is not inspect.Parameter.empty + ), f"Optional parameter '{optional_param}' should have a default value" + + + def test_get_personalized_return_annotation(self): + """Test that get_personalized has proper return type annotation.""" + method = getattr(TrendsClient, "get_personalized") + sig = inspect.signature(method) + # Check return annotation exists + assert ( + sig.return_annotation is not inspect.Signature.empty + ), f"Method get_personalized should have return type annotation" + + def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ - "get_personalized", + "get_ai", "get_by_woeid", + "get_personalized", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/users/test_contracts.py b/xdk/python/tests/users/test_contracts.py index 92902805..fd1f53d9 100644 --- a/xdk/python/tests/users/test_contracts.py +++ b/xdk/python/tests/users/test_contracts.py @@ -27,8 +27,8 @@ def setup_class(self): self.users_client = getattr(self.client, "users") - def test_get_me_request_structure(self): - """Test get_me request structure.""" + def test_like_post_request_structure(self): + """Test like_post request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -37,14 +37,19 @@ def test_get_me_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import LikePostRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = LikePostRequest() # Call the method try: - method = getattr(self.users_client, "get_me") + method = getattr(self.users_client, "like_post") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -63,7 +68,7 @@ def test_get_me_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -72,14 +77,14 @@ def test_get_me_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/me" + expected_path = "/2/users/{id}/likes" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -95,27 +100,27 @@ def test_get_me_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_me: {e}") + pytest.fail(f"Contract test failed for like_post: {e}") - def test_get_me_required_parameters(self): - """Test that get_me handles parameters correctly.""" - method = getattr(self.users_client, "get_me") - # No required parameters, method should be callable without args + def test_like_post_required_parameters(self): + """Test that like_post handles parameters correctly.""" + method = getattr(self.users_client, "like_post") + # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 200 - mock_response.json.return_value = {} - mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response - try: + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") + mock_session.post.return_value = mock_response + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): method() - except Exception as e: - pytest.fail(f"Method with no required params should be callable: {e}") - def test_get_me_response_structure(self): - """Test get_me response structure validation.""" + def test_like_post_response_structure(self): + """Test like_post response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -125,12 +130,17 @@ def test_get_me_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import LikePostRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = LikePostRequest() # Call method and verify response structure - method = getattr(self.users_client, "get_me") + method = getattr(self.users_client, "like_post") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -142,8 +152,8 @@ def test_get_me_response_structure(self): ) - def test_unfollow_list_request_structure(self): - """Test unfollow_list request structure.""" + def test_unlike_post_request_structure(self): + """Test unlike_post request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -157,11 +167,11 @@ def test_unfollow_list_request_structure(self): kwargs = {} # Add required parameters kwargs["id"] = "test_value" - kwargs["list_id"] = "test_value" + kwargs["tweet_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "unfollow_list") + method = getattr(self.users_client, "unlike_post") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -196,7 +206,7 @@ def test_unfollow_list_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/followed_lists/{list_id}" + expected_path = "/2/users/{id}/likes/{tweet_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -212,12 +222,12 @@ def test_unfollow_list_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for unfollow_list: {e}") + pytest.fail(f"Contract test failed for unlike_post: {e}") - def test_unfollow_list_required_parameters(self): - """Test that unfollow_list handles parameters correctly.""" - method = getattr(self.users_client, "unfollow_list") + def test_unlike_post_required_parameters(self): + """Test that unlike_post handles parameters correctly.""" + method = getattr(self.users_client, "unlike_post") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -231,8 +241,8 @@ def test_unfollow_list_required_parameters(self): method() - def test_unfollow_list_response_structure(self): - """Test unfollow_list response structure validation.""" + def test_unlike_post_response_structure(self): + """Test unlike_post response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -246,10 +256,10 @@ def test_unfollow_list_response_structure(self): # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" - kwargs["list_id"] = "test" + kwargs["tweet_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "unfollow_list") + method = getattr(self.users_client, "unlike_post") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -503,8 +513,8 @@ def test_mute_user_response_structure(self): ) - def test_unlike_post_request_structure(self): - """Test unlike_post request structure.""" + def test_get_pinned_lists_request_structure(self): + """Test get_pinned_lists request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -513,16 +523,15 @@ def test_unlike_post_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" - kwargs["tweet_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "unlike_post") + method = getattr(self.users_client, "get_pinned_lists") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -541,7 +550,7 @@ def test_unlike_post_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -550,14 +559,14 @@ def test_unlike_post_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/likes/{tweet_id}" + expected_path = "/2/users/{id}/pinned_lists" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -573,12 +582,12 @@ def test_unlike_post_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for unlike_post: {e}") + pytest.fail(f"Contract test failed for get_pinned_lists: {e}") - def test_unlike_post_required_parameters(self): - """Test that unlike_post handles parameters correctly.""" - method = getattr(self.users_client, "unlike_post") + def test_get_pinned_lists_required_parameters(self): + """Test that get_pinned_lists handles parameters correctly.""" + method = getattr(self.users_client, "get_pinned_lists") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -586,14 +595,14 @@ def test_unlike_post_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_unlike_post_response_structure(self): - """Test unlike_post response structure validation.""" + def test_get_pinned_lists_response_structure(self): + """Test get_pinned_lists response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -603,14 +612,13 @@ def test_unlike_post_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" - kwargs["tweet_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "unlike_post") + method = getattr(self.users_client, "get_pinned_lists") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -622,8 +630,8 @@ def test_unlike_post_response_structure(self): ) - def test_get_posts_request_structure(self): - """Test get_posts request structure.""" + def test_pin_list_request_structure(self): + """Test pin_list request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -632,15 +640,19 @@ def test_get_posts_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import PinListRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = PinListRequest() # Call the method try: - method = getattr(self.users_client, "get_posts") + method = getattr(self.users_client, "pin_list") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -659,7 +671,7 @@ def test_get_posts_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -668,14 +680,14 @@ def test_get_posts_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/tweets" + expected_path = "/2/users/{id}/pinned_lists" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -691,12 +703,12 @@ def test_get_posts_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_posts: {e}") + pytest.fail(f"Contract test failed for pin_list: {e}") - def test_get_posts_required_parameters(self): - """Test that get_posts handles parameters correctly.""" - method = getattr(self.users_client, "get_posts") + def test_pin_list_required_parameters(self): + """Test that pin_list handles parameters correctly.""" + method = getattr(self.users_client, "pin_list") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -704,14 +716,14 @@ def test_get_posts_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_posts_response_structure(self): - """Test get_posts response structure validation.""" + def test_pin_list_response_structure(self): + """Test pin_list response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -721,13 +733,17 @@ def test_get_posts_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import PinListRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = PinListRequest() # Call method and verify response structure - method = getattr(self.users_client, "get_posts") + method = getattr(self.users_client, "pin_list") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -739,8 +755,8 @@ def test_get_posts_response_structure(self): ) - def test_get_following_request_structure(self): - """Test get_following request structure.""" + def test_unrepost_post_request_structure(self): + """Test unrepost_post request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -749,15 +765,16 @@ def test_get_following_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" + kwargs["source_tweet_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_following") + method = getattr(self.users_client, "unrepost_post") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -776,7 +793,7 @@ def test_get_following_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -785,14 +802,14 @@ def test_get_following_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/following" + expected_path = "/2/users/{id}/retweets/{source_tweet_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -808,12 +825,12 @@ def test_get_following_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_following: {e}") + pytest.fail(f"Contract test failed for unrepost_post: {e}") - def test_get_following_required_parameters(self): - """Test that get_following handles parameters correctly.""" - method = getattr(self.users_client, "get_following") + def test_unrepost_post_required_parameters(self): + """Test that unrepost_post handles parameters correctly.""" + method = getattr(self.users_client, "unrepost_post") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -821,14 +838,14 @@ def test_get_following_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_following_response_structure(self): - """Test get_following response structure validation.""" + def test_unrepost_post_response_structure(self): + """Test unrepost_post response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -838,13 +855,14 @@ def test_get_following_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" + kwargs["source_tweet_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_following") + method = getattr(self.users_client, "unrepost_post") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -856,8 +874,8 @@ def test_get_following_response_structure(self): ) - def test_follow_user_request_structure(self): - """Test follow_user request structure.""" + def test_unmute_user_request_structure(self): + """Test unmute_user request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -866,19 +884,16 @@ def test_follow_user_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["source_user_id"] = "test_value" + kwargs["target_user_id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import FollowUserRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = FollowUserRequest() # Call the method try: - method = getattr(self.users_client, "follow_user") + method = getattr(self.users_client, "unmute_user") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -897,7 +912,7 @@ def test_follow_user_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -906,14 +921,14 @@ def test_follow_user_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/following" + expected_path = "/2/users/{source_user_id}/muting/{target_user_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -929,12 +944,12 @@ def test_follow_user_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for follow_user: {e}") + pytest.fail(f"Contract test failed for unmute_user: {e}") - def test_follow_user_required_parameters(self): - """Test that follow_user handles parameters correctly.""" - method = getattr(self.users_client, "follow_user") + def test_unmute_user_required_parameters(self): + """Test that unmute_user handles parameters correctly.""" + method = getattr(self.users_client, "unmute_user") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -942,14 +957,14 @@ def test_follow_user_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_follow_user_response_structure(self): - """Test follow_user response structure validation.""" + def test_unmute_user_response_structure(self): + """Test unmute_user response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -959,17 +974,14 @@ def test_follow_user_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["source_user_id"] = "test" + kwargs["target_user_id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import FollowUserRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = FollowUserRequest() # Call method and verify response structure - method = getattr(self.users_client, "follow_user") + method = getattr(self.users_client, "unmute_user") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -981,8 +993,8 @@ def test_follow_user_response_structure(self): ) - def test_get_timeline_request_structure(self): - """Test get_timeline request structure.""" + def test_delete_bookmark_request_structure(self): + """Test delete_bookmark request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -991,15 +1003,16 @@ def test_get_timeline_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" + kwargs["tweet_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_timeline") + method = getattr(self.users_client, "delete_bookmark") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1018,7 +1031,7 @@ def test_get_timeline_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -1027,14 +1040,14 @@ def test_get_timeline_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/timelines/reverse_chronological" + expected_path = "/2/users/{id}/bookmarks/{tweet_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1050,12 +1063,12 @@ def test_get_timeline_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_timeline: {e}") + pytest.fail(f"Contract test failed for delete_bookmark: {e}") - def test_get_timeline_required_parameters(self): - """Test that get_timeline handles parameters correctly.""" - method = getattr(self.users_client, "get_timeline") + def test_delete_bookmark_required_parameters(self): + """Test that delete_bookmark handles parameters correctly.""" + method = getattr(self.users_client, "delete_bookmark") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1063,14 +1076,14 @@ def test_get_timeline_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_timeline_response_structure(self): - """Test get_timeline response structure validation.""" + def test_delete_bookmark_response_structure(self): + """Test delete_bookmark response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1080,13 +1093,14 @@ def test_get_timeline_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" + kwargs["tweet_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_timeline") + method = getattr(self.users_client, "delete_bookmark") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1098,8 +1112,8 @@ def test_get_timeline_response_structure(self): ) - def test_unmute_user_request_structure(self): - """Test unmute_user request structure.""" + def test_get_list_memberships_request_structure(self): + """Test get_list_memberships request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1108,16 +1122,15 @@ def test_unmute_user_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["source_user_id"] = "test_value" - kwargs["target_user_id"] = "test_value" + kwargs["id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "unmute_user") + method = getattr(self.users_client, "get_list_memberships") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1136,7 +1149,7 @@ def test_unmute_user_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -1145,14 +1158,14 @@ def test_unmute_user_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{source_user_id}/muting/{target_user_id}" + expected_path = "/2/users/{id}/list_memberships" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1168,12 +1181,12 @@ def test_unmute_user_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for unmute_user: {e}") + pytest.fail(f"Contract test failed for get_list_memberships: {e}") - def test_unmute_user_required_parameters(self): - """Test that unmute_user handles parameters correctly.""" - method = getattr(self.users_client, "unmute_user") + def test_get_list_memberships_required_parameters(self): + """Test that get_list_memberships handles parameters correctly.""" + method = getattr(self.users_client, "get_list_memberships") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1181,14 +1194,14 @@ def test_unmute_user_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_unmute_user_response_structure(self): - """Test unmute_user response structure validation.""" + def test_get_list_memberships_response_structure(self): + """Test get_list_memberships response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1198,14 +1211,13 @@ def test_unmute_user_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["source_user_id"] = "test" - kwargs["target_user_id"] = "test" + kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "unmute_user") + method = getattr(self.users_client, "get_list_memberships") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1217,8 +1229,8 @@ def test_unmute_user_response_structure(self): ) - def test_search_request_structure(self): - """Test search request structure.""" + def test_get_me_request_structure(self): + """Test get_me request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1231,11 +1243,10 @@ def test_search_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["query"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "search") + method = getattr(self.users_client, "get_me") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1270,7 +1281,7 @@ def test_search_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/search" + expected_path = "/2/users/me" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1286,27 +1297,27 @@ def test_search_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for search: {e}") + pytest.fail(f"Contract test failed for get_me: {e}") - def test_search_required_parameters(self): - """Test that search handles parameters correctly.""" - method = getattr(self.users_client, "search") - # Test with missing required parameters - mock the request to avoid network calls + def test_get_me_required_parameters(self): + """Test that get_me handles parameters correctly.""" + method = getattr(self.users_client, "get_me") + # No required parameters, method should be callable without args with patch.object(self.client, "session") as mock_session: - # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 400 - mock_response.json.return_value = {"error": "Missing required parameters"} - mock_response.raise_for_status.side_effect = Exception("Bad Request") + mock_response.status_code = 200 + mock_response.json.return_value = {} + mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - # Call without required parameters should either raise locally or via server response - with pytest.raises((TypeError, ValueError, Exception)): + try: method() + except Exception as e: + pytest.fail(f"Method with no required params should be callable: {e}") - def test_search_response_structure(self): - """Test search response structure validation.""" + def test_get_me_response_structure(self): + """Test get_me response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1319,10 +1330,9 @@ def test_search_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["query"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "search") + method = getattr(self.users_client, "get_me") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1334,8 +1344,8 @@ def test_search_response_structure(self): ) - def test_get_owned_lists_request_structure(self): - """Test get_owned_lists request structure.""" + def test_get_liked_posts_request_structure(self): + """Test get_liked_posts request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1352,7 +1362,7 @@ def test_get_owned_lists_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_owned_lists") + method = getattr(self.users_client, "get_liked_posts") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1387,7 +1397,7 @@ def test_get_owned_lists_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/owned_lists" + expected_path = "/2/users/{id}/liked_tweets" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1403,12 +1413,12 @@ def test_get_owned_lists_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_owned_lists: {e}") + pytest.fail(f"Contract test failed for get_liked_posts: {e}") - def test_get_owned_lists_required_parameters(self): - """Test that get_owned_lists handles parameters correctly.""" - method = getattr(self.users_client, "get_owned_lists") + def test_get_liked_posts_required_parameters(self): + """Test that get_liked_posts handles parameters correctly.""" + method = getattr(self.users_client, "get_liked_posts") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1422,8 +1432,8 @@ def test_get_owned_lists_required_parameters(self): method() - def test_get_owned_lists_response_structure(self): - """Test get_owned_lists response structure validation.""" + def test_get_liked_posts_response_structure(self): + """Test get_liked_posts response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1439,7 +1449,7 @@ def test_get_owned_lists_response_structure(self): kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_owned_lists") + method = getattr(self.users_client, "get_liked_posts") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1451,8 +1461,8 @@ def test_get_owned_lists_response_structure(self): ) - def test_get_by_usernames_request_structure(self): - """Test get_by_usernames request structure.""" + def test_get_posts_request_structure(self): + """Test get_posts request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1465,11 +1475,11 @@ def test_get_by_usernames_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["usernames"] = ["test_item"] + kwargs["id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_by_usernames") + method = getattr(self.users_client, "get_posts") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1504,7 +1514,7 @@ def test_get_by_usernames_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/by" + expected_path = "/2/users/{id}/tweets" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1520,12 +1530,12 @@ def test_get_by_usernames_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_usernames: {e}") + pytest.fail(f"Contract test failed for get_posts: {e}") - def test_get_by_usernames_required_parameters(self): - """Test that get_by_usernames handles parameters correctly.""" - method = getattr(self.users_client, "get_by_usernames") + def test_get_posts_required_parameters(self): + """Test that get_posts handles parameters correctly.""" + method = getattr(self.users_client, "get_posts") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1539,8 +1549,8 @@ def test_get_by_usernames_required_parameters(self): method() - def test_get_by_usernames_response_structure(self): - """Test get_by_usernames response structure validation.""" + def test_get_posts_response_structure(self): + """Test get_posts response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1553,10 +1563,10 @@ def test_get_by_usernames_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["usernames"] = ["test"] + kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_by_usernames") + method = getattr(self.users_client, "get_posts") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1568,8 +1578,8 @@ def test_get_by_usernames_response_structure(self): ) - def test_get_mentions_request_structure(self): - """Test get_mentions request structure.""" + def test_get_followed_lists_request_structure(self): + """Test get_followed_lists request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1586,7 +1596,7 @@ def test_get_mentions_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_mentions") + method = getattr(self.users_client, "get_followed_lists") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1621,7 +1631,7 @@ def test_get_mentions_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/mentions" + expected_path = "/2/users/{id}/followed_lists" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1637,12 +1647,12 @@ def test_get_mentions_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_mentions: {e}") + pytest.fail(f"Contract test failed for get_followed_lists: {e}") - def test_get_mentions_required_parameters(self): - """Test that get_mentions handles parameters correctly.""" - method = getattr(self.users_client, "get_mentions") + def test_get_followed_lists_required_parameters(self): + """Test that get_followed_lists handles parameters correctly.""" + method = getattr(self.users_client, "get_followed_lists") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1656,8 +1666,8 @@ def test_get_mentions_required_parameters(self): method() - def test_get_mentions_response_structure(self): - """Test get_mentions response structure validation.""" + def test_get_followed_lists_response_structure(self): + """Test get_followed_lists response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1673,7 +1683,7 @@ def test_get_mentions_response_structure(self): kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_mentions") + method = getattr(self.users_client, "get_followed_lists") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1685,8 +1695,8 @@ def test_get_mentions_response_structure(self): ) - def test_get_list_memberships_request_structure(self): - """Test get_list_memberships request structure.""" + def test_follow_list_request_structure(self): + """Test follow_list request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1695,15 +1705,19 @@ def test_get_list_memberships_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import FollowListRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = FollowListRequest() # Call the method try: - method = getattr(self.users_client, "get_list_memberships") + method = getattr(self.users_client, "follow_list") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1722,7 +1736,7 @@ def test_get_list_memberships_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -1731,14 +1745,14 @@ def test_get_list_memberships_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/list_memberships" + expected_path = "/2/users/{id}/followed_lists" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1754,12 +1768,12 @@ def test_get_list_memberships_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_list_memberships: {e}") + pytest.fail(f"Contract test failed for follow_list: {e}") - def test_get_list_memberships_required_parameters(self): - """Test that get_list_memberships handles parameters correctly.""" - method = getattr(self.users_client, "get_list_memberships") + def test_follow_list_required_parameters(self): + """Test that follow_list handles parameters correctly.""" + method = getattr(self.users_client, "follow_list") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1767,14 +1781,14 @@ def test_get_list_memberships_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_list_memberships_response_structure(self): - """Test get_list_memberships response structure validation.""" + def test_follow_list_response_structure(self): + """Test follow_list response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1784,13 +1798,17 @@ def test_get_list_memberships_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import FollowListRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = FollowListRequest() # Call method and verify response structure - method = getattr(self.users_client, "get_list_memberships") + method = getattr(self.users_client, "follow_list") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1802,8 +1820,8 @@ def test_get_list_memberships_response_structure(self): ) - def test_get_blocking_request_structure(self): - """Test get_blocking request structure.""" + def test_get_by_username_request_structure(self): + """Test get_by_username request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1816,11 +1834,11 @@ def test_get_blocking_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["username"] = "test_username" # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_blocking") + method = getattr(self.users_client, "get_by_username") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1855,7 +1873,7 @@ def test_get_blocking_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/blocking" + expected_path = "/2/users/by/username/{username}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1871,12 +1889,12 @@ def test_get_blocking_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_blocking: {e}") + pytest.fail(f"Contract test failed for get_by_username: {e}") - def test_get_blocking_required_parameters(self): - """Test that get_blocking handles parameters correctly.""" - method = getattr(self.users_client, "get_blocking") + def test_get_by_username_required_parameters(self): + """Test that get_by_username handles parameters correctly.""" + method = getattr(self.users_client, "get_by_username") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -1890,8 +1908,8 @@ def test_get_blocking_required_parameters(self): method() - def test_get_blocking_response_structure(self): - """Test get_blocking response structure validation.""" + def test_get_by_username_response_structure(self): + """Test get_by_username response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -1904,10 +1922,10 @@ def test_get_blocking_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["username"] = "test_value" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_blocking") + method = getattr(self.users_client, "get_by_username") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -1919,8 +1937,8 @@ def test_get_blocking_response_structure(self): ) - def test_get_followed_lists_request_structure(self): - """Test get_followed_lists request structure.""" + def test_get_mentions_request_structure(self): + """Test get_mentions request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -1937,7 +1955,7 @@ def test_get_followed_lists_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_followed_lists") + method = getattr(self.users_client, "get_mentions") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -1972,7 +1990,7 @@ def test_get_followed_lists_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/followed_lists" + expected_path = "/2/users/{id}/mentions" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -1988,13 +2006,13 @@ def test_get_followed_lists_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_followed_lists: {e}") + pytest.fail(f"Contract test failed for get_mentions: {e}") - def test_get_followed_lists_required_parameters(self): - """Test that get_followed_lists handles parameters correctly.""" - method = getattr(self.users_client, "get_followed_lists") - # Test with missing required parameters - mock the request to avoid network calls + def test_get_mentions_required_parameters(self): + """Test that get_mentions handles parameters correctly.""" + method = getattr(self.users_client, "get_mentions") + # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) mock_response = Mock() @@ -2007,8 +2025,8 @@ def test_get_followed_lists_required_parameters(self): method() - def test_get_followed_lists_response_structure(self): - """Test get_followed_lists response structure validation.""" + def test_get_mentions_response_structure(self): + """Test get_mentions response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -2024,7 +2042,7 @@ def test_get_followed_lists_response_structure(self): kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_followed_lists") + method = getattr(self.users_client, "get_mentions") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -2036,8 +2054,8 @@ def test_get_followed_lists_response_structure(self): ) - def test_follow_list_request_structure(self): - """Test follow_list request structure.""" + def test_get_owned_lists_request_structure(self): + """Test get_owned_lists request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -2046,19 +2064,15 @@ def test_follow_list_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import FollowListRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = FollowListRequest() # Call the method try: - method = getattr(self.users_client, "follow_list") + method = getattr(self.users_client, "get_owned_lists") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -2077,7 +2091,7 @@ def test_follow_list_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -2086,14 +2100,14 @@ def test_follow_list_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/followed_lists" + expected_path = "/2/users/{id}/owned_lists" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -2109,12 +2123,12 @@ def test_follow_list_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for follow_list: {e}") + pytest.fail(f"Contract test failed for get_owned_lists: {e}") - def test_follow_list_required_parameters(self): - """Test that follow_list handles parameters correctly.""" - method = getattr(self.users_client, "follow_list") + def test_get_owned_lists_required_parameters(self): + """Test that get_owned_lists handles parameters correctly.""" + method = getattr(self.users_client, "get_owned_lists") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -2122,14 +2136,14 @@ def test_follow_list_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_follow_list_response_structure(self): - """Test follow_list response structure validation.""" + def test_get_owned_lists_response_structure(self): + """Test get_owned_lists response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -2139,17 +2153,13 @@ def test_follow_list_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import FollowListRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = FollowListRequest() # Call method and verify response structure - method = getattr(self.users_client, "follow_list") + method = getattr(self.users_client, "get_owned_lists") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -2161,8 +2171,8 @@ def test_follow_list_response_structure(self): ) - def test_unrepost_post_request_structure(self): - """Test unrepost_post request structure.""" + def test_repost_post_request_structure(self): + """Test repost_post request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -2171,16 +2181,19 @@ def test_unrepost_post_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" - kwargs["source_tweet_id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import RepostPostRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = RepostPostRequest() # Call the method try: - method = getattr(self.users_client, "unrepost_post") + method = getattr(self.users_client, "repost_post") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -2199,7 +2212,7 @@ def test_unrepost_post_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -2208,14 +2221,14 @@ def test_unrepost_post_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/retweets/{source_tweet_id}" + expected_path = "/2/users/{id}/retweets" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -2231,12 +2244,12 @@ def test_unrepost_post_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for unrepost_post: {e}") + pytest.fail(f"Contract test failed for repost_post: {e}") - def test_unrepost_post_required_parameters(self): - """Test that unrepost_post handles parameters correctly.""" - method = getattr(self.users_client, "unrepost_post") + def test_repost_post_required_parameters(self): + """Test that repost_post handles parameters correctly.""" + method = getattr(self.users_client, "repost_post") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -2244,14 +2257,14 @@ def test_unrepost_post_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_unrepost_post_response_structure(self): - """Test unrepost_post response structure validation.""" + def test_repost_post_response_structure(self): + """Test repost_post response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -2261,14 +2274,17 @@ def test_unrepost_post_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" - kwargs["source_tweet_id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import RepostPostRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = RepostPostRequest() # Call method and verify response structure - method = getattr(self.users_client, "unrepost_post") + method = getattr(self.users_client, "repost_post") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -2280,8 +2296,8 @@ def test_unrepost_post_response_structure(self): ) - def test_get_reposts_of_me_request_structure(self): - """Test get_reposts_of_me request structure.""" + def test_unfollow_list_request_structure(self): + """Test unfollow_list request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -2290,14 +2306,16 @@ def test_get_reposts_of_me_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters + kwargs["id"] = "test_value" + kwargs["list_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_reposts_of_me") + method = getattr(self.users_client, "unfollow_list") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -2316,7 +2334,7 @@ def test_get_reposts_of_me_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -2325,14 +2343,14 @@ def test_get_reposts_of_me_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/reposts_of_me" + expected_path = "/2/users/{id}/followed_lists/{list_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -2348,27 +2366,27 @@ def test_get_reposts_of_me_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_reposts_of_me: {e}") + pytest.fail(f"Contract test failed for unfollow_list: {e}") - def test_get_reposts_of_me_required_parameters(self): - """Test that get_reposts_of_me handles parameters correctly.""" - method = getattr(self.users_client, "get_reposts_of_me") - # No required parameters, method should be callable without args + def test_unfollow_list_required_parameters(self): + """Test that unfollow_list handles parameters correctly.""" + method = getattr(self.users_client, "unfollow_list") + # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: + # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 200 - mock_response.json.return_value = {} - mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response - try: + mock_response.status_code = 400 + mock_response.json.return_value = {"error": "Missing required parameters"} + mock_response.raise_for_status.side_effect = Exception("Bad Request") + mock_session.delete.return_value = mock_response + # Call without required parameters should either raise locally or via server response + with pytest.raises((TypeError, ValueError, Exception)): method() - except Exception as e: - pytest.fail(f"Method with no required params should be callable: {e}") - def test_get_reposts_of_me_response_structure(self): - """Test get_reposts_of_me response structure validation.""" + def test_unfollow_list_response_structure(self): + """Test unfollow_list response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -2378,12 +2396,14 @@ def test_get_reposts_of_me_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} + kwargs["id"] = "test" + kwargs["list_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_reposts_of_me") + method = getattr(self.users_client, "unfollow_list") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -2395,8 +2415,8 @@ def test_get_reposts_of_me_response_structure(self): ) - def test_get_bookmarks_request_structure(self): - """Test get_bookmarks request structure.""" + def test_get_by_ids_request_structure(self): + """Test get_by_ids request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -2409,11 +2429,11 @@ def test_get_bookmarks_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["ids"] = ["test_item"] # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_bookmarks") + method = getattr(self.users_client, "get_by_ids") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -2448,7 +2468,7 @@ def test_get_bookmarks_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/bookmarks" + expected_path = "/2/users" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -2464,12 +2484,12 @@ def test_get_bookmarks_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_bookmarks: {e}") + pytest.fail(f"Contract test failed for get_by_ids: {e}") - def test_get_bookmarks_required_parameters(self): - """Test that get_bookmarks handles parameters correctly.""" - method = getattr(self.users_client, "get_bookmarks") + def test_get_by_ids_required_parameters(self): + """Test that get_by_ids handles parameters correctly.""" + method = getattr(self.users_client, "get_by_ids") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -2483,8 +2503,8 @@ def test_get_bookmarks_required_parameters(self): method() - def test_get_bookmarks_response_structure(self): - """Test get_bookmarks response structure validation.""" + def test_get_by_ids_response_structure(self): + """Test get_by_ids response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -2497,10 +2517,10 @@ def test_get_bookmarks_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["ids"] = ["test"] # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_bookmarks") + method = getattr(self.users_client, "get_by_ids") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -2512,8 +2532,8 @@ def test_get_bookmarks_response_structure(self): ) - def test_create_bookmark_request_structure(self): - """Test create_bookmark request structure.""" + def test_get_bookmarks_by_folder_id_request_structure(self): + """Test get_bookmarks_by_folder_id request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -2522,19 +2542,16 @@ def test_create_bookmark_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" + kwargs["folder_id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import CreateBookmarkRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateBookmarkRequest() # Call the method try: - method = getattr(self.users_client, "create_bookmark") + method = getattr(self.users_client, "get_bookmarks_by_folder_id") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -2553,7 +2570,7 @@ def test_create_bookmark_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -2562,14 +2579,14 @@ def test_create_bookmark_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/bookmarks" + expected_path = "/2/users/{id}/bookmarks/folders/{folder_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -2585,12 +2602,12 @@ def test_create_bookmark_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create_bookmark: {e}") + pytest.fail(f"Contract test failed for get_bookmarks_by_folder_id: {e}") - def test_create_bookmark_required_parameters(self): - """Test that create_bookmark handles parameters correctly.""" - method = getattr(self.users_client, "create_bookmark") + def test_get_bookmarks_by_folder_id_required_parameters(self): + """Test that get_bookmarks_by_folder_id handles parameters correctly.""" + method = getattr(self.users_client, "get_bookmarks_by_folder_id") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -2598,14 +2615,14 @@ def test_create_bookmark_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_create_bookmark_response_structure(self): - """Test create_bookmark response structure validation.""" + def test_get_bookmarks_by_folder_id_response_structure(self): + """Test get_bookmarks_by_folder_id response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -2615,17 +2632,14 @@ def test_create_bookmark_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" + kwargs["folder_id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import CreateBookmarkRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = CreateBookmarkRequest() # Call method and verify response structure - method = getattr(self.users_client, "create_bookmark") + method = getattr(self.users_client, "get_bookmarks_by_folder_id") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -2637,8 +2651,8 @@ def test_create_bookmark_response_structure(self): ) - def test_get_by_ids_request_structure(self): - """Test get_by_ids request structure.""" + def test_unblock_dms_request_structure(self): + """Test unblock_dms request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -2647,15 +2661,15 @@ def test_get_by_ids_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["ids"] = ["test_item"] + kwargs["id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_by_ids") + method = getattr(self.users_client, "unblock_dms") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -2674,7 +2688,7 @@ def test_get_by_ids_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -2683,14 +2697,14 @@ def test_get_by_ids_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users" + expected_path = "/2/users/{id}/dm/unblock" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -2706,12 +2720,12 @@ def test_get_by_ids_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_ids: {e}") + pytest.fail(f"Contract test failed for unblock_dms: {e}") - def test_get_by_ids_required_parameters(self): - """Test that get_by_ids handles parameters correctly.""" - method = getattr(self.users_client, "get_by_ids") + def test_unblock_dms_required_parameters(self): + """Test that unblock_dms handles parameters correctly.""" + method = getattr(self.users_client, "unblock_dms") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -2719,14 +2733,14 @@ def test_get_by_ids_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_by_ids_response_structure(self): - """Test get_by_ids response structure validation.""" + def test_unblock_dms_response_structure(self): + """Test unblock_dms response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -2736,13 +2750,13 @@ def test_get_by_ids_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["ids"] = ["test"] + kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_by_ids") + method = getattr(self.users_client, "unblock_dms") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -2754,8 +2768,8 @@ def test_get_by_ids_response_structure(self): ) - def test_get_by_id_request_structure(self): - """Test get_by_id request structure.""" + def test_get_blocking_request_structure(self): + """Test get_blocking request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -2772,7 +2786,7 @@ def test_get_by_id_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_by_id") + method = getattr(self.users_client, "get_blocking") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -2807,7 +2821,7 @@ def test_get_by_id_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}" + expected_path = "/2/users/{id}/blocking" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -2823,12 +2837,12 @@ def test_get_by_id_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_id: {e}") + pytest.fail(f"Contract test failed for get_blocking: {e}") - def test_get_by_id_required_parameters(self): - """Test that get_by_id handles parameters correctly.""" - method = getattr(self.users_client, "get_by_id") + def test_get_blocking_required_parameters(self): + """Test that get_blocking handles parameters correctly.""" + method = getattr(self.users_client, "get_blocking") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -2842,8 +2856,8 @@ def test_get_by_id_required_parameters(self): method() - def test_get_by_id_response_structure(self): - """Test get_by_id response structure validation.""" + def test_get_blocking_response_structure(self): + """Test get_blocking response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -2859,7 +2873,7 @@ def test_get_by_id_response_structure(self): kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_by_id") + method = getattr(self.users_client, "get_blocking") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -2871,8 +2885,8 @@ def test_get_by_id_response_structure(self): ) - def test_get_bookmark_folders_request_structure(self): - """Test get_bookmark_folders request structure.""" + def test_get_by_usernames_request_structure(self): + """Test get_by_usernames request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -2885,11 +2899,11 @@ def test_get_bookmark_folders_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["usernames"] = ["test_item"] # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_bookmark_folders") + method = getattr(self.users_client, "get_by_usernames") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -2924,7 +2938,7 @@ def test_get_bookmark_folders_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/bookmarks/folders" + expected_path = "/2/users/by" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -2940,12 +2954,12 @@ def test_get_bookmark_folders_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_bookmark_folders: {e}") + pytest.fail(f"Contract test failed for get_by_usernames: {e}") - def test_get_bookmark_folders_required_parameters(self): - """Test that get_bookmark_folders handles parameters correctly.""" - method = getattr(self.users_client, "get_bookmark_folders") + def test_get_by_usernames_required_parameters(self): + """Test that get_by_usernames handles parameters correctly.""" + method = getattr(self.users_client, "get_by_usernames") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -2959,8 +2973,8 @@ def test_get_bookmark_folders_required_parameters(self): method() - def test_get_bookmark_folders_response_structure(self): - """Test get_bookmark_folders response structure validation.""" + def test_get_by_usernames_response_structure(self): + """Test get_by_usernames response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -2973,10 +2987,10 @@ def test_get_bookmark_folders_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["usernames"] = ["test"] # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_bookmark_folders") + method = getattr(self.users_client, "get_by_usernames") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -2988,8 +3002,8 @@ def test_get_bookmark_folders_response_structure(self): ) - def test_unblock_dms_request_structure(self): - """Test unblock_dms request structure.""" + def test_unfollow_user_request_structure(self): + """Test unfollow_user request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -2998,15 +3012,16 @@ def test_unblock_dms_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" + kwargs["source_user_id"] = "test_value" + kwargs["target_user_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "unblock_dms") + method = getattr(self.users_client, "unfollow_user") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -3025,7 +3040,7 @@ def test_unblock_dms_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -3034,14 +3049,14 @@ def test_unblock_dms_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/dm/unblock" + expected_path = "/2/users/{source_user_id}/following/{target_user_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -3057,12 +3072,12 @@ def test_unblock_dms_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for unblock_dms: {e}") + pytest.fail(f"Contract test failed for unfollow_user: {e}") - def test_unblock_dms_required_parameters(self): - """Test that unblock_dms handles parameters correctly.""" - method = getattr(self.users_client, "unblock_dms") + def test_unfollow_user_required_parameters(self): + """Test that unfollow_user handles parameters correctly.""" + method = getattr(self.users_client, "unfollow_user") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -3070,14 +3085,14 @@ def test_unblock_dms_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_unblock_dms_response_structure(self): - """Test unblock_dms response structure validation.""" + def test_unfollow_user_response_structure(self): + """Test unfollow_user response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -3087,13 +3102,14 @@ def test_unblock_dms_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" + kwargs["source_user_id"] = "test" + kwargs["target_user_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "unblock_dms") + method = getattr(self.users_client, "unfollow_user") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -3105,8 +3121,8 @@ def test_unblock_dms_response_structure(self): ) - def test_get_pinned_lists_request_structure(self): - """Test get_pinned_lists request structure.""" + def test_block_dms_request_structure(self): + """Test block_dms request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -3115,7 +3131,7 @@ def test_get_pinned_lists_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters @@ -3123,7 +3139,7 @@ def test_get_pinned_lists_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_pinned_lists") + method = getattr(self.users_client, "block_dms") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -3142,7 +3158,7 @@ def test_get_pinned_lists_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -3151,14 +3167,14 @@ def test_get_pinned_lists_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/pinned_lists" + expected_path = "/2/users/{id}/dm/block" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -3174,12 +3190,12 @@ def test_get_pinned_lists_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_pinned_lists: {e}") + pytest.fail(f"Contract test failed for block_dms: {e}") - def test_get_pinned_lists_required_parameters(self): - """Test that get_pinned_lists handles parameters correctly.""" - method = getattr(self.users_client, "get_pinned_lists") + def test_block_dms_required_parameters(self): + """Test that block_dms handles parameters correctly.""" + method = getattr(self.users_client, "block_dms") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -3187,14 +3203,14 @@ def test_get_pinned_lists_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_pinned_lists_response_structure(self): - """Test get_pinned_lists response structure validation.""" + def test_block_dms_response_structure(self): + """Test block_dms response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -3204,13 +3220,13 @@ def test_get_pinned_lists_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_pinned_lists") + method = getattr(self.users_client, "block_dms") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -3222,8 +3238,8 @@ def test_get_pinned_lists_response_structure(self): ) - def test_pin_list_request_structure(self): - """Test pin_list request structure.""" + def test_get_followers_request_structure(self): + """Test get_followers request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -3232,19 +3248,15 @@ def test_pin_list_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import PinListRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = PinListRequest() # Call the method try: - method = getattr(self.users_client, "pin_list") + method = getattr(self.users_client, "get_followers") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -3263,7 +3275,7 @@ def test_pin_list_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -3272,14 +3284,14 @@ def test_pin_list_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/pinned_lists" + expected_path = "/2/users/{id}/followers" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -3295,12 +3307,12 @@ def test_pin_list_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for pin_list: {e}") + pytest.fail(f"Contract test failed for get_followers: {e}") - def test_pin_list_required_parameters(self): - """Test that pin_list handles parameters correctly.""" - method = getattr(self.users_client, "pin_list") + def test_get_followers_required_parameters(self): + """Test that get_followers handles parameters correctly.""" + method = getattr(self.users_client, "get_followers") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -3308,14 +3320,14 @@ def test_pin_list_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_pin_list_response_structure(self): - """Test pin_list response structure validation.""" + def test_get_followers_response_structure(self): + """Test get_followers response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -3325,17 +3337,13 @@ def test_pin_list_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import PinListRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = PinListRequest() # Call method and verify response structure - method = getattr(self.users_client, "pin_list") + method = getattr(self.users_client, "get_followers") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -3347,8 +3355,8 @@ def test_pin_list_response_structure(self): ) - def test_get_liked_posts_request_structure(self): - """Test get_liked_posts request structure.""" + def test_get_by_id_request_structure(self): + """Test get_by_id request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -3365,7 +3373,7 @@ def test_get_liked_posts_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_liked_posts") + method = getattr(self.users_client, "get_by_id") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -3400,7 +3408,7 @@ def test_get_liked_posts_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/liked_tweets" + expected_path = "/2/users/{id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -3416,12 +3424,12 @@ def test_get_liked_posts_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_liked_posts: {e}") + pytest.fail(f"Contract test failed for get_by_id: {e}") - def test_get_liked_posts_required_parameters(self): - """Test that get_liked_posts handles parameters correctly.""" - method = getattr(self.users_client, "get_liked_posts") + def test_get_by_id_required_parameters(self): + """Test that get_by_id handles parameters correctly.""" + method = getattr(self.users_client, "get_by_id") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -3435,8 +3443,8 @@ def test_get_liked_posts_required_parameters(self): method() - def test_get_liked_posts_response_structure(self): - """Test get_liked_posts response structure validation.""" + def test_get_by_id_response_structure(self): + """Test get_by_id response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -3452,7 +3460,7 @@ def test_get_liked_posts_response_structure(self): kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_liked_posts") + method = getattr(self.users_client, "get_by_id") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -3464,8 +3472,8 @@ def test_get_liked_posts_response_structure(self): ) - def test_get_bookmarks_by_folder_id_request_structure(self): - """Test get_bookmarks_by_folder_id request structure.""" + def test_get_bookmark_folders_request_structure(self): + """Test get_bookmark_folders request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -3479,11 +3487,10 @@ def test_get_bookmarks_by_folder_id_request_structure(self): kwargs = {} # Add required parameters kwargs["id"] = "test_value" - kwargs["folder_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_bookmarks_by_folder_id") + method = getattr(self.users_client, "get_bookmark_folders") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -3518,7 +3525,7 @@ def test_get_bookmarks_by_folder_id_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/bookmarks/folders/{folder_id}" + expected_path = "/2/users/{id}/bookmarks/folders" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -3534,12 +3541,12 @@ def test_get_bookmarks_by_folder_id_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_bookmarks_by_folder_id: {e}") + pytest.fail(f"Contract test failed for get_bookmark_folders: {e}") - def test_get_bookmarks_by_folder_id_required_parameters(self): - """Test that get_bookmarks_by_folder_id handles parameters correctly.""" - method = getattr(self.users_client, "get_bookmarks_by_folder_id") + def test_get_bookmark_folders_required_parameters(self): + """Test that get_bookmark_folders handles parameters correctly.""" + method = getattr(self.users_client, "get_bookmark_folders") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -3553,8 +3560,8 @@ def test_get_bookmarks_by_folder_id_required_parameters(self): method() - def test_get_bookmarks_by_folder_id_response_structure(self): - """Test get_bookmarks_by_folder_id response structure validation.""" + def test_get_bookmark_folders_response_structure(self): + """Test get_bookmark_folders response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -3568,10 +3575,9 @@ def test_get_bookmarks_by_folder_id_response_structure(self): # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" - kwargs["folder_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_bookmarks_by_folder_id") + method = getattr(self.users_client, "get_bookmark_folders") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -3583,8 +3589,8 @@ def test_get_bookmarks_by_folder_id_response_structure(self): ) - def test_like_post_request_structure(self): - """Test like_post request structure.""" + def test_get_following_request_structure(self): + """Test get_following request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -3593,19 +3599,15 @@ def test_like_post_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import LikePostRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = LikePostRequest() # Call the method try: - method = getattr(self.users_client, "like_post") + method = getattr(self.users_client, "get_following") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -3624,7 +3626,7 @@ def test_like_post_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -3633,14 +3635,14 @@ def test_like_post_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/likes" + expected_path = "/2/users/{id}/following" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -3656,12 +3658,12 @@ def test_like_post_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for like_post: {e}") + pytest.fail(f"Contract test failed for get_following: {e}") - def test_like_post_required_parameters(self): - """Test that like_post handles parameters correctly.""" - method = getattr(self.users_client, "like_post") + def test_get_following_required_parameters(self): + """Test that get_following handles parameters correctly.""" + method = getattr(self.users_client, "get_following") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -3669,14 +3671,14 @@ def test_like_post_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_like_post_response_structure(self): - """Test like_post response structure validation.""" + def test_get_following_response_structure(self): + """Test get_following response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -3686,17 +3688,13 @@ def test_like_post_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required - # Import and create proper request model instance - from xdk.users.models import LikePostRequest - # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = LikePostRequest() # Call method and verify response structure - method = getattr(self.users_client, "like_post") + method = getattr(self.users_client, "get_following") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -3708,8 +3706,8 @@ def test_like_post_response_structure(self): ) - def test_unpin_list_request_structure(self): - """Test unpin_list request structure.""" + def test_follow_user_request_structure(self): + """Test follow_user request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -3718,16 +3716,19 @@ def test_unpin_list_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" - kwargs["list_id"] = "test_value" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import FollowUserRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = FollowUserRequest() # Call the method try: - method = getattr(self.users_client, "unpin_list") + method = getattr(self.users_client, "follow_user") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -3746,7 +3747,7 @@ def test_unpin_list_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -3755,14 +3756,14 @@ def test_unpin_list_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/pinned_lists/{list_id}" + expected_path = "/2/users/{id}/following" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -3778,12 +3779,12 @@ def test_unpin_list_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for unpin_list: {e}") + pytest.fail(f"Contract test failed for follow_user: {e}") - def test_unpin_list_required_parameters(self): - """Test that unpin_list handles parameters correctly.""" - method = getattr(self.users_client, "unpin_list") + def test_follow_user_required_parameters(self): + """Test that follow_user handles parameters correctly.""" + method = getattr(self.users_client, "follow_user") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -3791,14 +3792,14 @@ def test_unpin_list_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_unpin_list_response_structure(self): - """Test unpin_list response structure validation.""" + def test_follow_user_response_structure(self): + """Test follow_user response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -3808,14 +3809,17 @@ def test_unpin_list_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" - kwargs["list_id"] = "test" # Add request body if required + # Import and create proper request model instance + from xdk.users.models import FollowUserRequest + # Create instance with minimal valid data (empty instance should work for most cases) + kwargs["body"] = FollowUserRequest() # Call method and verify response structure - method = getattr(self.users_client, "unpin_list") + method = getattr(self.users_client, "follow_user") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -3827,8 +3831,8 @@ def test_unpin_list_response_structure(self): ) - def test_get_by_username_request_structure(self): - """Test get_by_username request structure.""" + def test_get_timeline_request_structure(self): + """Test get_timeline request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -3841,11 +3845,11 @@ def test_get_by_username_request_structure(self): # Prepare test parameters kwargs = {} # Add required parameters - kwargs["username"] = "test_username" + kwargs["id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_by_username") + method = getattr(self.users_client, "get_timeline") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -3880,7 +3884,7 @@ def test_get_by_username_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/by/username/{username}" + expected_path = "/2/users/{id}/timelines/reverse_chronological" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -3896,12 +3900,12 @@ def test_get_by_username_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_by_username: {e}") + pytest.fail(f"Contract test failed for get_timeline: {e}") - def test_get_by_username_required_parameters(self): - """Test that get_by_username handles parameters correctly.""" - method = getattr(self.users_client, "get_by_username") + def test_get_timeline_required_parameters(self): + """Test that get_timeline handles parameters correctly.""" + method = getattr(self.users_client, "get_timeline") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -3915,8 +3919,8 @@ def test_get_by_username_required_parameters(self): method() - def test_get_by_username_response_structure(self): - """Test get_by_username response structure validation.""" + def test_get_timeline_response_structure(self): + """Test get_timeline response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -3929,10 +3933,10 @@ def test_get_by_username_response_structure(self): mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["username"] = "test_value" + kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_by_username") + method = getattr(self.users_client, "get_timeline") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -3944,8 +3948,8 @@ def test_get_by_username_response_structure(self): ) - def test_delete_bookmark_request_structure(self): - """Test delete_bookmark request structure.""" + def test_search_request_structure(self): + """Test search request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -3954,16 +3958,15 @@ def test_delete_bookmark_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["id"] = "test_value" - kwargs["tweet_id"] = "test_value" + kwargs["query"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "delete_bookmark") + method = getattr(self.users_client, "search") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -3982,7 +3985,7 @@ def test_delete_bookmark_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -3991,14 +3994,14 @@ def test_delete_bookmark_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/bookmarks/{tweet_id}" + expected_path = "/2/users/search" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -4014,12 +4017,12 @@ def test_delete_bookmark_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for delete_bookmark: {e}") + pytest.fail(f"Contract test failed for search: {e}") - def test_delete_bookmark_required_parameters(self): - """Test that delete_bookmark handles parameters correctly.""" - method = getattr(self.users_client, "delete_bookmark") + def test_search_required_parameters(self): + """Test that search handles parameters correctly.""" + method = getattr(self.users_client, "search") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -4027,14 +4030,14 @@ def test_delete_bookmark_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_delete_bookmark_response_structure(self): - """Test delete_bookmark response structure validation.""" + def test_search_response_structure(self): + """Test search response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -4044,14 +4047,13 @@ def test_delete_bookmark_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["id"] = "test" - kwargs["tweet_id"] = "test" + kwargs["query"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "delete_bookmark") + method = getattr(self.users_client, "search") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -4063,8 +4065,8 @@ def test_delete_bookmark_response_structure(self): ) - def test_block_dms_request_structure(self): - """Test block_dms request structure.""" + def test_get_bookmarks_request_structure(self): + """Test get_bookmarks request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -4073,7 +4075,7 @@ def test_block_dms_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters @@ -4081,7 +4083,7 @@ def test_block_dms_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.users_client, "block_dms") + method = getattr(self.users_client, "get_bookmarks") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -4100,7 +4102,7 @@ def test_block_dms_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -4109,14 +4111,14 @@ def test_block_dms_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/dm/block" + expected_path = "/2/users/{id}/bookmarks" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -4132,12 +4134,12 @@ def test_block_dms_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for block_dms: {e}") + pytest.fail(f"Contract test failed for get_bookmarks: {e}") - def test_block_dms_required_parameters(self): - """Test that block_dms handles parameters correctly.""" - method = getattr(self.users_client, "block_dms") + def test_get_bookmarks_required_parameters(self): + """Test that get_bookmarks handles parameters correctly.""" + method = getattr(self.users_client, "get_bookmarks") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -4145,14 +4147,14 @@ def test_block_dms_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_block_dms_response_structure(self): - """Test block_dms response structure validation.""" + def test_get_bookmarks_response_structure(self): + """Test get_bookmarks response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -4162,13 +4164,13 @@ def test_block_dms_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "block_dms") + method = getattr(self.users_client, "get_bookmarks") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -4180,8 +4182,8 @@ def test_block_dms_response_structure(self): ) - def test_repost_post_request_structure(self): - """Test repost_post request structure.""" + def test_create_bookmark_request_structure(self): + """Test create_bookmark request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -4197,12 +4199,12 @@ def test_repost_post_request_structure(self): kwargs["id"] = "test_value" # Add request body if required # Import and create proper request model instance - from xdk.users.models import RepostPostRequest + from xdk.users.models import CreateBookmarkRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = RepostPostRequest() + kwargs["body"] = CreateBookmarkRequest() # Call the method try: - method = getattr(self.users_client, "repost_post") + method = getattr(self.users_client, "create_bookmark") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -4237,7 +4239,7 @@ def test_repost_post_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/retweets" + expected_path = "/2/users/{id}/bookmarks" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -4253,12 +4255,12 @@ def test_repost_post_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for repost_post: {e}") + pytest.fail(f"Contract test failed for create_bookmark: {e}") - def test_repost_post_required_parameters(self): - """Test that repost_post handles parameters correctly.""" - method = getattr(self.users_client, "repost_post") + def test_create_bookmark_required_parameters(self): + """Test that create_bookmark handles parameters correctly.""" + method = getattr(self.users_client, "create_bookmark") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -4272,8 +4274,8 @@ def test_repost_post_required_parameters(self): method() - def test_repost_post_response_structure(self): - """Test repost_post response structure validation.""" + def test_create_bookmark_response_structure(self): + """Test create_bookmark response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -4289,11 +4291,11 @@ def test_repost_post_response_structure(self): kwargs["id"] = "test" # Add request body if required # Import and create proper request model instance - from xdk.users.models import RepostPostRequest + from xdk.users.models import CreateBookmarkRequest # Create instance with minimal valid data (empty instance should work for most cases) - kwargs["body"] = RepostPostRequest() + kwargs["body"] = CreateBookmarkRequest() # Call method and verify response structure - method = getattr(self.users_client, "repost_post") + method = getattr(self.users_client, "create_bookmark") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -4305,8 +4307,8 @@ def test_repost_post_response_structure(self): ) - def test_unfollow_user_request_structure(self): - """Test unfollow_user request structure.""" + def test_get_reposts_of_me_request_structure(self): + """Test get_reposts_of_me request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -4315,16 +4317,14 @@ def test_unfollow_user_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters - kwargs["source_user_id"] = "test_value" - kwargs["target_user_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "unfollow_user") + method = getattr(self.users_client, "get_reposts_of_me") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -4343,7 +4343,7 @@ def test_unfollow_user_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.delete.return_value = mock_streaming_response + mock_session.get.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -4352,14 +4352,14 @@ def test_unfollow_user_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.delete.assert_called_once() + mock_session.get.assert_called_once() # Verify request structure - call_args = mock_session.delete.call_args + call_args = mock_session.get.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{source_user_id}/following/{target_user_id}" + expected_path = "/2/users/reposts_of_me" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -4375,27 +4375,27 @@ def test_unfollow_user_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for unfollow_user: {e}") + pytest.fail(f"Contract test failed for get_reposts_of_me: {e}") - def test_unfollow_user_required_parameters(self): - """Test that unfollow_user handles parameters correctly.""" - method = getattr(self.users_client, "unfollow_user") - # Test with missing required parameters - mock the request to avoid network calls + def test_get_reposts_of_me_required_parameters(self): + """Test that get_reposts_of_me handles parameters correctly.""" + method = getattr(self.users_client, "get_reposts_of_me") + # No required parameters, method should be callable without args with patch.object(self.client, "session") as mock_session: - # Mock a 400 response (typical for missing required parameters) mock_response = Mock() - mock_response.status_code = 400 - mock_response.json.return_value = {"error": "Missing required parameters"} - mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.delete.return_value = mock_response - # Call without required parameters should either raise locally or via server response - with pytest.raises((TypeError, ValueError, Exception)): + mock_response.status_code = 200 + mock_response.json.return_value = {} + mock_response.raise_for_status.return_value = None + mock_session.get.return_value = mock_response + try: method() + except Exception as e: + pytest.fail(f"Method with no required params should be callable: {e}") - def test_unfollow_user_response_structure(self): - """Test unfollow_user response structure validation.""" + def test_get_reposts_of_me_response_structure(self): + """Test get_reposts_of_me response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -4405,14 +4405,12 @@ def test_unfollow_user_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.delete.return_value = mock_response + mock_session.get.return_value = mock_response # Prepare minimal valid parameters kwargs = {} - kwargs["source_user_id"] = "test" - kwargs["target_user_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "unfollow_user") + method = getattr(self.users_client, "get_reposts_of_me") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -4424,8 +4422,8 @@ def test_unfollow_user_response_structure(self): ) - def test_get_followers_request_structure(self): - """Test get_followers request structure.""" + def test_unpin_list_request_structure(self): + """Test unpin_list request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -4434,15 +4432,16 @@ def test_get_followers_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters kwargs["id"] = "test_value" + kwargs["list_id"] = "test_value" # Add request body if required # Call the method try: - method = getattr(self.users_client, "get_followers") + method = getattr(self.users_client, "unpin_list") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -4461,7 +4460,7 @@ def test_get_followers_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.get.return_value = mock_streaming_response + mock_session.delete.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -4470,14 +4469,14 @@ def test_get_followers_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.get.assert_called_once() + mock_session.delete.assert_called_once() # Verify request structure - call_args = mock_session.get.call_args + call_args = mock_session.delete.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/users/{id}/followers" + expected_path = "/2/users/{id}/pinned_lists/{list_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -4493,12 +4492,12 @@ def test_get_followers_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for get_followers: {e}") + pytest.fail(f"Contract test failed for unpin_list: {e}") - def test_get_followers_required_parameters(self): - """Test that get_followers handles parameters correctly.""" - method = getattr(self.users_client, "get_followers") + def test_unpin_list_required_parameters(self): + """Test that unpin_list handles parameters correctly.""" + method = getattr(self.users_client, "unpin_list") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -4506,14 +4505,14 @@ def test_get_followers_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_get_followers_response_structure(self): - """Test get_followers response structure validation.""" + def test_unpin_list_response_structure(self): + """Test unpin_list response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -4523,13 +4522,14 @@ def test_get_followers_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.get.return_value = mock_response + mock_session.delete.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["id"] = "test" + kwargs["list_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.users_client, "get_followers") + method = getattr(self.users_client, "unpin_list") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/users/test_pagination.py b/xdk/python/tests/users/test_pagination.py index dd982f9c..1c0936d4 100644 --- a/xdk/python/tests/users/test_pagination.py +++ b/xdk/python/tests/users/test_pagination.py @@ -169,20 +169,20 @@ def test_get_muting_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_posts_cursor_creation(self): - """Test that get_posts can be used with Cursor.""" - method = getattr(self.users_client, "get_posts") + def test_get_list_memberships_cursor_creation(self): + """Test that get_list_memberships can be used with Cursor.""" + method = getattr(self.users_client, "get_list_memberships") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_posts should support pagination") + pytest.fail(f"Method get_list_memberships should support pagination") - def test_get_posts_cursor_pages(self): - """Test pagination with pages() for get_posts.""" + def test_get_list_memberships_cursor_pages(self): + """Test pagination with pages() for get_list_memberships.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -203,7 +203,7 @@ def test_get_posts_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_posts") + method = getattr(self.users_client, "get_list_memberships") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -219,8 +219,8 @@ def test_get_posts_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_posts_cursor_items(self): - """Test pagination with items() for get_posts.""" + def test_get_list_memberships_cursor_items(self): + """Test pagination with items() for get_list_memberships.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -239,7 +239,7 @@ def test_get_posts_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_posts") + method = getattr(self.users_client, "get_list_memberships") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -250,15 +250,15 @@ def test_get_posts_cursor_items(self): ), "Items should have 'id' field" - def test_get_posts_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_posts.""" + def test_get_list_memberships_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_list_memberships.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_posts") + method = getattr(self.users_client, "get_list_memberships") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -311,20 +311,20 @@ def test_get_posts_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_following_cursor_creation(self): - """Test that get_following can be used with Cursor.""" - method = getattr(self.users_client, "get_following") + def test_get_liked_posts_cursor_creation(self): + """Test that get_liked_posts can be used with Cursor.""" + method = getattr(self.users_client, "get_liked_posts") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_following should support pagination") + pytest.fail(f"Method get_liked_posts should support pagination") - def test_get_following_cursor_pages(self): - """Test pagination with pages() for get_following.""" + def test_get_liked_posts_cursor_pages(self): + """Test pagination with pages() for get_liked_posts.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -345,7 +345,7 @@ def test_get_following_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_following") + method = getattr(self.users_client, "get_liked_posts") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -361,8 +361,8 @@ def test_get_following_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_following_cursor_items(self): - """Test pagination with items() for get_following.""" + def test_get_liked_posts_cursor_items(self): + """Test pagination with items() for get_liked_posts.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -381,7 +381,7 @@ def test_get_following_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_following") + method = getattr(self.users_client, "get_liked_posts") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -392,15 +392,15 @@ def test_get_following_cursor_items(self): ), "Items should have 'id' field" - def test_get_following_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_following.""" + def test_get_liked_posts_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_liked_posts.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_following") + method = getattr(self.users_client, "get_liked_posts") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -453,20 +453,20 @@ def test_get_following_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_timeline_cursor_creation(self): - """Test that get_timeline can be used with Cursor.""" - method = getattr(self.users_client, "get_timeline") + def test_get_posts_cursor_creation(self): + """Test that get_posts can be used with Cursor.""" + method = getattr(self.users_client, "get_posts") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_timeline should support pagination") + pytest.fail(f"Method get_posts should support pagination") - def test_get_timeline_cursor_pages(self): - """Test pagination with pages() for get_timeline.""" + def test_get_posts_cursor_pages(self): + """Test pagination with pages() for get_posts.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -487,7 +487,7 @@ def test_get_timeline_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_timeline") + method = getattr(self.users_client, "get_posts") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -503,8 +503,8 @@ def test_get_timeline_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_timeline_cursor_items(self): - """Test pagination with items() for get_timeline.""" + def test_get_posts_cursor_items(self): + """Test pagination with items() for get_posts.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -523,7 +523,7 @@ def test_get_timeline_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_timeline") + method = getattr(self.users_client, "get_posts") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -534,15 +534,15 @@ def test_get_timeline_cursor_items(self): ), "Items should have 'id' field" - def test_get_timeline_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_timeline.""" + def test_get_posts_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_posts.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_timeline") + method = getattr(self.users_client, "get_posts") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -595,20 +595,20 @@ def test_get_timeline_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_search_cursor_creation(self): - """Test that search can be used with Cursor.""" - method = getattr(self.users_client, "search") + def test_get_followed_lists_cursor_creation(self): + """Test that get_followed_lists can be used with Cursor.""" + method = getattr(self.users_client, "get_followed_lists") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method search should support pagination") + pytest.fail(f"Method get_followed_lists should support pagination") - def test_search_cursor_pages(self): - """Test pagination with pages() for search.""" + def test_get_followed_lists_cursor_pages(self): + """Test pagination with pages() for get_followed_lists.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -629,7 +629,7 @@ def test_search_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "search") + method = getattr(self.users_client, "get_followed_lists") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -645,8 +645,8 @@ def test_search_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_search_cursor_items(self): - """Test pagination with items() for search.""" + def test_get_followed_lists_cursor_items(self): + """Test pagination with items() for get_followed_lists.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -665,7 +665,7 @@ def test_search_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "search") + method = getattr(self.users_client, "get_followed_lists") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -676,15 +676,15 @@ def test_search_cursor_items(self): ), "Items should have 'id' field" - def test_search_pagination_parameters(self): - """Test that pagination parameters are handled correctly for search.""" + def test_get_followed_lists_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_followed_lists.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "search") + method = getattr(self.users_client, "get_followed_lists") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -730,27 +730,27 @@ def test_search_pagination_parameters(self): ): second_params = second_call_args[1]["params"] assert ( - "next_token" in second_params - ), "Second request should include next_token" + "pagination_token" in second_params + ), "Second request should include pagination_token" assert ( - second_params["next_token"] == "next_token_value" + second_params["pagination_token"] == "next_token_value" ), "Pagination token should be passed correctly" - def test_get_owned_lists_cursor_creation(self): - """Test that get_owned_lists can be used with Cursor.""" - method = getattr(self.users_client, "get_owned_lists") + def test_get_mentions_cursor_creation(self): + """Test that get_mentions can be used with Cursor.""" + method = getattr(self.users_client, "get_mentions") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_owned_lists should support pagination") + pytest.fail(f"Method get_mentions should support pagination") - def test_get_owned_lists_cursor_pages(self): - """Test pagination with pages() for get_owned_lists.""" + def test_get_mentions_cursor_pages(self): + """Test pagination with pages() for get_mentions.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -771,7 +771,7 @@ def test_get_owned_lists_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_owned_lists") + method = getattr(self.users_client, "get_mentions") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -787,8 +787,8 @@ def test_get_owned_lists_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_owned_lists_cursor_items(self): - """Test pagination with items() for get_owned_lists.""" + def test_get_mentions_cursor_items(self): + """Test pagination with items() for get_mentions.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -807,7 +807,7 @@ def test_get_owned_lists_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_owned_lists") + method = getattr(self.users_client, "get_mentions") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -818,15 +818,15 @@ def test_get_owned_lists_cursor_items(self): ), "Items should have 'id' field" - def test_get_owned_lists_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_owned_lists.""" + def test_get_mentions_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_mentions.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_owned_lists") + method = getattr(self.users_client, "get_mentions") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -879,20 +879,20 @@ def test_get_owned_lists_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_mentions_cursor_creation(self): - """Test that get_mentions can be used with Cursor.""" - method = getattr(self.users_client, "get_mentions") + def test_get_owned_lists_cursor_creation(self): + """Test that get_owned_lists can be used with Cursor.""" + method = getattr(self.users_client, "get_owned_lists") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_mentions should support pagination") + pytest.fail(f"Method get_owned_lists should support pagination") - def test_get_mentions_cursor_pages(self): - """Test pagination with pages() for get_mentions.""" + def test_get_owned_lists_cursor_pages(self): + """Test pagination with pages() for get_owned_lists.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -913,7 +913,7 @@ def test_get_mentions_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_mentions") + method = getattr(self.users_client, "get_owned_lists") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -929,8 +929,8 @@ def test_get_mentions_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_mentions_cursor_items(self): - """Test pagination with items() for get_mentions.""" + def test_get_owned_lists_cursor_items(self): + """Test pagination with items() for get_owned_lists.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -949,7 +949,7 @@ def test_get_mentions_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_mentions") + method = getattr(self.users_client, "get_owned_lists") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -960,15 +960,15 @@ def test_get_mentions_cursor_items(self): ), "Items should have 'id' field" - def test_get_mentions_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_mentions.""" + def test_get_owned_lists_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_owned_lists.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_mentions") + method = getattr(self.users_client, "get_owned_lists") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -1021,20 +1021,20 @@ def test_get_mentions_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_list_memberships_cursor_creation(self): - """Test that get_list_memberships can be used with Cursor.""" - method = getattr(self.users_client, "get_list_memberships") + def test_get_blocking_cursor_creation(self): + """Test that get_blocking can be used with Cursor.""" + method = getattr(self.users_client, "get_blocking") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_list_memberships should support pagination") + pytest.fail(f"Method get_blocking should support pagination") - def test_get_list_memberships_cursor_pages(self): - """Test pagination with pages() for get_list_memberships.""" + def test_get_blocking_cursor_pages(self): + """Test pagination with pages() for get_blocking.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -1055,7 +1055,7 @@ def test_get_list_memberships_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_list_memberships") + method = getattr(self.users_client, "get_blocking") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -1071,8 +1071,8 @@ def test_get_list_memberships_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_list_memberships_cursor_items(self): - """Test pagination with items() for get_list_memberships.""" + def test_get_blocking_cursor_items(self): + """Test pagination with items() for get_blocking.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -1091,7 +1091,7 @@ def test_get_list_memberships_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_list_memberships") + method = getattr(self.users_client, "get_blocking") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -1102,15 +1102,15 @@ def test_get_list_memberships_cursor_items(self): ), "Items should have 'id' field" - def test_get_list_memberships_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_list_memberships.""" + def test_get_blocking_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_blocking.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_list_memberships") + method = getattr(self.users_client, "get_blocking") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -1163,20 +1163,20 @@ def test_get_list_memberships_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_blocking_cursor_creation(self): - """Test that get_blocking can be used with Cursor.""" - method = getattr(self.users_client, "get_blocking") + def test_get_followers_cursor_creation(self): + """Test that get_followers can be used with Cursor.""" + method = getattr(self.users_client, "get_followers") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_blocking should support pagination") + pytest.fail(f"Method get_followers should support pagination") - def test_get_blocking_cursor_pages(self): - """Test pagination with pages() for get_blocking.""" + def test_get_followers_cursor_pages(self): + """Test pagination with pages() for get_followers.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -1197,7 +1197,7 @@ def test_get_blocking_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_blocking") + method = getattr(self.users_client, "get_followers") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -1213,8 +1213,8 @@ def test_get_blocking_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_blocking_cursor_items(self): - """Test pagination with items() for get_blocking.""" + def test_get_followers_cursor_items(self): + """Test pagination with items() for get_followers.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -1233,7 +1233,7 @@ def test_get_blocking_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_blocking") + method = getattr(self.users_client, "get_followers") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -1244,15 +1244,15 @@ def test_get_blocking_cursor_items(self): ), "Items should have 'id' field" - def test_get_blocking_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_blocking.""" + def test_get_followers_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_followers.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_blocking") + method = getattr(self.users_client, "get_followers") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -1305,20 +1305,20 @@ def test_get_blocking_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_followed_lists_cursor_creation(self): - """Test that get_followed_lists can be used with Cursor.""" - method = getattr(self.users_client, "get_followed_lists") + def test_get_bookmark_folders_cursor_creation(self): + """Test that get_bookmark_folders can be used with Cursor.""" + method = getattr(self.users_client, "get_bookmark_folders") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_followed_lists should support pagination") + pytest.fail(f"Method get_bookmark_folders should support pagination") - def test_get_followed_lists_cursor_pages(self): - """Test pagination with pages() for get_followed_lists.""" + def test_get_bookmark_folders_cursor_pages(self): + """Test pagination with pages() for get_bookmark_folders.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -1339,7 +1339,7 @@ def test_get_followed_lists_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_followed_lists") + method = getattr(self.users_client, "get_bookmark_folders") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -1355,8 +1355,8 @@ def test_get_followed_lists_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_followed_lists_cursor_items(self): - """Test pagination with items() for get_followed_lists.""" + def test_get_bookmark_folders_cursor_items(self): + """Test pagination with items() for get_bookmark_folders.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -1375,7 +1375,7 @@ def test_get_followed_lists_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_followed_lists") + method = getattr(self.users_client, "get_bookmark_folders") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -1386,15 +1386,15 @@ def test_get_followed_lists_cursor_items(self): ), "Items should have 'id' field" - def test_get_followed_lists_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_followed_lists.""" + def test_get_bookmark_folders_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_bookmark_folders.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_followed_lists") + method = getattr(self.users_client, "get_bookmark_folders") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -1447,20 +1447,20 @@ def test_get_followed_lists_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_reposts_of_me_cursor_creation(self): - """Test that get_reposts_of_me can be used with Cursor.""" - method = getattr(self.users_client, "get_reposts_of_me") + def test_get_following_cursor_creation(self): + """Test that get_following can be used with Cursor.""" + method = getattr(self.users_client, "get_following") # Should be able to create cursor without error try: - test_cursor = cursor(method, max_results=10) + test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_reposts_of_me should support pagination") + pytest.fail(f"Method get_following should support pagination") - def test_get_reposts_of_me_cursor_pages(self): - """Test pagination with pages() for get_reposts_of_me.""" + def test_get_following_cursor_pages(self): + """Test pagination with pages() for get_following.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -1481,8 +1481,8 @@ def test_get_reposts_of_me_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_reposts_of_me") - test_cursor = cursor(method, max_results=2) + method = getattr(self.users_client, "get_following") + test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" # Verify first page @@ -1497,8 +1497,8 @@ def test_get_reposts_of_me_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_reposts_of_me_cursor_items(self): - """Test pagination with items() for get_reposts_of_me.""" + def test_get_following_cursor_items(self): + """Test pagination with items() for get_following.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -1517,8 +1517,8 @@ def test_get_reposts_of_me_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_reposts_of_me") - test_cursor = cursor(method, max_results=10) + method = getattr(self.users_client, "get_following") + test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" # Verify items have expected structure @@ -1528,17 +1528,17 @@ def test_get_reposts_of_me_cursor_items(self): ), "Items should have 'id' field" - def test_get_reposts_of_me_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_reposts_of_me.""" + def test_get_following_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_following.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_reposts_of_me") + method = getattr(self.users_client, "get_following") # Test with max_results parameter - test_cursor = cursor(method, max_results=5) + test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request # Verify max_results was passed in request call_args = mock_session.get.call_args @@ -1567,7 +1567,7 @@ def test_get_reposts_of_me_pagination_parameters(self): mock_response_with_token, second_page_response, ] - test_cursor = cursor(method, max_results=1) + test_cursor = cursor(method, "test_value", max_results=1) pages = list(test_cursor.pages(2)) # Should have made 2 requests assert ( @@ -1589,20 +1589,20 @@ def test_get_reposts_of_me_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_bookmarks_cursor_creation(self): - """Test that get_bookmarks can be used with Cursor.""" - method = getattr(self.users_client, "get_bookmarks") + def test_get_timeline_cursor_creation(self): + """Test that get_timeline can be used with Cursor.""" + method = getattr(self.users_client, "get_timeline") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_bookmarks should support pagination") + pytest.fail(f"Method get_timeline should support pagination") - def test_get_bookmarks_cursor_pages(self): - """Test pagination with pages() for get_bookmarks.""" + def test_get_timeline_cursor_pages(self): + """Test pagination with pages() for get_timeline.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -1623,7 +1623,7 @@ def test_get_bookmarks_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_bookmarks") + method = getattr(self.users_client, "get_timeline") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -1639,8 +1639,8 @@ def test_get_bookmarks_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_bookmarks_cursor_items(self): - """Test pagination with items() for get_bookmarks.""" + def test_get_timeline_cursor_items(self): + """Test pagination with items() for get_timeline.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -1659,7 +1659,7 @@ def test_get_bookmarks_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_bookmarks") + method = getattr(self.users_client, "get_timeline") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -1670,15 +1670,15 @@ def test_get_bookmarks_cursor_items(self): ), "Items should have 'id' field" - def test_get_bookmarks_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_bookmarks.""" + def test_get_timeline_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_timeline.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_bookmarks") + method = getattr(self.users_client, "get_timeline") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -1731,20 +1731,20 @@ def test_get_bookmarks_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_bookmark_folders_cursor_creation(self): - """Test that get_bookmark_folders can be used with Cursor.""" - method = getattr(self.users_client, "get_bookmark_folders") + def test_search_cursor_creation(self): + """Test that search can be used with Cursor.""" + method = getattr(self.users_client, "search") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_bookmark_folders should support pagination") + pytest.fail(f"Method search should support pagination") - def test_get_bookmark_folders_cursor_pages(self): - """Test pagination with pages() for get_bookmark_folders.""" + def test_search_cursor_pages(self): + """Test pagination with pages() for search.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -1765,7 +1765,7 @@ def test_get_bookmark_folders_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_bookmark_folders") + method = getattr(self.users_client, "search") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -1781,8 +1781,8 @@ def test_get_bookmark_folders_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_bookmark_folders_cursor_items(self): - """Test pagination with items() for get_bookmark_folders.""" + def test_search_cursor_items(self): + """Test pagination with items() for search.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -1801,7 +1801,7 @@ def test_get_bookmark_folders_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_bookmark_folders") + method = getattr(self.users_client, "search") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -1812,15 +1812,15 @@ def test_get_bookmark_folders_cursor_items(self): ), "Items should have 'id' field" - def test_get_bookmark_folders_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_bookmark_folders.""" + def test_search_pagination_parameters(self): + """Test that pagination parameters are handled correctly for search.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_bookmark_folders") + method = getattr(self.users_client, "search") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -1866,27 +1866,27 @@ def test_get_bookmark_folders_pagination_parameters(self): ): second_params = second_call_args[1]["params"] assert ( - "pagination_token" in second_params - ), "Second request should include pagination_token" + "next_token" in second_params + ), "Second request should include next_token" assert ( - second_params["pagination_token"] == "next_token_value" + second_params["next_token"] == "next_token_value" ), "Pagination token should be passed correctly" - def test_get_liked_posts_cursor_creation(self): - """Test that get_liked_posts can be used with Cursor.""" - method = getattr(self.users_client, "get_liked_posts") + def test_get_bookmarks_cursor_creation(self): + """Test that get_bookmarks can be used with Cursor.""" + method = getattr(self.users_client, "get_bookmarks") # Should be able to create cursor without error try: test_cursor = cursor(method, "test_value", max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_liked_posts should support pagination") + pytest.fail(f"Method get_bookmarks should support pagination") - def test_get_liked_posts_cursor_pages(self): - """Test pagination with pages() for get_liked_posts.""" + def test_get_bookmarks_cursor_pages(self): + """Test pagination with pages() for get_bookmarks.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -1907,7 +1907,7 @@ def test_get_liked_posts_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_liked_posts") + method = getattr(self.users_client, "get_bookmarks") test_cursor = cursor(method, "test_value", max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" @@ -1923,8 +1923,8 @@ def test_get_liked_posts_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_liked_posts_cursor_items(self): - """Test pagination with items() for get_liked_posts.""" + def test_get_bookmarks_cursor_items(self): + """Test pagination with items() for get_bookmarks.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -1943,7 +1943,7 @@ def test_get_liked_posts_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_liked_posts") + method = getattr(self.users_client, "get_bookmarks") test_cursor = cursor(method, "test_value", max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" @@ -1954,15 +1954,15 @@ def test_get_liked_posts_cursor_items(self): ), "Items should have 'id' field" - def test_get_liked_posts_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_liked_posts.""" + def test_get_bookmarks_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_bookmarks.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_liked_posts") + method = getattr(self.users_client, "get_bookmarks") # Test with max_results parameter test_cursor = cursor(method, "test_value", max_results=5) list(test_cursor.pages(1)) # Trigger one request @@ -2015,20 +2015,20 @@ def test_get_liked_posts_pagination_parameters(self): ), "Pagination token should be passed correctly" - def test_get_followers_cursor_creation(self): - """Test that get_followers can be used with Cursor.""" - method = getattr(self.users_client, "get_followers") + def test_get_reposts_of_me_cursor_creation(self): + """Test that get_reposts_of_me can be used with Cursor.""" + method = getattr(self.users_client, "get_reposts_of_me") # Should be able to create cursor without error try: - test_cursor = cursor(method, "test_value", max_results=10) + test_cursor = cursor(method, max_results=10) assert test_cursor is not None assert isinstance(test_cursor, Cursor) except PaginationError: - pytest.fail(f"Method get_followers should support pagination") + pytest.fail(f"Method get_reposts_of_me should support pagination") - def test_get_followers_cursor_pages(self): - """Test pagination with pages() for get_followers.""" + def test_get_reposts_of_me_cursor_pages(self): + """Test pagination with pages() for get_reposts_of_me.""" with patch.object(self.client, "session") as mock_session: # Mock first page response first_page_response = Mock() @@ -2049,8 +2049,8 @@ def test_get_followers_cursor_pages(self): # Return different responses for consecutive calls mock_session.get.side_effect = [first_page_response, second_page_response] # Test pagination - method = getattr(self.users_client, "get_followers") - test_cursor = cursor(method, "test_value", max_results=2) + method = getattr(self.users_client, "get_reposts_of_me") + test_cursor = cursor(method, max_results=2) pages = list(test_cursor.pages(2)) # Limit to 2 pages assert len(pages) == 2, f"Should get 2 pages, got {len(pages)}" # Verify first page @@ -2065,8 +2065,8 @@ def test_get_followers_cursor_pages(self): assert len(second_data) == 1, "Second page should have 1 item" - def test_get_followers_cursor_items(self): - """Test pagination with items() for get_followers.""" + def test_get_reposts_of_me_cursor_items(self): + """Test pagination with items() for get_reposts_of_me.""" with patch.object(self.client, "session") as mock_session: # Mock response with paginated data mock_response = Mock() @@ -2085,8 +2085,8 @@ def test_get_followers_cursor_items(self): mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response # Test item iteration - method = getattr(self.users_client, "get_followers") - test_cursor = cursor(method, "test_value", max_results=10) + method = getattr(self.users_client, "get_reposts_of_me") + test_cursor = cursor(method, max_results=10) items = list(test_cursor.items(5)) # Limit to 5 items assert len(items) == 3, f"Should get 3 items, got {len(items)}" # Verify items have expected structure @@ -2096,17 +2096,17 @@ def test_get_followers_cursor_items(self): ), "Items should have 'id' field" - def test_get_followers_pagination_parameters(self): - """Test that pagination parameters are handled correctly for get_followers.""" + def test_get_reposts_of_me_pagination_parameters(self): + """Test that pagination parameters are handled correctly for get_reposts_of_me.""" with patch.object(self.client, "session") as mock_session: mock_response = Mock() mock_response.status_code = 200 mock_response.json.return_value = {"data": [], "meta": {"result_count": 0}} mock_response.raise_for_status.return_value = None mock_session.get.return_value = mock_response - method = getattr(self.users_client, "get_followers") + method = getattr(self.users_client, "get_reposts_of_me") # Test with max_results parameter - test_cursor = cursor(method, "test_value", max_results=5) + test_cursor = cursor(method, max_results=5) list(test_cursor.pages(1)) # Trigger one request # Verify max_results was passed in request call_args = mock_session.get.call_args @@ -2135,7 +2135,7 @@ def test_get_followers_pagination_parameters(self): mock_response_with_token, second_page_response, ] - test_cursor = cursor(method, "test_value", max_results=1) + test_cursor = cursor(method, max_results=1) pages = list(test_cursor.pages(2)) # Should have made 2 requests assert ( diff --git a/xdk/python/tests/users/test_structure.py b/xdk/python/tests/users/test_structure.py index 7eeef541..0b69572c 100644 --- a/xdk/python/tests/users/test_structure.py +++ b/xdk/python/tests/users/test_structure.py @@ -28,33 +28,31 @@ def setup_class(self): self.users_client = getattr(self.client, "users") - def test_get_me_exists(self): - """Test that get_me method exists with correct signature.""" + def test_like_post_exists(self): + """Test that like_post method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_me", None) - assert method is not None, f"Method get_me does not exist on UsersClient" + method = getattr(UsersClient, "like_post", None) + assert method is not None, f"Method like_post does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_me is not callable" + assert callable(method), f"like_post is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_me should have at least 'self' parameter" + assert len(params) >= 1, f"like_post should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "id", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_me" + ), f"Required parameter '{required_param}' missing from like_post" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "user.fields", - "expansions", - "tweet.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -63,40 +61,40 @@ def test_get_me_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_me_return_annotation(self): - """Test that get_me has proper return type annotation.""" - method = getattr(UsersClient, "get_me") + def test_like_post_return_annotation(self): + """Test that like_post has proper return type annotation.""" + method = getattr(UsersClient, "like_post") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_me should have return type annotation" + ), f"Method like_post should have return type annotation" - def test_unfollow_list_exists(self): - """Test that unfollow_list method exists with correct signature.""" + def test_unlike_post_exists(self): + """Test that unlike_post method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "unfollow_list", None) - assert method is not None, f"Method unfollow_list does not exist on UsersClient" + method = getattr(UsersClient, "unlike_post", None) + assert method is not None, f"Method unlike_post does not exist on UsersClient" # Check method is callable - assert callable(method), f"unfollow_list is not callable" + assert callable(method), f"unlike_post is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"unfollow_list should have at least 'self' parameter" + assert len(params) >= 1, f"unlike_post should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "id", - "list_id", + "tweet_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from unfollow_list" + ), f"Required parameter '{required_param}' missing from unlike_post" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -107,14 +105,14 @@ def test_unfollow_list_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_unfollow_list_return_annotation(self): - """Test that unfollow_list has proper return type annotation.""" - method = getattr(UsersClient, "unfollow_list") + def test_unlike_post_return_annotation(self): + """Test that unlike_post has proper return type annotation.""" + method = getattr(UsersClient, "unlike_post") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method unfollow_list should have return type annotation" + ), f"Method unlike_post should have return type annotation" def test_get_muting_exists(self): @@ -228,32 +226,39 @@ def test_mute_user_return_annotation(self): ), f"Method mute_user should have return type annotation" - def test_unlike_post_exists(self): - """Test that unlike_post method exists with correct signature.""" + def test_get_pinned_lists_exists(self): + """Test that get_pinned_lists method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "unlike_post", None) - assert method is not None, f"Method unlike_post does not exist on UsersClient" + method = getattr(UsersClient, "get_pinned_lists", None) + assert ( + method is not None + ), f"Method get_pinned_lists does not exist on UsersClient" # Check method is callable - assert callable(method), f"unlike_post is not callable" + assert callable(method), f"get_pinned_lists is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"unlike_post should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_pinned_lists should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "id", - "tweet_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from unlike_post" + ), f"Required parameter '{required_param}' missing from get_pinned_lists" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "list.fields", + "expansions", + "user.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -262,28 +267,28 @@ def test_unlike_post_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_unlike_post_return_annotation(self): - """Test that unlike_post has proper return type annotation.""" - method = getattr(UsersClient, "unlike_post") + def test_get_pinned_lists_return_annotation(self): + """Test that get_pinned_lists has proper return type annotation.""" + method = getattr(UsersClient, "get_pinned_lists") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method unlike_post should have return type annotation" + ), f"Method get_pinned_lists should have return type annotation" - def test_get_posts_exists(self): - """Test that get_posts method exists with correct signature.""" + def test_pin_list_exists(self): + """Test that pin_list method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_posts", None) - assert method is not None, f"Method get_posts does not exist on UsersClient" + method = getattr(UsersClient, "pin_list", None) + assert method is not None, f"Method pin_list does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_posts is not callable" + assert callable(method), f"pin_list is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_posts should have at least 'self' parameter" + assert len(params) >= 1, f"pin_list should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -294,23 +299,9 @@ def test_get_posts_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_posts" + ), f"Required parameter '{required_param}' missing from pin_list" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "since_id", - "until_id", - "max_results", - "pagination_token", - "exclude", - "start_time", - "end_time", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -319,66 +310,42 @@ def test_get_posts_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_posts_return_annotation(self): - """Test that get_posts has proper return type annotation.""" - method = getattr(UsersClient, "get_posts") + def test_pin_list_return_annotation(self): + """Test that pin_list has proper return type annotation.""" + method = getattr(UsersClient, "pin_list") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_posts should have return type annotation" - - - def test_get_posts_pagination_params(self): - """Test that get_posts has pagination parameters.""" - method = getattr(UsersClient, "get_posts") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_posts should have pagination parameters" + ), f"Method pin_list should have return type annotation" - def test_get_following_exists(self): - """Test that get_following method exists with correct signature.""" + def test_unrepost_post_exists(self): + """Test that unrepost_post method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_following", None) - assert method is not None, f"Method get_following does not exist on UsersClient" + method = getattr(UsersClient, "unrepost_post", None) + assert method is not None, f"Method unrepost_post does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_following is not callable" + assert callable(method), f"unrepost_post is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_following should have at least 'self' parameter" + assert len(params) >= 1, f"unrepost_post should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "id", + "source_tweet_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_following" + ), f"Required parameter '{required_param}' missing from unrepost_post" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "max_results", - "pagination_token", - "user.fields", - "expansions", - "tweet.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -387,58 +354,40 @@ def test_get_following_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_following_return_annotation(self): - """Test that get_following has proper return type annotation.""" - method = getattr(UsersClient, "get_following") + def test_unrepost_post_return_annotation(self): + """Test that unrepost_post has proper return type annotation.""" + method = getattr(UsersClient, "unrepost_post") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_following should have return type annotation" - - - def test_get_following_pagination_params(self): - """Test that get_following has pagination parameters.""" - method = getattr(UsersClient, "get_following") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_following should have pagination parameters" + ), f"Method unrepost_post should have return type annotation" - def test_follow_user_exists(self): - """Test that follow_user method exists with correct signature.""" + def test_unmute_user_exists(self): + """Test that unmute_user method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "follow_user", None) - assert method is not None, f"Method follow_user does not exist on UsersClient" + method = getattr(UsersClient, "unmute_user", None) + assert method is not None, f"Method unmute_user does not exist on UsersClient" # Check method is callable - assert callable(method), f"follow_user is not callable" + assert callable(method), f"unmute_user is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"follow_user should have at least 'self' parameter" + assert len(params) >= 1, f"unmute_user should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "source_user_id", + "target_user_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from follow_user" + ), f"Required parameter '{required_param}' missing from unmute_user" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -449,55 +398,46 @@ def test_follow_user_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_follow_user_return_annotation(self): - """Test that follow_user has proper return type annotation.""" - method = getattr(UsersClient, "follow_user") + def test_unmute_user_return_annotation(self): + """Test that unmute_user has proper return type annotation.""" + method = getattr(UsersClient, "unmute_user") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method follow_user should have return type annotation" + ), f"Method unmute_user should have return type annotation" - def test_get_timeline_exists(self): - """Test that get_timeline method exists with correct signature.""" + def test_delete_bookmark_exists(self): + """Test that delete_bookmark method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_timeline", None) - assert method is not None, f"Method get_timeline does not exist on UsersClient" + method = getattr(UsersClient, "delete_bookmark", None) + assert ( + method is not None + ), f"Method delete_bookmark does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_timeline is not callable" + assert callable(method), f"delete_bookmark is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_timeline should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"delete_bookmark should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "id", + "tweet_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_timeline" + ), f"Required parameter '{required_param}' missing from delete_bookmark" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "since_id", - "until_id", - "max_results", - "pagination_token", - "exclude", - "start_time", - "end_time", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -506,19 +446,72 @@ def test_get_timeline_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_timeline_return_annotation(self): - """Test that get_timeline has proper return type annotation.""" - method = getattr(UsersClient, "get_timeline") + def test_delete_bookmark_return_annotation(self): + """Test that delete_bookmark has proper return type annotation.""" + method = getattr(UsersClient, "delete_bookmark") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_timeline should have return type annotation" + ), f"Method delete_bookmark should have return type annotation" - def test_get_timeline_pagination_params(self): - """Test that get_timeline has pagination parameters.""" - method = getattr(UsersClient, "get_timeline") + def test_get_list_memberships_exists(self): + """Test that get_list_memberships method exists with correct signature.""" + # Check method exists + method = getattr(UsersClient, "get_list_memberships", None) + assert ( + method is not None + ), f"Method get_list_memberships does not exist on UsersClient" + # Check method is callable + assert callable(method), f"get_list_memberships is not callable" + # Check method signature + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have 'self' as first parameter + assert ( + len(params) >= 1 + ), f"get_list_memberships should have at least 'self' parameter" + assert ( + params[0] == "self" + ), f"First parameter should be 'self', got '{params[0]}'" + # Check required parameters exist (excluding 'self') + required_params = [ + "id", + ] + for required_param in required_params: + assert ( + required_param in params + ), f"Required parameter '{required_param}' missing from get_list_memberships" + # Check optional parameters have defaults (excluding 'self') + optional_params = [ + "max_results", + "pagination_token", + "list.fields", + "expansions", + "user.fields", + ] + for optional_param in optional_params: + if optional_param in params: + param_obj = sig.parameters[optional_param] + assert ( + param_obj.default is not inspect.Parameter.empty + ), f"Optional parameter '{optional_param}' should have a default value" + + + def test_get_list_memberships_return_annotation(self): + """Test that get_list_memberships has proper return type annotation.""" + method = getattr(UsersClient, "get_list_memberships") + sig = inspect.signature(method) + # Check return annotation exists + assert ( + sig.return_annotation is not inspect.Signature.empty + ), f"Method get_list_memberships should have return type annotation" + + + def test_get_list_memberships_pagination_params(self): + """Test that get_list_memberships has pagination parameters.""" + method = getattr(UsersClient, "get_list_memberships") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -532,35 +525,36 @@ def test_get_timeline_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method get_timeline should have pagination parameters" + ), f"Paginated method get_list_memberships should have pagination parameters" - def test_unmute_user_exists(self): - """Test that unmute_user method exists with correct signature.""" + def test_get_me_exists(self): + """Test that get_me method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "unmute_user", None) - assert method is not None, f"Method unmute_user does not exist on UsersClient" + method = getattr(UsersClient, "get_me", None) + assert method is not None, f"Method get_me does not exist on UsersClient" # Check method is callable - assert callable(method), f"unmute_user is not callable" + assert callable(method), f"get_me is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"unmute_user should have at least 'self' parameter" + assert len(params) >= 1, f"get_me should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "source_user_id", - "target_user_id", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from unmute_user" + ), f"Required parameter '{required_param}' missing from get_me" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "user.fields", + "expansions", + "tweet.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -569,46 +563,53 @@ def test_unmute_user_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_unmute_user_return_annotation(self): - """Test that unmute_user has proper return type annotation.""" - method = getattr(UsersClient, "unmute_user") + def test_get_me_return_annotation(self): + """Test that get_me has proper return type annotation.""" + method = getattr(UsersClient, "get_me") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method unmute_user should have return type annotation" + ), f"Method get_me should have return type annotation" - def test_search_exists(self): - """Test that search method exists with correct signature.""" + def test_get_liked_posts_exists(self): + """Test that get_liked_posts method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "search", None) - assert method is not None, f"Method search does not exist on UsersClient" + method = getattr(UsersClient, "get_liked_posts", None) + assert ( + method is not None + ), f"Method get_liked_posts does not exist on UsersClient" # Check method is callable - assert callable(method), f"search is not callable" + assert callable(method), f"get_liked_posts is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"search should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_liked_posts should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "query", + "id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from search" + ), f"Required parameter '{required_param}' missing from get_liked_posts" # Check optional parameters have defaults (excluding 'self') optional_params = [ "max_results", - "next_token", - "user.fields", - "expansions", + "pagination_token", "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -618,19 +619,19 @@ def test_search_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_search_return_annotation(self): - """Test that search has proper return type annotation.""" - method = getattr(UsersClient, "search") + def test_get_liked_posts_return_annotation(self): + """Test that get_liked_posts has proper return type annotation.""" + method = getattr(UsersClient, "get_liked_posts") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method search should have return type annotation" + ), f"Method get_liked_posts should have return type annotation" - def test_search_pagination_params(self): - """Test that search has pagination parameters.""" - method = getattr(UsersClient, "search") + def test_get_liked_posts_pagination_params(self): + """Test that get_liked_posts has pagination parameters.""" + method = getattr(UsersClient, "get_liked_posts") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -644,25 +645,21 @@ def test_search_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method search should have pagination parameters" + ), f"Paginated method get_liked_posts should have pagination parameters" - def test_get_owned_lists_exists(self): - """Test that get_owned_lists method exists with correct signature.""" + def test_get_posts_exists(self): + """Test that get_posts method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_owned_lists", None) - assert ( - method is not None - ), f"Method get_owned_lists does not exist on UsersClient" + method = getattr(UsersClient, "get_posts", None) + assert method is not None, f"Method get_posts does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_owned_lists is not callable" + assert callable(method), f"get_posts is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_owned_lists should have at least 'self' parameter" + assert len(params) >= 1, f"get_posts should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -673,14 +670,22 @@ def test_get_owned_lists_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_owned_lists" + ), f"Required parameter '{required_param}' missing from get_posts" # Check optional parameters have defaults (excluding 'self') optional_params = [ + "since_id", + "until_id", "max_results", "pagination_token", - "list.fields", + "exclude", + "start_time", + "end_time", + "tweet.fields", "expansions", + "media.fields", + "poll.fields", "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -690,19 +695,19 @@ def test_get_owned_lists_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_owned_lists_return_annotation(self): - """Test that get_owned_lists has proper return type annotation.""" - method = getattr(UsersClient, "get_owned_lists") + def test_get_posts_return_annotation(self): + """Test that get_posts has proper return type annotation.""" + method = getattr(UsersClient, "get_posts") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_owned_lists should have return type annotation" + ), f"Method get_posts should have return type annotation" - def test_get_owned_lists_pagination_params(self): - """Test that get_owned_lists has pagination parameters.""" - method = getattr(UsersClient, "get_owned_lists") + def test_get_posts_pagination_params(self): + """Test that get_posts has pagination parameters.""" + method = getattr(UsersClient, "get_posts") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -716,41 +721,43 @@ def test_get_owned_lists_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method get_owned_lists should have pagination parameters" + ), f"Paginated method get_posts should have pagination parameters" - def test_get_by_usernames_exists(self): - """Test that get_by_usernames method exists with correct signature.""" + def test_get_followed_lists_exists(self): + """Test that get_followed_lists method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_by_usernames", None) + method = getattr(UsersClient, "get_followed_lists", None) assert ( method is not None - ), f"Method get_by_usernames does not exist on UsersClient" + ), f"Method get_followed_lists does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_by_usernames is not callable" + assert callable(method), f"get_followed_lists is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_by_usernames should have at least 'self' parameter" + ), f"get_followed_lists should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "usernames", + "id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_usernames" + ), f"Required parameter '{required_param}' missing from get_followed_lists" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "user.fields", + "max_results", + "pagination_token", + "list.fields", "expansions", - "tweet.fields", + "user.fields", ] for optional_param in optional_params: if optional_param in params: @@ -760,28 +767,47 @@ def test_get_by_usernames_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_usernames_return_annotation(self): - """Test that get_by_usernames has proper return type annotation.""" - method = getattr(UsersClient, "get_by_usernames") + def test_get_followed_lists_return_annotation(self): + """Test that get_followed_lists has proper return type annotation.""" + method = getattr(UsersClient, "get_followed_lists") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_usernames should have return type annotation" + ), f"Method get_followed_lists should have return type annotation" - def test_get_mentions_exists(self): - """Test that get_mentions method exists with correct signature.""" + def test_get_followed_lists_pagination_params(self): + """Test that get_followed_lists has pagination parameters.""" + method = getattr(UsersClient, "get_followed_lists") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_followed_lists should have pagination parameters" + + + def test_follow_list_exists(self): + """Test that follow_list method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_mentions", None) - assert method is not None, f"Method get_mentions does not exist on UsersClient" + method = getattr(UsersClient, "follow_list", None) + assert method is not None, f"Method follow_list does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_mentions is not callable" + assert callable(method), f"follow_list is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_mentions should have at least 'self' parameter" + assert len(params) >= 1, f"follow_list should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -792,22 +818,9 @@ def test_get_mentions_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_mentions" + ), f"Required parameter '{required_param}' missing from follow_list" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "since_id", - "until_id", - "max_results", - "pagination_token", - "start_time", - "end_time", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -816,69 +829,48 @@ def test_get_mentions_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_mentions_return_annotation(self): - """Test that get_mentions has proper return type annotation.""" - method = getattr(UsersClient, "get_mentions") + def test_follow_list_return_annotation(self): + """Test that follow_list has proper return type annotation.""" + method = getattr(UsersClient, "follow_list") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_mentions should have return type annotation" - - - def test_get_mentions_pagination_params(self): - """Test that get_mentions has pagination parameters.""" - method = getattr(UsersClient, "get_mentions") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_mentions should have pagination parameters" + ), f"Method follow_list should have return type annotation" - def test_get_list_memberships_exists(self): - """Test that get_list_memberships method exists with correct signature.""" + def test_get_by_username_exists(self): + """Test that get_by_username method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_list_memberships", None) + method = getattr(UsersClient, "get_by_username", None) assert ( method is not None - ), f"Method get_list_memberships does not exist on UsersClient" + ), f"Method get_by_username does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_list_memberships is not callable" + assert callable(method), f"get_by_username is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_list_memberships should have at least 'self' parameter" + ), f"get_by_username should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "username", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_list_memberships" + ), f"Required parameter '{required_param}' missing from get_by_username" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "max_results", - "pagination_token", - "list.fields", - "expansions", "user.fields", + "expansions", + "tweet.fields", ] for optional_param in optional_params: if optional_param in params: @@ -888,47 +880,28 @@ def test_get_list_memberships_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_list_memberships_return_annotation(self): - """Test that get_list_memberships has proper return type annotation.""" - method = getattr(UsersClient, "get_list_memberships") + def test_get_by_username_return_annotation(self): + """Test that get_by_username has proper return type annotation.""" + method = getattr(UsersClient, "get_by_username") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_list_memberships should have return type annotation" - - - def test_get_list_memberships_pagination_params(self): - """Test that get_list_memberships has pagination parameters.""" - method = getattr(UsersClient, "get_list_memberships") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_list_memberships should have pagination parameters" + ), f"Method get_by_username should have return type annotation" - def test_get_blocking_exists(self): - """Test that get_blocking method exists with correct signature.""" + def test_get_mentions_exists(self): + """Test that get_mentions method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_blocking", None) - assert method is not None, f"Method get_blocking does not exist on UsersClient" + method = getattr(UsersClient, "get_mentions", None) + assert method is not None, f"Method get_mentions does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_blocking is not callable" + assert callable(method), f"get_mentions is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_blocking should have at least 'self' parameter" + assert len(params) >= 1, f"get_mentions should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -939,14 +912,21 @@ def test_get_blocking_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_blocking" + ), f"Required parameter '{required_param}' missing from get_mentions" # Check optional parameters have defaults (excluding 'self') optional_params = [ + "since_id", + "until_id", "max_results", "pagination_token", - "user.fields", - "expansions", + "start_time", + "end_time", "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -956,19 +936,19 @@ def test_get_blocking_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_blocking_return_annotation(self): - """Test that get_blocking has proper return type annotation.""" - method = getattr(UsersClient, "get_blocking") + def test_get_mentions_return_annotation(self): + """Test that get_mentions has proper return type annotation.""" + method = getattr(UsersClient, "get_mentions") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_blocking should have return type annotation" + ), f"Method get_mentions should have return type annotation" - def test_get_blocking_pagination_params(self): - """Test that get_blocking has pagination parameters.""" - method = getattr(UsersClient, "get_blocking") + def test_get_mentions_pagination_params(self): + """Test that get_mentions has pagination parameters.""" + method = getattr(UsersClient, "get_mentions") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -982,25 +962,25 @@ def test_get_blocking_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method get_blocking should have pagination parameters" + ), f"Paginated method get_mentions should have pagination parameters" - def test_get_followed_lists_exists(self): - """Test that get_followed_lists method exists with correct signature.""" + def test_get_owned_lists_exists(self): + """Test that get_owned_lists method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_followed_lists", None) + method = getattr(UsersClient, "get_owned_lists", None) assert ( method is not None - ), f"Method get_followed_lists does not exist on UsersClient" + ), f"Method get_owned_lists does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_followed_lists is not callable" + assert callable(method), f"get_owned_lists is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_followed_lists should have at least 'self' parameter" + ), f"get_owned_lists should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -1011,7 +991,7 @@ def test_get_followed_lists_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_followed_lists" + ), f"Required parameter '{required_param}' missing from get_owned_lists" # Check optional parameters have defaults (excluding 'self') optional_params = [ "max_results", @@ -1028,19 +1008,19 @@ def test_get_followed_lists_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_followed_lists_return_annotation(self): - """Test that get_followed_lists has proper return type annotation.""" - method = getattr(UsersClient, "get_followed_lists") + def test_get_owned_lists_return_annotation(self): + """Test that get_owned_lists has proper return type annotation.""" + method = getattr(UsersClient, "get_owned_lists") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_followed_lists should have return type annotation" + ), f"Method get_owned_lists should have return type annotation" - def test_get_followed_lists_pagination_params(self): - """Test that get_followed_lists has pagination parameters.""" - method = getattr(UsersClient, "get_followed_lists") + def test_get_owned_lists_pagination_params(self): + """Test that get_owned_lists has pagination parameters.""" + method = getattr(UsersClient, "get_owned_lists") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -1054,21 +1034,21 @@ def test_get_followed_lists_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method get_followed_lists should have pagination parameters" + ), f"Paginated method get_owned_lists should have pagination parameters" - def test_follow_list_exists(self): - """Test that follow_list method exists with correct signature.""" + def test_repost_post_exists(self): + """Test that repost_post method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "follow_list", None) - assert method is not None, f"Method follow_list does not exist on UsersClient" + method = getattr(UsersClient, "repost_post", None) + assert method is not None, f"Method repost_post does not exist on UsersClient" # Check method is callable - assert callable(method), f"follow_list is not callable" + assert callable(method), f"repost_post is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"follow_list should have at least 'self' parameter" + assert len(params) >= 1, f"repost_post should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -1079,7 +1059,7 @@ def test_follow_list_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from follow_list" + ), f"Required parameter '{required_param}' missing from repost_post" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -1090,40 +1070,40 @@ def test_follow_list_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_follow_list_return_annotation(self): - """Test that follow_list has proper return type annotation.""" - method = getattr(UsersClient, "follow_list") + def test_repost_post_return_annotation(self): + """Test that repost_post has proper return type annotation.""" + method = getattr(UsersClient, "repost_post") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method follow_list should have return type annotation" + ), f"Method repost_post should have return type annotation" - def test_unrepost_post_exists(self): - """Test that unrepost_post method exists with correct signature.""" + def test_unfollow_list_exists(self): + """Test that unfollow_list method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "unrepost_post", None) - assert method is not None, f"Method unrepost_post does not exist on UsersClient" + method = getattr(UsersClient, "unfollow_list", None) + assert method is not None, f"Method unfollow_list does not exist on UsersClient" # Check method is callable - assert callable(method), f"unrepost_post is not callable" + assert callable(method), f"unfollow_list is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"unrepost_post should have at least 'self' parameter" + assert len(params) >= 1, f"unfollow_list should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "id", - "source_tweet_id", + "list_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from unrepost_post" + ), f"Required parameter '{required_param}' missing from unfollow_list" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -1134,51 +1114,44 @@ def test_unrepost_post_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_unrepost_post_return_annotation(self): - """Test that unrepost_post has proper return type annotation.""" - method = getattr(UsersClient, "unrepost_post") + def test_unfollow_list_return_annotation(self): + """Test that unfollow_list has proper return type annotation.""" + method = getattr(UsersClient, "unfollow_list") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method unrepost_post should have return type annotation" + ), f"Method unfollow_list should have return type annotation" - def test_get_reposts_of_me_exists(self): - """Test that get_reposts_of_me method exists with correct signature.""" + def test_get_by_ids_exists(self): + """Test that get_by_ids method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_reposts_of_me", None) - assert ( - method is not None - ), f"Method get_reposts_of_me does not exist on UsersClient" + method = getattr(UsersClient, "get_by_ids", None) + assert method is not None, f"Method get_by_ids does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_reposts_of_me is not callable" + assert callable(method), f"get_by_ids is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_reposts_of_me should have at least 'self' parameter" + assert len(params) >= 1, f"get_by_ids should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [] + required_params = [ + "ids", + ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_reposts_of_me" + ), f"Required parameter '{required_param}' missing from get_by_ids" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "max_results", - "pagination_token", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", "user.fields", - "place.fields", + "expansions", + "tweet.fields", ] for optional_param in optional_params: if optional_param in params: @@ -1188,69 +1161,46 @@ def test_get_reposts_of_me_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_reposts_of_me_return_annotation(self): - """Test that get_reposts_of_me has proper return type annotation.""" - method = getattr(UsersClient, "get_reposts_of_me") + def test_get_by_ids_return_annotation(self): + """Test that get_by_ids has proper return type annotation.""" + method = getattr(UsersClient, "get_by_ids") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_reposts_of_me should have return type annotation" + ), f"Method get_by_ids should have return type annotation" - def test_get_reposts_of_me_pagination_params(self): - """Test that get_reposts_of_me has pagination parameters.""" - method = getattr(UsersClient, "get_reposts_of_me") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_reposts_of_me should have pagination parameters" - - - def test_get_bookmarks_exists(self): - """Test that get_bookmarks method exists with correct signature.""" + def test_get_bookmarks_by_folder_id_exists(self): + """Test that get_bookmarks_by_folder_id method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_bookmarks", None) - assert method is not None, f"Method get_bookmarks does not exist on UsersClient" + method = getattr(UsersClient, "get_bookmarks_by_folder_id", None) + assert ( + method is not None + ), f"Method get_bookmarks_by_folder_id does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_bookmarks is not callable" + assert callable(method), f"get_bookmarks_by_folder_id is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_bookmarks should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_bookmarks_by_folder_id should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "id", + "folder_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_bookmarks" + ), f"Required parameter '{required_param}' missing from get_bookmarks_by_folder_id" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "max_results", - "pagination_token", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -1259,51 +1209,28 @@ def test_get_bookmarks_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_bookmarks_return_annotation(self): - """Test that get_bookmarks has proper return type annotation.""" - method = getattr(UsersClient, "get_bookmarks") + def test_get_bookmarks_by_folder_id_return_annotation(self): + """Test that get_bookmarks_by_folder_id has proper return type annotation.""" + method = getattr(UsersClient, "get_bookmarks_by_folder_id") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_bookmarks should have return type annotation" - - - def test_get_bookmarks_pagination_params(self): - """Test that get_bookmarks has pagination parameters.""" - method = getattr(UsersClient, "get_bookmarks") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_bookmarks should have pagination parameters" + ), f"Method get_bookmarks_by_folder_id should have return type annotation" - def test_create_bookmark_exists(self): - """Test that create_bookmark method exists with correct signature.""" + def test_unblock_dms_exists(self): + """Test that unblock_dms method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "create_bookmark", None) - assert ( - method is not None - ), f"Method create_bookmark does not exist on UsersClient" + method = getattr(UsersClient, "unblock_dms", None) + assert method is not None, f"Method unblock_dms does not exist on UsersClient" # Check method is callable - assert callable(method), f"create_bookmark is not callable" + assert callable(method), f"unblock_dms is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"create_bookmark should have at least 'self' parameter" + assert len(params) >= 1, f"unblock_dms should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -1314,7 +1241,7 @@ def test_create_bookmark_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from create_bookmark" + ), f"Required parameter '{required_param}' missing from unblock_dms" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -1325,41 +1252,43 @@ def test_create_bookmark_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_create_bookmark_return_annotation(self): - """Test that create_bookmark has proper return type annotation.""" - method = getattr(UsersClient, "create_bookmark") + def test_unblock_dms_return_annotation(self): + """Test that unblock_dms has proper return type annotation.""" + method = getattr(UsersClient, "unblock_dms") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method create_bookmark should have return type annotation" + ), f"Method unblock_dms should have return type annotation" - def test_get_by_ids_exists(self): - """Test that get_by_ids method exists with correct signature.""" + def test_get_blocking_exists(self): + """Test that get_blocking method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_by_ids", None) - assert method is not None, f"Method get_by_ids does not exist on UsersClient" + method = getattr(UsersClient, "get_blocking", None) + assert method is not None, f"Method get_blocking does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_by_ids is not callable" + assert callable(method), f"get_blocking is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_by_ids should have at least 'self' parameter" + assert len(params) >= 1, f"get_blocking should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "ids", + "id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_ids" + ), f"Required parameter '{required_param}' missing from get_blocking" # Check optional parameters have defaults (excluding 'self') optional_params = [ + "max_results", + "pagination_token", "user.fields", "expansions", "tweet.fields", @@ -1372,39 +1301,62 @@ def test_get_by_ids_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_ids_return_annotation(self): - """Test that get_by_ids has proper return type annotation.""" - method = getattr(UsersClient, "get_by_ids") + def test_get_blocking_return_annotation(self): + """Test that get_blocking has proper return type annotation.""" + method = getattr(UsersClient, "get_blocking") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_ids should have return type annotation" + ), f"Method get_blocking should have return type annotation" - def test_get_by_id_exists(self): - """Test that get_by_id method exists with correct signature.""" + def test_get_blocking_pagination_params(self): + """Test that get_blocking has pagination parameters.""" + method = getattr(UsersClient, "get_blocking") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_blocking should have pagination parameters" + + + def test_get_by_usernames_exists(self): + """Test that get_by_usernames method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_by_id", None) - assert method is not None, f"Method get_by_id does not exist on UsersClient" + method = getattr(UsersClient, "get_by_usernames", None) + assert ( + method is not None + ), f"Method get_by_usernames does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_by_id is not callable" + assert callable(method), f"get_by_usernames is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_by_id should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_by_usernames should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "usernames", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_id" + ), f"Required parameter '{required_param}' missing from get_by_usernames" # Check optional parameters have defaults (excluding 'self') optional_params = [ "user.fields", @@ -1419,48 +1371,42 @@ def test_get_by_id_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_id_return_annotation(self): - """Test that get_by_id has proper return type annotation.""" - method = getattr(UsersClient, "get_by_id") + def test_get_by_usernames_return_annotation(self): + """Test that get_by_usernames has proper return type annotation.""" + method = getattr(UsersClient, "get_by_usernames") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_id should have return type annotation" + ), f"Method get_by_usernames should have return type annotation" - def test_get_bookmark_folders_exists(self): - """Test that get_bookmark_folders method exists with correct signature.""" + def test_unfollow_user_exists(self): + """Test that unfollow_user method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_bookmark_folders", None) - assert ( - method is not None - ), f"Method get_bookmark_folders does not exist on UsersClient" + method = getattr(UsersClient, "unfollow_user", None) + assert method is not None, f"Method unfollow_user does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_bookmark_folders is not callable" + assert callable(method), f"unfollow_user is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_bookmark_folders should have at least 'self' parameter" + assert len(params) >= 1, f"unfollow_user should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "id", + "source_user_id", + "target_user_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_bookmark_folders" + ), f"Required parameter '{required_param}' missing from unfollow_user" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "max_results", - "pagination_token", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -1469,47 +1415,28 @@ def test_get_bookmark_folders_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_bookmark_folders_return_annotation(self): - """Test that get_bookmark_folders has proper return type annotation.""" - method = getattr(UsersClient, "get_bookmark_folders") + def test_unfollow_user_return_annotation(self): + """Test that unfollow_user has proper return type annotation.""" + method = getattr(UsersClient, "unfollow_user") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_bookmark_folders should have return type annotation" - - - def test_get_bookmark_folders_pagination_params(self): - """Test that get_bookmark_folders has pagination parameters.""" - method = getattr(UsersClient, "get_bookmark_folders") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_bookmark_folders should have pagination parameters" + ), f"Method unfollow_user should have return type annotation" - def test_unblock_dms_exists(self): - """Test that unblock_dms method exists with correct signature.""" + def test_block_dms_exists(self): + """Test that block_dms method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "unblock_dms", None) - assert method is not None, f"Method unblock_dms does not exist on UsersClient" + method = getattr(UsersClient, "block_dms", None) + assert method is not None, f"Method block_dms does not exist on UsersClient" # Check method is callable - assert callable(method), f"unblock_dms is not callable" + assert callable(method), f"block_dms is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"unblock_dms should have at least 'self' parameter" + assert len(params) >= 1, f"block_dms should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -1520,7 +1447,7 @@ def test_unblock_dms_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from unblock_dms" + ), f"Required parameter '{required_param}' missing from block_dms" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -1531,32 +1458,28 @@ def test_unblock_dms_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_unblock_dms_return_annotation(self): - """Test that unblock_dms has proper return type annotation.""" - method = getattr(UsersClient, "unblock_dms") + def test_block_dms_return_annotation(self): + """Test that block_dms has proper return type annotation.""" + method = getattr(UsersClient, "block_dms") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method unblock_dms should have return type annotation" + ), f"Method block_dms should have return type annotation" - def test_get_pinned_lists_exists(self): - """Test that get_pinned_lists method exists with correct signature.""" + def test_get_followers_exists(self): + """Test that get_followers method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_pinned_lists", None) - assert ( - method is not None - ), f"Method get_pinned_lists does not exist on UsersClient" + method = getattr(UsersClient, "get_followers", None) + assert method is not None, f"Method get_followers does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_pinned_lists is not callable" + assert callable(method), f"get_followers is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_pinned_lists should have at least 'self' parameter" + assert len(params) >= 1, f"get_followers should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -1567,12 +1490,14 @@ def test_get_pinned_lists_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_pinned_lists" + ), f"Required parameter '{required_param}' missing from get_followers" # Check optional parameters have defaults (excluding 'self') optional_params = [ - "list.fields", - "expansions", + "max_results", + "pagination_token", "user.fields", + "expansions", + "tweet.fields", ] for optional_param in optional_params: if optional_param in params: @@ -1582,28 +1507,47 @@ def test_get_pinned_lists_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_pinned_lists_return_annotation(self): - """Test that get_pinned_lists has proper return type annotation.""" - method = getattr(UsersClient, "get_pinned_lists") + def test_get_followers_return_annotation(self): + """Test that get_followers has proper return type annotation.""" + method = getattr(UsersClient, "get_followers") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_pinned_lists should have return type annotation" + ), f"Method get_followers should have return type annotation" - def test_pin_list_exists(self): - """Test that pin_list method exists with correct signature.""" + def test_get_followers_pagination_params(self): + """Test that get_followers has pagination parameters.""" + method = getattr(UsersClient, "get_followers") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_followers should have pagination parameters" + + + def test_get_by_id_exists(self): + """Test that get_by_id method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "pin_list", None) - assert method is not None, f"Method pin_list does not exist on UsersClient" + method = getattr(UsersClient, "get_by_id", None) + assert method is not None, f"Method get_by_id does not exist on UsersClient" # Check method is callable - assert callable(method), f"pin_list is not callable" + assert callable(method), f"get_by_id is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"pin_list should have at least 'self' parameter" + assert len(params) >= 1, f"get_by_id should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -1614,9 +1558,13 @@ def test_pin_list_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from pin_list" + ), f"Required parameter '{required_param}' missing from get_by_id" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "user.fields", + "expansions", + "tweet.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -1625,32 +1573,32 @@ def test_pin_list_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_pin_list_return_annotation(self): - """Test that pin_list has proper return type annotation.""" - method = getattr(UsersClient, "pin_list") + def test_get_by_id_return_annotation(self): + """Test that get_by_id has proper return type annotation.""" + method = getattr(UsersClient, "get_by_id") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method pin_list should have return type annotation" + ), f"Method get_by_id should have return type annotation" - def test_get_liked_posts_exists(self): - """Test that get_liked_posts method exists with correct signature.""" + def test_get_bookmark_folders_exists(self): + """Test that get_bookmark_folders method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_liked_posts", None) + method = getattr(UsersClient, "get_bookmark_folders", None) assert ( method is not None - ), f"Method get_liked_posts does not exist on UsersClient" + ), f"Method get_bookmark_folders does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_liked_posts is not callable" + assert callable(method), f"get_bookmark_folders is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter assert ( len(params) >= 1 - ), f"get_liked_posts should have at least 'self' parameter" + ), f"get_bookmark_folders should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -1661,17 +1609,11 @@ def test_get_liked_posts_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_liked_posts" + ), f"Required parameter '{required_param}' missing from get_bookmark_folders" # Check optional parameters have defaults (excluding 'self') optional_params = [ "max_results", "pagination_token", - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", ] for optional_param in optional_params: if optional_param in params: @@ -1681,19 +1623,19 @@ def test_get_liked_posts_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_liked_posts_return_annotation(self): - """Test that get_liked_posts has proper return type annotation.""" - method = getattr(UsersClient, "get_liked_posts") + def test_get_bookmark_folders_return_annotation(self): + """Test that get_bookmark_folders has proper return type annotation.""" + method = getattr(UsersClient, "get_bookmark_folders") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_liked_posts should have return type annotation" + ), f"Method get_bookmark_folders should have return type annotation" - def test_get_liked_posts_pagination_params(self): - """Test that get_liked_posts has pagination parameters.""" - method = getattr(UsersClient, "get_liked_posts") + def test_get_bookmark_folders_pagination_params(self): + """Test that get_bookmark_folders has pagination parameters.""" + method = getattr(UsersClient, "get_bookmark_folders") sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have pagination-related parameters @@ -1707,39 +1649,40 @@ def test_get_liked_posts_pagination_params(self): has_pagination_param = any(param in params for param in pagination_params) assert ( has_pagination_param - ), f"Paginated method get_liked_posts should have pagination parameters" + ), f"Paginated method get_bookmark_folders should have pagination parameters" - def test_get_bookmarks_by_folder_id_exists(self): - """Test that get_bookmarks_by_folder_id method exists with correct signature.""" + def test_get_following_exists(self): + """Test that get_following method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_bookmarks_by_folder_id", None) - assert ( - method is not None - ), f"Method get_bookmarks_by_folder_id does not exist on UsersClient" + method = getattr(UsersClient, "get_following", None) + assert method is not None, f"Method get_following does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_bookmarks_by_folder_id is not callable" + assert callable(method), f"get_following is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_bookmarks_by_folder_id should have at least 'self' parameter" + assert len(params) >= 1, f"get_following should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "id", - "folder_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_bookmarks_by_folder_id" + ), f"Required parameter '{required_param}' missing from get_following" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "max_results", + "pagination_token", + "user.fields", + "expansions", + "tweet.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -1748,28 +1691,47 @@ def test_get_bookmarks_by_folder_id_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_bookmarks_by_folder_id_return_annotation(self): - """Test that get_bookmarks_by_folder_id has proper return type annotation.""" - method = getattr(UsersClient, "get_bookmarks_by_folder_id") + def test_get_following_return_annotation(self): + """Test that get_following has proper return type annotation.""" + method = getattr(UsersClient, "get_following") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_bookmarks_by_folder_id should have return type annotation" + ), f"Method get_following should have return type annotation" - def test_like_post_exists(self): - """Test that like_post method exists with correct signature.""" + def test_get_following_pagination_params(self): + """Test that get_following has pagination parameters.""" + method = getattr(UsersClient, "get_following") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_following should have pagination parameters" + + + def test_follow_user_exists(self): + """Test that follow_user method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "like_post", None) - assert method is not None, f"Method like_post does not exist on UsersClient" + method = getattr(UsersClient, "follow_user", None) + assert method is not None, f"Method follow_user does not exist on UsersClient" # Check method is callable - assert callable(method), f"like_post is not callable" + assert callable(method), f"follow_user is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"like_post should have at least 'self' parameter" + assert len(params) >= 1, f"follow_user should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -1780,7 +1742,7 @@ def test_like_post_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from like_post" + ), f"Required parameter '{required_param}' missing from follow_user" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -1791,42 +1753,55 @@ def test_like_post_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_like_post_return_annotation(self): - """Test that like_post has proper return type annotation.""" - method = getattr(UsersClient, "like_post") + def test_follow_user_return_annotation(self): + """Test that follow_user has proper return type annotation.""" + method = getattr(UsersClient, "follow_user") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method like_post should have return type annotation" + ), f"Method follow_user should have return type annotation" - def test_unpin_list_exists(self): - """Test that unpin_list method exists with correct signature.""" + def test_get_timeline_exists(self): + """Test that get_timeline method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "unpin_list", None) - assert method is not None, f"Method unpin_list does not exist on UsersClient" + method = getattr(UsersClient, "get_timeline", None) + assert method is not None, f"Method get_timeline does not exist on UsersClient" # Check method is callable - assert callable(method), f"unpin_list is not callable" + assert callable(method), f"get_timeline is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"unpin_list should have at least 'self' parameter" + assert len(params) >= 1, f"get_timeline should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "id", - "list_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from unpin_list" + ), f"Required parameter '{required_param}' missing from get_timeline" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "since_id", + "until_id", + "max_results", + "pagination_token", + "exclude", + "start_time", + "end_time", + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -1835,45 +1810,62 @@ def test_unpin_list_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_unpin_list_return_annotation(self): - """Test that unpin_list has proper return type annotation.""" - method = getattr(UsersClient, "unpin_list") + def test_get_timeline_return_annotation(self): + """Test that get_timeline has proper return type annotation.""" + method = getattr(UsersClient, "get_timeline") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method unpin_list should have return type annotation" + ), f"Method get_timeline should have return type annotation" - def test_get_by_username_exists(self): - """Test that get_by_username method exists with correct signature.""" - # Check method exists - method = getattr(UsersClient, "get_by_username", None) + def test_get_timeline_pagination_params(self): + """Test that get_timeline has pagination parameters.""" + method = getattr(UsersClient, "get_timeline") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) assert ( - method is not None - ), f"Method get_by_username does not exist on UsersClient" + has_pagination_param + ), f"Paginated method get_timeline should have pagination parameters" + + + def test_search_exists(self): + """Test that search method exists with correct signature.""" + # Check method exists + method = getattr(UsersClient, "search", None) + assert method is not None, f"Method search does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_by_username is not callable" + assert callable(method), f"search is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"get_by_username should have at least 'self' parameter" + assert len(params) >= 1, f"search should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ - "username", + "query", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_by_username" + ), f"Required parameter '{required_param}' missing from search" # Check optional parameters have defaults (excluding 'self') optional_params = [ + "max_results", + "next_token", "user.fields", "expansions", "tweet.fields", @@ -1886,76 +1878,47 @@ def test_get_by_username_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_by_username_return_annotation(self): - """Test that get_by_username has proper return type annotation.""" - method = getattr(UsersClient, "get_by_username") + def test_search_return_annotation(self): + """Test that search has proper return type annotation.""" + method = getattr(UsersClient, "search") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_by_username should have return type annotation" + ), f"Method search should have return type annotation" - def test_delete_bookmark_exists(self): - """Test that delete_bookmark method exists with correct signature.""" - # Check method exists - method = getattr(UsersClient, "delete_bookmark", None) - assert ( - method is not None - ), f"Method delete_bookmark does not exist on UsersClient" - # Check method is callable - assert callable(method), f"delete_bookmark is not callable" - # Check method signature + def test_search_pagination_params(self): + """Test that search has pagination parameters.""" + method = getattr(UsersClient, "search") sig = inspect.signature(method) params = list(sig.parameters.keys()) - # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"delete_bookmark should have at least 'self' parameter" - assert ( - params[0] == "self" - ), f"First parameter should be 'self', got '{params[0]}'" - # Check required parameters exist (excluding 'self') - required_params = [ - "id", - "tweet_id", + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", ] - for required_param in required_params: - assert ( - required_param in params - ), f"Required parameter '{required_param}' missing from delete_bookmark" - # Check optional parameters have defaults (excluding 'self') - optional_params = [] - for optional_param in optional_params: - if optional_param in params: - param_obj = sig.parameters[optional_param] - assert ( - param_obj.default is not inspect.Parameter.empty - ), f"Optional parameter '{optional_param}' should have a default value" - - - def test_delete_bookmark_return_annotation(self): - """Test that delete_bookmark has proper return type annotation.""" - method = getattr(UsersClient, "delete_bookmark") - sig = inspect.signature(method) - # Check return annotation exists + has_pagination_param = any(param in params for param in pagination_params) assert ( - sig.return_annotation is not inspect.Signature.empty - ), f"Method delete_bookmark should have return type annotation" + has_pagination_param + ), f"Paginated method search should have pagination parameters" - def test_block_dms_exists(self): - """Test that block_dms method exists with correct signature.""" + def test_get_bookmarks_exists(self): + """Test that get_bookmarks method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "block_dms", None) - assert method is not None, f"Method block_dms does not exist on UsersClient" + method = getattr(UsersClient, "get_bookmarks", None) + assert method is not None, f"Method get_bookmarks does not exist on UsersClient" # Check method is callable - assert callable(method), f"block_dms is not callable" + assert callable(method), f"get_bookmarks is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"block_dms should have at least 'self' parameter" + assert len(params) >= 1, f"get_bookmarks should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -1966,9 +1929,18 @@ def test_block_dms_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from block_dms" + ), f"Required parameter '{required_param}' missing from get_bookmarks" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "max_results", + "pagination_token", + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -1977,28 +1949,51 @@ def test_block_dms_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_block_dms_return_annotation(self): - """Test that block_dms has proper return type annotation.""" - method = getattr(UsersClient, "block_dms") + def test_get_bookmarks_return_annotation(self): + """Test that get_bookmarks has proper return type annotation.""" + method = getattr(UsersClient, "get_bookmarks") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method block_dms should have return type annotation" + ), f"Method get_bookmarks should have return type annotation" - def test_repost_post_exists(self): - """Test that repost_post method exists with correct signature.""" + def test_get_bookmarks_pagination_params(self): + """Test that get_bookmarks has pagination parameters.""" + method = getattr(UsersClient, "get_bookmarks") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_bookmarks should have pagination parameters" + + + def test_create_bookmark_exists(self): + """Test that create_bookmark method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "repost_post", None) - assert method is not None, f"Method repost_post does not exist on UsersClient" + method = getattr(UsersClient, "create_bookmark", None) + assert ( + method is not None + ), f"Method create_bookmark does not exist on UsersClient" # Check method is callable - assert callable(method), f"repost_post is not callable" + assert callable(method), f"create_bookmark is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"repost_post should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"create_bookmark should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -2009,7 +2004,7 @@ def test_repost_post_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from repost_post" + ), f"Required parameter '{required_param}' missing from create_bookmark" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -2020,42 +2015,52 @@ def test_repost_post_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_repost_post_return_annotation(self): - """Test that repost_post has proper return type annotation.""" - method = getattr(UsersClient, "repost_post") + def test_create_bookmark_return_annotation(self): + """Test that create_bookmark has proper return type annotation.""" + method = getattr(UsersClient, "create_bookmark") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method repost_post should have return type annotation" + ), f"Method create_bookmark should have return type annotation" - def test_unfollow_user_exists(self): - """Test that unfollow_user method exists with correct signature.""" + def test_get_reposts_of_me_exists(self): + """Test that get_reposts_of_me method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "unfollow_user", None) - assert method is not None, f"Method unfollow_user does not exist on UsersClient" + method = getattr(UsersClient, "get_reposts_of_me", None) + assert ( + method is not None + ), f"Method get_reposts_of_me does not exist on UsersClient" # Check method is callable - assert callable(method), f"unfollow_user is not callable" + assert callable(method), f"get_reposts_of_me is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"unfollow_user should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"get_reposts_of_me should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') - required_params = [ - "source_user_id", - "target_user_id", - ] + required_params = [] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from unfollow_user" + ), f"Required parameter '{required_param}' missing from get_reposts_of_me" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "max_results", + "pagination_token", + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -2064,47 +2069,61 @@ def test_unfollow_user_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_unfollow_user_return_annotation(self): - """Test that unfollow_user has proper return type annotation.""" - method = getattr(UsersClient, "unfollow_user") + def test_get_reposts_of_me_return_annotation(self): + """Test that get_reposts_of_me has proper return type annotation.""" + method = getattr(UsersClient, "get_reposts_of_me") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method unfollow_user should have return type annotation" + ), f"Method get_reposts_of_me should have return type annotation" - def test_get_followers_exists(self): - """Test that get_followers method exists with correct signature.""" + def test_get_reposts_of_me_pagination_params(self): + """Test that get_reposts_of_me has pagination parameters.""" + method = getattr(UsersClient, "get_reposts_of_me") + sig = inspect.signature(method) + params = list(sig.parameters.keys()) + # Should have pagination-related parameters + pagination_params = [ + "pagination_token", + "max_results", + "next_token", + "cursor", + "limit", + ] + has_pagination_param = any(param in params for param in pagination_params) + assert ( + has_pagination_param + ), f"Paginated method get_reposts_of_me should have pagination parameters" + + + def test_unpin_list_exists(self): + """Test that unpin_list method exists with correct signature.""" # Check method exists - method = getattr(UsersClient, "get_followers", None) - assert method is not None, f"Method get_followers does not exist on UsersClient" + method = getattr(UsersClient, "unpin_list", None) + assert method is not None, f"Method unpin_list does not exist on UsersClient" # Check method is callable - assert callable(method), f"get_followers is not callable" + assert callable(method), f"unpin_list is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"get_followers should have at least 'self' parameter" + assert len(params) >= 1, f"unpin_list should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" # Check required parameters exist (excluding 'self') required_params = [ "id", + "list_id", ] for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from get_followers" + ), f"Required parameter '{required_param}' missing from unpin_list" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "max_results", - "pagination_token", - "user.fields", - "expansions", - "tweet.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -2113,76 +2132,57 @@ def test_get_followers_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_get_followers_return_annotation(self): - """Test that get_followers has proper return type annotation.""" - method = getattr(UsersClient, "get_followers") + def test_unpin_list_return_annotation(self): + """Test that unpin_list has proper return type annotation.""" + method = getattr(UsersClient, "unpin_list") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method get_followers should have return type annotation" - - - def test_get_followers_pagination_params(self): - """Test that get_followers has pagination parameters.""" - method = getattr(UsersClient, "get_followers") - sig = inspect.signature(method) - params = list(sig.parameters.keys()) - # Should have pagination-related parameters - pagination_params = [ - "pagination_token", - "max_results", - "next_token", - "cursor", - "limit", - ] - has_pagination_param = any(param in params for param in pagination_params) - assert ( - has_pagination_param - ), f"Paginated method get_followers should have pagination parameters" + ), f"Method unpin_list should have return type annotation" def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ - "get_me", - "unfollow_list", + "like_post", + "unlike_post", "get_muting", "mute_user", - "unlike_post", - "get_posts", - "get_following", - "follow_user", - "get_timeline", + "get_pinned_lists", + "pin_list", + "unrepost_post", "unmute_user", - "search", - "get_owned_lists", - "get_by_usernames", - "get_mentions", + "delete_bookmark", "get_list_memberships", - "get_blocking", + "get_me", + "get_liked_posts", + "get_posts", "get_followed_lists", "follow_list", - "unrepost_post", - "get_reposts_of_me", - "get_bookmarks", - "create_bookmark", - "get_by_ids", - "get_by_id", - "get_bookmark_folders", - "unblock_dms", - "get_pinned_lists", - "pin_list", - "get_liked_posts", - "get_bookmarks_by_folder_id", - "like_post", - "unpin_list", "get_by_username", - "delete_bookmark", - "block_dms", + "get_mentions", + "get_owned_lists", "repost_post", + "unfollow_list", + "get_by_ids", + "get_bookmarks_by_folder_id", + "unblock_dms", + "get_blocking", + "get_by_usernames", "unfollow_user", + "block_dms", "get_followers", + "get_by_id", + "get_bookmark_folders", + "get_following", + "follow_user", + "get_timeline", + "search", + "get_bookmarks", + "create_bookmark", + "get_reposts_of_me", + "unpin_list", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/tests/webhooks/test_contracts.py b/xdk/python/tests/webhooks/test_contracts.py index 7cf73d0e..14871766 100644 --- a/xdk/python/tests/webhooks/test_contracts.py +++ b/xdk/python/tests/webhooks/test_contracts.py @@ -142,8 +142,8 @@ def test_get_stream_links_response_structure(self): ) - def test_validate_request_structure(self): - """Test validate request structure.""" + def test_create_stream_link_request_structure(self): + """Test create_stream_link request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -152,7 +152,7 @@ def test_validate_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.put.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters @@ -160,7 +160,7 @@ def test_validate_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.webhooks_client, "validate") + method = getattr(self.webhooks_client, "create_stream_link") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -179,7 +179,7 @@ def test_validate_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.put.return_value = mock_streaming_response + mock_session.post.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -188,14 +188,14 @@ def test_validate_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.put.assert_called_once() + mock_session.post.assert_called_once() # Verify request structure - call_args = mock_session.put.call_args + call_args = mock_session.post.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/webhooks/{webhook_id}" + expected_path = "/2/tweets/search/webhooks/{webhook_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -211,12 +211,12 @@ def test_validate_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for validate: {e}") + pytest.fail(f"Contract test failed for create_stream_link: {e}") - def test_validate_required_parameters(self): - """Test that validate handles parameters correctly.""" - method = getattr(self.webhooks_client, "validate") + def test_create_stream_link_required_parameters(self): + """Test that create_stream_link handles parameters correctly.""" + method = getattr(self.webhooks_client, "create_stream_link") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -224,14 +224,14 @@ def test_validate_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.put.return_value = mock_response + mock_session.post.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_validate_response_structure(self): - """Test validate response structure validation.""" + def test_create_stream_link_response_structure(self): + """Test create_stream_link response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -241,13 +241,13 @@ def test_validate_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.put.return_value = mock_response + mock_session.post.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["webhook_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.webhooks_client, "validate") + method = getattr(self.webhooks_client, "create_stream_link") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -259,8 +259,8 @@ def test_validate_response_structure(self): ) - def test_delete_request_structure(self): - """Test delete request structure.""" + def test_delete_stream_link_request_structure(self): + """Test delete_stream_link request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -277,7 +277,7 @@ def test_delete_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.webhooks_client, "delete") + method = getattr(self.webhooks_client, "delete_stream_link") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -312,7 +312,7 @@ def test_delete_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/webhooks/{webhook_id}" + expected_path = "/2/tweets/search/webhooks/{webhook_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -328,12 +328,12 @@ def test_delete_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for delete: {e}") + pytest.fail(f"Contract test failed for delete_stream_link: {e}") - def test_delete_required_parameters(self): - """Test that delete handles parameters correctly.""" - method = getattr(self.webhooks_client, "delete") + def test_delete_stream_link_required_parameters(self): + """Test that delete_stream_link handles parameters correctly.""" + method = getattr(self.webhooks_client, "delete_stream_link") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -347,8 +347,8 @@ def test_delete_required_parameters(self): method() - def test_delete_response_structure(self): - """Test delete response structure validation.""" + def test_delete_stream_link_response_structure(self): + """Test delete_stream_link response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -364,7 +364,7 @@ def test_delete_response_structure(self): kwargs["webhook_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.webhooks_client, "delete") + method = getattr(self.webhooks_client, "delete_stream_link") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -614,8 +614,8 @@ def test_create_response_structure(self): ) - def test_create_stream_link_request_structure(self): - """Test create_stream_link request structure.""" + def test_validate_request_structure(self): + """Test validate request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -624,7 +624,7 @@ def test_create_stream_link_request_structure(self): "data": None, } mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.put.return_value = mock_response # Prepare test parameters kwargs = {} # Add required parameters @@ -632,7 +632,7 @@ def test_create_stream_link_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.webhooks_client, "create_stream_link") + method = getattr(self.webhooks_client, "validate") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -651,7 +651,7 @@ def test_create_stream_link_request_structure(self): test_data = '{"data": "test"}\n' mock_streaming_response.iter_content.return_value = [test_data] # Update the session mock to return our streaming response - mock_session.post.return_value = mock_streaming_response + mock_session.put.return_value = mock_streaming_response # Consume the generator to trigger the HTTP request try: next(result) @@ -660,14 +660,14 @@ def test_create_stream_link_request_structure(self): except Exception: pass # Ignore other exceptions in test data processing # Verify the request was made - mock_session.post.assert_called_once() + mock_session.put.assert_called_once() # Verify request structure - call_args = mock_session.post.call_args + call_args = mock_session.put.call_args # Check URL structure called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/search/webhooks/{webhook_id}" + expected_path = "/2/webhooks/{webhook_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -683,12 +683,12 @@ def test_create_stream_link_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for create_stream_link: {e}") + pytest.fail(f"Contract test failed for validate: {e}") - def test_create_stream_link_required_parameters(self): - """Test that create_stream_link handles parameters correctly.""" - method = getattr(self.webhooks_client, "create_stream_link") + def test_validate_required_parameters(self): + """Test that validate handles parameters correctly.""" + method = getattr(self.webhooks_client, "validate") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -696,14 +696,14 @@ def test_create_stream_link_required_parameters(self): mock_response.status_code = 400 mock_response.json.return_value = {"error": "Missing required parameters"} mock_response.raise_for_status.side_effect = Exception("Bad Request") - mock_session.post.return_value = mock_response + mock_session.put.return_value = mock_response # Call without required parameters should either raise locally or via server response with pytest.raises((TypeError, ValueError, Exception)): method() - def test_create_stream_link_response_structure(self): - """Test create_stream_link response structure validation.""" + def test_validate_response_structure(self): + """Test validate response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -713,13 +713,13 @@ def test_create_stream_link_response_structure(self): mock_response.status_code = 200 mock_response.json.return_value = mock_response_data mock_response.raise_for_status.return_value = None - mock_session.post.return_value = mock_response + mock_session.put.return_value = mock_response # Prepare minimal valid parameters kwargs = {} kwargs["webhook_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.webhooks_client, "create_stream_link") + method = getattr(self.webhooks_client, "validate") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed @@ -731,8 +731,8 @@ def test_create_stream_link_response_structure(self): ) - def test_delete_stream_link_request_structure(self): - """Test delete_stream_link request structure.""" + def test_delete_request_structure(self): + """Test delete request structure.""" # Mock the session to capture request details with patch.object(self.client, "session") as mock_session: mock_response = Mock() @@ -749,7 +749,7 @@ def test_delete_stream_link_request_structure(self): # Add request body if required # Call the method try: - method = getattr(self.webhooks_client, "delete_stream_link") + method = getattr(self.webhooks_client, "delete") result = method(**kwargs) # Check if this is a streaming operation (returns Generator) import types @@ -784,7 +784,7 @@ def test_delete_stream_link_request_structure(self): called_url = ( call_args[0][0] if call_args[0] else call_args[1].get("url", "") ) - expected_path = "/2/tweets/search/webhooks/{webhook_id}" + expected_path = "/2/webhooks/{webhook_id}" assert expected_path.replace("{", "").replace( "}", "" ) in called_url or any( @@ -800,12 +800,12 @@ def test_delete_stream_link_request_structure(self): # For regular operations, verify we got a result assert result is not None, "Method should return a result" except Exception as e: - pytest.fail(f"Contract test failed for delete_stream_link: {e}") + pytest.fail(f"Contract test failed for delete: {e}") - def test_delete_stream_link_required_parameters(self): - """Test that delete_stream_link handles parameters correctly.""" - method = getattr(self.webhooks_client, "delete_stream_link") + def test_delete_required_parameters(self): + """Test that delete handles parameters correctly.""" + method = getattr(self.webhooks_client, "delete") # Test with missing required parameters - mock the request to avoid network calls with patch.object(self.client, "session") as mock_session: # Mock a 400 response (typical for missing required parameters) @@ -819,8 +819,8 @@ def test_delete_stream_link_required_parameters(self): method() - def test_delete_stream_link_response_structure(self): - """Test delete_stream_link response structure validation.""" + def test_delete_response_structure(self): + """Test delete response structure validation.""" with patch.object(self.client, "session") as mock_session: # Create mock response with expected structure mock_response_data = { @@ -836,7 +836,7 @@ def test_delete_stream_link_response_structure(self): kwargs["webhook_id"] = "test" # Add request body if required # Call method and verify response structure - method = getattr(self.webhooks_client, "delete_stream_link") + method = getattr(self.webhooks_client, "delete") result = method(**kwargs) # Verify response object has expected attributes # Optional field - just check it doesn't cause errors if accessed diff --git a/xdk/python/tests/webhooks/test_structure.py b/xdk/python/tests/webhooks/test_structure.py index c4427843..88ed6213 100644 --- a/xdk/python/tests/webhooks/test_structure.py +++ b/xdk/python/tests/webhooks/test_structure.py @@ -73,18 +73,22 @@ def test_get_stream_links_return_annotation(self): ), f"Method get_stream_links should have return type annotation" - def test_validate_exists(self): - """Test that validate method exists with correct signature.""" + def test_create_stream_link_exists(self): + """Test that create_stream_link method exists with correct signature.""" # Check method exists - method = getattr(WebhooksClient, "validate", None) - assert method is not None, f"Method validate does not exist on WebhooksClient" + method = getattr(WebhooksClient, "create_stream_link", None) + assert ( + method is not None + ), f"Method create_stream_link does not exist on WebhooksClient" # Check method is callable - assert callable(method), f"validate is not callable" + assert callable(method), f"create_stream_link is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"validate should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"create_stream_link should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -95,9 +99,16 @@ def test_validate_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from validate" + ), f"Required parameter '{required_param}' missing from create_stream_link" # Check optional parameters have defaults (excluding 'self') - optional_params = [] + optional_params = [ + "tweet.fields", + "expansions", + "media.fields", + "poll.fields", + "user.fields", + "place.fields", + ] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -106,28 +117,32 @@ def test_validate_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_validate_return_annotation(self): - """Test that validate has proper return type annotation.""" - method = getattr(WebhooksClient, "validate") + def test_create_stream_link_return_annotation(self): + """Test that create_stream_link has proper return type annotation.""" + method = getattr(WebhooksClient, "create_stream_link") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method validate should have return type annotation" + ), f"Method create_stream_link should have return type annotation" - def test_delete_exists(self): - """Test that delete method exists with correct signature.""" + def test_delete_stream_link_exists(self): + """Test that delete_stream_link method exists with correct signature.""" # Check method exists - method = getattr(WebhooksClient, "delete", None) - assert method is not None, f"Method delete does not exist on WebhooksClient" + method = getattr(WebhooksClient, "delete_stream_link", None) + assert ( + method is not None + ), f"Method delete_stream_link does not exist on WebhooksClient" # Check method is callable - assert callable(method), f"delete is not callable" + assert callable(method), f"delete_stream_link is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert len(params) >= 1, f"delete should have at least 'self' parameter" + assert ( + len(params) >= 1 + ), f"delete_stream_link should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -138,7 +153,7 @@ def test_delete_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from delete" + ), f"Required parameter '{required_param}' missing from delete_stream_link" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -149,14 +164,14 @@ def test_delete_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_delete_return_annotation(self): - """Test that delete has proper return type annotation.""" - method = getattr(WebhooksClient, "delete") + def test_delete_stream_link_return_annotation(self): + """Test that delete_stream_link has proper return type annotation.""" + method = getattr(WebhooksClient, "delete_stream_link") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method delete should have return type annotation" + ), f"Method delete_stream_link should have return type annotation" def test_get_exists(self): @@ -243,22 +258,18 @@ def test_create_return_annotation(self): ), f"Method create should have return type annotation" - def test_create_stream_link_exists(self): - """Test that create_stream_link method exists with correct signature.""" + def test_validate_exists(self): + """Test that validate method exists with correct signature.""" # Check method exists - method = getattr(WebhooksClient, "create_stream_link", None) - assert ( - method is not None - ), f"Method create_stream_link does not exist on WebhooksClient" + method = getattr(WebhooksClient, "validate", None) + assert method is not None, f"Method validate does not exist on WebhooksClient" # Check method is callable - assert callable(method), f"create_stream_link is not callable" + assert callable(method), f"validate is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"create_stream_link should have at least 'self' parameter" + assert len(params) >= 1, f"validate should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -269,16 +280,9 @@ def test_create_stream_link_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from create_stream_link" + ), f"Required parameter '{required_param}' missing from validate" # Check optional parameters have defaults (excluding 'self') - optional_params = [ - "tweet.fields", - "expansions", - "media.fields", - "poll.fields", - "user.fields", - "place.fields", - ] + optional_params = [] for optional_param in optional_params: if optional_param in params: param_obj = sig.parameters[optional_param] @@ -287,32 +291,28 @@ def test_create_stream_link_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_create_stream_link_return_annotation(self): - """Test that create_stream_link has proper return type annotation.""" - method = getattr(WebhooksClient, "create_stream_link") + def test_validate_return_annotation(self): + """Test that validate has proper return type annotation.""" + method = getattr(WebhooksClient, "validate") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method create_stream_link should have return type annotation" + ), f"Method validate should have return type annotation" - def test_delete_stream_link_exists(self): - """Test that delete_stream_link method exists with correct signature.""" + def test_delete_exists(self): + """Test that delete method exists with correct signature.""" # Check method exists - method = getattr(WebhooksClient, "delete_stream_link", None) - assert ( - method is not None - ), f"Method delete_stream_link does not exist on WebhooksClient" + method = getattr(WebhooksClient, "delete", None) + assert method is not None, f"Method delete does not exist on WebhooksClient" # Check method is callable - assert callable(method), f"delete_stream_link is not callable" + assert callable(method), f"delete is not callable" # Check method signature sig = inspect.signature(method) params = list(sig.parameters.keys()) # Should have 'self' as first parameter - assert ( - len(params) >= 1 - ), f"delete_stream_link should have at least 'self' parameter" + assert len(params) >= 1, f"delete should have at least 'self' parameter" assert ( params[0] == "self" ), f"First parameter should be 'self', got '{params[0]}'" @@ -323,7 +323,7 @@ def test_delete_stream_link_exists(self): for required_param in required_params: assert ( required_param in params - ), f"Required parameter '{required_param}' missing from delete_stream_link" + ), f"Required parameter '{required_param}' missing from delete" # Check optional parameters have defaults (excluding 'self') optional_params = [] for optional_param in optional_params: @@ -334,26 +334,26 @@ def test_delete_stream_link_exists(self): ), f"Optional parameter '{optional_param}' should have a default value" - def test_delete_stream_link_return_annotation(self): - """Test that delete_stream_link has proper return type annotation.""" - method = getattr(WebhooksClient, "delete_stream_link") + def test_delete_return_annotation(self): + """Test that delete has proper return type annotation.""" + method = getattr(WebhooksClient, "delete") sig = inspect.signature(method) # Check return annotation exists assert ( sig.return_annotation is not inspect.Signature.empty - ), f"Method delete_stream_link should have return type annotation" + ), f"Method delete should have return type annotation" def test_all_expected_methods_exist(self): """Test that all expected methods exist on the client.""" expected_methods = [ "get_stream_links", - "validate", - "delete", - "get", - "create", "create_stream_link", "delete_stream_link", + "get", + "create", + "validate", + "delete", ] for expected_method in expected_methods: assert hasattr( diff --git a/xdk/python/xdk/account_activity/client.py b/xdk/python/xdk/account_activity/client.py index 1ae1a682..b2c8b52c 100644 --- a/xdk/python/xdk/account_activity/client.py +++ b/xdk/python/xdk/account_activity/client.py @@ -21,13 +21,13 @@ if TYPE_CHECKING: from ..client import Client from .models import ( + DeleteSubscriptionResponse, + GetSubscriptionCountResponse, + CreateReplayJobResponse, ValidateSubscriptionResponse, CreateSubscriptionRequest, CreateSubscriptionResponse, - DeleteSubscriptionResponse, GetSubscriptionsResponse, - CreateReplayJobResponse, - GetSubscriptionCountResponse, ) @@ -39,106 +39,6 @@ def __init__(self, client: Client): self.client = client - def validate_subscription(self, webhook_id: Any) -> ValidateSubscriptionResponse: - """ - Validate subscription - Checks a user’s Account Activity subscription for a given webhook. - Args: - webhook_id: The webhook ID to check subscription against. - Returns: - ValidateSubscriptionResponse: Response data - """ - url = ( - self.client.base_url - + "/2/account_activity/webhooks/{webhook_id}/subscriptions/all" - ) - url = url.replace("{webhook_id}", str(webhook_id)) - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} - headers = {} - # Prepare request data - json_data = None - # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return ValidateSubscriptionResponse.model_validate(response_data) - - - def create_subscription( - self, webhook_id: Any, body: Optional[CreateSubscriptionRequest] = None - ) -> CreateSubscriptionResponse: - """ - Create subscription - Creates an Account Activity subscription for the user and the given webhook. - Args: - webhook_id: The webhook ID to check subscription against. - body: Request body - Returns: - CreateSubscriptionResponse: Response data - """ - url = ( - self.client.base_url - + "/2/account_activity/webhooks/{webhook_id}/subscriptions/all" - ) - url = url.replace("{webhook_id}", str(webhook_id)) - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} - headers = {} - headers["Content-Type"] = "application/json" - # Prepare request data - json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) - # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - else: - response = self.client.session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return CreateSubscriptionResponse.model_validate(response_data) - - def delete_subscription( self, webhook_id: Any, user_id: Any ) -> DeleteSubscriptionResponse: @@ -183,20 +83,16 @@ def delete_subscription( return DeleteSubscriptionResponse.model_validate(response_data) - def get_subscriptions(self, webhook_id: Any) -> GetSubscriptionsResponse: + def get_subscription_count( + self, + ) -> GetSubscriptionCountResponse: """ - Get subscriptions - Retrieves a list of all active subscriptions for a given webhook. - Args: - webhook_id: The webhook ID to pull subscriptions for. - Returns: - GetSubscriptionsResponse: Response data + Get subscription count + Retrieves a count of currently active Account Activity subscriptions. + Returns: + GetSubscriptionCountResponse: Response data """ - url = ( - self.client.base_url - + "/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list" - ) - url = url.replace("{webhook_id}", str(webhook_id)) + url = self.client.base_url + "/2/account_activity/subscriptions/count" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -220,7 +116,7 @@ def get_subscriptions(self, webhook_id: Any) -> GetSubscriptionsResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetSubscriptionsResponse.model_validate(response_data) + return GetSubscriptionCountResponse.model_validate(response_data) def create_replay_job( @@ -271,16 +167,120 @@ def create_replay_job( return CreateReplayJobResponse.model_validate(response_data) - def get_subscription_count( - self, - ) -> GetSubscriptionCountResponse: + def validate_subscription(self, webhook_id: Any) -> ValidateSubscriptionResponse: """ - Get subscription count - Retrieves a count of currently active Account Activity subscriptions. + Validate subscription + Checks a user’s Account Activity subscription for a given webhook. + Args: + webhook_id: The webhook ID to check subscription against. + Returns: + ValidateSubscriptionResponse: Response data + """ + url = ( + self.client.base_url + + "/2/account_activity/webhooks/{webhook_id}/subscriptions/all" + ) + url = url.replace("{webhook_id}", str(webhook_id)) + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + headers = {} + # Prepare request data + json_data = None + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.get( + url, + params=params, + headers=headers, + ) + else: + response = self.client.session.get( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return ValidateSubscriptionResponse.model_validate(response_data) + + + def create_subscription( + self, webhook_id: Any, body: Optional[CreateSubscriptionRequest] = None + ) -> CreateSubscriptionResponse: + """ + Create subscription + Creates an Account Activity subscription for the user and the given webhook. + Args: + webhook_id: The webhook ID to check subscription against. + body: Request body Returns: - GetSubscriptionCountResponse: Response data + CreateSubscriptionResponse: Response data """ - url = self.client.base_url + "/2/account_activity/subscriptions/count" + url = ( + self.client.base_url + + "/2/account_activity/webhooks/{webhook_id}/subscriptions/all" + ) + url = url.replace("{webhook_id}", str(webhook_id)) + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + headers = {} + headers["Content-Type"] = "application/json" + # Prepare request data + json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + else: + response = self.client.session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return CreateSubscriptionResponse.model_validate(response_data) + + + def get_subscriptions(self, webhook_id: Any) -> GetSubscriptionsResponse: + """ + Get subscriptions + Retrieves a list of all active subscriptions for a given webhook. + Args: + webhook_id: The webhook ID to pull subscriptions for. + Returns: + GetSubscriptionsResponse: Response data + """ + url = ( + self.client.base_url + + "/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list" + ) + url = url.replace("{webhook_id}", str(webhook_id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -304,4 +304,4 @@ def get_subscription_count( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetSubscriptionCountResponse.model_validate(response_data) + return GetSubscriptionsResponse.model_validate(response_data) diff --git a/xdk/python/xdk/account_activity/models.py b/xdk/python/xdk/account_activity/models.py index 51677ec1..c70927a7 100644 --- a/xdk/python/xdk/account_activity/models.py +++ b/xdk/python/xdk/account_activity/models.py @@ -16,61 +16,61 @@ from datetime import datetime -# Models for validate_subscription +# Models for delete_subscription -class ValidateSubscriptionResponse(BaseModel): - """Response model for validate_subscription""" +class DeleteSubscriptionResponse(BaseModel): + """Response model for delete_subscription""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for create_subscription - - -class CreateSubscriptionRequest(BaseModel): - """Request model for create_subscription""" - - model_config = ConfigDict(populate_by_name=True) +# Models for get_subscription_count -class CreateSubscriptionResponse(BaseModel): - """Response model for create_subscription""" +class GetSubscriptionCountResponse(BaseModel): + """Response model for get_subscription_count""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for delete_subscription +# Models for create_replay_job -class DeleteSubscriptionResponse(BaseModel): - """Response model for delete_subscription""" +class CreateReplayJobResponse(BaseModel): + """Response model for create_replay_job""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_subscriptions +# Models for validate_subscription -class GetSubscriptionsResponse(BaseModel): - """Response model for get_subscriptions""" +class ValidateSubscriptionResponse(BaseModel): + """Response model for validate_subscription""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for create_replay_job +# Models for create_subscription -class CreateReplayJobResponse(BaseModel): - """Response model for create_replay_job""" +class CreateSubscriptionRequest(BaseModel): + """Request model for create_subscription""" + + model_config = ConfigDict(populate_by_name=True) + + +class CreateSubscriptionResponse(BaseModel): + """Response model for create_subscription""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_subscription_count +# Models for get_subscriptions -class GetSubscriptionCountResponse(BaseModel): - """Response model for get_subscription_count""" +class GetSubscriptionsResponse(BaseModel): + """Response model for get_subscriptions""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/activity/client.py b/xdk/python/xdk/activity/client.py index b6299ccb..3f43fe6e 100644 --- a/xdk/python/xdk/activity/client.py +++ b/xdk/python/xdk/activity/client.py @@ -32,12 +32,12 @@ from ..client import Client from .models import ( StreamResponse, - GetSubscriptionsResponse, - CreateSubscriptionRequest, - CreateSubscriptionResponse, UpdateSubscriptionRequest, UpdateSubscriptionResponse, DeleteSubscriptionResponse, + GetSubscriptionsResponse, + CreateSubscriptionRequest, + CreateSubscriptionResponse, ) @@ -147,16 +147,20 @@ def stream( raise - def get_subscriptions( - self, - ) -> GetSubscriptionsResponse: + def update_subscription( + self, subscription_id: Any, body: Optional[UpdateSubscriptionRequest] = None + ) -> UpdateSubscriptionResponse: """ - Get X activity subscriptions - Get a list of active subscriptions for XAA + Update X activity subscription + Updates a subscription for an X activity event + Args: + subscription_id: The ID of the subscription to update. + body: Request body Returns: - GetSubscriptionsResponse: Response data + UpdateSubscriptionResponse: Response data """ - url = self.client.base_url + "/2/activity/subscriptions" + url = self.client.base_url + "/2/activity/subscriptions/{subscription_id}" + url = url.replace("{subscription_id}", str(subscription_id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -167,33 +171,41 @@ def get_subscriptions( ) params = {} headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request - response = self.client.session.get( + response = self.client.session.put( url, params=params, headers=headers, + json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetSubscriptionsResponse.model_validate(response_data) + return UpdateSubscriptionResponse.model_validate(response_data) - def create_subscription( - self, body: Optional[CreateSubscriptionRequest] = None - ) -> CreateSubscriptionResponse: + def delete_subscription(self, subscription_id: Any) -> DeleteSubscriptionResponse: """ - Create X activity subscription - Creates a subscription for an X activity event - body: Request body - Returns: - CreateSubscriptionResponse: Response data + Deletes X activity subscription + Deletes a subscription for an X activity event + Args: + subscription_id: The ID of the subscription to delete. + Returns: + DeleteSubscriptionResponse: Response data """ - url = self.client.base_url + "/2/activity/subscriptions" + url = self.client.base_url + "/2/activity/subscriptions/{subscription_id}" + url = url.replace("{subscription_id}", str(subscription_id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -204,44 +216,32 @@ def create_subscription( ) params = {} headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request - response = self.client.session.post( + response = self.client.session.delete( url, params=params, headers=headers, - json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return CreateSubscriptionResponse.model_validate(response_data) + return DeleteSubscriptionResponse.model_validate(response_data) - def update_subscription( - self, subscription_id: Any, body: Optional[UpdateSubscriptionRequest] = None - ) -> UpdateSubscriptionResponse: + def get_subscriptions( + self, + ) -> GetSubscriptionsResponse: """ - Update X activity subscription - Updates a subscription for an X activity event - Args: - subscription_id: The ID of the subscription to update. - body: Request body + Get X activity subscriptions + Get a list of active subscriptions for XAA Returns: - UpdateSubscriptionResponse: Response data + GetSubscriptionsResponse: Response data """ - url = self.client.base_url + "/2/activity/subscriptions/{subscription_id}" - url = url.replace("{subscription_id}", str(subscription_id)) + url = self.client.base_url + "/2/activity/subscriptions" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -252,41 +252,33 @@ def update_subscription( ) params = {} headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request - response = self.client.session.put( + response = self.client.session.get( url, params=params, headers=headers, - json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UpdateSubscriptionResponse.model_validate(response_data) + return GetSubscriptionsResponse.model_validate(response_data) - def delete_subscription(self, subscription_id: Any) -> DeleteSubscriptionResponse: + def create_subscription( + self, body: Optional[CreateSubscriptionRequest] = None + ) -> CreateSubscriptionResponse: """ - Deletes X activity subscription - Deletes a subscription for an X activity event - Args: - subscription_id: The ID of the subscription to delete. - Returns: - DeleteSubscriptionResponse: Response data + Create X activity subscription + Creates a subscription for an X activity event + body: Request body + Returns: + CreateSubscriptionResponse: Response data """ - url = self.client.base_url + "/2/activity/subscriptions/{subscription_id}" - url = url.replace("{subscription_id}", str(subscription_id)) + url = self.client.base_url + "/2/activity/subscriptions" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -297,17 +289,25 @@ def delete_subscription(self, subscription_id: Any) -> DeleteSubscriptionRespons ) params = {} headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request - response = self.client.session.delete( + response = self.client.session.post( url, params=params, headers=headers, + json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return DeleteSubscriptionResponse.model_validate(response_data) + return CreateSubscriptionResponse.model_validate(response_data) diff --git a/xdk/python/xdk/activity/models.py b/xdk/python/xdk/activity/models.py index 7e98de67..c3e842ee 100644 --- a/xdk/python/xdk/activity/models.py +++ b/xdk/python/xdk/activity/models.py @@ -25,49 +25,49 @@ class StreamResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_subscriptions +# Models for update_subscription -class GetSubscriptionsResponse(BaseModel): - """Response model for get_subscriptions""" +class UpdateSubscriptionRequest(BaseModel): + """Request model for update_subscription""" - model_config = ConfigDict(populate_by_name=True, extra="allow") + model_config = ConfigDict(populate_by_name=True) -# Models for create_subscription +class UpdateSubscriptionResponse(BaseModel): + """Response model for update_subscription""" + model_config = ConfigDict(populate_by_name=True, extra="allow") -class CreateSubscriptionRequest(BaseModel): - """Request model for create_subscription""" - model_config = ConfigDict(populate_by_name=True) +# Models for delete_subscription -class CreateSubscriptionResponse(BaseModel): - """Response model for create_subscription""" +class DeleteSubscriptionResponse(BaseModel): + """Response model for delete_subscription""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for update_subscription +# Models for get_subscriptions -class UpdateSubscriptionRequest(BaseModel): - """Request model for update_subscription""" +class GetSubscriptionsResponse(BaseModel): + """Response model for get_subscriptions""" - model_config = ConfigDict(populate_by_name=True) + model_config = ConfigDict(populate_by_name=True, extra="allow") -class UpdateSubscriptionResponse(BaseModel): - """Response model for update_subscription""" +# Models for create_subscription - model_config = ConfigDict(populate_by_name=True, extra="allow") +class CreateSubscriptionRequest(BaseModel): + """Request model for create_subscription""" -# Models for delete_subscription + model_config = ConfigDict(populate_by_name=True) -class DeleteSubscriptionResponse(BaseModel): - """Response model for delete_subscription""" +class CreateSubscriptionResponse(BaseModel): + """Response model for create_subscription""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/client.py b/xdk/python/xdk/client.py index 691b386a..fa82548c 100644 --- a/xdk/python/xdk/client.py +++ b/xdk/python/xdk/client.py @@ -17,40 +17,42 @@ from .oauth2_auth import OAuth2PKCEAuth from .paginator import Cursor, cursor, PaginationError -from .trends.client import TrendsClient +from .news.client import NewsClient -from .users.client import UsersClient +from .communities.client import CommunitiesClient -from .spaces.client import SpacesClient +from .account_activity.client import AccountActivityClient from .compliance.client import ComplianceClient -from .communities.client import CommunitiesClient +from .trends.client import TrendsClient -from .account_activity.client import AccountActivityClient +from .users.client import UsersClient -from .connections.client import ConnectionsClient +from .stream.client import StreamClient -from .lists.client import ListsClient +from .media.client import MediaClient -from .usage.client import UsageClient +from .direct_messages.client import DirectMessagesClient -from .posts.client import PostsClient +from .spaces.client import SpacesClient -from .stream.client import StreamClient +from .activity.client import ActivityClient -from .general.client import GeneralClient +from .usage.client import UsageClient from .community_notes.client import CommunityNotesClient -from .media.client import MediaClient - -from .activity.client import ActivityClient +from .lists.client import ListsClient -from .direct_messages.client import DirectMessagesClient +from .posts.client import PostsClient from .webhooks.client import WebhooksClient +from .connections.client import ConnectionsClient + +from .general.client import GeneralClient + class Client: """Client for interacting with the X API.""" @@ -92,23 +94,24 @@ def __init__( scope=scope, ) # Initialize clients for each tag - self.trends = TrendsClient(self) - self.users = UsersClient(self) - self.spaces = SpacesClient(self) - self.compliance = ComplianceClient(self) + self.news = NewsClient(self) self.communities = CommunitiesClient(self) self.account_activity = AccountActivityClient(self) - self.connections = ConnectionsClient(self) - self.lists = ListsClient(self) - self.usage = UsageClient(self) - self.posts = PostsClient(self) + self.compliance = ComplianceClient(self) + self.trends = TrendsClient(self) + self.users = UsersClient(self) self.stream = StreamClient(self) - self.general = GeneralClient(self) - self.community_notes = CommunityNotesClient(self) self.media = MediaClient(self) - self.activity = ActivityClient(self) self.direct_messages = DirectMessagesClient(self) + self.spaces = SpacesClient(self) + self.activity = ActivityClient(self) + self.usage = UsageClient(self) + self.community_notes = CommunityNotesClient(self) + self.lists = ListsClient(self) + self.posts = PostsClient(self) self.webhooks = WebhooksClient(self) + self.connections = ConnectionsClient(self) + self.general = GeneralClient(self) @property diff --git a/xdk/python/xdk/communities/client.py b/xdk/python/xdk/communities/client.py index 652f23df..4f5008df 100644 --- a/xdk/python/xdk/communities/client.py +++ b/xdk/python/xdk/communities/client.py @@ -40,7 +40,7 @@ def search( max_results: int = None, next_token: Any = None, pagination_token: Any = None, - communityfields: List = None, + community_fields: List = None, ) -> SearchResponse: """ Search Communities @@ -50,7 +50,7 @@ def search( max_results: The maximum number of search results to be returned by a request. next_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. pagination_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - communityfields: A comma separated list of Community fields to display. + community_fields: A comma separated list of Community fields to display. Returns: SearchResponse: Response data """ @@ -69,8 +69,10 @@ def search( params["next_token"] = next_token if pagination_token is not None: params["pagination_token"] = pagination_token - if communityfields is not None: - params["community.fields"] = ",".join(str(item) for item in communityfields) + if community_fields is not None: + params["community.fields"] = ",".join( + str(item) for item in community_fields + ) headers = {} # Prepare request data json_data = None @@ -95,13 +97,13 @@ def search( return SearchResponse.model_validate(response_data) - def get_by_id(self, id: Any, communityfields: List = None) -> GetByIdResponse: + def get_by_id(self, id: Any, community_fields: List = None) -> GetByIdResponse: """ Get Community by ID Retrieves details of a specific Community by its ID. Args: id: The ID of the Community. - communityfields: A comma separated list of Community fields to display. + community_fields: A comma separated list of Community fields to display. Returns: GetByIdResponse: Response data """ @@ -121,8 +123,10 @@ def get_by_id(self, id: Any, communityfields: List = None) -> GetByIdResponse: if self.client.is_token_expired(): self.client.refresh_token() params = {} - if communityfields is not None: - params["community.fields"] = ",".join(str(item) for item in communityfields) + if community_fields is not None: + params["community.fields"] = ",".join( + str(item) for item in community_fields + ) headers = {} # Prepare request data json_data = None diff --git a/xdk/python/xdk/community_notes/client.py b/xdk/python/xdk/community_notes/client.py index 802561b5..43d16068 100644 --- a/xdk/python/xdk/community_notes/client.py +++ b/xdk/python/xdk/community_notes/client.py @@ -23,11 +23,11 @@ from .models import ( SearchEligiblePostsResponse, DeleteResponse, - EvaluateRequest, - EvaluateResponse, + SearchWrittenResponse, CreateRequest, CreateResponse, - SearchWrittenResponse, + EvaluateRequest, + EvaluateResponse, ) @@ -44,12 +44,13 @@ def search_eligible_posts( test_mode: bool, pagination_token: str = None, max_results: int = None, - tweetfields: List = None, + post_selection: str = None, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, ) -> SearchEligiblePostsResponse: """ Search for Posts Eligible for Community Notes @@ -58,12 +59,13 @@ def search_eligible_posts( test_mode: If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. pagination_token: Pagination token to get next set of posts eligible for notes. max_results: Max results to return. - tweetfields: A comma separated list of Tweet fields to display. + post_selection: The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: SearchEligiblePostsResponse: Response data """ @@ -80,18 +82,20 @@ def search_eligible_posts( params["pagination_token"] = pagination_token if max_results is not None: params["max_results"] = max_results - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if post_selection is not None: + params["post_selection"] = post_selection + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -157,52 +161,61 @@ def delete(self, id: Any) -> DeleteResponse: return DeleteResponse.model_validate(response_data) - def evaluate(self, body: Optional[EvaluateRequest] = None) -> EvaluateResponse: + def search_written( + self, + test_mode: bool, + pagination_token: str = None, + max_results: int = None, + note_fields: List = None, + ) -> SearchWrittenResponse: """ - Evaluate a Community Note - Endpoint to evaluate a community note. - body: Request body - Returns: - EvaluateResponse: Response data + Search for Community Notes Written + Returns all the community notes written by the user. + Args: + test_mode: If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. + pagination_token: Pagination token to get next set of posts eligible for notes. + max_results: Max results to return. + note_fields: A comma separated list of Note fields to display. + Returns: + SearchWrittenResponse: Response data """ - url = self.client.base_url + "/2/evaluate_note" + url = self.client.base_url + "/2/notes/search/notes_written" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if test_mode is not None: + params["test_mode"] = test_mode + if pagination_token is not None: + params["pagination_token"] = pagination_token + if max_results is not None: + params["max_results"] = max_results + if note_fields is not None: + params["note.fields"] = ",".join(str(item) for item in note_fields) headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.post( + response = self.client.oauth2_session.get( url, params=params, headers=headers, - json=json_data, ) else: - response = self.client.session.post( + response = self.client.session.get( url, params=params, headers=headers, - json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return EvaluateResponse.model_validate(response_data) + return SearchWrittenResponse.model_validate(response_data) def create(self, body: Optional[CreateRequest] = None) -> CreateResponse: @@ -253,58 +266,49 @@ def create(self, body: Optional[CreateRequest] = None) -> CreateResponse: return CreateResponse.model_validate(response_data) - def search_written( - self, - test_mode: bool, - pagination_token: str = None, - max_results: int = None, - notefields: List = None, - ) -> SearchWrittenResponse: + def evaluate(self, body: Optional[EvaluateRequest] = None) -> EvaluateResponse: """ - Search for Community Notes Written - Returns all the community notes written by the user. - Args: - test_mode: If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. - pagination_token: Pagination token to get next set of posts eligible for notes. - max_results: Max results to return. - notefields: A comma separated list of Note fields to display. - Returns: - SearchWrittenResponse: Response data + Evaluate a Community Note + Endpoint to evaluate a community note. + body: Request body + Returns: + EvaluateResponse: Response data """ - url = self.client.base_url + "/2/notes/search/notes_written" + url = self.client.base_url + "/2/evaluate_note" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if test_mode is not None: - params["test_mode"] = test_mode - if pagination_token is not None: - params["pagination_token"] = pagination_token - if max_results is not None: - params["max_results"] = max_results - if notefields is not None: - params["note.fields"] = ",".join(str(item) for item in notefields) headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.get( + response = self.client.oauth2_session.post( url, params=params, headers=headers, + json=json_data, ) else: - response = self.client.session.get( + response = self.client.session.post( url, params=params, headers=headers, + json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return SearchWrittenResponse.model_validate(response_data) + return EvaluateResponse.model_validate(response_data) diff --git a/xdk/python/xdk/community_notes/models.py b/xdk/python/xdk/community_notes/models.py index 9871c3c2..6f5a1fc9 100644 --- a/xdk/python/xdk/community_notes/models.py +++ b/xdk/python/xdk/community_notes/models.py @@ -34,17 +34,11 @@ class DeleteResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for evaluate - - -class EvaluateRequest(BaseModel): - """Request model for evaluate""" - - model_config = ConfigDict(populate_by_name=True) +# Models for search_written -class EvaluateResponse(BaseModel): - """Response model for evaluate""" +class SearchWrittenResponse(BaseModel): + """Response model for search_written""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -64,10 +58,16 @@ class CreateResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for search_written +# Models for evaluate -class SearchWrittenResponse(BaseModel): - """Response model for search_written""" +class EvaluateRequest(BaseModel): + """Request model for evaluate""" + + model_config = ConfigDict(populate_by_name=True) + + +class EvaluateResponse(BaseModel): + """Response model for evaluate""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/compliance/client.py b/xdk/python/xdk/compliance/client.py index f1b7b0ea..ede2e65c 100644 --- a/xdk/python/xdk/compliance/client.py +++ b/xdk/python/xdk/compliance/client.py @@ -37,7 +37,7 @@ def __init__(self, client: Client): def get_jobs( - self, type: str, status: str = None, compliance_jobfields: List = None + self, type: str, status: str = None, compliance_job_fields: List = None ) -> GetJobsResponse: """ Get Compliance Jobs @@ -45,7 +45,7 @@ def get_jobs( Args: type: Type of Compliance Job to list. status: Status of Compliance Job to list. - compliance_jobfields: A comma separated list of ComplianceJob fields to display. + compliance_job_fields: A comma separated list of ComplianceJob fields to display. Returns: GetJobsResponse: Response data """ @@ -63,9 +63,9 @@ def get_jobs( params["type"] = type if status is not None: params["status"] = status - if compliance_jobfields is not None: + if compliance_job_fields is not None: params["compliance_job.fields"] = ",".join( - str(item) for item in compliance_jobfields + str(item) for item in compliance_job_fields ) headers = {} # Prepare request data @@ -128,14 +128,14 @@ def create_jobs(self, body: CreateJobsRequest) -> CreateJobsResponse: def get_jobs_by_id( - self, id: Any, compliance_jobfields: List = None + self, id: Any, compliance_job_fields: List = None ) -> GetJobsByIdResponse: """ Get Compliance Job by ID Retrieves details of a specific Compliance Job by its ID. Args: id: The ID of the Compliance Job to retrieve. - compliance_jobfields: A comma separated list of ComplianceJob fields to display. + compliance_job_fields: A comma separated list of ComplianceJob fields to display. Returns: GetJobsByIdResponse: Response data """ @@ -150,9 +150,9 @@ def get_jobs_by_id( f"Bearer {self.client.access_token}" ) params = {} - if compliance_jobfields is not None: + if compliance_job_fields is not None: params["compliance_job.fields"] = ",".join( - str(item) for item in compliance_jobfields + str(item) for item in compliance_job_fields ) headers = {} # Prepare request data diff --git a/xdk/python/xdk/direct_messages/client.py b/xdk/python/xdk/direct_messages/client.py index 8964dbfc..d4f8773f 100644 --- a/xdk/python/xdk/direct_messages/client.py +++ b/xdk/python/xdk/direct_messages/client.py @@ -21,12 +21,12 @@ if TYPE_CHECKING: from ..client import Client from .models import ( - GetEventsByParticipantIdResponse, - CreateByConversationIdRequest, - CreateByConversationIdResponse, GetEventsByConversationIdResponse, CreateConversationRequest, CreateConversationResponse, + CreateByConversationIdRequest, + CreateByConversationIdResponse, + GetEventsByParticipantIdResponse, GetEventsResponse, CreateByParticipantIdRequest, CreateByParticipantIdResponse, @@ -43,38 +43,36 @@ def __init__(self, client: Client): self.client = client - def get_events_by_participant_id( + def get_events_by_conversation_id( self, - participant_id: Any, + id: Any, max_results: int = None, pagination_token: Any = None, event_types: List = None, - dm_eventfields: List = None, + dm_event_fields: List = None, expansions: List = None, - mediafields: List = None, - userfields: List = None, - tweetfields: List = None, - ) -> GetEventsByParticipantIdResponse: + media_fields: List = None, + user_fields: List = None, + tweet_fields: List = None, + ) -> GetEventsByConversationIdResponse: """ Get DM events for a DM conversation Retrieves direct message events for a specific conversation. Args: - participant_id: The ID of the participant user for the One to One DM conversation. + id: The DM conversation ID. max_results: The maximum number of results. pagination_token: This parameter is used to get a specified 'page' of results. event_types: The set of event_types to include in the results. - dm_eventfields: A comma separated list of DmEvent fields to display. + dm_event_fields: A comma separated list of DmEvent fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - userfields: A comma separated list of User fields to display. - tweetfields: A comma separated list of Tweet fields to display. + media_fields: A comma separated list of Media fields to display. + user_fields: A comma separated list of User fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetEventsByParticipantIdResponse: Response data + GetEventsByConversationIdResponse: Response data """ - url = ( - self.client.base_url + "/2/dm_conversations/with/{participant_id}/dm_events" - ) - url = url.replace("{participant_id}", str(participant_id)) + url = self.client.base_url + "/2/dm_conversations/{id}/dm_events" + url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh @@ -87,16 +85,16 @@ def get_events_by_participant_id( params["pagination_token"] = pagination_token if event_types is not None: params["event_types"] = ",".join(str(item) for item in event_types) - if dm_eventfields is not None: - params["dm_event.fields"] = ",".join(str(item) for item in dm_eventfields) + if dm_event_fields is not None: + params["dm_event.fields"] = ",".join(str(item) for item in dm_event_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None @@ -118,7 +116,57 @@ def get_events_by_participant_id( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetEventsByParticipantIdResponse.model_validate(response_data) + return GetEventsByConversationIdResponse.model_validate(response_data) + + + def create_conversation( + self, body: Optional[CreateConversationRequest] = None + ) -> Dict[str, Any]: + """ + Create DM conversation + Initiates a new direct message conversation with specified participants. + body: Request body + Returns: + CreateConversationResponse: Response data + """ + url = self.client.base_url + "/2/dm_conversations" + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + headers = {} + headers["Content-Type"] = "application/json" + # Prepare request data + json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + else: + response = self.client.session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return CreateConversationResponse.model_validate(response_data) def create_by_conversation_id( @@ -176,36 +224,38 @@ def create_by_conversation_id( return CreateByConversationIdResponse.model_validate(response_data) - def get_events_by_conversation_id( + def get_events_by_participant_id( self, - id: Any, + participant_id: Any, max_results: int = None, pagination_token: Any = None, event_types: List = None, - dm_eventfields: List = None, + dm_event_fields: List = None, expansions: List = None, - mediafields: List = None, - userfields: List = None, - tweetfields: List = None, - ) -> GetEventsByConversationIdResponse: + media_fields: List = None, + user_fields: List = None, + tweet_fields: List = None, + ) -> GetEventsByParticipantIdResponse: """ Get DM events for a DM conversation Retrieves direct message events for a specific conversation. Args: - id: The DM conversation ID. + participant_id: The ID of the participant user for the One to One DM conversation. max_results: The maximum number of results. pagination_token: This parameter is used to get a specified 'page' of results. event_types: The set of event_types to include in the results. - dm_eventfields: A comma separated list of DmEvent fields to display. + dm_event_fields: A comma separated list of DmEvent fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - userfields: A comma separated list of User fields to display. - tweetfields: A comma separated list of Tweet fields to display. + media_fields: A comma separated list of Media fields to display. + user_fields: A comma separated list of User fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetEventsByConversationIdResponse: Response data + GetEventsByParticipantIdResponse: Response data """ - url = self.client.base_url + "/2/dm_conversations/{id}/dm_events" - url = url.replace("{id}", str(id)) + url = ( + self.client.base_url + "/2/dm_conversations/with/{participant_id}/dm_events" + ) + url = url.replace("{participant_id}", str(participant_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh @@ -218,16 +268,16 @@ def get_events_by_conversation_id( params["pagination_token"] = pagination_token if event_types is not None: params["event_types"] = ",".join(str(item) for item in event_types) - if dm_eventfields is not None: - params["dm_event.fields"] = ",".join(str(item) for item in dm_eventfields) + if dm_event_fields is not None: + params["dm_event.fields"] = ",".join(str(item) for item in dm_event_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None @@ -249,57 +299,7 @@ def get_events_by_conversation_id( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetEventsByConversationIdResponse.model_validate(response_data) - - - def create_conversation( - self, body: Optional[CreateConversationRequest] = None - ) -> Dict[str, Any]: - """ - Create DM conversation - Initiates a new direct message conversation with specified participants. - body: Request body - Returns: - CreateConversationResponse: Response data - """ - url = self.client.base_url + "/2/dm_conversations" - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} - headers = {} - headers["Content-Type"] = "application/json" - # Prepare request data - json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) - # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - else: - response = self.client.session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return CreateConversationResponse.model_validate(response_data) + return GetEventsByParticipantIdResponse.model_validate(response_data) def get_events( @@ -307,11 +307,11 @@ def get_events( max_results: int = None, pagination_token: Any = None, event_types: List = None, - dm_eventfields: List = None, + dm_event_fields: List = None, expansions: List = None, - mediafields: List = None, - userfields: List = None, - tweetfields: List = None, + media_fields: List = None, + user_fields: List = None, + tweet_fields: List = None, ) -> GetEventsResponse: """ Get DM events @@ -320,11 +320,11 @@ def get_events( max_results: The maximum number of results. pagination_token: This parameter is used to get a specified 'page' of results. event_types: The set of event_types to include in the results. - dm_eventfields: A comma separated list of DmEvent fields to display. + dm_event_fields: A comma separated list of DmEvent fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - userfields: A comma separated list of User fields to display. - tweetfields: A comma separated list of Tweet fields to display. + media_fields: A comma separated list of Media fields to display. + user_fields: A comma separated list of User fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: GetEventsResponse: Response data """ @@ -341,16 +341,16 @@ def get_events( params["pagination_token"] = pagination_token if event_types is not None: params["event_types"] = ",".join(str(item) for item in event_types) - if dm_eventfields is not None: - params["dm_event.fields"] = ",".join(str(item) for item in dm_eventfields) + if dm_event_fields is not None: + params["dm_event.fields"] = ",".join(str(item) for item in dm_event_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None @@ -433,22 +433,22 @@ def create_by_participant_id( def get_events_by_id( self, event_id: Any, - dm_eventfields: List = None, + dm_event_fields: List = None, expansions: List = None, - mediafields: List = None, - userfields: List = None, - tweetfields: List = None, + media_fields: List = None, + user_fields: List = None, + tweet_fields: List = None, ) -> GetEventsByIdResponse: """ Get DM event by ID Retrieves details of a specific direct message event by its ID. Args: event_id: dm event id. - dm_eventfields: A comma separated list of DmEvent fields to display. + dm_event_fields: A comma separated list of DmEvent fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - userfields: A comma separated list of User fields to display. - tweetfields: A comma separated list of Tweet fields to display. + media_fields: A comma separated list of Media fields to display. + user_fields: A comma separated list of User fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: GetEventsByIdResponse: Response data """ @@ -460,16 +460,16 @@ def get_events_by_id( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if dm_eventfields is not None: - params["dm_event.fields"] = ",".join(str(item) for item in dm_eventfields) + if dm_event_fields is not None: + params["dm_event.fields"] = ",".join(str(item) for item in dm_event_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None diff --git a/xdk/python/xdk/direct_messages/models.py b/xdk/python/xdk/direct_messages/models.py index 96791b5c..5b2c5caf 100644 --- a/xdk/python/xdk/direct_messages/models.py +++ b/xdk/python/xdk/direct_messages/models.py @@ -16,50 +16,50 @@ from datetime import datetime -# Models for get_events_by_participant_id +# Models for get_events_by_conversation_id -class GetEventsByParticipantIdResponse(BaseModel): - """Response model for get_events_by_participant_id""" +class GetEventsByConversationIdResponse(BaseModel): + """Response model for get_events_by_conversation_id""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for create_by_conversation_id +# Models for create_conversation -class CreateByConversationIdRequest(BaseModel): - """Request model for create_by_conversation_id""" +class CreateConversationRequest(BaseModel): + """Request model for create_conversation""" model_config = ConfigDict(populate_by_name=True) -class CreateByConversationIdResponse(BaseModel): - """Response model for create_by_conversation_id""" +class CreateConversationResponse(BaseModel): + """Response model for create_conversation""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_events_by_conversation_id +# Models for create_by_conversation_id -class GetEventsByConversationIdResponse(BaseModel): - """Response model for get_events_by_conversation_id""" +class CreateByConversationIdRequest(BaseModel): + """Request model for create_by_conversation_id""" - model_config = ConfigDict(populate_by_name=True, extra="allow") + model_config = ConfigDict(populate_by_name=True) -# Models for create_conversation +class CreateByConversationIdResponse(BaseModel): + """Response model for create_by_conversation_id""" + model_config = ConfigDict(populate_by_name=True, extra="allow") -class CreateConversationRequest(BaseModel): - """Request model for create_conversation""" - model_config = ConfigDict(populate_by_name=True) +# Models for get_events_by_participant_id -class CreateConversationResponse(BaseModel): - """Response model for create_conversation""" +class GetEventsByParticipantIdResponse(BaseModel): + """Response model for get_events_by_participant_id""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/lists/client.py b/xdk/python/xdk/lists/client.py index b4bff1f7..e04ab3e2 100644 --- a/xdk/python/xdk/lists/client.py +++ b/xdk/python/xdk/lists/client.py @@ -21,18 +21,18 @@ if TYPE_CHECKING: from ..client import Client from .models import ( - GetFollowersResponse, - GetMembersResponse, - AddMemberRequest, - AddMemberResponse, - GetPostsResponse, CreateRequest, CreateResponse, - RemoveMemberByUserIdResponse, GetByIdResponse, UpdateRequest, UpdateResponse, DeleteResponse, + GetFollowersResponse, + RemoveMemberByUserIdResponse, + GetPostsResponse, + GetMembersResponse, + AddMemberRequest, + AddMemberResponse, ) @@ -44,94 +44,73 @@ def __init__(self, client: Client): self.client = client - def get_followers( - self, - id: Any, - max_results: int = None, - pagination_token: Any = None, - userfields: List = None, - expansions: List = None, - tweetfields: List = None, - ) -> GetFollowersResponse: + def create(self, body: Optional[CreateRequest] = None) -> CreateResponse: """ - Get List followers - Retrieves a list of Users who follow a specific List by its ID. - Args: - id: The ID of the List. - max_results: The maximum number of results. - pagination_token: This parameter is used to get a specified 'page' of results. - userfields: A comma separated list of User fields to display. - expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. - Returns: - GetFollowersResponse: Response data + Create List + Creates a new List for the authenticated user. + body: Request body + Returns: + CreateResponse: Response data """ - url = self.client.base_url + "/2/lists/{id}/followers" - url = url.replace("{id}", str(id)) - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) + url = self.client.base_url + "/2/lists" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + if self.client.oauth2_session: + response = self.client.oauth2_session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + else: + response = self.client.session.post( + url, + params=params, + headers=headers, + json=json_data, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetFollowersResponse.model_validate(response_data) + return CreateResponse.model_validate(response_data) - def get_members( + def get_by_id( self, id: Any, - max_results: int = None, - pagination_token: Any = None, - userfields: List = None, + list_fields: List = None, expansions: List = None, - tweetfields: List = None, - ) -> GetMembersResponse: + user_fields: List = None, + ) -> GetByIdResponse: """ - Get List members - Retrieves a list of Users who are members of a specific List by its ID. + Get List by ID + Retrieves details of a specific List by its ID. Args: id: The ID of the List. - max_results: The maximum number of results. - pagination_token: This parameter is used to get a specified 'page' of results. - userfields: A comma separated list of User fields to display. + list_fields: A comma separated list of List fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + user_fields: A comma separated list of User fields to display. Returns: - GetMembersResponse: Response data + GetByIdResponse: Response data """ - url = self.client.base_url + "/2/lists/{id}/members" + url = self.client.base_url + "/2/lists/{id}" url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -147,16 +126,12 @@ def get_members( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if list_fields is not None: + params["list.fields"] = ",".join(str(item) for item in list_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) headers = {} # Prepare request data json_data = None @@ -171,22 +146,20 @@ def get_members( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetMembersResponse.model_validate(response_data) + return GetByIdResponse.model_validate(response_data) - def add_member( - self, id: Any, body: Optional[AddMemberRequest] = None - ) -> AddMemberResponse: + def update(self, id: Any, body: Optional[UpdateRequest] = None) -> UpdateResponse: """ - Add List member - Adds a User to a specific List by its ID. + Update List + Updates the details of a specific List owned by the authenticated user by its ID. Args: - id: The ID of the List for which to add a member. + id: The ID of the List to modify. body: Request body Returns: - AddMemberResponse: Response data + UpdateResponse: Response data """ - url = self.client.base_url + "/2/lists/{id}/members" + url = self.client.base_url + "/2/lists/{id}" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -206,14 +179,14 @@ def add_member( ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.post( + response = self.client.oauth2_session.put( url, params=params, headers=headers, json=json_data, ) else: - response = self.client.session.post( + response = self.client.session.put( url, params=params, headers=headers, @@ -224,38 +197,73 @@ def add_member( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return AddMemberResponse.model_validate(response_data) + return UpdateResponse.model_validate(response_data) - def get_posts( + def delete(self, id: Any) -> DeleteResponse: + """ + Delete List + Deletes a specific List owned by the authenticated user by its ID. + Args: + id: The ID of the List to delete. + Returns: + DeleteResponse: Response data + """ + url = self.client.base_url + "/2/lists/{id}" + url = url.replace("{id}", str(id)) + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + headers = {} + # Prepare request data + json_data = None + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.delete( + url, + params=params, + headers=headers, + ) + else: + response = self.client.session.delete( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return DeleteResponse.model_validate(response_data) + + + def get_followers( self, id: Any, max_results: int = None, pagination_token: Any = None, - tweetfields: List = None, + user_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetPostsResponse: + tweet_fields: List = None, + ) -> GetFollowersResponse: """ - Get List Posts - Retrieves a list of Posts associated with a specific List by its ID. + Get List followers + Retrieves a list of Users who follow a specific List by its ID. Args: id: The ID of the List. max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. - tweetfields: A comma separated list of Tweet fields to display. + pagination_token: This parameter is used to get a specified 'page' of results. + user_fields: A comma separated list of User fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetPostsResponse: Response data + GetFollowersResponse: Response data """ - url = self.client.base_url + "/2/lists/{id}/tweets" + url = self.client.base_url + "/2/lists/{id}/followers" url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -275,18 +283,12 @@ def get_posts( params["max_results"] = max_results if pagination_token is not None: params["pagination_token"] = pagination_token - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None @@ -301,55 +303,7 @@ def get_posts( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetPostsResponse.model_validate(response_data) - - - def create(self, body: Optional[CreateRequest] = None) -> CreateResponse: - """ - Create List - Creates a new List for the authenticated user. - body: Request body - Returns: - CreateResponse: Response data - """ - url = self.client.base_url + "/2/lists" - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} - headers = {} - headers["Content-Type"] = "application/json" - # Prepare request data - json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) - # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - else: - response = self.client.session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return CreateResponse.model_validate(response_data) + return GetFollowersResponse.model_validate(response_data) def remove_member_by_user_id( @@ -397,25 +351,35 @@ def remove_member_by_user_id( return RemoveMemberByUserIdResponse.model_validate(response_data) - def get_by_id( + def get_posts( self, id: Any, - listfields: List = None, + max_results: int = None, + pagination_token: Any = None, + tweet_fields: List = None, expansions: List = None, - userfields: List = None, - ) -> GetByIdResponse: + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetPostsResponse: """ - Get List by ID - Retrieves details of a specific List by its ID. + Get List Posts + Retrieves a list of Posts associated with a specific List by its ID. Args: id: The ID of the List. - listfields: A comma separated list of List fields to display. + max_results: The maximum number of results. + pagination_token: This parameter is used to get the next 'page' of results. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - GetByIdResponse: Response data + GetPostsResponse: Response data """ - url = self.client.base_url + "/2/lists/{id}" + url = self.client.base_url + "/2/lists/{id}/tweets" url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -431,12 +395,22 @@ def get_by_id( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if listfields is not None: - params["list.fields"] = ",".join(str(item) for item in listfields) + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -451,70 +425,87 @@ def get_by_id( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetByIdResponse.model_validate(response_data) + return GetPostsResponse.model_validate(response_data) - def update(self, id: Any, body: Optional[UpdateRequest] = None) -> UpdateResponse: + def get_members( + self, + id: Any, + max_results: int = None, + pagination_token: Any = None, + user_fields: List = None, + expansions: List = None, + tweet_fields: List = None, + ) -> GetMembersResponse: """ - Update List - Updates the details of a specific List owned by the authenticated user by its ID. + Get List members + Retrieves a list of Users who are members of a specific List by its ID. Args: - id: The ID of the List to modify. - body: Request body - Returns: - UpdateResponse: Response data + id: The ID of the List. + max_results: The maximum number of results. + pagination_token: This parameter is used to get a specified 'page' of results. + user_fields: A comma separated list of User fields to display. + expansions: A comma separated list of fields to expand. + tweet_fields: A comma separated list of Tweet fields to display. + Returns: + GetMembersResponse: Response data """ - url = self.client.base_url + "/2/lists/{id}" + url = self.client.base_url + "/2/lists/{id}/members" url = url.replace("{id}", str(id)) + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.put( - url, - params=params, - headers=headers, - json=json_data, - ) - else: - response = self.client.session.put( - url, - params=params, - headers=headers, - json=json_data, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UpdateResponse.model_validate(response_data) + return GetMembersResponse.model_validate(response_data) - def delete(self, id: Any) -> DeleteResponse: + def add_member( + self, id: Any, body: Optional[AddMemberRequest] = None + ) -> AddMemberResponse: """ - Delete List - Deletes a specific List owned by the authenticated user by its ID. + Add List member + Adds a User to a specific List by its ID. Args: - id: The ID of the List to delete. - Returns: - DeleteResponse: Response data + id: The ID of the List for which to add a member. + body: Request body + Returns: + AddMemberResponse: Response data """ - url = self.client.base_url + "/2/lists/{id}" + url = self.client.base_url + "/2/lists/{id}/members" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -523,24 +514,33 @@ def delete(self, id: Any) -> DeleteResponse: self.client.refresh_token() params = {} headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.delete( + response = self.client.oauth2_session.post( url, params=params, headers=headers, + json=json_data, ) else: - response = self.client.session.delete( + response = self.client.session.post( url, params=params, headers=headers, + json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return DeleteResponse.model_validate(response_data) + return AddMemberResponse.model_validate(response_data) diff --git a/xdk/python/xdk/lists/models.py b/xdk/python/xdk/lists/models.py index d9f86e40..3978e2da 100644 --- a/xdk/python/xdk/lists/models.py +++ b/xdk/python/xdk/lists/models.py @@ -16,59 +16,59 @@ from datetime import datetime -# Models for get_followers +# Models for create -class GetFollowersResponse(BaseModel): - """Response model for get_followers""" +class CreateRequest(BaseModel): + """Request model for create""" + + model_config = ConfigDict(populate_by_name=True) + + +class CreateResponse(BaseModel): + """Response model for create""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_members +# Models for get_by_id -class GetMembersResponse(BaseModel): - """Response model for get_members""" +class GetByIdResponse(BaseModel): + """Response model for get_by_id""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for add_member +# Models for update -class AddMemberRequest(BaseModel): - """Request model for add_member""" +class UpdateRequest(BaseModel): + """Request model for update""" model_config = ConfigDict(populate_by_name=True) -class AddMemberResponse(BaseModel): - """Response model for add_member""" +class UpdateResponse(BaseModel): + """Response model for update""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_posts +# Models for delete -class GetPostsResponse(BaseModel): - """Response model for get_posts""" +class DeleteResponse(BaseModel): + """Response model for delete""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for create - - -class CreateRequest(BaseModel): - """Request model for create""" - - model_config = ConfigDict(populate_by_name=True) +# Models for get_followers -class CreateResponse(BaseModel): - """Response model for create""" +class GetFollowersResponse(BaseModel): + """Response model for get_followers""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -82,34 +82,34 @@ class RemoveMemberByUserIdResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_by_id +# Models for get_posts -class GetByIdResponse(BaseModel): - """Response model for get_by_id""" +class GetPostsResponse(BaseModel): + """Response model for get_posts""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for update +# Models for get_members -class UpdateRequest(BaseModel): - """Request model for update""" +class GetMembersResponse(BaseModel): + """Response model for get_members""" - model_config = ConfigDict(populate_by_name=True) + model_config = ConfigDict(populate_by_name=True, extra="allow") -class UpdateResponse(BaseModel): - """Response model for update""" +# Models for add_member - model_config = ConfigDict(populate_by_name=True, extra="allow") +class AddMemberRequest(BaseModel): + """Request model for add_member""" -# Models for delete + model_config = ConfigDict(populate_by_name=True) -class DeleteResponse(BaseModel): - """Response model for delete""" +class AddMemberResponse(BaseModel): + """Response model for add_member""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/media/client.py b/xdk/python/xdk/media/client.py index e386b4dd..216464e4 100644 --- a/xdk/python/xdk/media/client.py +++ b/xdk/python/xdk/media/client.py @@ -21,23 +21,23 @@ if TYPE_CHECKING: from ..client import Client from .models import ( + GetUploadStatusResponse, + UploadRequest, + UploadResponse, CreateSubtitlesRequest, CreateSubtitlesResponse, DeleteSubtitlesRequest, DeleteSubtitlesResponse, - GetAnalyticsResponse, + InitializeUploadRequest, + InitializeUploadResponse, GetByKeysResponse, - GetByKeyResponse, - FinalizeUploadResponse, AppendUploadRequest, AppendUploadResponse, - InitializeUploadRequest, - InitializeUploadResponse, CreateMetadataRequest, CreateMetadataResponse, - GetUploadStatusResponse, - UploadRequest, - UploadResponse, + FinalizeUploadResponse, + GetByKeyResponse, + GetAnalyticsResponse, ) @@ -49,6 +49,101 @@ def __init__(self, client: Client): self.client = client + def get_upload_status( + self, media_id: Any, command: str = None + ) -> GetUploadStatusResponse: + """ + Get Media upload status + Retrieves the status of a Media upload by its ID. + Args: + media_id: Media id for the requested media upload status. + command: The command for the media upload request. + Returns: + GetUploadStatusResponse: Response data + """ + url = self.client.base_url + "/2/media/upload" + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + if media_id is not None: + params["media_id"] = media_id + if command is not None: + params["command"] = command + headers = {} + # Prepare request data + json_data = None + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.get( + url, + params=params, + headers=headers, + ) + else: + response = self.client.session.get( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return GetUploadStatusResponse.model_validate(response_data) + + + def upload(self, body: Optional[UploadRequest] = None) -> UploadResponse: + """ + Upload media + Uploads a media file for use in posts or other content. + body: Request body + Returns: + UploadResponse: Response data + """ + url = self.client.base_url + "/2/media/upload" + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + headers = {} + headers["Content-Type"] = "application/json" + # Prepare request data + json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + else: + response = self.client.session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return UploadResponse.model_validate(response_data) + + def create_subtitles( self, body: Optional[CreateSubtitlesRequest] = None ) -> CreateSubtitlesResponse: @@ -149,78 +244,65 @@ def delete_subtitles( return DeleteSubtitlesResponse.model_validate(response_data) - def get_analytics( - self, - media_keys: List, - end_time: str, - start_time: str, - granularity: str, - media_analyticsfields: List = None, - ) -> GetAnalyticsResponse: + def initialize_upload( + self, body: Optional[InitializeUploadRequest] = None + ) -> InitializeUploadResponse: """ - Get Media analytics - Retrieves analytics data for media. - Args: - media_keys: A comma separated list of Media Keys. Up to 100 are allowed in a single request. - end_time: YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - start_time: YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - granularity: The granularity for the search counts results. - media_analyticsfields: A comma separated list of MediaAnalytics fields to display. - Returns: - GetAnalyticsResponse: Response data + Initialize media upload + Initializes a media upload. + body: Request body + Returns: + InitializeUploadResponse: Response data """ - url = self.client.base_url + "/2/media/analytics" + url = self.client.base_url + "/2/media/upload/initialize" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if media_keys is not None: - params["media_keys"] = ",".join(str(item) for item in media_keys) - if end_time is not None: - params["end_time"] = end_time - if start_time is not None: - params["start_time"] = start_time - if granularity is not None: - params["granularity"] = granularity - if media_analyticsfields is not None: - params["media_analytics.fields"] = ",".join( - str(item) for item in media_analyticsfields - ) headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.get( + response = self.client.oauth2_session.post( url, params=params, headers=headers, + json=json_data, ) else: - response = self.client.session.get( + response = self.client.session.post( url, params=params, headers=headers, + json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetAnalyticsResponse.model_validate(response_data) + return InitializeUploadResponse.model_validate(response_data) def get_by_keys( - self, media_keys: List, mediafields: List = None + self, media_keys: List, media_fields: List = None ) -> GetByKeysResponse: """ Get Media by media keys Retrieves details of Media files by their media keys. Args: media_keys: A comma separated list of Media Keys. Up to 100 are allowed in a single request. - mediafields: A comma separated list of Media fields to display. + media_fields: A comma separated list of Media fields to display. Returns: GetByKeysResponse: Response data """ @@ -241,8 +323,8 @@ def get_by_keys( params = {} if media_keys is not None: params["media_keys"] = ",".join(str(item) for item in media_keys) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) headers = {} # Prepare request data json_data = None @@ -260,92 +342,6 @@ def get_by_keys( return GetByKeysResponse.model_validate(response_data) - def get_by_key(self, media_key: Any, mediafields: List = None) -> GetByKeyResponse: - """ - Get Media by media key - Retrieves details of a specific Media file by its media key. - Args: - media_key: A single Media Key. - mediafields: A comma separated list of Media fields to display. - Returns: - GetByKeyResponse: Response data - """ - url = self.client.base_url + "/2/media/{media_key}" - url = url.replace("{media_key}", str(media_key)) - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - headers = {} - # Prepare request data - json_data = None - # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return GetByKeyResponse.model_validate(response_data) - - - def finalize_upload(self, id: Any) -> FinalizeUploadResponse: - """ - Finalize Media upload - Finalizes a Media upload request. - Args: - id: The media id of the targeted media to finalize. - Returns: - FinalizeUploadResponse: Response data - """ - url = self.client.base_url + "/2/media/upload/{id}/finalize" - url = url.replace("{id}", str(id)) - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} - headers = {} - # Prepare request data - json_data = None - # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.post( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.post( - url, - params=params, - headers=headers, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return FinalizeUploadResponse.model_validate(response_data) - - def append_upload( self, id: Any, body: Optional[AppendUploadRequest] = None ) -> AppendUploadResponse: @@ -399,17 +395,17 @@ def append_upload( return AppendUploadResponse.model_validate(response_data) - def initialize_upload( - self, body: Optional[InitializeUploadRequest] = None - ) -> InitializeUploadResponse: + def create_metadata( + self, body: Optional[CreateMetadataRequest] = None + ) -> CreateMetadataResponse: """ - Initialize media upload - Initializes a media upload. + Create Media metadata + Creates metadata for a Media file. body: Request body Returns: - InitializeUploadResponse: Response data + CreateMetadataResponse: Response data """ - url = self.client.base_url + "/2/media/upload/initialize" + url = self.client.base_url + "/2/media/metadata" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh @@ -446,20 +442,20 @@ def initialize_upload( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return InitializeUploadResponse.model_validate(response_data) + return CreateMetadataResponse.model_validate(response_data) - def create_metadata( - self, body: Optional[CreateMetadataRequest] = None - ) -> CreateMetadataResponse: + def finalize_upload(self, id: Any) -> FinalizeUploadResponse: """ - Create Media metadata - Creates metadata for a Media file. - body: Request body - Returns: - CreateMetadataResponse: Response data + Finalize Media upload + Finalizes a Media upload request. + Args: + id: The media id of the targeted media to finalize. + Returns: + FinalizeUploadResponse: Response data """ - url = self.client.base_url + "/2/media/metadata" + url = self.client.base_url + "/2/media/upload/{id}/finalize" + url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh @@ -467,128 +463,132 @@ def create_metadata( self.client.refresh_token() params = {} headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request if self.client.oauth2_session: response = self.client.oauth2_session.post( url, params=params, headers=headers, - json=json_data, ) else: response = self.client.session.post( url, params=params, headers=headers, - json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return CreateMetadataResponse.model_validate(response_data) + return FinalizeUploadResponse.model_validate(response_data) - def get_upload_status( - self, media_id: Any, command: str = None - ) -> GetUploadStatusResponse: + def get_by_key(self, media_key: Any, media_fields: List = None) -> GetByKeyResponse: """ - Get Media upload status - Retrieves the status of a Media upload by its ID. + Get Media by media key + Retrieves details of a specific Media file by its media key. Args: - media_id: Media id for the requested media upload status. - command: The command for the media upload request. + media_key: A single Media Key. + media_fields: A comma separated list of Media fields to display. Returns: - GetUploadStatusResponse: Response data + GetByKeyResponse: Response data """ - url = self.client.base_url + "/2/media/upload" + url = self.client.base_url + "/2/media/{media_key}" + url = url.replace("{media_key}", str(media_key)) + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if media_id is not None: - params["media_id"] = media_id - if command is not None: - params["command"] = command + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) headers = {} # Prepare request data json_data = None # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetUploadStatusResponse.model_validate(response_data) + return GetByKeyResponse.model_validate(response_data) - def upload(self, body: Optional[UploadRequest] = None) -> UploadResponse: + def get_analytics( + self, + media_keys: List, + end_time: str, + start_time: str, + granularity: str, + media_analytics_fields: List = None, + ) -> GetAnalyticsResponse: """ - Upload media - Uploads a media file for use in posts or other content. - body: Request body - Returns: - UploadResponse: Response data + Get Media analytics + Retrieves analytics data for media. + Args: + media_keys: A comma separated list of Media Keys. Up to 100 are allowed in a single request. + end_time: YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + start_time: YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + granularity: The granularity for the search counts results. + media_analytics_fields: A comma separated list of MediaAnalytics fields to display. + Returns: + GetAnalyticsResponse: Response data """ - url = self.client.base_url + "/2/media/upload" + url = self.client.base_url + "/2/media/analytics" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if media_keys is not None: + params["media_keys"] = ",".join(str(item) for item in media_keys) + if end_time is not None: + params["end_time"] = end_time + if start_time is not None: + params["start_time"] = start_time + if granularity is not None: + params["granularity"] = granularity + if media_analytics_fields is not None: + params["media_analytics.fields"] = ",".join( + str(item) for item in media_analytics_fields + ) headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.post( + response = self.client.oauth2_session.get( url, params=params, headers=headers, - json=json_data, ) else: - response = self.client.session.post( + response = self.client.session.get( url, params=params, headers=headers, - json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UploadResponse.model_validate(response_data) + return GetAnalyticsResponse.model_validate(response_data) diff --git a/xdk/python/xdk/media/models.py b/xdk/python/xdk/media/models.py index 59744870..943fb6a7 100644 --- a/xdk/python/xdk/media/models.py +++ b/xdk/python/xdk/media/models.py @@ -16,6 +16,30 @@ from datetime import datetime +# Models for get_upload_status + + +class GetUploadStatusResponse(BaseModel): + """Response model for get_upload_status""" + + model_config = ConfigDict(populate_by_name=True, extra="allow") + + +# Models for upload + + +class UploadRequest(BaseModel): + """Request model for upload""" + + model_config = ConfigDict(populate_by_name=True) + + +class UploadResponse(BaseModel): + """Response model for upload""" + + model_config = ConfigDict(populate_by_name=True, extra="allow") + + # Models for create_subtitles @@ -46,38 +70,26 @@ class DeleteSubtitlesResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_analytics - - -class GetAnalyticsResponse(BaseModel): - """Response model for get_analytics""" - - model_config = ConfigDict(populate_by_name=True, extra="allow") - - -# Models for get_by_keys - - -class GetByKeysResponse(BaseModel): - """Response model for get_by_keys""" +# Models for initialize_upload - model_config = ConfigDict(populate_by_name=True, extra="allow") +class InitializeUploadRequest(BaseModel): + """Request model for initialize_upload""" -# Models for get_by_key + model_config = ConfigDict(populate_by_name=True) -class GetByKeyResponse(BaseModel): - """Response model for get_by_key""" +class InitializeUploadResponse(BaseModel): + """Response model for initialize_upload""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for finalize_upload +# Models for get_by_keys -class FinalizeUploadResponse(BaseModel): - """Response model for finalize_upload""" +class GetByKeysResponse(BaseModel): + """Response model for get_by_keys""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -97,21 +109,6 @@ class AppendUploadResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for initialize_upload - - -class InitializeUploadRequest(BaseModel): - """Request model for initialize_upload""" - - model_config = ConfigDict(populate_by_name=True) - - -class InitializeUploadResponse(BaseModel): - """Response model for initialize_upload""" - - model_config = ConfigDict(populate_by_name=True, extra="allow") - - # Models for create_metadata @@ -127,25 +124,28 @@ class CreateMetadataResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_upload_status +# Models for finalize_upload -class GetUploadStatusResponse(BaseModel): - """Response model for get_upload_status""" +class FinalizeUploadResponse(BaseModel): + """Response model for finalize_upload""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for upload +# Models for get_by_key -class UploadRequest(BaseModel): - """Request model for upload""" +class GetByKeyResponse(BaseModel): + """Response model for get_by_key""" - model_config = ConfigDict(populate_by_name=True) + model_config = ConfigDict(populate_by_name=True, extra="allow") -class UploadResponse(BaseModel): - """Response model for upload""" +# Models for get_analytics + + +class GetAnalyticsResponse(BaseModel): + """Response model for get_analytics""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/news/__init__.py b/xdk/python/xdk/news/__init__.py new file mode 100644 index 00000000..d8ed8770 --- /dev/null +++ b/xdk/python/xdk/news/__init__.py @@ -0,0 +1,15 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +""" +Auto-generated news module for the X API. + +This module provides access to the news endpoints of the X API +and serves as the main entry point for all news-related functionality. + +Generated automatically - do not edit manually. +""" + +from .client import NewsClient + +__all__ = ["NewsClient"] diff --git a/xdk/python/xdk/news/client.py b/xdk/python/xdk/news/client.py new file mode 100644 index 00000000..f717d7f4 --- /dev/null +++ b/xdk/python/xdk/news/client.py @@ -0,0 +1,137 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. + +""" +Auto-generated news client for the X API. + +This module provides a client for interacting with the news endpoints of the X API. + +All methods, parameters, and response models are generated from the OpenAPI specification. + +Generated automatically - do not edit manually. +""" + +from __future__ import annotations +from typing import Dict, List, Optional, Any, Union, cast, TYPE_CHECKING +import requests +import time + + +if TYPE_CHECKING: + from ..client import Client +from .models import ( + SearchResponse, + GetResponse, +) + + +class NewsClient: + """Client for news operations""" + + + def __init__(self, client: Client): + self.client = client + + + def search( + self, + query: str, + max_results: int = None, + max_age_hours: int = None, + news_fields: List = None, + ) -> SearchResponse: + """ + Search News + Retrieves a list of News stories matching the specified search query. + Args: + query: The search query. + max_results: The number of results to return. + max_age_hours: The maximum age of the News story to search for. + news_fields: A comma separated list of News fields to display. + Returns: + SearchResponse: Response data + """ + url = self.client.base_url + "/2/news/search" + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + if query is not None: + params["query"] = query + if max_results is not None: + params["max_results"] = max_results + if max_age_hours is not None: + params["max_age_hours"] = max_age_hours + if news_fields is not None: + params["news.fields"] = ",".join(str(item) for item in news_fields) + headers = {} + # Prepare request data + json_data = None + # Make the request + response = self.client.session.get( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return SearchResponse.model_validate(response_data) + + + def get(self, id: Any, news_fields: List = None) -> GetResponse: + """ + Get news stories by ID + Retrieves news story by its ID. + Args: + id: The ID of the news story. + news_fields: A comma separated list of News fields to display. + Returns: + GetResponse: Response data + """ + url = self.client.base_url + "/2/news/{id}" + url = url.replace("{id}", str(id)) + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + if news_fields is not None: + params["news.fields"] = ",".join(str(item) for item in news_fields) + headers = {} + # Prepare request data + json_data = None + # Make the request + response = self.client.session.get( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return GetResponse.model_validate(response_data) diff --git a/xdk/python/xdk/news/models.py b/xdk/python/xdk/news/models.py new file mode 100644 index 00000000..fb791956 --- /dev/null +++ b/xdk/python/xdk/news/models.py @@ -0,0 +1,34 @@ +# AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +""" +Auto-generated news models for the X API. + +This module provides Pydantic models for request and response data structures +for the news endpoints of the X API. All models are generated +from the OpenAPI specification and provide type safety and validation. + +Generated automatically - do not edit manually. +""" + +from typing import Dict, List, Optional, Any, Union, Literal +from pydantic import BaseModel, Field, ConfigDict +from datetime import datetime + + +# Models for search + + +class SearchResponse(BaseModel): + """Response model for search""" + + model_config = ConfigDict(populate_by_name=True, extra="allow") + + +# Models for get + + +class GetResponse(BaseModel): + """Response model for get""" + + model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/posts/client.py b/xdk/python/xdk/posts/client.py index e16518aa..6e9190e3 100644 --- a/xdk/python/xdk/posts/client.py +++ b/xdk/python/xdk/posts/client.py @@ -22,23 +22,23 @@ from ..client import Client from .models import ( GetQuotedResponse, - GetCountsAllResponse, - GetByIdResponse, - DeleteResponse, - GetInsights28hrResponse, - GetCountsRecentResponse, - SearchAllResponse, + GetAnalyticsResponse, + HideReplyRequest, + HideReplyResponse, GetRepostedByResponse, - SearchRecentResponse, - GetInsightsHistoricalResponse, + GetRepostsResponse, GetByIdsResponse, CreateRequest, CreateResponse, GetLikingUsersResponse, - GetAnalyticsResponse, - HideReplyRequest, - HideReplyResponse, - GetRepostsResponse, + GetCountsRecentResponse, + GetCountsAllResponse, + SearchAllResponse, + SearchRecentResponse, + GetInsightsHistoricalResponse, + GetByIdResponse, + DeleteResponse, + GetInsights28hrResponse, ) @@ -56,12 +56,12 @@ def get_quoted( max_results: int = None, pagination_token: Any = None, exclude: List = None, - tweetfields: List = None, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, ) -> GetQuotedResponse: """ Get Quoted Posts @@ -71,12 +71,12 @@ def get_quoted( max_results: The maximum number of results to be returned. pagination_token: This parameter is used to get a specified 'page' of results. exclude: The set of entities to exclude (e.g. 'replies' or 'retweets'). - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: GetQuotedResponse: Response data """ @@ -102,18 +102,18 @@ def get_quoted( params["pagination_token"] = pagination_token if exclude is not None: params["exclude"] = ",".join(str(item) for item in exclude) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -131,35 +131,146 @@ def get_quoted( return GetQuotedResponse.model_validate(response_data) - def get_counts_all( + def get_analytics( self, - query: str, - start_time: str = None, - end_time: str = None, - since_id: Any = None, - until_id: Any = None, - next_token: Any = None, - pagination_token: Any = None, - granularity: str = None, - search_countfields: List = None, - ) -> GetCountsAllResponse: + ids: List, + end_time: str, + start_time: str, + granularity: str, + analytics_fields: List = None, + ) -> GetAnalyticsResponse: """ - Get count of all Posts - Retrieves the count of Posts matching a search query from the full archive. + Get Post analytics + Retrieves analytics data for specified Posts within a defined time range. Args: - query: One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - start_time: YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). - end_time: YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). - since_id: Returns results with a Post ID greater than (that is, more recent than) the specified ID. - until_id: Returns results with a Post ID less than (that is, older than) the specified ID. - next_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - pagination_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + ids: A comma separated list of Post IDs. Up to 100 are allowed in a single request. + end_time: YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + start_time: YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. granularity: The granularity for the search counts results. - search_countfields: A comma separated list of SearchCount fields to display. + analytics_fields: A comma separated list of Analytics fields to display. Returns: - GetCountsAllResponse: Response data + GetAnalyticsResponse: Response data """ - url = self.client.base_url + "/2/tweets/counts/all" + url = self.client.base_url + "/2/tweets/analytics" + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + if ids is not None: + params["ids"] = ",".join(str(item) for item in ids) + if end_time is not None: + params["end_time"] = end_time + if start_time is not None: + params["start_time"] = start_time + if granularity is not None: + params["granularity"] = granularity + if analytics_fields is not None: + params["analytics.fields"] = ",".join( + str(item) for item in analytics_fields + ) + headers = {} + # Prepare request data + json_data = None + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.get( + url, + params=params, + headers=headers, + ) + else: + response = self.client.session.get( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return GetAnalyticsResponse.model_validate(response_data) + + + def hide_reply( + self, tweet_id: Any, body: Optional[HideReplyRequest] = None + ) -> HideReplyResponse: + """ + Hide reply + Hides or unhides a reply to a conversation owned by the authenticated user. + Args: + tweet_id: The ID of the reply that you want to hide or unhide. + body: Request body + Returns: + HideReplyResponse: Response data + """ + url = self.client.base_url + "/2/tweets/{tweet_id}/hidden" + url = url.replace("{tweet_id}", str(tweet_id)) + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + headers = {} + headers["Content-Type"] = "application/json" + # Prepare request data + json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.put( + url, + params=params, + headers=headers, + json=json_data, + ) + else: + response = self.client.session.put( + url, + params=params, + headers=headers, + json=json_data, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return HideReplyResponse.model_validate(response_data) + + + def get_reposted_by( + self, + id: Any, + max_results: int = None, + pagination_token: Any = None, + user_fields: List = None, + expansions: List = None, + tweet_fields: List = None, + ) -> GetRepostedByResponse: + """ + Get Reposted by + Retrieves a list of Users who reposted a specific Post by its ID. + Args: + id: A single Post ID. + max_results: The maximum number of results. + pagination_token: This parameter is used to get the next 'page' of results. + user_fields: A comma separated list of User fields to display. + expansions: A comma separated list of fields to expand. + tweet_fields: A comma separated list of Tweet fields to display. + Returns: + GetRepostedByResponse: Response data + """ + url = self.client.base_url + "/2/tweets/{id}/retweeted_by" + url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -168,27 +279,22 @@ def get_counts_all( self.client.session.headers["Authorization"] = ( f"Bearer {self.client.access_token}" ) + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() params = {} - if query is not None: - params["query"] = query - if start_time is not None: - params["start_time"] = start_time - if end_time is not None: - params["end_time"] = end_time - if since_id is not None: - params["since_id"] = since_id - if until_id is not None: - params["until_id"] = until_id - if next_token is not None: - params["next_token"] = next_token + if max_results is not None: + params["max_results"] = max_results if pagination_token is not None: params["pagination_token"] = pagination_token - if granularity is not None: - params["granularity"] = granularity - if search_countfields is not None: - params["search_count.fields"] = ",".join( - str(item) for item in search_countfields - ) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None @@ -203,34 +309,38 @@ def get_counts_all( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetCountsAllResponse.model_validate(response_data) + return GetRepostedByResponse.model_validate(response_data) - def get_by_id( + def get_reposts( self, id: Any, - tweetfields: List = None, + max_results: int = None, + pagination_token: Any = None, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetByIdResponse: + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetRepostsResponse: """ - Get Post by ID - Retrieves details of a specific Post by its ID. + Get Reposts + Retrieves a list of Posts that repost a specific Post by its ID. Args: id: A single Post ID. - tweetfields: A comma separated list of Tweet fields to display. + max_results: The maximum number of results. + pagination_token: This parameter is used to get the next 'page' of results. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - GetByIdResponse: Response data + GetRepostsResponse: Response data """ - url = self.client.base_url + "/2/tweets/{id}" + url = self.client.base_url + "/2/tweets/{id}/retweets" url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -246,18 +356,22 @@ def get_by_id( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -272,20 +386,88 @@ def get_by_id( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetByIdResponse.model_validate(response_data) + return GetRepostsResponse.model_validate(response_data) - def delete(self, id: Any) -> DeleteResponse: + def get_by_ids( + self, + ids: List, + tweet_fields: List = None, + expansions: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetByIdsResponse: """ - Delete Post - Deletes a specific Post by its ID, if owned by the authenticated user. + Get Posts by IDs + Retrieves details of multiple Posts by their IDs. Args: - id: The ID of the Post to be deleted. + ids: A comma separated list of Post IDs. Up to 100 are allowed in a single request. + tweet_fields: A comma separated list of Tweet fields to display. + expansions: A comma separated list of fields to expand. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - DeleteResponse: Response data + GetByIdsResponse: Response data """ - url = self.client.base_url + "/2/tweets/{id}" - url = url.replace("{id}", str(id)) + url = self.client.base_url + "/2/tweets" + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + if ids is not None: + params["ids"] = ",".join(str(item) for item in ids) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) + headers = {} + # Prepare request data + json_data = None + # Make the request + response = self.client.session.get( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return GetByIdsResponse.model_validate(response_data) + + + def create(self, body: CreateRequest) -> Dict[str, Any]: + """ + Create or Edit Post + Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided. + body: Request body + Returns: + CreateResponse: Response data + """ + url = self.client.base_url + "/2/tweets" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh @@ -293,66 +475,78 @@ def delete(self, id: Any) -> DeleteResponse: self.client.refresh_token() params = {} headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.delete( + response = self.client.oauth2_session.post( url, params=params, headers=headers, + json=json_data, ) else: - response = self.client.session.delete( + response = self.client.session.post( url, params=params, headers=headers, + json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return DeleteResponse.model_validate(response_data) + return CreateResponse.model_validate(response_data) - def get_insights28hr( + def get_liking_users( self, - tweet_ids: List, - granularity: str, - requested_metrics: List, - engagementfields: List = None, - ) -> GetInsights28hrResponse: + id: Any, + max_results: int = None, + pagination_token: Any = None, + user_fields: List = None, + expansions: List = None, + tweet_fields: List = None, + ) -> GetLikingUsersResponse: """ - Get 28-hour Post insights - Retrieves engagement metrics for specified Posts over the last 28 hours. + Get Liking Users + Retrieves a list of Users who liked a specific Post by its ID. Args: - tweet_ids: List of PostIds for 28hr metrics. - granularity: granularity of metrics response. - requested_metrics: request metrics for historical request. - engagementfields: A comma separated list of Engagement fields to display. + id: A single Post ID. + max_results: The maximum number of results. + pagination_token: This parameter is used to get the next 'page' of results. + user_fields: A comma separated list of User fields to display. + expansions: A comma separated list of fields to expand. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetInsights28hrResponse: Response data + GetLikingUsersResponse: Response data """ - url = self.client.base_url + "/2/insights/28hr" + url = self.client.base_url + "/2/tweets/{id}/liking_users" + url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if tweet_ids is not None: - params["tweet_ids"] = ",".join(str(item) for item in tweet_ids) - if granularity is not None: - params["granularity"] = granularity - if requested_metrics is not None: - params["requested_metrics"] = ",".join( - str(item) for item in requested_metrics - ) - if engagementfields is not None: - params["engagement.fields"] = ",".join( - str(item) for item in engagementfields - ) + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None @@ -374,7 +568,7 @@ def get_insights28hr( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetInsights28hrResponse.model_validate(response_data) + return GetLikingUsersResponse.model_validate(response_data) def get_counts_recent( @@ -387,7 +581,7 @@ def get_counts_recent( next_token: Any = None, pagination_token: Any = None, granularity: str = None, - search_countfields: List = None, + search_count_fields: List = None, ) -> GetCountsRecentResponse: """ Get count of recent Posts @@ -401,7 +595,7 @@ def get_counts_recent( next_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. pagination_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. granularity: The granularity for the search counts results. - search_countfields: A comma separated list of SearchCount fields to display. + search_count_fields: A comma separated list of SearchCount fields to display. Returns: GetCountsRecentResponse: Response data """ @@ -431,9 +625,9 @@ def get_counts_recent( params["pagination_token"] = pagination_token if granularity is not None: params["granularity"] = granularity - if search_countfields is not None: + if search_count_fields is not None: params["search_count.fields"] = ",".join( - str(item) for item in search_countfields + str(item) for item in search_count_fields ) headers = {} # Prepare request data @@ -452,47 +646,35 @@ def get_counts_recent( return GetCountsRecentResponse.model_validate(response_data) - def search_all( + def get_counts_all( self, query: str, start_time: str = None, end_time: str = None, since_id: Any = None, until_id: Any = None, - max_results: int = None, next_token: Any = None, pagination_token: Any = None, - sort_order: str = None, - tweetfields: List = None, - expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> SearchAllResponse: + granularity: str = None, + search_count_fields: List = None, + ) -> GetCountsAllResponse: """ - Search all Posts - Retrieves Posts from the full archive matching a search query. + Get count of all Posts + Retrieves the count of Posts matching a search query from the full archive. Args: query: One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - start_time: YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + start_time: YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). end_time: YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). since_id: Returns results with a Post ID greater than (that is, more recent than) the specified ID. until_id: Returns results with a Post ID less than (that is, older than) the specified ID. - max_results: The maximum number of search results to be returned by a request. next_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. pagination_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - sort_order: This order in which to return results. - tweetfields: A comma separated list of Tweet fields to display. - expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + granularity: The granularity for the search counts results. + search_count_fields: A comma separated list of SearchCount fields to display. Returns: - SearchAllResponse: Response data + GetCountsAllResponse: Response data """ - url = self.client.base_url + "/2/tweets/search/all" + url = self.client.base_url + "/2/tweets/counts/all" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -512,26 +694,16 @@ def search_all( params["since_id"] = since_id if until_id is not None: params["until_id"] = until_id - if max_results is not None: - params["max_results"] = max_results if next_token is not None: params["next_token"] = next_token if pagination_token is not None: params["pagination_token"] = pagination_token - if sort_order is not None: - params["sort_order"] = sort_order - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if granularity is not None: + params["granularity"] = granularity + if search_count_fields is not None: + params["search_count.fields"] = ",".join( + str(item) for item in search_count_fields + ) headers = {} # Prepare request data json_data = None @@ -546,33 +718,50 @@ def search_all( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return SearchAllResponse.model_validate(response_data) + return GetCountsAllResponse.model_validate(response_data) - def get_reposted_by( + def search_all( self, - id: Any, + query: str, + start_time: str = None, + end_time: str = None, + since_id: Any = None, + until_id: Any = None, max_results: int = None, + next_token: Any = None, pagination_token: Any = None, - userfields: List = None, + sort_order: str = None, + tweet_fields: List = None, expansions: List = None, - tweetfields: List = None, - ) -> GetRepostedByResponse: + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> SearchAllResponse: """ - Get Reposted by - Retrieves a list of Users who reposted a specific Post by its ID. + Search all Posts + Retrieves Posts from the full archive matching a search query. Args: - id: A single Post ID. - max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. - userfields: A comma separated list of User fields to display. + query: One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. + start_time: YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + end_time: YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). + since_id: Returns results with a Post ID greater than (that is, more recent than) the specified ID. + until_id: Returns results with a Post ID less than (that is, older than) the specified ID. + max_results: The maximum number of search results to be returned by a request. + next_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + pagination_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + sort_order: This order in which to return results. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - GetRepostedByResponse: Response data + SearchAllResponse: Response data """ - url = self.client.base_url + "/2/tweets/{id}/retweeted_by" - url = url.replace("{id}", str(id)) + url = self.client.base_url + "/2/tweets/search/all" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -581,22 +770,37 @@ def get_reposted_by( self.client.session.headers["Authorization"] = ( f"Bearer {self.client.access_token}" ) - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() params = {} + if query is not None: + params["query"] = query + if start_time is not None: + params["start_time"] = start_time + if end_time is not None: + params["end_time"] = end_time + if since_id is not None: + params["since_id"] = since_id + if until_id is not None: + params["until_id"] = until_id if max_results is not None: params["max_results"] = max_results + if next_token is not None: + params["next_token"] = next_token if pagination_token is not None: params["pagination_token"] = pagination_token - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if sort_order is not None: + params["sort_order"] = sort_order + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -611,7 +815,7 @@ def get_reposted_by( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetRepostedByResponse.model_validate(response_data) + return SearchAllResponse.model_validate(response_data) def search_recent( @@ -625,12 +829,12 @@ def search_recent( next_token: Any = None, pagination_token: Any = None, sort_order: str = None, - tweetfields: List = None, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, ) -> SearchRecentResponse: """ Search recent Posts @@ -645,12 +849,12 @@ def search_recent( next_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. pagination_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. sort_order: This order in which to return results. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: SearchRecentResponse: Response data """ @@ -687,18 +891,18 @@ def search_recent( params["pagination_token"] = pagination_token if sort_order is not None: params["sort_order"] = sort_order - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -723,7 +927,7 @@ def get_insights_historical( start_time: str, granularity: str, requested_metrics: List, - engagementfields: List = None, + engagement_fields: List = None, ) -> GetInsightsHistoricalResponse: """ Get historical Post insights @@ -734,7 +938,7 @@ def get_insights_historical( start_time: YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. granularity: granularity of metrics response. requested_metrics: request metrics for historical request. - engagementfields: A comma separated list of Engagement fields to display. + engagement_fields: A comma separated list of Engagement fields to display. Returns: GetInsightsHistoricalResponse: Response data """ @@ -757,9 +961,9 @@ def get_insights_historical( params["requested_metrics"] = ",".join( str(item) for item in requested_metrics ) - if engagementfields is not None: + if engagement_fields is not None: params["engagement.fields"] = ",".join( - str(item) for item in engagementfields + str(item) for item in engagement_fields ) headers = {} # Prepare request data @@ -785,31 +989,32 @@ def get_insights_historical( return GetInsightsHistoricalResponse.model_validate(response_data) - def get_by_ids( + def get_by_id( self, - ids: List, - tweetfields: List = None, + id: Any, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetByIdsResponse: + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetByIdResponse: """ - Get Posts by IDs - Retrieves details of multiple Posts by their IDs. + Get Post by ID + Retrieves details of a specific Post by its ID. Args: - ids: A comma separated list of Post IDs. Up to 100 are allowed in a single request. - tweetfields: A comma separated list of Tweet fields to display. + id: A single Post ID. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - GetByIdsResponse: Response data + GetByIdResponse: Response data """ - url = self.client.base_url + "/2/tweets" + url = self.client.base_url + "/2/tweets/{id}" + url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -824,20 +1029,18 @@ def get_by_ids( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if ids is not None: - params["ids"] = ",".join(str(item) for item in ids) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -852,80 +1055,19 @@ def get_by_ids( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetByIdsResponse.model_validate(response_data) - - - def create(self, body: CreateRequest) -> Dict[str, Any]: - """ - Create or Edit Post - Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided. - body: Request body - Returns: - CreateResponse: Response data - """ - url = self.client.base_url + "/2/tweets" - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} - headers = {} - headers["Content-Type"] = "application/json" - # Prepare request data - json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) - # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - else: - response = self.client.session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return CreateResponse.model_validate(response_data) + return GetByIdResponse.model_validate(response_data) - def get_liking_users( - self, - id: Any, - max_results: int = None, - pagination_token: Any = None, - userfields: List = None, - expansions: List = None, - tweetfields: List = None, - ) -> GetLikingUsersResponse: + def delete(self, id: Any) -> DeleteResponse: """ - Get Liking Users - Retrieves a list of Users who liked a specific Post by its ID. + Delete Post + Deletes a specific Post by its ID, if owned by the authenticated user. Args: - id: A single Post ID. - max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. - userfields: A comma separated list of User fields to display. - expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + id: The ID of the Post to be deleted. Returns: - GetLikingUsersResponse: Response data + DeleteResponse: Response data """ - url = self.client.base_url + "/2/tweets/{id}/liking_users" + url = self.client.base_url + "/2/tweets/{id}" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -933,28 +1075,18 @@ def get_liking_users( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) headers = {} # Prepare request data json_data = None # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.get( + response = self.client.oauth2_session.delete( url, params=params, headers=headers, ) else: - response = self.client.session.get( + response = self.client.session.delete( url, params=params, headers=headers, @@ -964,195 +1096,65 @@ def get_liking_users( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetLikingUsersResponse.model_validate(response_data) + return DeleteResponse.model_validate(response_data) - def get_analytics( + def get_insights28hr( self, - ids: List, - end_time: str, - start_time: str, + tweet_ids: List, granularity: str, - analyticsfields: List = None, - ) -> GetAnalyticsResponse: + requested_metrics: List, + engagement_fields: List = None, + ) -> GetInsights28hrResponse: """ - Get Post analytics - Retrieves analytics data for specified Posts within a defined time range. + Get 28-hour Post insights + Retrieves engagement metrics for specified Posts over the last 28 hours. Args: - ids: A comma separated list of Post IDs. Up to 100 are allowed in a single request. - end_time: YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - start_time: YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - granularity: The granularity for the search counts results. - analyticsfields: A comma separated list of Analytics fields to display. + tweet_ids: List of PostIds for 28hr metrics. + granularity: granularity of metrics response. + requested_metrics: request metrics for historical request. + engagement_fields: A comma separated list of Engagement fields to display. Returns: - GetAnalyticsResponse: Response data + GetInsights28hrResponse: Response data """ - url = self.client.base_url + "/2/tweets/analytics" + url = self.client.base_url + "/2/insights/28hr" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if ids is not None: - params["ids"] = ",".join(str(item) for item in ids) - if end_time is not None: - params["end_time"] = end_time - if start_time is not None: - params["start_time"] = start_time + if tweet_ids is not None: + params["tweet_ids"] = ",".join(str(item) for item in tweet_ids) if granularity is not None: params["granularity"] = granularity - if analyticsfields is not None: - params["analytics.fields"] = ",".join(str(item) for item in analyticsfields) - headers = {} - # Prepare request data - json_data = None - # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, + if requested_metrics is not None: + params["requested_metrics"] = ",".join( + str(item) for item in requested_metrics ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, + if engagement_fields is not None: + params["engagement.fields"] = ",".join( + str(item) for item in engagement_fields ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return GetAnalyticsResponse.model_validate(response_data) - - - def hide_reply( - self, tweet_id: Any, body: Optional[HideReplyRequest] = None - ) -> HideReplyResponse: - """ - Hide reply - Hides or unhides a reply to a conversation owned by the authenticated user. - Args: - tweet_id: The ID of the reply that you want to hide or unhide. - body: Request body - Returns: - HideReplyResponse: Response data - """ - url = self.client.base_url + "/2/tweets/{tweet_id}/hidden" - url = url.replace("{tweet_id}", str(tweet_id)) - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.put( + response = self.client.oauth2_session.get( url, params=params, headers=headers, - json=json_data, ) else: - response = self.client.session.put( + response = self.client.session.get( url, params=params, headers=headers, - json=json_data, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return HideReplyResponse.model_validate(response_data) - - - def get_reposts( - self, - id: Any, - max_results: int = None, - pagination_token: Any = None, - tweetfields: List = None, - expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetRepostsResponse: - """ - Get Reposts - Retrieves a list of Posts that repost a specific Post by its ID. - Args: - id: A single Post ID. - max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. - tweetfields: A comma separated list of Tweet fields to display. - expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. - Returns: - GetRepostsResponse: Response data - """ - url = self.client.base_url + "/2/tweets/{id}/retweets" - url = url.replace("{id}", str(id)) - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" ) - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) - headers = {} - # Prepare request data - json_data = None - # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetRepostsResponse.model_validate(response_data) + return GetInsights28hrResponse.model_validate(response_data) diff --git a/xdk/python/xdk/posts/models.py b/xdk/python/xdk/posts/models.py index 9ae38dfe..fb341edb 100644 --- a/xdk/python/xdk/posts/models.py +++ b/xdk/python/xdk/posts/models.py @@ -25,148 +25,148 @@ class GetQuotedResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_counts_all +# Models for get_analytics -class GetCountsAllResponse(BaseModel): - """Response model for get_counts_all""" +class GetAnalyticsResponse(BaseModel): + """Response model for get_analytics""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_by_id - +# Models for hide_reply -class GetByIdResponse(BaseModel): - """Response model for get_by_id""" - - model_config = ConfigDict(populate_by_name=True, extra="allow") +class HideReplyRequest(BaseModel): + """Request model for hide_reply""" -# Models for delete + model_config = ConfigDict(populate_by_name=True) -class DeleteResponse(BaseModel): - """Response model for delete""" +class HideReplyResponse(BaseModel): + """Response model for hide_reply""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_insights28hr +# Models for get_reposted_by -class GetInsights28hrResponse(BaseModel): - """Response model for get_insights28hr""" +class GetRepostedByResponse(BaseModel): + """Response model for get_reposted_by""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_counts_recent +# Models for get_reposts -class GetCountsRecentResponse(BaseModel): - """Response model for get_counts_recent""" +class GetRepostsResponse(BaseModel): + """Response model for get_reposts""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for search_all +# Models for get_by_ids -class SearchAllResponse(BaseModel): - """Response model for search_all""" +class GetByIdsResponse(BaseModel): + """Response model for get_by_ids""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_reposted_by - - -class GetRepostedByResponse(BaseModel): - """Response model for get_reposted_by""" +# Models for create - model_config = ConfigDict(populate_by_name=True, extra="allow") +class CreateRequest(BaseModel): + """Request model for create""" -# Models for search_recent + model_config = ConfigDict(populate_by_name=True) -class SearchRecentResponse(BaseModel): - """Response model for search_recent""" +class CreateResponse(BaseModel): + """Response model for create""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_insights_historical +# Models for get_liking_users -class GetInsightsHistoricalResponse(BaseModel): - """Response model for get_insights_historical""" +class GetLikingUsersResponse(BaseModel): + """Response model for get_liking_users""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_by_ids +# Models for get_counts_recent -class GetByIdsResponse(BaseModel): - """Response model for get_by_ids""" +class GetCountsRecentResponse(BaseModel): + """Response model for get_counts_recent""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for create +# Models for get_counts_all -class CreateRequest(BaseModel): - """Request model for create""" +class GetCountsAllResponse(BaseModel): + """Response model for get_counts_all""" - model_config = ConfigDict(populate_by_name=True) + model_config = ConfigDict(populate_by_name=True, extra="allow") -class CreateResponse(BaseModel): - """Response model for create""" +# Models for search_all + + +class SearchAllResponse(BaseModel): + """Response model for search_all""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_liking_users +# Models for search_recent -class GetLikingUsersResponse(BaseModel): - """Response model for get_liking_users""" +class SearchRecentResponse(BaseModel): + """Response model for search_recent""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_analytics +# Models for get_insights_historical -class GetAnalyticsResponse(BaseModel): - """Response model for get_analytics""" +class GetInsightsHistoricalResponse(BaseModel): + """Response model for get_insights_historical""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for hide_reply +# Models for get_by_id -class HideReplyRequest(BaseModel): - """Request model for hide_reply""" +class GetByIdResponse(BaseModel): + """Response model for get_by_id""" - model_config = ConfigDict(populate_by_name=True) + model_config = ConfigDict(populate_by_name=True, extra="allow") -class HideReplyResponse(BaseModel): - """Response model for hide_reply""" +# Models for delete + + +class DeleteResponse(BaseModel): + """Response model for delete""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_reposts +# Models for get_insights28hr -class GetRepostsResponse(BaseModel): - """Response model for get_reposts""" +class GetInsights28hrResponse(BaseModel): + """Response model for get_insights28hr""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/spaces/client.py b/xdk/python/xdk/spaces/client.py index 1e4ec10d..b1f8926d 100644 --- a/xdk/python/xdk/spaces/client.py +++ b/xdk/python/xdk/spaces/client.py @@ -21,12 +21,12 @@ if TYPE_CHECKING: from ..client import Client from .models import ( - GetByCreatorIdsResponse, - GetByIdResponse, - GetByIdsResponse, GetPostsResponse, - GetBuyersResponse, SearchResponse, + GetBuyersResponse, + GetByIdResponse, + GetByIdsResponse, + GetByCreatorIdsResponse, ) @@ -38,27 +38,34 @@ def __init__(self, client: Client): self.client = client - def get_by_creator_ids( + def get_posts( self, - user_ids: List, - spacefields: List = None, + id: str, + max_results: int = None, + tweet_fields: List = None, expansions: List = None, - userfields: List = None, - topicfields: List = None, - ) -> GetByCreatorIdsResponse: + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetPostsResponse: """ - Get Spaces by creator IDs - Retrieves details of Spaces created by specified User IDs. + Get Space Posts + Retrieves a list of Posts shared in a specific Space by its ID. Args: - user_ids: The IDs of Users to search through. - spacefields: A comma separated list of Space fields to display. + id: The ID of the Space to be retrieved. + max_results: The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. - topicfields: A comma separated list of Topic fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - GetByCreatorIdsResponse: Response data + GetPostsResponse: Response data """ - url = self.client.base_url + "/2/spaces/by/creator_ids" + url = self.client.base_url + "/2/spaces/{id}/tweets" + url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -73,16 +80,20 @@ def get_by_creator_ids( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if user_ids is not None: - params["user_ids"] = ",".join(str(item) for item in user_ids) - if spacefields is not None: - params["space.fields"] = ",".join(str(item) for item in spacefields) + if max_results is not None: + params["max_results"] = max_results + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if topicfields is not None: - params["topic.fields"] = ",".join(str(item) for item in topicfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -97,31 +108,34 @@ def get_by_creator_ids( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetByCreatorIdsResponse.model_validate(response_data) + return GetPostsResponse.model_validate(response_data) - def get_by_id( + def search( self, - id: str, - spacefields: List = None, + query: str, + state: str = None, + max_results: int = None, + space_fields: List = None, expansions: List = None, - userfields: List = None, - topicfields: List = None, - ) -> GetByIdResponse: + user_fields: List = None, + topic_fields: List = None, + ) -> SearchResponse: """ - Get space by ID - Retrieves details of a specific space by its ID. + Search Spaces + Retrieves a list of Spaces matching the specified search query. Args: - id: The ID of the Space to be retrieved. - spacefields: A comma separated list of Space fields to display. + query: The search query. + state: The state of Spaces to search for. + max_results: The number of results to return. + space_fields: A comma separated list of Space fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. - topicfields: A comma separated list of Topic fields to display. + user_fields: A comma separated list of User fields to display. + topic_fields: A comma separated list of Topic fields to display. Returns: - GetByIdResponse: Response data + SearchResponse: Response data """ - url = self.client.base_url + "/2/spaces/{id}" - url = url.replace("{id}", str(id)) + url = self.client.base_url + "/2/spaces/search" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -136,14 +150,20 @@ def get_by_id( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if spacefields is not None: - params["space.fields"] = ",".join(str(item) for item in spacefields) + if query is not None: + params["query"] = query + if state is not None: + params["state"] = state + if max_results is not None: + params["max_results"] = max_results + if space_fields is not None: + params["space.fields"] = ",".join(str(item) for item in space_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if topicfields is not None: - params["topic.fields"] = ",".join(str(item) for item in topicfields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if topic_fields is not None: + params["topic.fields"] = ",".join(str(item) for item in topic_fields) headers = {} # Prepare request data json_data = None @@ -158,98 +178,94 @@ def get_by_id( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetByIdResponse.model_validate(response_data) + return SearchResponse.model_validate(response_data) - def get_by_ids( + def get_buyers( self, - ids: List, - spacefields: List = None, + id: str, + pagination_token: Any = None, + max_results: int = None, + user_fields: List = None, expansions: List = None, - userfields: List = None, - topicfields: List = None, - ) -> GetByIdsResponse: + tweet_fields: List = None, + ) -> GetBuyersResponse: """ - Get Spaces by IDs - Retrieves details of multiple Spaces by their IDs. + Get Space ticket buyers + Retrieves a list of Users who purchased tickets to a specific Space by its ID. Args: - ids: The list of Space IDs to return. - spacefields: A comma separated list of Space fields to display. + id: The ID of the Space to be retrieved. + pagination_token: This parameter is used to get a specified 'page' of results. + max_results: The maximum number of results. + user_fields: A comma separated list of User fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. - topicfields: A comma separated list of Topic fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetByIdsResponse: Response data + GetBuyersResponse: Response data """ - url = self.client.base_url + "/2/spaces" - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) + url = self.client.base_url + "/2/spaces/{id}/buyers" + url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if ids is not None: - params["ids"] = ",".join(str(item) for item in ids) - if spacefields is not None: - params["space.fields"] = ",".join(str(item) for item in spacefields) + if pagination_token is not None: + params["pagination_token"] = pagination_token + if max_results is not None: + params["max_results"] = max_results + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if topicfields is not None: - params["topic.fields"] = ",".join(str(item) for item in topicfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + if self.client.oauth2_session: + response = self.client.oauth2_session.get( + url, + params=params, + headers=headers, + ) + else: + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetByIdsResponse.model_validate(response_data) + return GetBuyersResponse.model_validate(response_data) - def get_posts( + def get_by_id( self, id: str, - max_results: int = None, - tweetfields: List = None, + space_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetPostsResponse: + user_fields: List = None, + topic_fields: List = None, + ) -> GetByIdResponse: """ - Get Space Posts - Retrieves a list of Posts shared in a specific Space by its ID. + Get space by ID + Retrieves details of a specific space by its ID. Args: id: The ID of the Space to be retrieved. - max_results: The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. - tweetfields: A comma separated list of Tweet fields to display. + space_fields: A comma separated list of Space fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + user_fields: A comma separated list of User fields to display. + topic_fields: A comma separated list of Topic fields to display. Returns: - GetPostsResponse: Response data + GetByIdResponse: Response data """ - url = self.client.base_url + "/2/spaces/{id}/tweets" + url = self.client.base_url + "/2/spaces/{id}" url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -265,20 +281,14 @@ def get_posts( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if space_fields is not None: + params["space.fields"] = ",".join(str(item) for item in space_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if topic_fields is not None: + params["topic.fields"] = ",".join(str(item) for item in topic_fields) headers = {} # Prepare request data json_data = None @@ -293,98 +303,92 @@ def get_posts( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetPostsResponse.model_validate(response_data) + return GetByIdResponse.model_validate(response_data) - def get_buyers( + def get_by_ids( self, - id: str, - pagination_token: Any = None, - max_results: int = None, - userfields: List = None, + ids: List, + space_fields: List = None, expansions: List = None, - tweetfields: List = None, - ) -> GetBuyersResponse: + user_fields: List = None, + topic_fields: List = None, + ) -> GetByIdsResponse: """ - Get Space ticket buyers - Retrieves a list of Users who purchased tickets to a specific Space by its ID. + Get Spaces by IDs + Retrieves details of multiple Spaces by their IDs. Args: - id: The ID of the Space to be retrieved. - pagination_token: This parameter is used to get a specified 'page' of results. - max_results: The maximum number of results. - userfields: A comma separated list of User fields to display. + ids: The list of Space IDs to return. + space_fields: A comma separated list of Space fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + user_fields: A comma separated list of User fields to display. + topic_fields: A comma separated list of Topic fields to display. Returns: - GetBuyersResponse: Response data + GetByIdsResponse: Response data """ - url = self.client.base_url + "/2/spaces/{id}/buyers" - url = url.replace("{id}", str(id)) + url = self.client.base_url + "/2/spaces" + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if pagination_token is not None: - params["pagination_token"] = pagination_token - if max_results is not None: - params["max_results"] = max_results - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if ids is not None: + params["ids"] = ",".join(str(item) for item in ids) + if space_fields is not None: + params["space.fields"] = ",".join(str(item) for item in space_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if topic_fields is not None: + params["topic.fields"] = ",".join(str(item) for item in topic_fields) headers = {} # Prepare request data json_data = None # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetBuyersResponse.model_validate(response_data) + return GetByIdsResponse.model_validate(response_data) - def search( + def get_by_creator_ids( self, - query: str, - state: str = None, - max_results: int = None, - spacefields: List = None, + user_ids: List, + space_fields: List = None, expansions: List = None, - userfields: List = None, - topicfields: List = None, - ) -> SearchResponse: + user_fields: List = None, + topic_fields: List = None, + ) -> GetByCreatorIdsResponse: """ - Search Spaces - Retrieves a list of Spaces matching the specified search query. + Get Spaces by creator IDs + Retrieves details of Spaces created by specified User IDs. Args: - query: The search query. - state: The state of Spaces to search for. - max_results: The number of results to return. - spacefields: A comma separated list of Space fields to display. + user_ids: The IDs of Users to search through. + space_fields: A comma separated list of Space fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. - topicfields: A comma separated list of Topic fields to display. + user_fields: A comma separated list of User fields to display. + topic_fields: A comma separated list of Topic fields to display. Returns: - SearchResponse: Response data + GetByCreatorIdsResponse: Response data """ - url = self.client.base_url + "/2/spaces/search" + url = self.client.base_url + "/2/spaces/by/creator_ids" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -399,20 +403,16 @@ def search( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if query is not None: - params["query"] = query - if state is not None: - params["state"] = state - if max_results is not None: - params["max_results"] = max_results - if spacefields is not None: - params["space.fields"] = ",".join(str(item) for item in spacefields) + if user_ids is not None: + params["user_ids"] = ",".join(str(item) for item in user_ids) + if space_fields is not None: + params["space.fields"] = ",".join(str(item) for item in space_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if topicfields is not None: - params["topic.fields"] = ",".join(str(item) for item in topicfields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if topic_fields is not None: + params["topic.fields"] = ",".join(str(item) for item in topic_fields) headers = {} # Prepare request data json_data = None @@ -427,4 +427,4 @@ def search( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return SearchResponse.model_validate(response_data) + return GetByCreatorIdsResponse.model_validate(response_data) diff --git a/xdk/python/xdk/spaces/models.py b/xdk/python/xdk/spaces/models.py index ebbc7904..1a9ca7a9 100644 --- a/xdk/python/xdk/spaces/models.py +++ b/xdk/python/xdk/spaces/models.py @@ -16,55 +16,55 @@ from datetime import datetime -# Models for get_by_creator_ids +# Models for get_posts -class GetByCreatorIdsResponse(BaseModel): - """Response model for get_by_creator_ids""" +class GetPostsResponse(BaseModel): + """Response model for get_posts""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_by_id +# Models for search -class GetByIdResponse(BaseModel): - """Response model for get_by_id""" +class SearchResponse(BaseModel): + """Response model for search""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_by_ids +# Models for get_buyers -class GetByIdsResponse(BaseModel): - """Response model for get_by_ids""" +class GetBuyersResponse(BaseModel): + """Response model for get_buyers""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_posts +# Models for get_by_id -class GetPostsResponse(BaseModel): - """Response model for get_posts""" +class GetByIdResponse(BaseModel): + """Response model for get_by_id""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_buyers +# Models for get_by_ids -class GetBuyersResponse(BaseModel): - """Response model for get_buyers""" +class GetByIdsResponse(BaseModel): + """Response model for get_by_ids""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for search +# Models for get_by_creator_ids -class SearchResponse(BaseModel): - """Response model for search""" +class GetByCreatorIdsResponse(BaseModel): + """Response model for get_by_creator_ids""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/stream/client.py b/xdk/python/xdk/stream/client.py index f3f2f9e2..ac38eea8 100644 --- a/xdk/python/xdk/stream/client.py +++ b/xdk/python/xdk/stream/client.py @@ -31,24 +31,24 @@ if TYPE_CHECKING: from ..client import Client from .models import ( - PostsSampleResponse, - GetRuleCountsResponse, - PostsFirehoseResponse, + LikesFirehoseResponse, PostsFirehosePtResponse, - UsersComplianceResponse, - PostsSample10Response, - LikesComplianceResponse, + PostsFirehoseJaResponse, LabelsComplianceResponse, - PostsFirehoseEnResponse, - PostsResponse, PostsFirehoseKoResponse, - LikesSample10Response, - PostsComplianceResponse, + PostsResponse, + LikesComplianceResponse, GetRulesResponse, UpdateRulesRequest, UpdateRulesResponse, - PostsFirehoseJaResponse, - LikesFirehoseResponse, + GetRuleCountsResponse, + LikesSample10Response, + PostsFirehoseResponse, + UsersComplianceResponse, + PostsComplianceResponse, + PostsSample10Response, + PostsFirehoseEnResponse, + PostsSampleResponse, ) @@ -60,40 +60,42 @@ def __init__(self, client: Client): self.client = client - def posts_sample( + def likes_firehose( self, + partition: int, backfill_minutes: int = None, - tweetfields: List = None, + start_time: str = None, + end_time: str = None, + like_with_tweet_author_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, + user_fields: List = None, + tweet_fields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[PostsSampleResponse, None, None]: + ) -> Generator[LikesFirehoseResponse, None, None]: """ - Stream sampled Posts (Streaming) - Streams a 1% sample of public Posts in real-time. + Stream all Likes (Streaming) + Streams all public Likes in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: backfill_minutes: The number of minutes of backfill requested. - tweetfields: A comma separated list of Tweet fields to display. + partition: The partition number. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + like_with_tweet_author_fields: A comma separated list of LikeWithTweetAuthor fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + user_fields: A comma separated list of User fields to display. + tweet_fields: A comma separated list of Tweet fields to display. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - PostsSampleResponse: Individual streaming data items + LikesFirehoseResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/tweets/sample/stream" + url = self.client.base_url + "/2/likes/firehose/stream" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -105,18 +107,22 @@ def posts_sample( params = {} if backfill_minutes is not None: params["backfill_minutes"] = backfill_minutes - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if partition is not None: + params["partition"] = partition + if start_time is not None: + params["start_time"] = start_time + if end_time is not None: + params["end_time"] = end_time + if like_with_tweet_author_fields is not None: + params["like_with_tweet_author.fields"] = ",".join( + str(item) for item in like_with_tweet_author_fields + ) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = { "Accept": "application/json", } @@ -153,7 +159,7 @@ def posts_sample( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield PostsSampleResponse.model_validate(data) + yield LikesFirehoseResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -164,7 +170,7 @@ def posts_sample( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield PostsSampleResponse.model_validate(data) + yield LikesFirehoseResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -174,64 +180,24 @@ def posts_sample( raise - def get_rule_counts(self, rules_countfields: List = None) -> GetRuleCountsResponse: - """ - Get stream rule counts - Retrieves the count of rules in the active rule set for the filtered stream. - Args: - rules_countfields: A comma separated list of RulesCount fields to display. - Returns: - GetRuleCountsResponse: Response data - """ - url = self.client.base_url + "/2/tweets/search/stream/rules/counts" - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) - params = {} - if rules_countfields is not None: - params["rules_count.fields"] = ",".join( - str(item) for item in rules_countfields - ) - headers = {} - # Prepare request data - json_data = None - # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return GetRuleCountsResponse.model_validate(response_data) - - - def posts_firehose( + def posts_firehose_pt( self, partition: int, backfill_minutes: int = None, start_time: str = None, end_time: str = None, - tweetfields: List = None, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[PostsFirehoseResponse, None, None]: + ) -> Generator[PostsFirehosePtResponse, None, None]: """ - Stream all Posts (Streaming) - Streams all public Posts in real-time. + Stream Portuguese Posts (Streaming) + Streams all public Portuguese-language Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: @@ -239,21 +205,21 @@ def posts_firehose( partition: The partition number. start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - PostsFirehoseResponse: Individual streaming data items + PostsFirehosePtResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/tweets/firehose/stream" + url = self.client.base_url + "/2/tweets/firehose/stream/lang/pt" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -271,18 +237,18 @@ def posts_firehose( params["start_time"] = start_time if end_time is not None: params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = { "Accept": "application/json", } @@ -319,7 +285,7 @@ def posts_firehose( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield PostsFirehoseResponse.model_validate(data) + yield PostsFirehosePtResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -330,7 +296,7 @@ def posts_firehose( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield PostsFirehoseResponse.model_validate(data) + yield PostsFirehosePtResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -340,24 +306,24 @@ def posts_firehose( raise - def posts_firehose_pt( + def posts_firehose_ja( self, partition: int, backfill_minutes: int = None, start_time: str = None, end_time: str = None, - tweetfields: List = None, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[PostsFirehosePtResponse, None, None]: + ) -> Generator[PostsFirehoseJaResponse, None, None]: """ - Stream Portuguese Posts (Streaming) - Streams all public Portuguese-language Posts in real-time. + Stream Japanese Posts (Streaming) + Streams all public Japanese-language Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: @@ -365,21 +331,21 @@ def posts_firehose_pt( partition: The partition number. start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - PostsFirehosePtResponse: Individual streaming data items + PostsFirehoseJaResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/tweets/firehose/stream/lang/pt" + url = self.client.base_url + "/2/tweets/firehose/stream/lang/ja" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -397,18 +363,18 @@ def posts_firehose_pt( params["start_time"] = start_time if end_time is not None: params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = { "Accept": "application/json", } @@ -445,7 +411,7 @@ def posts_firehose_pt( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield PostsFirehosePtResponse.model_validate(data) + yield PostsFirehoseJaResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -456,7 +422,7 @@ def posts_firehose_pt( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield PostsFirehosePtResponse.model_validate(data) + yield PostsFirehoseJaResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -466,34 +432,32 @@ def posts_firehose_pt( raise - def users_compliance( + def labels_compliance( self, - partition: int, backfill_minutes: int = None, start_time: str = None, end_time: str = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[UsersComplianceResponse, None, None]: + ) -> Generator[LabelsComplianceResponse, None, None]: """ - Stream Users compliance data (Streaming) - Streams all compliance data related to Users. + Stream Post labels (Streaming) + Streams all labeling events applied to Posts. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: backfill_minutes: The number of minutes of backfill requested. - partition: The partition number. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - UsersComplianceResponse: Individual streaming data items + LabelsComplianceResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/users/compliance/stream" + url = self.client.base_url + "/2/tweets/label/stream" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -505,8 +469,6 @@ def users_compliance( params = {} if backfill_minutes is not None: params["backfill_minutes"] = backfill_minutes - if partition is not None: - params["partition"] = partition if start_time is not None: params["start_time"] = start_time if end_time is not None: @@ -547,7 +509,7 @@ def users_compliance( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield UsersComplianceResponse.model_validate(data) + yield LabelsComplianceResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -558,7 +520,7 @@ def users_compliance( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield UsersComplianceResponse.model_validate(data) + yield LabelsComplianceResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -568,24 +530,24 @@ def users_compliance( raise - def posts_sample10( + def posts_firehose_ko( self, partition: int, backfill_minutes: int = None, start_time: str = None, end_time: str = None, - tweetfields: List = None, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[PostsSample10Response, None, None]: + ) -> Generator[PostsFirehoseKoResponse, None, None]: """ - Stream 10% sampled Posts (Streaming) - Streams a 10% sample of public Posts in real-time. + Stream Korean Posts (Streaming) + Streams all public Korean-language Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: @@ -593,21 +555,21 @@ def posts_sample10( partition: The partition number. start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - PostsSample10Response: Individual streaming data items + PostsFirehoseKoResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/tweets/sample10/stream" + url = self.client.base_url + "/2/tweets/firehose/stream/lang/ko" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -625,18 +587,18 @@ def posts_sample10( params["start_time"] = start_time if end_time is not None: params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = { "Accept": "application/json", } @@ -673,7 +635,7 @@ def posts_sample10( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield PostsSample10Response.model_validate(data) + yield PostsFirehoseKoResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -684,7 +646,7 @@ def posts_sample10( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield PostsSample10Response.model_validate(data) + yield PostsFirehoseKoResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -694,32 +656,44 @@ def posts_sample10( raise - def likes_compliance( + def posts( self, backfill_minutes: int = None, start_time: str = None, end_time: str = None, + tweet_fields: List = None, + expansions: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[LikesComplianceResponse, None, None]: + ) -> Generator[PostsResponse, None, None]: """ - Stream Likes compliance data (Streaming) - Streams all compliance data related to Likes for Users. + Stream filtered Posts (Streaming) + Streams Posts in real-time matching the active rule set. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: backfill_minutes: The number of minutes of backfill requested. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + tweet_fields: A comma separated list of Tweet fields to display. + expansions: A comma separated list of fields to expand. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - LikesComplianceResponse: Individual streaming data items + PostsResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/likes/compliance/stream" + url = self.client.base_url + "/2/tweets/search/stream" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -735,6 +709,18 @@ def likes_compliance( params["start_time"] = start_time if end_time is not None: params["end_time"] = end_time + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = { "Accept": "application/json", } @@ -771,7 +757,7 @@ def likes_compliance( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield LikesComplianceResponse.model_validate(data) + yield PostsResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -782,7 +768,7 @@ def likes_compliance( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield LikesComplianceResponse.model_validate(data) + yield PostsResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -792,32 +778,32 @@ def likes_compliance( raise - def labels_compliance( + def likes_compliance( self, backfill_minutes: int = None, start_time: str = None, end_time: str = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[LabelsComplianceResponse, None, None]: + ) -> Generator[LikesComplianceResponse, None, None]: """ - Stream Post labels (Streaming) - Streams all labeling events applied to Posts. + Stream Likes compliance data (Streaming) + Streams all compliance data related to Likes for Users. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: backfill_minutes: The number of minutes of backfill requested. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - LabelsComplianceResponse: Individual streaming data items + LikesComplianceResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/tweets/label/stream" + url = self.client.base_url + "/2/likes/compliance/stream" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -869,7 +855,7 @@ def labels_compliance( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield LabelsComplianceResponse.model_validate(data) + yield LikesComplianceResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -880,7 +866,7 @@ def labels_compliance( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield LabelsComplianceResponse.model_validate(data) + yield LikesComplianceResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -890,46 +876,20 @@ def labels_compliance( raise - def posts_firehose_en( - self, - partition: int, - backfill_minutes: int = None, - start_time: str = None, - end_time: str = None, - tweetfields: List = None, - expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - timeout: Optional[float] = None, - chunk_size: int = 1024, - ) -> Generator[PostsFirehoseEnResponse, None, None]: + def get_rules( + self, ids: List = None, max_results: int = None, pagination_token: str = None + ) -> GetRulesResponse: """ - Stream English Posts (Streaming) - Streams all public English-language Posts in real-time. - This is a streaming endpoint that yields data in real-time as it becomes available. - Each yielded item represents a single data point from the stream. + Get stream rules + Retrieves the active rule set or a subset of rules for the filtered stream. Args: - backfill_minutes: The number of minutes of backfill requested. - partition: The partition number. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. - tweetfields: A comma separated list of Tweet fields to display. - expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. - timeout: Request timeout in seconds (default: None for no timeout) - chunk_size: Size of chunks to read from the stream (default: 1024 bytes) - Yields: - PostsFirehoseEnResponse: Individual streaming data items - Raises: - requests.exceptions.RequestException: If the streaming connection fails - json.JSONDecodeError: If the streamed data is not valid JSON + ids: A comma-separated list of Rule IDs. + max_results: The maximum number of results. + pagination_token: This value is populated by passing the 'next_token' returned in a request to paginate through results. + Returns: + GetRulesResponse: Response data """ - url = self.client.base_url + "/2/tweets/firehose/stream/lang/en" + url = self.client.base_url + "/2/tweets/search/stream/rules" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -939,28 +899,186 @@ def posts_firehose_en( f"Bearer {self.client.access_token}" ) params = {} - if backfill_minutes is not None: - params["backfill_minutes"] = backfill_minutes - if partition is not None: - params["partition"] = partition - if start_time is not None: - params["start_time"] = start_time - if end_time is not None: - params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) - headers = { - "Accept": "application/json", + if ids is not None: + params["ids"] = ",".join(str(item) for item in ids) + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + headers = {} + # Prepare request data + json_data = None + # Make the request + response = self.client.session.get( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return GetRulesResponse.model_validate(response_data) + + + def update_rules( + self, body: UpdateRulesRequest, dry_run: bool = None, delete_all: bool = None + ) -> UpdateRulesResponse: + """ + Update stream rules + Adds or deletes rules from the active rule set for the filtered stream. + Args: + dry_run: Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. + delete_all: Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. + body: Request body + Returns: + UpdateRulesResponse: Response data + """ + url = self.client.base_url + "/2/tweets/search/stream/rules" + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) + params = {} + if dry_run is not None: + params["dry_run"] = dry_run + if delete_all is not None: + params["delete_all"] = delete_all + headers = {} + headers["Content-Type"] = "application/json" + # Prepare request data + json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) + # Make the request + response = self.client.session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return UpdateRulesResponse.model_validate(response_data) + + + def get_rule_counts(self, rules_count_fields: List = None) -> GetRuleCountsResponse: + """ + Get stream rule counts + Retrieves the count of rules in the active rule set for the filtered stream. + Args: + rules_count_fields: A comma separated list of RulesCount fields to display. + Returns: + GetRuleCountsResponse: Response data + """ + url = self.client.base_url + "/2/tweets/search/stream/rules/counts" + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) + params = {} + if rules_count_fields is not None: + params["rules_count.fields"] = ",".join( + str(item) for item in rules_count_fields + ) + headers = {} + # Prepare request data + json_data = None + # Make the request + response = self.client.session.get( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return GetRuleCountsResponse.model_validate(response_data) + + + def likes_sample10( + self, + partition: int, + backfill_minutes: int = None, + start_time: str = None, + end_time: str = None, + like_with_tweet_author_fields: List = None, + expansions: List = None, + user_fields: List = None, + tweet_fields: List = None, + timeout: Optional[float] = None, + chunk_size: int = 1024, + ) -> Generator[LikesSample10Response, None, None]: + """ + Stream sampled Likes (Streaming) + Streams a 10% sample of public Likes in real-time. + This is a streaming endpoint that yields data in real-time as it becomes available. + Each yielded item represents a single data point from the stream. + Args: + backfill_minutes: The number of minutes of backfill requested. + partition: The partition number. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + like_with_tweet_author_fields: A comma separated list of LikeWithTweetAuthor fields to display. + expansions: A comma separated list of fields to expand. + user_fields: A comma separated list of User fields to display. + tweet_fields: A comma separated list of Tweet fields to display. + timeout: Request timeout in seconds (default: None for no timeout) + chunk_size: Size of chunks to read from the stream (default: 1024 bytes) + Yields: + LikesSample10Response: Individual streaming data items + Raises: + requests.exceptions.RequestException: If the streaming connection fails + json.JSONDecodeError: If the streamed data is not valid JSON + """ + url = self.client.base_url + "/2/likes/sample10/stream" + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) + params = {} + if backfill_minutes is not None: + params["backfill_minutes"] = backfill_minutes + if partition is not None: + params["partition"] = partition + if start_time is not None: + params["start_time"] = start_time + if end_time is not None: + params["end_time"] = end_time + if like_with_tweet_author_fields is not None: + params["like_with_tweet_author.fields"] = ",".join( + str(item) for item in like_with_tweet_author_fields + ) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) + headers = { + "Accept": "application/json", } # Prepare request data json_data = None @@ -995,7 +1113,7 @@ def posts_firehose_en( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield PostsFirehoseEnResponse.model_validate(data) + yield LikesSample10Response.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -1006,7 +1124,7 @@ def posts_firehose_en( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield PostsFirehoseEnResponse.model_validate(data) + yield LikesSample10Response.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -1016,44 +1134,46 @@ def posts_firehose_en( raise - def posts( + def posts_firehose( self, + partition: int, backfill_minutes: int = None, start_time: str = None, end_time: str = None, - tweetfields: List = None, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[PostsResponse, None, None]: + ) -> Generator[PostsFirehoseResponse, None, None]: """ - Stream filtered Posts (Streaming) - Streams Posts in real-time matching the active rule set. + Stream all Posts (Streaming) + Streams all public Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: backfill_minutes: The number of minutes of backfill requested. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. + partition: The partition number. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - PostsResponse: Individual streaming data items + PostsFirehoseResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/tweets/search/stream" + url = self.client.base_url + "/2/tweets/firehose/stream" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -1065,22 +1185,24 @@ def posts( params = {} if backfill_minutes is not None: params["backfill_minutes"] = backfill_minutes + if partition is not None: + params["partition"] = partition if start_time is not None: params["start_time"] = start_time if end_time is not None: params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = { "Accept": "application/json", } @@ -1117,7 +1239,7 @@ def posts( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield PostsResponse.model_validate(data) + yield PostsFirehoseResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -1128,7 +1250,7 @@ def posts( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield PostsResponse.model_validate(data) + yield PostsFirehoseResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -1138,46 +1260,34 @@ def posts( raise - def posts_firehose_ko( + def users_compliance( self, partition: int, backfill_minutes: int = None, start_time: str = None, end_time: str = None, - tweetfields: List = None, - expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[PostsFirehoseKoResponse, None, None]: + ) -> Generator[UsersComplianceResponse, None, None]: """ - Stream Korean Posts (Streaming) - Streams all public Korean-language Posts in real-time. + Stream Users compliance data (Streaming) + Streams all compliance data related to Users. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: backfill_minutes: The number of minutes of backfill requested. partition: The partition number. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. - tweetfields: A comma separated list of Tweet fields to display. - expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - PostsFirehoseKoResponse: Individual streaming data items + UsersComplianceResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/tweets/firehose/stream/lang/ko" + url = self.client.base_url + "/2/users/compliance/stream" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -1195,18 +1305,6 @@ def posts_firehose_ko( params["start_time"] = start_time if end_time is not None: params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) headers = { "Accept": "application/json", } @@ -1243,7 +1341,7 @@ def posts_firehose_ko( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield PostsFirehoseKoResponse.model_validate(data) + yield UsersComplianceResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -1254,7 +1352,7 @@ def posts_firehose_ko( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield PostsFirehoseKoResponse.model_validate(data) + yield UsersComplianceResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -1264,42 +1362,34 @@ def posts_firehose_ko( raise - def likes_sample10( + def posts_compliance( self, partition: int, backfill_minutes: int = None, start_time: str = None, end_time: str = None, - like_with_tweet_authorfields: List = None, - expansions: List = None, - userfields: List = None, - tweetfields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[LikesSample10Response, None, None]: + ) -> Generator[PostsComplianceResponse, None, None]: """ - Stream sampled Likes (Streaming) - Streams a 10% sample of public Likes in real-time. + Stream Posts compliance data (Streaming) + Streams all compliance data related to Posts. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: backfill_minutes: The number of minutes of backfill requested. partition: The partition number. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. - like_with_tweet_authorfields: A comma separated list of LikeWithTweetAuthor fields to display. - expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. - tweetfields: A comma separated list of Tweet fields to display. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - LikesSample10Response: Individual streaming data items + PostsComplianceResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/likes/sample10/stream" + url = self.client.base_url + "/2/tweets/compliance/stream" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -1317,16 +1407,6 @@ def likes_sample10( params["start_time"] = start_time if end_time is not None: params["end_time"] = end_time - if like_with_tweet_authorfields is not None: - params["like_with_tweet_author.fields"] = ",".join( - str(item) for item in like_with_tweet_authorfields - ) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) headers = { "Accept": "application/json", } @@ -1363,7 +1443,7 @@ def likes_sample10( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield LikesSample10Response.model_validate(data) + yield PostsComplianceResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -1374,7 +1454,7 @@ def likes_sample10( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield LikesSample10Response.model_validate(data) + yield PostsComplianceResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -1384,34 +1464,46 @@ def likes_sample10( raise - def posts_compliance( + def posts_sample10( self, partition: int, backfill_minutes: int = None, start_time: str = None, end_time: str = None, + tweet_fields: List = None, + expansions: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[PostsComplianceResponse, None, None]: + ) -> Generator[PostsSample10Response, None, None]: """ - Stream Posts compliance data (Streaming) - Streams all compliance data related to Posts. + Stream 10% sampled Posts (Streaming) + Streams a 10% sample of public Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: backfill_minutes: The number of minutes of backfill requested. partition: The partition number. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + tweet_fields: A comma separated list of Tweet fields to display. + expansions: A comma separated list of fields to expand. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - PostsComplianceResponse: Individual streaming data items + PostsSample10Response: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/tweets/compliance/stream" + url = self.client.base_url + "/2/tweets/sample10/stream" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -1429,6 +1521,18 @@ def posts_compliance( params["start_time"] = start_time if end_time is not None: params["end_time"] = end_time + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = { "Accept": "application/json", } @@ -1465,7 +1569,7 @@ def posts_compliance( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield PostsComplianceResponse.model_validate(data) + yield PostsSample10Response.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -1476,7 +1580,7 @@ def posts_compliance( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield PostsComplianceResponse.model_validate(data) + yield PostsSample10Response.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -1486,122 +1590,24 @@ def posts_compliance( raise - def get_rules( - self, ids: List = None, max_results: int = None, pagination_token: str = None - ) -> GetRulesResponse: - """ - Get stream rules - Retrieves the active rule set or a subset of rules for the filtered stream. - Args: - ids: A comma-separated list of Rule IDs. - max_results: The maximum number of results. - pagination_token: This value is populated by passing the 'next_token' returned in a request to paginate through results. - Returns: - GetRulesResponse: Response data - """ - url = self.client.base_url + "/2/tweets/search/stream/rules" - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) - params = {} - if ids is not None: - params["ids"] = ",".join(str(item) for item in ids) - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - headers = {} - # Prepare request data - json_data = None - # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return GetRulesResponse.model_validate(response_data) - - - def update_rules( - self, body: UpdateRulesRequest, dry_run: bool = None, delete_all: bool = None - ) -> UpdateRulesResponse: - """ - Update stream rules - Adds or deletes rules from the active rule set for the filtered stream. - Args: - dry_run: Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. - delete_all: Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. - body: Request body - Returns: - UpdateRulesResponse: Response data - """ - url = self.client.base_url + "/2/tweets/search/stream/rules" - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) - params = {} - if dry_run is not None: - params["dry_run"] = dry_run - if delete_all is not None: - params["delete_all"] = delete_all - headers = {} - headers["Content-Type"] = "application/json" - # Prepare request data - json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) - # Make the request - response = self.client.session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return UpdateRulesResponse.model_validate(response_data) - - - def posts_firehose_ja( + def posts_firehose_en( self, partition: int, backfill_minutes: int = None, start_time: str = None, end_time: str = None, - tweetfields: List = None, + tweet_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[PostsFirehoseJaResponse, None, None]: + ) -> Generator[PostsFirehoseEnResponse, None, None]: """ - Stream Japanese Posts (Streaming) - Streams all public Japanese-language Posts in real-time. + Stream English Posts (Streaming) + Streams all public English-language Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: @@ -1609,21 +1615,21 @@ def posts_firehose_ja( partition: The partition number. start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - PostsFirehoseJaResponse: Individual streaming data items + PostsFirehoseEnResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/tweets/firehose/stream/lang/ja" + url = self.client.base_url + "/2/tweets/firehose/stream/lang/en" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -1641,18 +1647,18 @@ def posts_firehose_ja( params["start_time"] = start_time if end_time is not None: params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = { "Accept": "application/json", } @@ -1689,7 +1695,7 @@ def posts_firehose_ja( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield PostsFirehoseJaResponse.model_validate(data) + yield PostsFirehoseEnResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -1700,7 +1706,7 @@ def posts_firehose_ja( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield PostsFirehoseJaResponse.model_validate(data) + yield PostsFirehoseEnResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass @@ -1710,42 +1716,40 @@ def posts_firehose_ja( raise - def likes_firehose( + def posts_sample( self, - partition: int, backfill_minutes: int = None, - start_time: str = None, - end_time: str = None, - like_with_tweet_authorfields: List = None, + tweet_fields: List = None, expansions: List = None, - userfields: List = None, - tweetfields: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, timeout: Optional[float] = None, chunk_size: int = 1024, - ) -> Generator[LikesFirehoseResponse, None, None]: + ) -> Generator[PostsSampleResponse, None, None]: """ - Stream all Likes (Streaming) - Streams all public Likes in real-time. + Stream sampled Posts (Streaming) + Streams a 1% sample of public Posts in real-time. This is a streaming endpoint that yields data in real-time as it becomes available. Each yielded item represents a single data point from the stream. Args: backfill_minutes: The number of minutes of backfill requested. - partition: The partition number. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. - like_with_tweet_authorfields: A comma separated list of LikeWithTweetAuthor fields to display. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. - tweetfields: A comma separated list of Tweet fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. timeout: Request timeout in seconds (default: None for no timeout) chunk_size: Size of chunks to read from the stream (default: 1024 bytes) Yields: - LikesFirehoseResponse: Individual streaming data items + PostsSampleResponse: Individual streaming data items Raises: requests.exceptions.RequestException: If the streaming connection fails json.JSONDecodeError: If the streamed data is not valid JSON """ - url = self.client.base_url + "/2/likes/firehose/stream" + url = self.client.base_url + "/2/tweets/sample/stream" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -1757,22 +1761,18 @@ def likes_firehose( params = {} if backfill_minutes is not None: params["backfill_minutes"] = backfill_minutes - if partition is not None: - params["partition"] = partition - if start_time is not None: - params["start_time"] = start_time - if end_time is not None: - params["end_time"] = end_time - if like_with_tweet_authorfields is not None: - params["like_with_tweet_author.fields"] = ",".join( - str(item) for item in like_with_tweet_authorfields - ) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = { "Accept": "application/json", } @@ -1809,7 +1809,7 @@ def likes_firehose( # Parse JSON line data = json.loads(line) # Convert to response model if available - yield LikesFirehoseResponse.model_validate(data) + yield PostsSampleResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON lines continue @@ -1820,7 +1820,7 @@ def likes_firehose( if buffer.strip(): try: data = json.loads(buffer.strip()) - yield LikesFirehoseResponse.model_validate(data) + yield PostsSampleResponse.model_validate(data) except json.JSONDecodeError: # Skip invalid JSON in final buffer pass diff --git a/xdk/python/xdk/stream/models.py b/xdk/python/xdk/stream/models.py index d1bd57c0..ca5287bc 100644 --- a/xdk/python/xdk/stream/models.py +++ b/xdk/python/xdk/stream/models.py @@ -16,56 +16,56 @@ from datetime import datetime -# Models for posts_sample +# Models for likes_firehose -class PostsSampleResponse(BaseModel): - """Response model for posts_sample""" +class LikesFirehoseResponse(BaseModel): + """Response model for likes_firehose""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_rule_counts +# Models for posts_firehose_pt -class GetRuleCountsResponse(BaseModel): - """Response model for get_rule_counts""" +class PostsFirehosePtResponse(BaseModel): + """Response model for posts_firehose_pt""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for posts_firehose +# Models for posts_firehose_ja -class PostsFirehoseResponse(BaseModel): - """Response model for posts_firehose""" +class PostsFirehoseJaResponse(BaseModel): + """Response model for posts_firehose_ja""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for posts_firehose_pt +# Models for labels_compliance -class PostsFirehosePtResponse(BaseModel): - """Response model for posts_firehose_pt""" +class LabelsComplianceResponse(BaseModel): + """Response model for labels_compliance""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for users_compliance +# Models for posts_firehose_ko -class UsersComplianceResponse(BaseModel): - """Response model for users_compliance""" +class PostsFirehoseKoResponse(BaseModel): + """Response model for posts_firehose_ko""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for posts_sample10 +# Models for posts -class PostsSample10Response(BaseModel): - """Response model for posts_sample10""" +class PostsResponse(BaseModel): + """Response model for posts""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -79,38 +79,35 @@ class LikesComplianceResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for labels_compliance +# Models for get_rules -class LabelsComplianceResponse(BaseModel): - """Response model for labels_compliance""" +class GetRulesResponse(BaseModel): + """Response model for get_rules""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for posts_firehose_en - - -class PostsFirehoseEnResponse(BaseModel): - """Response model for posts_firehose_en""" +# Models for update_rules - model_config = ConfigDict(populate_by_name=True, extra="allow") +class UpdateRulesRequest(BaseModel): + """Request model for update_rules""" -# Models for posts + model_config = ConfigDict(populate_by_name=True) -class PostsResponse(BaseModel): - """Response model for posts""" +class UpdateRulesResponse(BaseModel): + """Response model for update_rules""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for posts_firehose_ko +# Models for get_rule_counts -class PostsFirehoseKoResponse(BaseModel): - """Response model for posts_firehose_ko""" +class GetRuleCountsResponse(BaseModel): + """Response model for get_rule_counts""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -124,52 +121,55 @@ class LikesSample10Response(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for posts_compliance +# Models for posts_firehose -class PostsComplianceResponse(BaseModel): - """Response model for posts_compliance""" +class PostsFirehoseResponse(BaseModel): + """Response model for posts_firehose""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_rules +# Models for users_compliance -class GetRulesResponse(BaseModel): - """Response model for get_rules""" +class UsersComplianceResponse(BaseModel): + """Response model for users_compliance""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for update_rules +# Models for posts_compliance -class UpdateRulesRequest(BaseModel): - """Request model for update_rules""" +class PostsComplianceResponse(BaseModel): + """Response model for posts_compliance""" - model_config = ConfigDict(populate_by_name=True) + model_config = ConfigDict(populate_by_name=True, extra="allow") -class UpdateRulesResponse(BaseModel): - """Response model for update_rules""" +# Models for posts_sample10 + + +class PostsSample10Response(BaseModel): + """Response model for posts_sample10""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for posts_firehose_ja +# Models for posts_firehose_en -class PostsFirehoseJaResponse(BaseModel): - """Response model for posts_firehose_ja""" +class PostsFirehoseEnResponse(BaseModel): + """Response model for posts_firehose_en""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for likes_firehose +# Models for posts_sample -class LikesFirehoseResponse(BaseModel): - """Response model for likes_firehose""" +class PostsSampleResponse(BaseModel): + """Response model for posts_sample""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/trends/client.py b/xdk/python/xdk/trends/client.py index 92a1af97..3c4947b8 100644 --- a/xdk/python/xdk/trends/client.py +++ b/xdk/python/xdk/trends/client.py @@ -21,8 +21,9 @@ if TYPE_CHECKING: from ..client import Client from .models import ( - GetPersonalizedResponse, + GetAiResponse, GetByWoeidResponse, + GetPersonalizedResponse, ) @@ -34,54 +35,48 @@ def __init__(self, client: Client): self.client = client - def get_personalized( - self, personalized_trendfields: List = None - ) -> GetPersonalizedResponse: + def get_ai(self, id: Any, news_fields: List = None) -> GetAiResponse: """ - Get personalized Trends - Retrieves personalized trending topics for the authenticated user. + Get AI Trends by ID + Retrieves an AI trend by its ID. Args: - personalized_trendfields: A comma separated list of PersonalizedTrend fields to display. + id: The ID of the ai trend. + news_fields: A comma separated list of News fields to display. Returns: - GetPersonalizedResponse: Response data + GetAiResponse: Response data """ - url = self.client.base_url + "/2/users/personalized_trends" - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} - if personalized_trendfields is not None: - params["personalized_trend.fields"] = ",".join( - str(item) for item in personalized_trendfields + url = self.client.base_url + "/2/ai_trends/{id}" + url = url.replace("{id}", str(id)) + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" ) + params = {} + if news_fields is not None: + params["news.fields"] = ",".join(str(item) for item in news_fields) headers = {} # Prepare request data json_data = None # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetPersonalizedResponse.model_validate(response_data) + return GetAiResponse.model_validate(response_data) def get_by_woeid( - self, woeid: int, max_trends: int = None, trendfields: List = None + self, woeid: int, max_trends: int = None, trend_fields: List = None ) -> GetByWoeidResponse: """ Get Trends by WOEID @@ -89,7 +84,7 @@ def get_by_woeid( Args: woeid: The WOEID of the place to lookup a trend for. max_trends: The maximum number of results. - trendfields: A comma separated list of Trend fields to display. + trend_fields: A comma separated list of Trend fields to display. Returns: GetByWoeidResponse: Response data """ @@ -106,8 +101,8 @@ def get_by_woeid( params = {} if max_trends is not None: params["max_trends"] = max_trends - if trendfields is not None: - params["trend.fields"] = ",".join(str(item) for item in trendfields) + if trend_fields is not None: + params["trend.fields"] = ",".join(str(item) for item in trend_fields) headers = {} # Prepare request data json_data = None @@ -123,3 +118,49 @@ def get_by_woeid( response_data = response.json() # Convert to Pydantic model if applicable return GetByWoeidResponse.model_validate(response_data) + + + def get_personalized( + self, personalized_trend_fields: List = None + ) -> GetPersonalizedResponse: + """ + Get personalized Trends + Retrieves personalized trending topics for the authenticated user. + Args: + personalized_trend_fields: A comma separated list of PersonalizedTrend fields to display. + Returns: + GetPersonalizedResponse: Response data + """ + url = self.client.base_url + "/2/users/personalized_trends" + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + if personalized_trend_fields is not None: + params["personalized_trend.fields"] = ",".join( + str(item) for item in personalized_trend_fields + ) + headers = {} + # Prepare request data + json_data = None + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.get( + url, + params=params, + headers=headers, + ) + else: + response = self.client.session.get( + url, + params=params, + headers=headers, + ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return GetPersonalizedResponse.model_validate(response_data) diff --git a/xdk/python/xdk/trends/models.py b/xdk/python/xdk/trends/models.py index 65f38c6d..f5a2a8ce 100644 --- a/xdk/python/xdk/trends/models.py +++ b/xdk/python/xdk/trends/models.py @@ -16,11 +16,11 @@ from datetime import datetime -# Models for get_personalized +# Models for get_ai -class GetPersonalizedResponse(BaseModel): - """Response model for get_personalized""" +class GetAiResponse(BaseModel): + """Response model for get_ai""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -32,3 +32,12 @@ class GetByWoeidResponse(BaseModel): """Response model for get_by_woeid""" model_config = ConfigDict(populate_by_name=True, extra="allow") + + +# Models for get_personalized + + +class GetPersonalizedResponse(BaseModel): + """Response model for get_personalized""" + + model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/usage/client.py b/xdk/python/xdk/usage/client.py index bad751eb..a478bc8e 100644 --- a/xdk/python/xdk/usage/client.py +++ b/xdk/python/xdk/usage/client.py @@ -33,13 +33,13 @@ def __init__(self, client: Client): self.client = client - def get(self, days: int = None, usagefields: List = None) -> GetResponse: + def get(self, days: int = None, usage_fields: List = None) -> GetResponse: """ Get usage Retrieves usage statistics for Posts over a specified number of days. Args: days: The number of days for which you need usage for. - usagefields: A comma separated list of Usage fields to display. + usage_fields: A comma separated list of Usage fields to display. Returns: GetResponse: Response data """ @@ -55,8 +55,8 @@ def get(self, days: int = None, usagefields: List = None) -> GetResponse: params = {} if days is not None: params["days"] = days - if usagefields is not None: - params["usage.fields"] = ",".join(str(item) for item in usagefields) + if usage_fields is not None: + params["usage.fields"] = ",".join(str(item) for item in usage_fields) headers = {} # Prepare request data json_data = None diff --git a/xdk/python/xdk/users/client.py b/xdk/python/xdk/users/client.py index da7588db..57e1abd7 100644 --- a/xdk/python/xdk/users/client.py +++ b/xdk/python/xdk/users/client.py @@ -21,51 +21,51 @@ if TYPE_CHECKING: from ..client import Client from .models import ( - GetMeResponse, - UnfollowListResponse, + LikePostRequest, + LikePostResponse, + UnlikePostResponse, GetMutingResponse, MuteUserRequest, MuteUserResponse, - UnlikePostResponse, - GetPostsResponse, - GetFollowingResponse, - FollowUserRequest, - FollowUserResponse, - GetTimelineResponse, + GetPinnedListsResponse, + PinListRequest, + PinListResponse, + UnrepostPostResponse, UnmuteUserResponse, - SearchResponse, - GetOwnedListsResponse, - GetByUsernamesResponse, - GetMentionsResponse, + DeleteBookmarkResponse, GetListMembershipsResponse, - GetBlockingResponse, + GetMeResponse, + GetLikedPostsResponse, + GetPostsResponse, GetFollowedListsResponse, FollowListRequest, FollowListResponse, - UnrepostPostResponse, - GetRepostsOfMeResponse, - GetBookmarksResponse, - CreateBookmarkRequest, - CreateBookmarkResponse, - GetByIdsResponse, - GetByIdResponse, - GetBookmarkFoldersResponse, - UnblockDmsResponse, - GetPinnedListsResponse, - PinListRequest, - PinListResponse, - GetLikedPostsResponse, - GetBookmarksByFolderIdResponse, - LikePostRequest, - LikePostResponse, - UnpinListResponse, GetByUsernameResponse, - DeleteBookmarkResponse, - BlockDmsResponse, + GetMentionsResponse, + GetOwnedListsResponse, RepostPostRequest, RepostPostResponse, + UnfollowListResponse, + GetByIdsResponse, + GetBookmarksByFolderIdResponse, + UnblockDmsResponse, + GetBlockingResponse, + GetByUsernamesResponse, UnfollowUserResponse, + BlockDmsResponse, GetFollowersResponse, + GetByIdResponse, + GetBookmarkFoldersResponse, + GetFollowingResponse, + FollowUserRequest, + FollowUserResponse, + GetTimelineResponse, + SearchResponse, + GetBookmarksResponse, + CreateBookmarkRequest, + CreateBookmarkResponse, + GetRepostsOfMeResponse, + UnpinListResponse, ) @@ -77,69 +77,72 @@ def __init__(self, client: Client): self.client = client - def get_me( - self, userfields: List = None, expansions: List = None, tweetfields: List = None - ) -> GetMeResponse: + def like_post( + self, id: Any, body: Optional[LikePostRequest] = None + ) -> LikePostResponse: """ - Get my User - Retrieves details of the authenticated user. + Like Post + Causes the authenticated user to Like a specific Post by its ID. Args: - userfields: A comma separated list of User fields to display. - expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. - Returns: - GetMeResponse: Response data + id: The ID of the authenticated source User that is requesting to like the Post. + body: Request body + Returns: + LikePostResponse: Response data """ - url = self.client.base_url + "/2/users/me" + url = self.client.base_url + "/2/users/{id}/likes" + url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.get( + response = self.client.oauth2_session.post( url, params=params, headers=headers, + json=json_data, ) else: - response = self.client.session.get( + response = self.client.session.post( url, params=params, headers=headers, + json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetMeResponse.model_validate(response_data) + return LikePostResponse.model_validate(response_data) - def unfollow_list(self, id: Any, list_id: Any) -> UnfollowListResponse: + def unlike_post(self, id: Any, tweet_id: Any) -> UnlikePostResponse: """ - Unfollow List - Causes the authenticated user to unfollow a specific List by its ID. + Unlike Post + Causes the authenticated user to Unlike a specific Post by its ID. Args: - id: The ID of the authenticated source User that will unfollow the List. - list_id: The ID of the List to unfollow. + id: The ID of the authenticated source User that is requesting to unlike the Post. + tweet_id: The ID of the Post that the User is requesting to unlike. Returns: - UnfollowListResponse: Response data + UnlikePostResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/followed_lists/{list_id}" + url = self.client.base_url + "/2/users/{id}/likes/{tweet_id}" url = url.replace("{id}", str(id)) - url = url.replace("{list_id}", str(list_id)) + url = url.replace("{tweet_id}", str(tweet_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh @@ -167,7 +170,7 @@ def unfollow_list(self, id: Any, list_id: Any) -> UnfollowListResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UnfollowListResponse.model_validate(response_data) + return UnlikePostResponse.model_validate(response_data) def get_muting( @@ -175,9 +178,9 @@ def get_muting( id: Any, max_results: int = None, pagination_token: Any = None, - userfields: List = None, + user_fields: List = None, expansions: List = None, - tweetfields: List = None, + tweet_fields: List = None, ) -> GetMutingResponse: """ Get muting @@ -186,9 +189,9 @@ def get_muting( id: The ID of the authenticated source User for whom to return results. max_results: The maximum number of results. pagination_token: This parameter is used to get the next 'page' of results. - userfields: A comma separated list of User fields to display. + user_fields: A comma separated list of User fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: GetMutingResponse: Response data """ @@ -204,12 +207,12 @@ def get_muting( params["max_results"] = max_results if pagination_token is not None: params["pagination_token"] = pagination_token - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None @@ -287,37 +290,50 @@ def mute_user( return MuteUserResponse.model_validate(response_data) - def unlike_post(self, id: Any, tweet_id: Any) -> UnlikePostResponse: + def get_pinned_lists( + self, + id: Any, + list_fields: List = None, + expansions: List = None, + user_fields: List = None, + ) -> GetPinnedListsResponse: """ - Unlike Post - Causes the authenticated user to Unlike a specific Post by its ID. + Get pinned Lists + Retrieves a list of Lists pinned by the authenticated user. Args: - id: The ID of the authenticated source User that is requesting to unlike the Post. - tweet_id: The ID of the Post that the User is requesting to unlike. + id: The ID of the authenticated source User for whom to return results. + list_fields: A comma separated list of List fields to display. + expansions: A comma separated list of fields to expand. + user_fields: A comma separated list of User fields to display. Returns: - UnlikePostResponse: Response data + GetPinnedListsResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/likes/{tweet_id}" + url = self.client.base_url + "/2/users/{id}/pinned_lists" url = url.replace("{id}", str(id)) - url = url.replace("{tweet_id}", str(tweet_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if list_fields is not None: + params["list.fields"] = ",".join(str(item) for item in list_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) headers = {} # Prepare request data json_data = None # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.delete( + response = self.client.oauth2_session.get( url, params=params, headers=headers, ) else: - response = self.client.session.delete( + response = self.client.session.get( url, params=params, headers=headers, @@ -327,185 +343,161 @@ def unlike_post(self, id: Any, tweet_id: Any) -> UnlikePostResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UnlikePostResponse.model_validate(response_data) + return GetPinnedListsResponse.model_validate(response_data) - def get_posts( - self, - id: Any, - since_id: Any = None, - until_id: Any = None, - max_results: int = None, - pagination_token: Any = None, - exclude: List = None, - start_time: str = None, - end_time: str = None, - tweetfields: List = None, - expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetPostsResponse: + def pin_list(self, id: Any, body: PinListRequest) -> PinListResponse: """ - Get Posts - Retrieves a list of posts authored by a specific User by their ID. + Pin List + Causes the authenticated user to pin a specific List by its ID. Args: - id: The ID of the User to lookup. - since_id: The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - until_id: The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. - exclude: The set of entities to exclude (e.g. 'replies' or 'retweets'). - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - tweetfields: A comma separated list of Tweet fields to display. - expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. - Returns: - GetPostsResponse: Response data + id: The ID of the authenticated source User that will pin the List. + body: Request body + Returns: + PinListResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/tweets" + url = self.client.base_url + "/2/users/{id}/pinned_lists" url = url.replace("{id}", str(id)) - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if since_id is not None: - params["since_id"] = since_id - if until_id is not None: - params["until_id"] = until_id - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if exclude is not None: - params["exclude"] = ",".join(str(item) for item in exclude) - if start_time is not None: - params["start_time"] = start_time - if end_time is not None: - params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + if self.client.oauth2_session: + response = self.client.oauth2_session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + else: + response = self.client.session.post( + url, + params=params, + headers=headers, + json=json_data, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetPostsResponse.model_validate(response_data) + return PinListResponse.model_validate(response_data) - def get_following( - self, - id: Any, - max_results: int = None, - pagination_token: Any = None, - userfields: List = None, - expansions: List = None, - tweetfields: List = None, - ) -> GetFollowingResponse: + def unrepost_post(self, id: Any, source_tweet_id: Any) -> UnrepostPostResponse: """ - Get following - Retrieves a list of Users followed by a specific User by their ID. + Unrepost Post + Causes the authenticated user to unrepost a specific Post by its ID. Args: - id: The ID of the User to lookup. - max_results: The maximum number of results. - pagination_token: This parameter is used to get a specified 'page' of results. - userfields: A comma separated list of User fields to display. - expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + id: The ID of the authenticated source User that is requesting to repost the Post. + source_tweet_id: The ID of the Post that the User is requesting to unretweet. Returns: - GetFollowingResponse: Response data + UnrepostPostResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/following" + url = self.client.base_url + "/2/users/{id}/retweets/{source_tweet_id}" url = url.replace("{id}", str(id)) - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" + url = url.replace("{source_tweet_id}", str(source_tweet_id)) + # Ensure we have a valid access token + if self.client.oauth2_auth and self.client.token: + # Check if token needs refresh + if self.client.is_token_expired(): + self.client.refresh_token() + params = {} + headers = {} + # Prepare request data + json_data = None + # Make the request + if self.client.oauth2_session: + response = self.client.oauth2_session.delete( + url, + params=params, + headers=headers, ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" + else: + response = self.client.session.delete( + url, + params=params, + headers=headers, ) + # Check for errors + response.raise_for_status() + # Parse the response data + response_data = response.json() + # Convert to Pydantic model if applicable + return UnrepostPostResponse.model_validate(response_data) + + + def unmute_user( + self, source_user_id: Any, target_user_id: Any + ) -> UnmuteUserResponse: + """ + Unmute User + Causes the authenticated user to unmute a specific user by their ID. + Args: + source_user_id: The ID of the authenticated source User that is requesting to unmute the target User. + target_user_id: The ID of the User that the source User is requesting to unmute. + Returns: + UnmuteUserResponse: Response data + """ + url = self.client.base_url + "/2/users/{source_user_id}/muting/{target_user_id}" + url = url.replace("{source_user_id}", str(source_user_id)) + url = url.replace("{target_user_id}", str(target_user_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) headers = {} # Prepare request data json_data = None # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + if self.client.oauth2_session: + response = self.client.oauth2_session.delete( + url, + params=params, + headers=headers, + ) + else: + response = self.client.session.delete( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetFollowingResponse.model_validate(response_data) + return UnmuteUserResponse.model_validate(response_data) - def follow_user( - self, id: Any, body: Optional[FollowUserRequest] = None - ) -> FollowUserResponse: + def delete_bookmark(self, id: Any, tweet_id: Any) -> DeleteBookmarkResponse: """ - Follow User - Causes the authenticated user to follow a specific user by their ID. + Delete Bookmark + Removes a Post from the authenticated user’s Bookmarks by its ID. Args: - id: The ID of the authenticated source User that is requesting to follow the target User. - body: Request body - Returns: - FollowUserResponse: Response data + id: The ID of the authenticated source User whose bookmark is to be removed. + tweet_id: The ID of the Post that the source User is removing from bookmarks. + Returns: + DeleteBookmarkResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/following" + url = self.client.base_url + "/2/users/{id}/bookmarks/{tweet_id}" url = url.replace("{id}", str(id)) + url = url.replace("{tweet_id}", str(tweet_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh @@ -513,167 +505,135 @@ def follow_user( self.client.refresh_token() params = {} headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.post( + response = self.client.oauth2_session.delete( url, params=params, headers=headers, - json=json_data, ) else: - response = self.client.session.post( + response = self.client.session.delete( url, params=params, headers=headers, - json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return FollowUserResponse.model_validate(response_data) + return DeleteBookmarkResponse.model_validate(response_data) - def get_timeline( + def get_list_memberships( self, id: Any, - since_id: Any = None, - until_id: Any = None, max_results: int = None, pagination_token: Any = None, - exclude: List = None, - start_time: str = None, - end_time: str = None, - tweetfields: List = None, + list_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetTimelineResponse: + user_fields: List = None, + ) -> GetListMembershipsResponse: """ - Get Timeline - Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. + Get List memberships + Retrieves a list of Lists that a specific User is a member of by their ID. Args: - id: The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. - since_id: The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - until_id: The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + id: The ID of the User to lookup. max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. - exclude: The set of entities to exclude (e.g. 'replies' or 'retweets'). - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - tweetfields: A comma separated list of Tweet fields to display. + pagination_token: This parameter is used to get a specified 'page' of results. + list_fields: A comma separated list of List fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + user_fields: A comma separated list of User fields to display. Returns: - GetTimelineResponse: Response data + GetListMembershipsResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/timelines/reverse_chronological" + url = self.client.base_url + "/2/users/{id}/list_memberships" url = url.replace("{id}", str(id)) + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if since_id is not None: - params["since_id"] = since_id - if until_id is not None: - params["until_id"] = until_id if max_results is not None: params["max_results"] = max_results if pagination_token is not None: params["pagination_token"] = pagination_token - if exclude is not None: - params["exclude"] = ",".join(str(item) for item in exclude) - if start_time is not None: - params["start_time"] = start_time - if end_time is not None: - params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if list_fields is not None: + params["list.fields"] = ",".join(str(item) for item in list_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) headers = {} # Prepare request data json_data = None # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetTimelineResponse.model_validate(response_data) + return GetListMembershipsResponse.model_validate(response_data) - def unmute_user( - self, source_user_id: Any, target_user_id: Any - ) -> UnmuteUserResponse: + def get_me( + self, + user_fields: List = None, + expansions: List = None, + tweet_fields: List = None, + ) -> GetMeResponse: """ - Unmute User - Causes the authenticated user to unmute a specific user by their ID. + Get my User + Retrieves details of the authenticated user. Args: - source_user_id: The ID of the authenticated source User that is requesting to unmute the target User. - target_user_id: The ID of the User that the source User is requesting to unmute. + user_fields: A comma separated list of User fields to display. + expansions: A comma separated list of fields to expand. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - UnmuteUserResponse: Response data + GetMeResponse: Response data """ - url = self.client.base_url + "/2/users/{source_user_id}/muting/{target_user_id}" - url = url.replace("{source_user_id}", str(source_user_id)) - url = url.replace("{target_user_id}", str(target_user_id)) + url = self.client.base_url + "/2/users/me" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.delete( + response = self.client.oauth2_session.get( url, params=params, headers=headers, ) else: - response = self.client.session.delete( + response = self.client.session.get( url, params=params, headers=headers, @@ -683,50 +643,61 @@ def unmute_user( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UnmuteUserResponse.model_validate(response_data) + return GetMeResponse.model_validate(response_data) - def search( + def get_liked_posts( self, - query: Any, + id: Any, max_results: int = None, - next_token: Any = None, - userfields: List = None, + pagination_token: Any = None, + tweet_fields: List = None, expansions: List = None, - tweetfields: List = None, - ) -> SearchResponse: + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetLikedPostsResponse: """ - Search Users - Retrieves a list of Users matching a search query. + Get liked Posts + Retrieves a list of Posts liked by a specific User by their ID. Args: - query: TThe the query string by which to query for users. + id: The ID of the User to lookup. max_results: The maximum number of results. - next_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - userfields: A comma separated list of User fields to display. + pagination_token: This parameter is used to get the next 'page' of results. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - SearchResponse: Response data + GetLikedPostsResponse: Response data """ - url = self.client.base_url + "/2/users/search" + url = self.client.base_url + "/2/users/{id}/liked_tweets" + url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if query is not None: - params["query"] = query if max_results is not None: params["max_results"] = max_results - if next_token is not None: - params["next_token"] = next_token - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if pagination_token is not None: + params["pagination_token"] = pagination_token + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -748,32 +719,48 @@ def search( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return SearchResponse.model_validate(response_data) + return GetLikedPostsResponse.model_validate(response_data) - def get_owned_lists( + def get_posts( self, id: Any, + since_id: Any = None, + until_id: Any = None, max_results: int = None, pagination_token: Any = None, - listfields: List = None, + exclude: List = None, + start_time: str = None, + end_time: str = None, + tweet_fields: List = None, expansions: List = None, - userfields: List = None, - ) -> GetOwnedListsResponse: + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetPostsResponse: """ - Get owned Lists - Retrieves a list of Lists owned by a specific User by their ID. + Get Posts + Retrieves a list of posts authored by a specific User by their ID. Args: id: The ID of the User to lookup. + since_id: The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + until_id: The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. max_results: The maximum number of results. - pagination_token: This parameter is used to get a specified 'page' of results. - listfields: A comma separated list of List fields to display. + pagination_token: This parameter is used to get the next 'page' of results. + exclude: The set of entities to exclude (e.g. 'replies' or 'retweets'). + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - GetOwnedListsResponse: Response data + GetPostsResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/owned_lists" + url = self.client.base_url + "/2/users/{id}/tweets" url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -789,16 +776,32 @@ def get_owned_lists( if self.client.is_token_expired(): self.client.refresh_token() params = {} + if since_id is not None: + params["since_id"] = since_id + if until_id is not None: + params["until_id"] = until_id if max_results is not None: params["max_results"] = max_results if pagination_token is not None: params["pagination_token"] = pagination_token - if listfields is not None: - params["list.fields"] = ",".join(str(item) for item in listfields) + if exclude is not None: + params["exclude"] = ",".join(str(item) for item in exclude) + if start_time is not None: + params["start_time"] = start_time + if end_time is not None: + params["end_time"] = end_time + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None @@ -813,28 +816,33 @@ def get_owned_lists( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetOwnedListsResponse.model_validate(response_data) + return GetPostsResponse.model_validate(response_data) - def get_by_usernames( + def get_followed_lists( self, - usernames: List, - userfields: List = None, + id: Any, + max_results: int = None, + pagination_token: Any = None, + list_fields: List = None, expansions: List = None, - tweetfields: List = None, - ) -> GetByUsernamesResponse: + user_fields: List = None, + ) -> GetFollowedListsResponse: """ - Get Users by usernames - Retrieves details of multiple Users by their usernames. + Get followed Lists + Retrieves a list of Lists followed by a specific User by their ID. Args: - usernames: A list of usernames, comma-separated. - userfields: A comma separated list of User fields to display. + id: The ID of the User to lookup. + max_results: The maximum number of results. + pagination_token: This parameter is used to get a specified 'page' of results. + list_fields: A comma separated list of List fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + user_fields: A comma separated list of User fields to display. Returns: - GetByUsernamesResponse: Response data + GetFollowedListsResponse: Response data """ - url = self.client.base_url + "/2/users/by" + url = self.client.base_url + "/2/users/{id}/followed_lists" + url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -849,14 +857,16 @@ def get_by_usernames( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if usernames is not None: - params["usernames"] = ",".join(str(item) for item in usernames) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if list_fields is not None: + params["list.fields"] = ",".join(str(item) for item in list_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) headers = {} # Prepare request data json_data = None @@ -871,126 +881,82 @@ def get_by_usernames( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetByUsernamesResponse.model_validate(response_data) + return GetFollowedListsResponse.model_validate(response_data) - def get_mentions( - self, - id: Any, - since_id: Any = None, - until_id: Any = None, - max_results: int = None, - pagination_token: Any = None, - start_time: str = None, - end_time: str = None, - tweetfields: List = None, - expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetMentionsResponse: + def follow_list( + self, id: Any, body: Optional[FollowListRequest] = None + ) -> FollowListResponse: """ - Get mentions - Retrieves a list of Posts that mention a specific User by their ID. + Follow List + Causes the authenticated user to follow a specific List by its ID. Args: - id: The ID of the User to lookup. - since_id: The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - until_id: The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. - start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - tweetfields: A comma separated list of Tweet fields to display. - expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. - Returns: - GetMentionsResponse: Response data + id: The ID of the authenticated source User that will follow the List. + body: Request body + Returns: + FollowListResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/mentions" + url = self.client.base_url + "/2/users/{id}/followed_lists" url = url.replace("{id}", str(id)) - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if since_id is not None: - params["since_id"] = since_id - if until_id is not None: - params["until_id"] = until_id - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if start_time is not None: - params["start_time"] = start_time - if end_time is not None: - params["end_time"] = end_time - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) headers = {} + headers["Content-Type"] = "application/json" # Prepare request data json_data = None + if body is not None: + json_data = ( + body.model_dump(exclude_none=True) + if hasattr(body, "model_dump") + else body + ) # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + if self.client.oauth2_session: + response = self.client.oauth2_session.post( + url, + params=params, + headers=headers, + json=json_data, + ) + else: + response = self.client.session.post( + url, + params=params, + headers=headers, + json=json_data, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetMentionsResponse.model_validate(response_data) + return FollowListResponse.model_validate(response_data) - def get_list_memberships( + def get_by_username( self, - id: Any, - max_results: int = None, - pagination_token: Any = None, - listfields: List = None, + username: str, + user_fields: List = None, expansions: List = None, - userfields: List = None, - ) -> GetListMembershipsResponse: + tweet_fields: List = None, + ) -> GetByUsernameResponse: """ - Get List memberships - Retrieves a list of Lists that a specific User is a member of by their ID. + Get User by username + Retrieves details of a specific User by their username. Args: - id: The ID of the User to lookup. - max_results: The maximum number of results. - pagination_token: This parameter is used to get a specified 'page' of results. - listfields: A comma separated list of List fields to display. + username: A username. + user_fields: A comma separated list of User fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetListMembershipsResponse: Response data + GetByUsernameResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/list_memberships" - url = url.replace("{id}", str(id)) + url = self.client.base_url + "/2/users/by/username/{username}" + url = url.replace("{username}", str(username)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -1005,16 +971,12 @@ def get_list_memberships( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if listfields is not None: - params["list.fields"] = ",".join(str(item) for item in listfields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None @@ -1029,96 +991,125 @@ def get_list_memberships( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetListMembershipsResponse.model_validate(response_data) + return GetByUsernameResponse.model_validate(response_data) - def get_blocking( + def get_mentions( self, id: Any, + since_id: Any = None, + until_id: Any = None, max_results: int = None, pagination_token: Any = None, - userfields: List = None, + start_time: str = None, + end_time: str = None, + tweet_fields: List = None, expansions: List = None, - tweetfields: List = None, - ) -> GetBlockingResponse: + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetMentionsResponse: """ - Get blocking - Retrieves a list of Users blocked by the specified User ID. + Get mentions + Retrieves a list of Posts that mention a specific User by their ID. Args: - id: The ID of the authenticated source User for whom to return results. + id: The ID of the User to lookup. + since_id: The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + until_id: The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. max_results: The maximum number of results. - pagination_token: This parameter is used to get a specified 'page' of results. - userfields: A comma separated list of User fields to display. + pagination_token: This parameter is used to get the next 'page' of results. + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + tweet_fields: A comma separated list of Tweet fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - GetBlockingResponse: Response data + GetMentionsResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/blocking" + url = self.client.base_url + "/2/users/{id}/mentions" url = url.replace("{id}", str(id)) + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if since_id is not None: + params["since_id"] = since_id + if until_id is not None: + params["until_id"] = until_id if max_results is not None: params["max_results"] = max_results if pagination_token is not None: params["pagination_token"] = pagination_token - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if start_time is not None: + params["start_time"] = start_time + if end_time is not None: + params["end_time"] = end_time + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetBlockingResponse.model_validate(response_data) + return GetMentionsResponse.model_validate(response_data) - def get_followed_lists( + def get_owned_lists( self, id: Any, max_results: int = None, pagination_token: Any = None, - listfields: List = None, + list_fields: List = None, expansions: List = None, - userfields: List = None, - ) -> GetFollowedListsResponse: + user_fields: List = None, + ) -> GetOwnedListsResponse: """ - Get followed Lists - Retrieves a list of Lists followed by a specific User by their ID. + Get owned Lists + Retrieves a list of Lists owned by a specific User by their ID. Args: id: The ID of the User to lookup. max_results: The maximum number of results. pagination_token: This parameter is used to get a specified 'page' of results. - listfields: A comma separated list of List fields to display. + list_fields: A comma separated list of List fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. + user_fields: A comma separated list of User fields to display. Returns: - GetFollowedListsResponse: Response data + GetOwnedListsResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/followed_lists" + url = self.client.base_url + "/2/users/{id}/owned_lists" url = url.replace("{id}", str(id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -1138,12 +1129,12 @@ def get_followed_lists( params["max_results"] = max_results if pagination_token is not None: params["pagination_token"] = pagination_token - if listfields is not None: - params["list.fields"] = ",".join(str(item) for item in listfields) + if list_fields is not None: + params["list.fields"] = ",".join(str(item) for item in list_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) headers = {} # Prepare request data json_data = None @@ -1158,22 +1149,22 @@ def get_followed_lists( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetFollowedListsResponse.model_validate(response_data) + return GetOwnedListsResponse.model_validate(response_data) - def follow_list( - self, id: Any, body: Optional[FollowListRequest] = None - ) -> FollowListResponse: + def repost_post( + self, id: Any, body: Optional[RepostPostRequest] = None + ) -> RepostPostResponse: """ - Follow List - Causes the authenticated user to follow a specific List by its ID. + Repost Post + Causes the authenticated user to repost a specific Post by its ID. Args: - id: The ID of the authenticated source User that will follow the List. + id: The ID of the authenticated source User that is requesting to repost the Post. body: Request body Returns: - FollowListResponse: Response data + RepostPostResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/followed_lists" + url = self.client.base_url + "/2/users/{id}/retweets" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -1211,22 +1202,22 @@ def follow_list( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return FollowListResponse.model_validate(response_data) + return RepostPostResponse.model_validate(response_data) - def unrepost_post(self, id: Any, source_tweet_id: Any) -> UnrepostPostResponse: + def unfollow_list(self, id: Any, list_id: Any) -> UnfollowListResponse: """ - Unrepost Post - Causes the authenticated user to unrepost a specific Post by its ID. + Unfollow List + Causes the authenticated user to unfollow a specific List by its ID. Args: - id: The ID of the authenticated source User that is requesting to repost the Post. - source_tweet_id: The ID of the Post that the User is requesting to unretweet. + id: The ID of the authenticated source User that will unfollow the List. + list_id: The ID of the List to unfollow. Returns: - UnrepostPostResponse: Response data + UnfollowListResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/retweets/{source_tweet_id}" + url = self.client.base_url + "/2/users/{id}/followed_lists/{list_id}" url = url.replace("{id}", str(id)) - url = url.replace("{source_tweet_id}", str(source_tweet_id)) + url = url.replace("{list_id}", str(list_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh @@ -1254,134 +1245,88 @@ def unrepost_post(self, id: Any, source_tweet_id: Any) -> UnrepostPostResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UnrepostPostResponse.model_validate(response_data) + return UnfollowListResponse.model_validate(response_data) - def get_reposts_of_me( + def get_by_ids( self, - max_results: int = None, - pagination_token: Any = None, - tweetfields: List = None, + ids: List, + user_fields: List = None, expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetRepostsOfMeResponse: + tweet_fields: List = None, + ) -> GetByIdsResponse: """ - Get Reposts of me - Retrieves a list of Posts that repost content from the authenticated user. + Get Users by IDs + Retrieves details of multiple Users by their IDs. Args: - max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. - tweetfields: A comma separated list of Tweet fields to display. + ids: A list of User IDs, comma-separated. You can specify up to 100 IDs. + user_fields: A comma separated list of User fields to display. expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetRepostsOfMeResponse: Response data + GetByIdsResponse: Response data """ - url = self.client.base_url + "/2/users/reposts_of_me" + url = self.client.base_url + "/2/users" + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if ids is not None: + params["ids"] = ",".join(str(item) for item in ids) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetRepostsOfMeResponse.model_validate(response_data) + return GetByIdsResponse.model_validate(response_data) - def get_bookmarks( - self, - id: Any, - max_results: int = None, - pagination_token: Any = None, - tweetfields: List = None, - expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetBookmarksResponse: + def get_bookmarks_by_folder_id( + self, id: Any, folder_id: Any + ) -> GetBookmarksByFolderIdResponse: """ - Get Bookmarks - Retrieves a list of Posts bookmarked by the authenticated user. + Get Bookmarks by folder ID + Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. Args: id: The ID of the authenticated source User for whom to return results. - max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. - tweetfields: A comma separated list of Tweet fields to display. - expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + folder_id: The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. Returns: - GetBookmarksResponse: Response data + GetBookmarksByFolderIdResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/bookmarks" + url = self.client.base_url + "/2/users/{id}/bookmarks/folders/{folder_id}" url = url.replace("{id}", str(id)) + url = url.replace("{folder_id}", str(folder_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) headers = {} # Prepare request data json_data = None @@ -1403,22 +1348,19 @@ def get_bookmarks( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetBookmarksResponse.model_validate(response_data) + return GetBookmarksByFolderIdResponse.model_validate(response_data) - def create_bookmark( - self, id: Any, body: CreateBookmarkRequest - ) -> CreateBookmarkResponse: + def unblock_dms(self, id: Any) -> UnblockDmsResponse: """ - Create Bookmark - Adds a post to the authenticated user’s bookmarks. + Unblock DMs + Unblocks direct messages to or from a specific User by their ID for the authenticated user. Args: - id: The ID of the authenticated source User for whom to add bookmarks. - body: Request body - Returns: - CreateBookmarkResponse: Response data + id: The ID of the target User that the authenticated user requesting to unblock dms for. + Returns: + UnblockDmsResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/bookmarks" + url = self.client.base_url + "/2/users/{id}/dm/unblock" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -1427,116 +1369,112 @@ def create_bookmark( self.client.refresh_token() params = {} headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request if self.client.oauth2_session: response = self.client.oauth2_session.post( url, params=params, headers=headers, - json=json_data, ) else: response = self.client.session.post( url, params=params, headers=headers, - json=json_data, ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return CreateBookmarkResponse.model_validate(response_data) + return UnblockDmsResponse.model_validate(response_data) - def get_by_ids( + def get_blocking( self, - ids: List, - userfields: List = None, + id: Any, + max_results: int = None, + pagination_token: Any = None, + user_fields: List = None, expansions: List = None, - tweetfields: List = None, - ) -> GetByIdsResponse: + tweet_fields: List = None, + ) -> GetBlockingResponse: """ - Get Users by IDs - Retrieves details of multiple Users by their IDs. + Get blocking + Retrieves a list of Users blocked by the specified User ID. Args: - ids: A list of User IDs, comma-separated. You can specify up to 100 IDs. - userfields: A comma separated list of User fields to display. + id: The ID of the authenticated source User for whom to return results. + max_results: The maximum number of results. + pagination_token: This parameter is used to get a specified 'page' of results. + user_fields: A comma separated list of User fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetByIdsResponse: Response data + GetBlockingResponse: Response data """ - url = self.client.base_url + "/2/users" - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) + url = self.client.base_url + "/2/users/{id}/blocking" + url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if ids is not None: - params["ids"] = ",".join(str(item) for item in ids) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + if self.client.oauth2_session: + response = self.client.oauth2_session.get( + url, + params=params, + headers=headers, + ) + else: + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetByIdsResponse.model_validate(response_data) + return GetBlockingResponse.model_validate(response_data) - def get_by_id( + def get_by_usernames( self, - id: Any, - userfields: List = None, + usernames: List, + user_fields: List = None, expansions: List = None, - tweetfields: List = None, - ) -> GetByIdResponse: + tweet_fields: List = None, + ) -> GetByUsernamesResponse: """ - Get User by ID - Retrieves details of a specific User by their ID. + Get Users by usernames + Retrieves details of multiple Users by their usernames. Args: - id: The ID of the User to lookup. - userfields: A comma separated list of User fields to display. + usernames: A list of usernames, comma-separated. + user_fields: A comma separated list of User fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetByIdResponse: Response data + GetByUsernamesResponse: Response data """ - url = self.client.base_url + "/2/users/{id}" - url = url.replace("{id}", str(id)) + url = self.client.base_url + "/2/users/by" if self.client.bearer_token: self.client.session.headers["Authorization"] = ( f"Bearer {self.client.bearer_token}" @@ -1551,12 +1489,14 @@ def get_by_id( if self.client.is_token_expired(): self.client.refresh_token() params = {} - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if usernames is not None: + params["usernames"] = ",".join(str(item) for item in usernames) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None @@ -1571,46 +1511,45 @@ def get_by_id( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetByIdResponse.model_validate(response_data) + return GetByUsernamesResponse.model_validate(response_data) - def get_bookmark_folders( - self, id: Any, max_results: int = None, pagination_token: Any = None - ) -> GetBookmarkFoldersResponse: + def unfollow_user( + self, source_user_id: Any, target_user_id: Any + ) -> UnfollowUserResponse: """ - Get Bookmark folders - Retrieves a list of Bookmark folders created by the authenticated user. + Unfollow User + Causes the authenticated user to unfollow a specific user by their ID. Args: - id: The ID of the authenticated source User for whom to return results. - max_results: The maximum number of results. - pagination_token: This parameter is used to get the next 'page' of results. + source_user_id: The ID of the authenticated source User that is requesting to unfollow the target User. + target_user_id: The ID of the User that the source User is requesting to unfollow. Returns: - GetBookmarkFoldersResponse: Response data + UnfollowUserResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/bookmarks/folders" - url = url.replace("{id}", str(id)) + url = ( + self.client.base_url + + "/2/users/{source_user_id}/following/{target_user_id}" + ) + url = url.replace("{source_user_id}", str(source_user_id)) + url = url.replace("{target_user_id}", str(target_user_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token headers = {} # Prepare request data json_data = None # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.get( + response = self.client.oauth2_session.delete( url, params=params, headers=headers, ) else: - response = self.client.session.get( + response = self.client.session.delete( url, params=params, headers=headers, @@ -1620,19 +1559,19 @@ def get_bookmark_folders( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetBookmarkFoldersResponse.model_validate(response_data) + return UnfollowUserResponse.model_validate(response_data) - def unblock_dms(self, id: Any) -> UnblockDmsResponse: + def block_dms(self, id: Any) -> BlockDmsResponse: """ - Unblock DMs - Unblocks direct messages to or from a specific User by their ID for the authenticated user. + Block DMs + Blocks direct messages to or from a specific User by their ID for the authenticated user. Args: - id: The ID of the target User that the authenticated user requesting to unblock dms for. + id: The ID of the target User that the authenticated user requesting to block dms for. Returns: - UnblockDmsResponse: Response data + BlockDmsResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/dm/unblock" + url = self.client.base_url + "/2/users/{id}/dm/block" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -1661,145 +1600,145 @@ def unblock_dms(self, id: Any) -> UnblockDmsResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UnblockDmsResponse.model_validate(response_data) + return BlockDmsResponse.model_validate(response_data) - def get_pinned_lists( + def get_followers( self, id: Any, - listfields: List = None, + max_results: int = None, + pagination_token: Any = None, + user_fields: List = None, expansions: List = None, - userfields: List = None, - ) -> GetPinnedListsResponse: + tweet_fields: List = None, + ) -> GetFollowersResponse: """ - Get pinned Lists - Retrieves a list of Lists pinned by the authenticated user. + Get followers + Retrieves a list of Users who follow a specific User by their ID. Args: - id: The ID of the authenticated source User for whom to return results. - listfields: A comma separated list of List fields to display. + id: The ID of the User to lookup. + max_results: The maximum number of results. + pagination_token: This parameter is used to get a specified 'page' of results. + user_fields: A comma separated list of User fields to display. expansions: A comma separated list of fields to expand. - userfields: A comma separated list of User fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetPinnedListsResponse: Response data + GetFollowersResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/pinned_lists" + url = self.client.base_url + "/2/users/{id}/followers" url = url.replace("{id}", str(id)) + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if listfields is not None: - params["list.fields"] = ",".join(str(item) for item in listfields) + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetPinnedListsResponse.model_validate(response_data) + return GetFollowersResponse.model_validate(response_data) - def pin_list(self, id: Any, body: PinListRequest) -> PinListResponse: + def get_by_id( + self, + id: Any, + user_fields: List = None, + expansions: List = None, + tweet_fields: List = None, + ) -> GetByIdResponse: """ - Pin List - Causes the authenticated user to pin a specific List by its ID. + Get User by ID + Retrieves details of a specific User by their ID. Args: - id: The ID of the authenticated source User that will pin the List. - body: Request body - Returns: - PinListResponse: Response data + id: The ID of the User to lookup. + user_fields: A comma separated list of User fields to display. + expansions: A comma separated list of fields to expand. + tweet_fields: A comma separated list of Tweet fields to display. + Returns: + GetByIdResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/pinned_lists" + url = self.client.base_url + "/2/users/{id}" url = url.replace("{id}", str(id)) + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} - headers["Content-Type"] = "application/json" # Prepare request data json_data = None - if body is not None: - json_data = ( - body.model_dump(exclude_none=True) - if hasattr(body, "model_dump") - else body - ) # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.post( - url, - params=params, - headers=headers, - json=json_data, - ) - else: - response = self.client.session.post( - url, - params=params, - headers=headers, - json=json_data, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return PinListResponse.model_validate(response_data) + return GetByIdResponse.model_validate(response_data) - def get_liked_posts( - self, - id: Any, - max_results: int = None, - pagination_token: Any = None, - tweetfields: List = None, - expansions: List = None, - mediafields: List = None, - pollfields: List = None, - userfields: List = None, - placefields: List = None, - ) -> GetLikedPostsResponse: + def get_bookmark_folders( + self, id: Any, max_results: int = None, pagination_token: Any = None + ) -> GetBookmarkFoldersResponse: """ - Get liked Posts - Retrieves a list of Posts liked by a specific User by their ID. + Get Bookmark folders + Retrieves a list of Bookmark folders created by the authenticated user. Args: - id: The ID of the User to lookup. + id: The ID of the authenticated source User for whom to return results. max_results: The maximum number of results. pagination_token: This parameter is used to get the next 'page' of results. - tweetfields: A comma separated list of Tweet fields to display. - expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. Returns: - GetLikedPostsResponse: Response data + GetBookmarkFoldersResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/liked_tweets" + url = self.client.base_url + "/2/users/{id}/bookmarks/folders" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -1811,18 +1750,6 @@ def get_liked_posts( params["max_results"] = max_results if pagination_token is not None: params["pagination_token"] = pagination_token - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if mediafields is not None: - params["media.fields"] = ",".join(str(item) for item in mediafields) - if pollfields is not None: - params["poll.fields"] = ",".join(str(item) for item in pollfields) - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if placefields is not None: - params["place.fields"] = ",".join(str(item) for item in placefields) headers = {} # Prepare request data json_data = None @@ -1844,67 +1771,87 @@ def get_liked_posts( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetLikedPostsResponse.model_validate(response_data) + return GetBookmarkFoldersResponse.model_validate(response_data) - def get_bookmarks_by_folder_id( - self, id: Any, folder_id: Any - ) -> GetBookmarksByFolderIdResponse: + def get_following( + self, + id: Any, + max_results: int = None, + pagination_token: Any = None, + user_fields: List = None, + expansions: List = None, + tweet_fields: List = None, + ) -> GetFollowingResponse: """ - Get Bookmarks by folder ID - Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. + Get following + Retrieves a list of Users followed by a specific User by their ID. Args: - id: The ID of the authenticated source User for whom to return results. - folder_id: The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. + id: The ID of the User to lookup. + max_results: The maximum number of results. + pagination_token: This parameter is used to get a specified 'page' of results. + user_fields: A comma separated list of User fields to display. + expansions: A comma separated list of fields to expand. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetBookmarksByFolderIdResponse: Response data + GetFollowingResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/bookmarks/folders/{folder_id}" + url = self.client.base_url + "/2/users/{id}/following" url = url.replace("{id}", str(id)) - url = url.replace("{folder_id}", str(folder_id)) + if self.client.bearer_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.bearer_token}" + ) + elif self.client.access_token: + self.client.session.headers["Authorization"] = ( + f"Bearer {self.client.access_token}" + ) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None # Make the request - if self.client.oauth2_session: - response = self.client.oauth2_session.get( - url, - params=params, - headers=headers, - ) - else: - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + response = self.client.session.get( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetBookmarksByFolderIdResponse.model_validate(response_data) + return GetFollowingResponse.model_validate(response_data) - def like_post( - self, id: Any, body: Optional[LikePostRequest] = None - ) -> LikePostResponse: + def follow_user( + self, id: Any, body: Optional[FollowUserRequest] = None + ) -> FollowUserResponse: """ - Like Post - Causes the authenticated user to Like a specific Post by its ID. + Follow User + Causes the authenticated user to follow a specific user by their ID. Args: - id: The ID of the authenticated source User that is requesting to like the Post. + id: The ID of the authenticated source User that is requesting to follow the target User. body: Request body Returns: - LikePostResponse: Response data + FollowUserResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/likes" + url = self.client.base_url + "/2/users/{id}/following" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -1942,40 +1889,93 @@ def like_post( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return LikePostResponse.model_validate(response_data) + return FollowUserResponse.model_validate(response_data) - def unpin_list(self, id: Any, list_id: Any) -> UnpinListResponse: + def get_timeline( + self, + id: Any, + since_id: Any = None, + until_id: Any = None, + max_results: int = None, + pagination_token: Any = None, + exclude: List = None, + start_time: str = None, + end_time: str = None, + tweet_fields: List = None, + expansions: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetTimelineResponse: """ - Unpin List - Causes the authenticated user to unpin a specific List by its ID. + Get Timeline + Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. Args: - id: The ID of the authenticated source User for whom to return results. - list_id: The ID of the List to unpin. + id: The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. + since_id: The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + until_id: The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + max_results: The maximum number of results. + pagination_token: This parameter is used to get the next 'page' of results. + exclude: The set of entities to exclude (e.g. 'replies' or 'retweets'). + start_time: YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + end_time: YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + tweet_fields: A comma separated list of Tweet fields to display. + expansions: A comma separated list of fields to expand. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - UnpinListResponse: Response data + GetTimelineResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/pinned_lists/{list_id}" + url = self.client.base_url + "/2/users/{id}/timelines/reverse_chronological" url = url.replace("{id}", str(id)) - url = url.replace("{list_id}", str(list_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if since_id is not None: + params["since_id"] = since_id + if until_id is not None: + params["until_id"] = until_id + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if exclude is not None: + params["exclude"] = ",".join(str(item) for item in exclude) + if start_time is not None: + params["start_time"] = start_time + if end_time is not None: + params["end_time"] = end_time + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.delete( + response = self.client.oauth2_session.get( url, params=params, headers=headers, ) else: - response = self.client.session.delete( + response = self.client.session.get( url, params=params, headers=headers, @@ -1985,97 +1985,62 @@ def unpin_list(self, id: Any, list_id: Any) -> UnpinListResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UnpinListResponse.model_validate(response_data) + return GetTimelineResponse.model_validate(response_data) - def get_by_username( + def search( self, - username: str, - userfields: List = None, + query: Any, + max_results: int = None, + next_token: Any = None, + user_fields: List = None, expansions: List = None, - tweetfields: List = None, - ) -> GetByUsernameResponse: + tweet_fields: List = None, + ) -> SearchResponse: """ - Get User by username - Retrieves details of a specific User by their username. + Search Users + Retrieves a list of Users matching a search query. Args: - username: A username. - userfields: A comma separated list of User fields to display. + query: TThe the query string by which to query for users. + max_results: The maximum number of results. + next_token: This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + user_fields: A comma separated list of User fields to display. expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + tweet_fields: A comma separated list of Tweet fields to display. Returns: - GetByUsernameResponse: Response data + SearchResponse: Response data """ - url = self.client.base_url + "/2/users/by/username/{username}" - url = url.replace("{username}", str(username)) - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) + url = self.client.base_url + "/2/users/search" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) + if query is not None: + params["query"] = query + if max_results is not None: + params["max_results"] = max_results + if next_token is not None: + params["next_token"] = next_token + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) if expansions is not None: params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) - headers = {} - # Prepare request data - json_data = None - # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) - # Check for errors - response.raise_for_status() - # Parse the response data - response_data = response.json() - # Convert to Pydantic model if applicable - return GetByUsernameResponse.model_validate(response_data) - - - def delete_bookmark(self, id: Any, tweet_id: Any) -> DeleteBookmarkResponse: - """ - Delete Bookmark - Removes a Post from the authenticated user’s Bookmarks by its ID. - Args: - id: The ID of the authenticated source User whose bookmark is to be removed. - tweet_id: The ID of the Post that the source User is removing from bookmarks. - Returns: - DeleteBookmarkResponse: Response data - """ - url = self.client.base_url + "/2/users/{id}/bookmarks/{tweet_id}" - url = url.replace("{id}", str(id)) - url = url.replace("{tweet_id}", str(tweet_id)) - # Ensure we have a valid access token - if self.client.oauth2_auth and self.client.token: - # Check if token needs refresh - if self.client.is_token_expired(): - self.client.refresh_token() - params = {} + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) headers = {} # Prepare request data json_data = None # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.delete( + response = self.client.oauth2_session.get( url, params=params, headers=headers, ) else: - response = self.client.session.delete( + response = self.client.session.get( url, params=params, headers=headers, @@ -2085,19 +2050,38 @@ def delete_bookmark(self, id: Any, tweet_id: Any) -> DeleteBookmarkResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return DeleteBookmarkResponse.model_validate(response_data) + return SearchResponse.model_validate(response_data) - def block_dms(self, id: Any) -> BlockDmsResponse: + def get_bookmarks( + self, + id: Any, + max_results: int = None, + pagination_token: Any = None, + tweet_fields: List = None, + expansions: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetBookmarksResponse: """ - Block DMs - Blocks direct messages to or from a specific User by their ID for the authenticated user. + Get Bookmarks + Retrieves a list of Posts bookmarked by the authenticated user. Args: - id: The ID of the target User that the authenticated user requesting to block dms for. + id: The ID of the authenticated source User for whom to return results. + max_results: The maximum number of results. + pagination_token: This parameter is used to get the next 'page' of results. + tweet_fields: A comma separated list of Tweet fields to display. + expansions: A comma separated list of fields to expand. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - BlockDmsResponse: Response data + GetBookmarksResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/dm/block" + url = self.client.base_url + "/2/users/{id}/bookmarks" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -2105,18 +2089,34 @@ def block_dms(self, id: Any) -> BlockDmsResponse: if self.client.is_token_expired(): self.client.refresh_token() params = {} + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.post( + response = self.client.oauth2_session.get( url, params=params, headers=headers, ) else: - response = self.client.session.post( + response = self.client.session.get( url, params=params, headers=headers, @@ -2126,22 +2126,22 @@ def block_dms(self, id: Any) -> BlockDmsResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return BlockDmsResponse.model_validate(response_data) + return GetBookmarksResponse.model_validate(response_data) - def repost_post( - self, id: Any, body: Optional[RepostPostRequest] = None - ) -> RepostPostResponse: + def create_bookmark( + self, id: Any, body: CreateBookmarkRequest + ) -> CreateBookmarkResponse: """ - Repost Post - Causes the authenticated user to repost a specific Post by its ID. + Create Bookmark + Adds a post to the authenticated user’s bookmarks. Args: - id: The ID of the authenticated source User that is requesting to repost the Post. + id: The ID of the authenticated source User for whom to add bookmarks. body: Request body Returns: - RepostPostResponse: Response data + CreateBookmarkResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/retweets" + url = self.client.base_url + "/2/users/{id}/bookmarks" url = url.replace("{id}", str(id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: @@ -2179,45 +2179,70 @@ def repost_post( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return RepostPostResponse.model_validate(response_data) + return CreateBookmarkResponse.model_validate(response_data) - def unfollow_user( - self, source_user_id: Any, target_user_id: Any - ) -> UnfollowUserResponse: + def get_reposts_of_me( + self, + max_results: int = None, + pagination_token: Any = None, + tweet_fields: List = None, + expansions: List = None, + media_fields: List = None, + poll_fields: List = None, + user_fields: List = None, + place_fields: List = None, + ) -> GetRepostsOfMeResponse: """ - Unfollow User - Causes the authenticated user to unfollow a specific user by their ID. + Get Reposts of me + Retrieves a list of Posts that repost content from the authenticated user. Args: - source_user_id: The ID of the authenticated source User that is requesting to unfollow the target User. - target_user_id: The ID of the User that the source User is requesting to unfollow. + max_results: The maximum number of results. + pagination_token: This parameter is used to get the next 'page' of results. + tweet_fields: A comma separated list of Tweet fields to display. + expansions: A comma separated list of fields to expand. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - UnfollowUserResponse: Response data + GetRepostsOfMeResponse: Response data """ - url = ( - self.client.base_url - + "/2/users/{source_user_id}/following/{target_user_id}" - ) - url = url.replace("{source_user_id}", str(source_user_id)) - url = url.replace("{target_user_id}", str(target_user_id)) + url = self.client.base_url + "/2/users/reposts_of_me" # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} + if max_results is not None: + params["max_results"] = max_results + if pagination_token is not None: + params["pagination_token"] = pagination_token + if tweet_fields is not None: + params["tweet.fields"] = ",".join(str(item) for item in tweet_fields) + if expansions is not None: + params["expansions"] = ",".join(str(item) for item in expansions) + if media_fields is not None: + params["media.fields"] = ",".join(str(item) for item in media_fields) + if poll_fields is not None: + params["poll.fields"] = ",".join(str(item) for item in poll_fields) + if user_fields is not None: + params["user.fields"] = ",".join(str(item) for item in user_fields) + if place_fields is not None: + params["place.fields"] = ",".join(str(item) for item in place_fields) headers = {} # Prepare request data json_data = None # Make the request if self.client.oauth2_session: - response = self.client.oauth2_session.delete( + response = self.client.oauth2_session.get( url, params=params, headers=headers, ) else: - response = self.client.session.delete( + response = self.client.session.get( url, params=params, headers=headers, @@ -2227,69 +2252,47 @@ def unfollow_user( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return UnfollowUserResponse.model_validate(response_data) + return GetRepostsOfMeResponse.model_validate(response_data) - def get_followers( - self, - id: Any, - max_results: int = None, - pagination_token: Any = None, - userfields: List = None, - expansions: List = None, - tweetfields: List = None, - ) -> GetFollowersResponse: + def unpin_list(self, id: Any, list_id: Any) -> UnpinListResponse: """ - Get followers - Retrieves a list of Users who follow a specific User by their ID. + Unpin List + Causes the authenticated user to unpin a specific List by its ID. Args: - id: The ID of the User to lookup. - max_results: The maximum number of results. - pagination_token: This parameter is used to get a specified 'page' of results. - userfields: A comma separated list of User fields to display. - expansions: A comma separated list of fields to expand. - tweetfields: A comma separated list of Tweet fields to display. + id: The ID of the authenticated source User for whom to return results. + list_id: The ID of the List to unpin. Returns: - GetFollowersResponse: Response data + UnpinListResponse: Response data """ - url = self.client.base_url + "/2/users/{id}/followers" + url = self.client.base_url + "/2/users/{id}/pinned_lists/{list_id}" url = url.replace("{id}", str(id)) - if self.client.bearer_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.bearer_token}" - ) - elif self.client.access_token: - self.client.session.headers["Authorization"] = ( - f"Bearer {self.client.access_token}" - ) + url = url.replace("{list_id}", str(list_id)) # Ensure we have a valid access token if self.client.oauth2_auth and self.client.token: # Check if token needs refresh if self.client.is_token_expired(): self.client.refresh_token() params = {} - if max_results is not None: - params["max_results"] = max_results - if pagination_token is not None: - params["pagination_token"] = pagination_token - if userfields is not None: - params["user.fields"] = ",".join(str(item) for item in userfields) - if expansions is not None: - params["expansions"] = ",".join(str(item) for item in expansions) - if tweetfields is not None: - params["tweet.fields"] = ",".join(str(item) for item in tweetfields) headers = {} # Prepare request data json_data = None # Make the request - response = self.client.session.get( - url, - params=params, - headers=headers, - ) + if self.client.oauth2_session: + response = self.client.oauth2_session.delete( + url, + params=params, + headers=headers, + ) + else: + response = self.client.session.delete( + url, + params=params, + headers=headers, + ) # Check for errors response.raise_for_status() # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return GetFollowersResponse.model_validate(response_data) + return UnpinListResponse.model_validate(response_data) diff --git a/xdk/python/xdk/users/models.py b/xdk/python/xdk/users/models.py index ffa6c09a..e2e8b34c 100644 --- a/xdk/python/xdk/users/models.py +++ b/xdk/python/xdk/users/models.py @@ -16,20 +16,26 @@ from datetime import datetime -# Models for get_me +# Models for like_post -class GetMeResponse(BaseModel): - """Response model for get_me""" +class LikePostRequest(BaseModel): + """Request model for like_post""" + + model_config = ConfigDict(populate_by_name=True) + + +class LikePostResponse(BaseModel): + """Response model for like_post""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for unfollow_list +# Models for unlike_post -class UnfollowListResponse(BaseModel): - """Response model for unfollow_list""" +class UnlikePostResponse(BaseModel): + """Response model for unlike_post""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -58,53 +64,35 @@ class MuteUserResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for unlike_post - - -class UnlikePostResponse(BaseModel): - """Response model for unlike_post""" - - model_config = ConfigDict(populate_by_name=True, extra="allow") - - -# Models for get_posts - - -class GetPostsResponse(BaseModel): - """Response model for get_posts""" - - model_config = ConfigDict(populate_by_name=True, extra="allow") - - -# Models for get_following +# Models for get_pinned_lists -class GetFollowingResponse(BaseModel): - """Response model for get_following""" +class GetPinnedListsResponse(BaseModel): + """Response model for get_pinned_lists""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for follow_user +# Models for pin_list -class FollowUserRequest(BaseModel): - """Request model for follow_user""" +class PinListRequest(BaseModel): + """Request model for pin_list""" model_config = ConfigDict(populate_by_name=True) -class FollowUserResponse(BaseModel): - """Response model for follow_user""" +class PinListResponse(BaseModel): + """Response model for pin_list""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_timeline +# Models for unrepost_post -class GetTimelineResponse(BaseModel): - """Response model for get_timeline""" +class UnrepostPostResponse(BaseModel): + """Response model for unrepost_post""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -118,56 +106,47 @@ class UnmuteUserResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for search - - -class SearchResponse(BaseModel): - """Response model for search""" - - model_config = ConfigDict(populate_by_name=True, extra="allow") - - -# Models for get_owned_lists +# Models for delete_bookmark -class GetOwnedListsResponse(BaseModel): - """Response model for get_owned_lists""" +class DeleteBookmarkResponse(BaseModel): + """Response model for delete_bookmark""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_by_usernames +# Models for get_list_memberships -class GetByUsernamesResponse(BaseModel): - """Response model for get_by_usernames""" +class GetListMembershipsResponse(BaseModel): + """Response model for get_list_memberships""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_mentions +# Models for get_me -class GetMentionsResponse(BaseModel): - """Response model for get_mentions""" +class GetMeResponse(BaseModel): + """Response model for get_me""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_list_memberships +# Models for get_liked_posts -class GetListMembershipsResponse(BaseModel): - """Response model for get_list_memberships""" +class GetLikedPostsResponse(BaseModel): + """Response model for get_liked_posts""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_blocking +# Models for get_posts -class GetBlockingResponse(BaseModel): - """Response model for get_blocking""" +class GetPostsResponse(BaseModel): + """Response model for get_posts""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -196,71 +175,71 @@ class FollowListResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for unrepost_post +# Models for get_by_username -class UnrepostPostResponse(BaseModel): - """Response model for unrepost_post""" +class GetByUsernameResponse(BaseModel): + """Response model for get_by_username""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_reposts_of_me +# Models for get_mentions -class GetRepostsOfMeResponse(BaseModel): - """Response model for get_reposts_of_me""" +class GetMentionsResponse(BaseModel): + """Response model for get_mentions""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_bookmarks +# Models for get_owned_lists -class GetBookmarksResponse(BaseModel): - """Response model for get_bookmarks""" +class GetOwnedListsResponse(BaseModel): + """Response model for get_owned_lists""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for create_bookmark +# Models for repost_post -class CreateBookmarkRequest(BaseModel): - """Request model for create_bookmark""" +class RepostPostRequest(BaseModel): + """Request model for repost_post""" model_config = ConfigDict(populate_by_name=True) -class CreateBookmarkResponse(BaseModel): - """Response model for create_bookmark""" +class RepostPostResponse(BaseModel): + """Response model for repost_post""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_by_ids +# Models for unfollow_list -class GetByIdsResponse(BaseModel): - """Response model for get_by_ids""" +class UnfollowListResponse(BaseModel): + """Response model for unfollow_list""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_by_id +# Models for get_by_ids -class GetByIdResponse(BaseModel): - """Response model for get_by_id""" +class GetByIdsResponse(BaseModel): + """Response model for get_by_ids""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_bookmark_folders +# Models for get_bookmarks_by_folder_id -class GetBookmarkFoldersResponse(BaseModel): - """Response model for get_bookmark_folders""" +class GetBookmarksByFolderIdResponse(BaseModel): + """Response model for get_bookmarks_by_folder_id""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -274,127 +253,148 @@ class UnblockDmsResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_pinned_lists +# Models for get_blocking -class GetPinnedListsResponse(BaseModel): - """Response model for get_pinned_lists""" +class GetBlockingResponse(BaseModel): + """Response model for get_blocking""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for pin_list +# Models for get_by_usernames -class PinListRequest(BaseModel): - """Request model for pin_list""" +class GetByUsernamesResponse(BaseModel): + """Response model for get_by_usernames""" - model_config = ConfigDict(populate_by_name=True) + model_config = ConfigDict(populate_by_name=True, extra="allow") -class PinListResponse(BaseModel): - """Response model for pin_list""" +# Models for unfollow_user + + +class UnfollowUserResponse(BaseModel): + """Response model for unfollow_user""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_liked_posts +# Models for block_dms -class GetLikedPostsResponse(BaseModel): - """Response model for get_liked_posts""" +class BlockDmsResponse(BaseModel): + """Response model for block_dms""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_bookmarks_by_folder_id +# Models for get_followers -class GetBookmarksByFolderIdResponse(BaseModel): - """Response model for get_bookmarks_by_folder_id""" +class GetFollowersResponse(BaseModel): + """Response model for get_followers""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for like_post +# Models for get_by_id -class LikePostRequest(BaseModel): - """Request model for like_post""" +class GetByIdResponse(BaseModel): + """Response model for get_by_id""" - model_config = ConfigDict(populate_by_name=True) + model_config = ConfigDict(populate_by_name=True, extra="allow") -class LikePostResponse(BaseModel): - """Response model for like_post""" +# Models for get_bookmark_folders + + +class GetBookmarkFoldersResponse(BaseModel): + """Response model for get_bookmark_folders""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for unpin_list +# Models for get_following -class UnpinListResponse(BaseModel): - """Response model for unpin_list""" +class GetFollowingResponse(BaseModel): + """Response model for get_following""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_by_username +# Models for follow_user -class GetByUsernameResponse(BaseModel): - """Response model for get_by_username""" +class FollowUserRequest(BaseModel): + """Request model for follow_user""" + + model_config = ConfigDict(populate_by_name=True) + + +class FollowUserResponse(BaseModel): + """Response model for follow_user""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for delete_bookmark +# Models for get_timeline -class DeleteBookmarkResponse(BaseModel): - """Response model for delete_bookmark""" +class GetTimelineResponse(BaseModel): + """Response model for get_timeline""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for block_dms +# Models for search -class BlockDmsResponse(BaseModel): - """Response model for block_dms""" +class SearchResponse(BaseModel): + """Response model for search""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for repost_post +# Models for get_bookmarks -class RepostPostRequest(BaseModel): - """Request model for repost_post""" +class GetBookmarksResponse(BaseModel): + """Response model for get_bookmarks""" + + model_config = ConfigDict(populate_by_name=True, extra="allow") + + +# Models for create_bookmark + + +class CreateBookmarkRequest(BaseModel): + """Request model for create_bookmark""" model_config = ConfigDict(populate_by_name=True) -class RepostPostResponse(BaseModel): - """Response model for repost_post""" +class CreateBookmarkResponse(BaseModel): + """Response model for create_bookmark""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for unfollow_user +# Models for get_reposts_of_me -class UnfollowUserResponse(BaseModel): - """Response model for unfollow_user""" +class GetRepostsOfMeResponse(BaseModel): + """Response model for get_reposts_of_me""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for get_followers +# Models for unpin_list -class GetFollowersResponse(BaseModel): - """Response model for get_followers""" +class UnpinListResponse(BaseModel): + """Response model for unpin_list""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/python/xdk/webhooks/client.py b/xdk/python/xdk/webhooks/client.py index 8cdfd866..5f3a0dd7 100644 --- a/xdk/python/xdk/webhooks/client.py +++ b/xdk/python/xdk/webhooks/client.py @@ -22,13 +22,13 @@ from ..client import Client from .models import ( GetStreamLinksResponse, - ValidateResponse, - DeleteResponse, + CreateStreamLinkResponse, + DeleteStreamLinkResponse, GetResponse, CreateRequest, CreateResponse, - CreateStreamLinkResponse, - DeleteStreamLinkResponse, + ValidateResponse, + DeleteResponse, ) @@ -76,16 +76,31 @@ def get_stream_links( return GetStreamLinksResponse.model_validate(response_data) - def validate(self, webhook_id: Any) -> ValidateResponse: + def create_stream_link( + self, + webhook_id: Any, + tweet_fields: str = None, + expansions: str = None, + media_fields: str = None, + poll_fields: str = None, + user_fields: str = None, + place_fields: str = None, + ) -> CreateStreamLinkResponse: """ - Validate webhook - Triggers a CRC check for a given webhook. + Create stream link + Creates a link to deliver FilteredStream events to the given webhook. Args: - webhook_id: The ID of the webhook to check. + webhook_id: The webhook ID to link to your FilteredStream ruleset. + tweet_fields: A comma separated list of Tweet fields to display. + expansions: A comma separated list of fields to expand. + media_fields: A comma separated list of Media fields to display. + poll_fields: A comma separated list of Poll fields to display. + user_fields: A comma separated list of User fields to display. + place_fields: A comma separated list of Place fields to display. Returns: - ValidateResponse: Response data + CreateStreamLinkResponse: Response data """ - url = self.client.base_url + "/2/webhooks/{webhook_id}" + url = self.client.base_url + "/2/tweets/search/webhooks/{webhook_id}" url = url.replace("{webhook_id}", str(webhook_id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -96,11 +111,23 @@ def validate(self, webhook_id: Any) -> ValidateResponse: f"Bearer {self.client.access_token}" ) params = {} + if tweet_fields is not None: + params["tweet.fields"] = tweet_fields + if expansions is not None: + params["expansions"] = expansions + if media_fields is not None: + params["media.fields"] = media_fields + if poll_fields is not None: + params["poll.fields"] = poll_fields + if user_fields is not None: + params["user.fields"] = user_fields + if place_fields is not None: + params["place.fields"] = place_fields headers = {} # Prepare request data json_data = None # Make the request - response = self.client.session.put( + response = self.client.session.post( url, params=params, headers=headers, @@ -110,19 +137,19 @@ def validate(self, webhook_id: Any) -> ValidateResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return ValidateResponse.model_validate(response_data) + return CreateStreamLinkResponse.model_validate(response_data) - def delete(self, webhook_id: Any) -> DeleteResponse: + def delete_stream_link(self, webhook_id: Any) -> DeleteStreamLinkResponse: """ - Delete webhook - Deletes an existing webhook configuration. + Delete stream link + Deletes a link from FilteredStream events to the given webhook. Args: - webhook_id: The ID of the webhook to delete. + webhook_id: The webhook ID to link to your FilteredStream ruleset. Returns: - DeleteResponse: Response data + DeleteStreamLinkResponse: Response data """ - url = self.client.base_url + "/2/webhooks/{webhook_id}" + url = self.client.base_url + "/2/tweets/search/webhooks/{webhook_id}" url = url.replace("{webhook_id}", str(webhook_id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -147,15 +174,15 @@ def delete(self, webhook_id: Any) -> DeleteResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return DeleteResponse.model_validate(response_data) + return DeleteStreamLinkResponse.model_validate(response_data) - def get(self, webhook_configfields: List = None) -> GetResponse: + def get(self, webhook_config_fields: List = None) -> GetResponse: """ Get webhook Get a list of webhook configs associated with a client app. Args: - webhook_configfields: A comma separated list of WebhookConfig fields to display. + webhook_config_fields: A comma separated list of WebhookConfig fields to display. Returns: GetResponse: Response data """ @@ -169,9 +196,9 @@ def get(self, webhook_configfields: List = None) -> GetResponse: f"Bearer {self.client.access_token}" ) params = {} - if webhook_configfields is not None: + if webhook_config_fields is not None: params["webhook_config.fields"] = ",".join( - str(item) for item in webhook_configfields + str(item) for item in webhook_config_fields ) headers = {} # Prepare request data @@ -233,31 +260,16 @@ def create(self, body: Optional[CreateRequest] = None) -> CreateResponse: return CreateResponse.model_validate(response_data) - def create_stream_link( - self, - webhook_id: Any, - tweetfields: str = None, - expansions: str = None, - mediafields: str = None, - pollfields: str = None, - userfields: str = None, - placefields: str = None, - ) -> CreateStreamLinkResponse: + def validate(self, webhook_id: Any) -> ValidateResponse: """ - Create stream link - Creates a link to deliver FilteredStream events to the given webhook. + Validate webhook + Triggers a CRC check for a given webhook. Args: - webhook_id: The webhook ID to link to your FilteredStream ruleset. - tweetfields: A comma separated list of Tweet fields to display. - expansions: A comma separated list of fields to expand. - mediafields: A comma separated list of Media fields to display. - pollfields: A comma separated list of Poll fields to display. - userfields: A comma separated list of User fields to display. - placefields: A comma separated list of Place fields to display. + webhook_id: The ID of the webhook to check. Returns: - CreateStreamLinkResponse: Response data + ValidateResponse: Response data """ - url = self.client.base_url + "/2/tweets/search/webhooks/{webhook_id}" + url = self.client.base_url + "/2/webhooks/{webhook_id}" url = url.replace("{webhook_id}", str(webhook_id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -268,23 +280,11 @@ def create_stream_link( f"Bearer {self.client.access_token}" ) params = {} - if tweetfields is not None: - params["tweet.fields"] = tweetfields - if expansions is not None: - params["expansions"] = expansions - if mediafields is not None: - params["media.fields"] = mediafields - if pollfields is not None: - params["poll.fields"] = pollfields - if userfields is not None: - params["user.fields"] = userfields - if placefields is not None: - params["place.fields"] = placefields headers = {} # Prepare request data json_data = None # Make the request - response = self.client.session.post( + response = self.client.session.put( url, params=params, headers=headers, @@ -294,19 +294,19 @@ def create_stream_link( # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return CreateStreamLinkResponse.model_validate(response_data) + return ValidateResponse.model_validate(response_data) - def delete_stream_link(self, webhook_id: Any) -> DeleteStreamLinkResponse: + def delete(self, webhook_id: Any) -> DeleteResponse: """ - Delete stream link - Deletes a link from FilteredStream events to the given webhook. + Delete webhook + Deletes an existing webhook configuration. Args: - webhook_id: The webhook ID to link to your FilteredStream ruleset. + webhook_id: The ID of the webhook to delete. Returns: - DeleteStreamLinkResponse: Response data + DeleteResponse: Response data """ - url = self.client.base_url + "/2/tweets/search/webhooks/{webhook_id}" + url = self.client.base_url + "/2/webhooks/{webhook_id}" url = url.replace("{webhook_id}", str(webhook_id)) if self.client.bearer_token: self.client.session.headers["Authorization"] = ( @@ -331,4 +331,4 @@ def delete_stream_link(self, webhook_id: Any) -> DeleteStreamLinkResponse: # Parse the response data response_data = response.json() # Convert to Pydantic model if applicable - return DeleteStreamLinkResponse.model_validate(response_data) + return DeleteResponse.model_validate(response_data) diff --git a/xdk/python/xdk/webhooks/models.py b/xdk/python/xdk/webhooks/models.py index a14a49f5..49bbfdad 100644 --- a/xdk/python/xdk/webhooks/models.py +++ b/xdk/python/xdk/webhooks/models.py @@ -25,20 +25,20 @@ class GetStreamLinksResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for validate +# Models for create_stream_link -class ValidateResponse(BaseModel): - """Response model for validate""" +class CreateStreamLinkResponse(BaseModel): + """Response model for create_stream_link""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for delete +# Models for delete_stream_link -class DeleteResponse(BaseModel): - """Response model for delete""" +class DeleteStreamLinkResponse(BaseModel): + """Response model for delete_stream_link""" model_config = ConfigDict(populate_by_name=True, extra="allow") @@ -67,19 +67,19 @@ class CreateResponse(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for create_stream_link +# Models for validate -class CreateStreamLinkResponse(BaseModel): - """Response model for create_stream_link""" +class ValidateResponse(BaseModel): + """Response model for validate""" model_config = ConfigDict(populate_by_name=True, extra="allow") -# Models for delete_stream_link +# Models for delete -class DeleteStreamLinkResponse(BaseModel): - """Response model for delete_stream_link""" +class DeleteResponse(BaseModel): + """Response model for delete""" model_config = ConfigDict(populate_by_name=True, extra="allow") diff --git a/xdk/typescript/.gitignore b/xdk/typescript/.gitignore new file mode 100644 index 00000000..a2515ba2 --- /dev/null +++ b/xdk/typescript/.gitignore @@ -0,0 +1,17 @@ +xdk/typescript/.gitignore # AUTO-GENERATED FILE - DO NOT EDIT +# This file was automatically generated by the XDK build tool. +# Any manual changes will be overwritten on the next generation. +# Documentation generation outputs +# These are generated by the docs scripts and should not be committed + +# TypeDoc output directories +docs/ +docs/html/ +docs/markdown/ +docs/api/ + +# Mintlify processed documentation +mintlify-docs/ + +# Temporary files created during doc generation +tsconfig.docs.json diff --git a/xdk/typescript/dist/index.cjs b/xdk/typescript/dist/index.cjs index f79765b2..53845ffa 100644 --- a/xdk/typescript/dist/index.cjs +++ b/xdk/typescript/dist/index.cjs @@ -6643,11 +6643,11 @@ var HttpClient = class { }; var httpClient = new HttpClient(); -// src/news/client.ts -var NewsClient = class { +// src/activity/client.ts +var ActivityClient = class { client; /** - * Creates a new news client instance + * Creates a new activity client instance * * @param client - The main X API client instance */ @@ -6672,50 +6672,25 @@ var NewsClient = class { return normalized; } /** - * Get news stories by ID - * Retrieves news story by its ID. - - - * @param id The ID of the news story. - + * Get X activity subscriptions + * Get a list of active subscriptions for XAA - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async get(id, options = {}) { - const paramMappings = { - "news.fields": "newsFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - newsFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/news/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getSubscriptions() { + let path = "/2/activity/subscriptions"; const params = new URLSearchParams(); - if (newsFields !== void 0 && newsFields.length > 0) { - params.append("news.fields", newsFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "GET", @@ -6723,140 +6698,80 @@ var NewsClient = class { finalRequestOptions ); } -}; - -// src/news/models.ts -var models_exports = {}; - -// src/users/client.ts -var UsersClient = class { - client; - /** - * Creates a new users client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Unlike Post - * Causes the authenticated user to Unlike a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to unlike the Post. - - - - * @param tweetId The ID of the Post that the User is requesting to unlike. - + * Create X activity subscription + * Creates a subscription for an X activity event - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unlikePost(id, tweetId) { - let path = "/2/users/{id}/likes/{tweet_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + async createSubscription(options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/activity/subscriptions"; const params = new URLSearchParams(); const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["like.write", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get owned Lists - * Retrieves a list of Lists owned by a specific User by their ID. - - - * @param id The ID of the User to lookup. - + * Activity Stream + * Stream of X Activities - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getOwnedLists(id, options = {}) { + async stream(options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "list.fields": "listFields", - "user.fields": "userFields" + backfill_minutes: "backfillMinutes", + start_time: "startTime", + end_time: "endTime" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - listFields = [], - expansions = [], - userFields = [], + backfillMinutes = void 0, + startTime = void 0, + endTime = void 0, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/owned_lists"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/activity/stream"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (backfillMinutes !== void 0) { + params.append("backfill_minutes", String(backfillMinutes)); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] - }, - { - UserToken: [] } ], ...requestOptions @@ -6868,100 +6783,71 @@ var UsersClient = class { ); } /** - * Get blocking - * Retrieves a list of Users blocked by the specified User ID. + * Update X activity subscription + * Updates a subscription for an X activity event - * @param id The ID of the authenticated source User for whom to return results. + * @param subscriptionId The ID of the subscription to update. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBlocking(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async updateSubscription(subscriptionId, options = {}) { + const normalizedOptions = options || {}; const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], - expansions = [], - tweetFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/blocking"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/activity/subscriptions/{subscription_id}"; + path = path.replace( + "{subscription_id}", + encodeURIComponent(String(subscriptionId)) + ); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["block.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "PUT", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Delete Bookmark - * Removes a Post from the authenticated user’s Bookmarks by its ID. - - - * @param id The ID of the authenticated source User whose bookmark is to be removed. - + * Deletes X activity subscription + * Deletes a subscription for an X activity event - * @param tweetId The ID of the Post that the source User is removing from bookmarks. + * @param subscriptionId The ID of the subscription to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteBookmark(id, tweetId) { - let path = "/2/users/{id}/bookmarks/{tweet_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + async deleteSubscription(subscriptionId) { + let path = "/2/activity/subscriptions/{subscription_id}"; + path = path.replace( + "{subscription_id}", + encodeURIComponent(String(subscriptionId)) + ); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["bookmark.write", "tweet.read", "users.read"] + BearerToken: [] } ] // No optional parameters, using empty request options @@ -6972,45 +6858,69 @@ var UsersClient = class { finalRequestOptions ); } - /** - * Get User by username - * Retrieves details of a specific User by their username. - - - * @param username A username. +}; + +// src/activity/models.ts +var models_exports = {}; + +// src/news/client.ts +var NewsClient = class { + client; + /** + * Creates a new news client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get news stories by ID + * Retrieves news story by its ID. + * @param id The ID of the news story. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByUsername(username, options = {}) { + async get(id, options = {}) { const paramMappings = { - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "news.fields": "newsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - userFields = [], - expansions = [], - tweetFields = [], + newsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/by/username/{username}"; - path = path.replace("{username}", encodeURIComponent(String(username))); + let path = "/2/news/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (newsFields !== void 0 && newsFields.length > 0) { + params.append("news.fields", newsFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -7034,133 +6944,47 @@ var UsersClient = class { ); } /** - * Unpin List - * Causes the authenticated user to unpin a specific List by its ID. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - * @param listId The ID of the List to unpin. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async unpinList(id, listId) { - let path = "/2/users/{id}/pinned_lists/{list_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{list_id}", encodeURIComponent(String(listId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Get Posts - * Retrieves a list of posts authored by a specific User by their ID. + * Search News + * Retrieves a list of News stories matching the specified search query. - * @param id The ID of the User to lookup. + * @param query The search query. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPosts(id, options = {}) { + async search(query, options = {}) { const paramMappings = { - since_id: "sinceId", - until_id: "untilId", max_results: "maxResults", - pagination_token: "paginationToken", - start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + max_age_hours: "maxAgeHours", + "news.fields": "newsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - sinceId = void 0, - untilId = void 0, maxResults = void 0, - paginationToken = void 0, - exclude = [], - startTime = void 0, - endTime = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + maxAgeHours = void 0, + newsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/tweets"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/news/search"; const params = new URLSearchParams(); - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); + if (query !== void 0) { + params.append("query", String(query)); } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (exclude !== void 0 && exclude.length > 0) { - params.append("exclude", exclude.join(",")); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); + if (maxAgeHours !== void 0) { + params.append("max_age_hours", String(maxAgeHours)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (newsFields !== void 0 && newsFields.length > 0) { + params.append("news.fields", newsFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -7170,9 +6994,6 @@ var UsersClient = class { }, { OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] } ], ...requestOptions @@ -7183,143 +7004,153 @@ var UsersClient = class { finalRequestOptions ); } +}; + +// src/news/models.ts +var models_exports2 = {}; + +// src/connections/client.ts +var ConnectionsClient = class { + client; /** - * Get Bookmarks - * Retrieves a list of Posts bookmarked by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - + * Creates a new connections client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Terminate all connections + * Terminates all active streaming connections for the authenticated application. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBookmarks(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + async deleteAll() { + let path = "/2/connections/all"; + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + } + ] + // No optional parameters, using empty request options }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings + return this.client.request( + "DELETE", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions ); - const { - maxResults = void 0, - paginationToken = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/users/{id}/bookmarks"; - path = path.replace("{id}", encodeURIComponent(String(id))); - const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + } +}; + +// src/connections/models.ts +var models_exports3 = {}; + +// src/account_activity/client.ts +var AccountActivityClient = class { + client; + /** + * Creates a new account activity client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } } - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["bookmark.read", "tweet.read", "users.read"] - } - ], - ...requestOptions - }; - return this.client.request( - "GET", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); + return normalized; } /** - * Create Bookmark - * Adds a post to the authenticated user’s bookmarks. - + * Get subscriptions + * Retrieves a list of all active subscriptions for a given webhook. - * @param id The ID of the authenticated source User for whom to add bookmarks. + * @param webhookId The webhook ID to pull subscriptions for. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createBookmark(id, body) { - let path = "/2/users/{id}/bookmarks"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getSubscriptions(webhookId) { + let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["bookmark.write", "tweet.read", "users.read"] + BearerToken: [] } ] // No optional parameters, using empty request options }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Block DMs - * Blocks direct messages to or from a specific User by their ID for the authenticated user. + * Validate subscription + * Checks a user’s Account Activity subscription for a given webhook. - * @param id The ID of the target User that the authenticated user requesting to block dms for. + * @param webhookId The webhook ID to check subscription against. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async blockDms(id) { - let path = "/2/users/{id}/dm/block"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async validateSubscription(webhookId) { + let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.write", "tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "dm.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -7328,112 +7159,72 @@ var UsersClient = class { // No optional parameters, using empty request options }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Unfollow List - * Causes the authenticated user to unfollow a specific List by its ID. - - - * @param id The ID of the authenticated source User that will unfollow the List. - + * Create subscription + * Creates an Account Activity subscription for the user and the given webhook. - * @param listId The ID of the List to unfollow. + * @param webhookId The webhook ID to check subscription against. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unfollowList(id, listId) { - let path = "/2/users/{id}/followed_lists/{list_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{list_id}", encodeURIComponent(String(listId))); + async createSubscription(webhookId, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "dm.write", "tweet.read", "users.read"] }, { UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get muting - * Retrieves a list of Users muted by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - + * Get subscription count + * Retrieves a count of currently active Account Activity subscriptions. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMuting(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], - expansions = [], - tweetFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/users/{id}/muting"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getSubscriptionCount() { + let path = "/2/account_activity/subscriptions/count"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["mute.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "GET", @@ -7442,150 +7233,174 @@ var UsersClient = class { ); } /** - * Mute User - * Causes the authenticated user to mute a specific User by their ID. + * Delete subscription + * Deletes an Account Activity subscription for the given webhook and user ID. - * @param id The ID of the authenticated source User that is requesting to mute the target User. + * @param webhookId The webhook ID to check subscription against. + * @param userId User ID to unsubscribe from. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async muteUser(id, options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/users/{id}/muting"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async deleteSubscription(webhookId, userId) { + let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + path = path.replace("{user_id}", encodeURIComponent(String(userId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["mute.write", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get User by ID - * Retrieves details of a specific User by their ID. + * Create replay job + * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook. - * @param id The ID of the User to lookup. + * @param webhookId The unique identifier for the webhook configuration. - * @returns {Promise} Promise resolving to the API response + * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. + + + + * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { - const paramMappings = { - "user.fields": "userFields", - "tweet.fields": "tweetFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - userFields = [], - expansions = [], - tweetFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/users/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async createReplayJob(webhookId, fromDate, toDate) { + let path = "/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (fromDate !== void 0) { + params.append("from_date", String(fromDate)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (toDate !== void 0) { + params.append("to_date", String(toDate)); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/account_activity/models.ts +var models_exports4 = {}; + +// src/spaces/client.ts +var SpacesClient = class { + client; + /** + * Creates a new spaces client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } /** - * Get my User - * Retrieves details of the authenticated user. + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get space by ID + * Retrieves details of a specific space by its ID. + * @param id The ID of the Space to be retrieved. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMe(options = {}) { + async getById(id, options = {}) { const paramMappings = { + "space.fields": "spaceFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "topic.fields": "topicFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - userFields = [], + spaceFields = [], expansions = [], - tweetFields = [], + userFields = [], + topicFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/me"; + let path = "/2/spaces/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (spaceFields !== void 0 && spaceFields.length > 0) { + params.append("space.fields", spaceFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (topicFields !== void 0 && topicFields.length > 0) { + params.append("topic.fields", topicFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] + BearerToken: [] }, { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -7597,111 +7412,22 @@ var UsersClient = class { ); } /** - * Unrepost Post - * Causes the authenticated user to unrepost a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to repost the Post. - - - - * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async unrepostPost(id, sourceTweetId) { - let path = "/2/users/{id}/retweets/{source_tweet_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace( - "{source_tweet_id}", - encodeURIComponent(String(sourceTweetId)) - ); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Unmute User - * Causes the authenticated user to unmute a specific user by their ID. - - - * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. - - - - * @param targetUserId The ID of the User that the source User is requesting to unmute. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async unmuteUser(sourceUserId, targetUserId) { - let path = "/2/users/{source_user_id}/muting/{target_user_id}"; - path = path.replace( - "{source_user_id}", - encodeURIComponent(String(sourceUserId)) - ); - path = path.replace( - "{target_user_id}", - encodeURIComponent(String(targetUserId)) - ); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["mute.write", "tweet.read", "users.read"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Search Users - * Retrieves a list of Users matching a search query. + * Get Space ticket buyers + * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + * @param id The ID of the Space to be retrieved. - * @param query TThe the query string by which to query for users. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async search(query, options = {}) { + async getBuyers(id, options = {}) { const paramMappings = { + pagination_token: "paginationToken", max_results: "maxResults", - next_token: "nextToken", "user.fields": "userFields", "tweet.fields": "tweetFields" }; @@ -7710,24 +7436,22 @@ var UsersClient = class { paramMappings ); const { + paginationToken = void 0, maxResults = void 0, - nextToken = void 0, userFields = [], expansions = [], tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/search"; + let path = "/2/spaces/{id}/buyers"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } - if (nextToken !== void 0) { - params.append("next_token", String(nextToken)); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } @@ -7741,10 +7465,7 @@ var UsersClient = class { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -7756,53 +7477,73 @@ var UsersClient = class { ); } /** - * Get pinned Lists - * Retrieves a list of Lists pinned by the authenticated user. + * Get Space Posts + * Retrieves a list of Posts shared in a specific Space by its ID. - * @param id The ID of the authenticated source User for whom to return results. + * @param id The ID of the Space to be retrieved. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPinnedLists(id, options = {}) { + async getPosts(id, options = {}) { const paramMappings = { - "list.fields": "listFields", - "user.fields": "userFields" + max_results: "maxResults", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - listFields = [], + maxResults = void 0, + tweetFields = [], expansions = [], + mediaFields = [], + pollFields = [], userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/pinned_lists"; + let path = "/2/spaces/{id}/tweets"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + BearerToken: [] }, { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -7814,86 +7555,107 @@ var UsersClient = class { ); } /** - * Pin List - * Causes the authenticated user to pin a specific List by its ID. - + * Get Spaces by creator IDs + * Retrieves details of Spaces created by specified User IDs. - * @param id The ID of the authenticated source User that will pin the List. + * @param userIds The IDs of Users to search through. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async pinList(id, body) { - let path = "/2/users/{id}/pinned_lists"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getByCreatorIds(userIds, options = {}) { + const paramMappings = { + "space.fields": "spaceFields", + "user.fields": "userFields", + "topic.fields": "topicFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + spaceFields = [], + expansions = [], + userFields = [], + topicFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/spaces/by/creator_ids"; const params = new URLSearchParams(); + if (userIds !== void 0 && userIds.length > 0) { + params.append("user_ids", userIds.join(",")); + } + if (spaceFields !== void 0 && spaceFields.length > 0) { + params.append("space.fields", spaceFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (topicFields !== void 0 && topicFields.length > 0) { + params.append("topic.fields", topicFields.join(",")); + } const finalRequestOptions = { - body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + BearerToken: [] }, { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get followed Lists - * Retrieves a list of Lists followed by a specific User by their ID. + * Get Spaces by IDs + * Retrieves details of multiple Spaces by their IDs. - * @param id The ID of the User to lookup. + * @param ids The list of Space IDs to return. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowedLists(id, options = {}) { + async getByIds(ids, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "list.fields": "listFields", - "user.fields": "userFields" + "space.fields": "spaceFields", + "user.fields": "userFields", + "topic.fields": "topicFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - listFields = [], + spaceFields = [], expansions = [], userFields = [], + topicFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/followed_lists"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/spaces"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); } - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (spaceFields !== void 0 && spaceFields.length > 0) { + params.append("space.fields", spaceFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -7901,6 +7663,9 @@ var UsersClient = class { if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } + if (topicFields !== void 0 && topicFields.length > 0) { + params.append("topic.fields", topicFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ @@ -7908,10 +7673,7 @@ var UsersClient = class { BearerToken: [] }, { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -7923,74 +7685,146 @@ var UsersClient = class { ); } /** - * Follow List - * Causes the authenticated user to follow a specific List by its ID. + * Search Spaces + * Retrieves a list of Spaces matching the specified search query. - * @param id The ID of the authenticated source User that will follow the List. + * @param query The search query. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async followList(id, options = {}) { - const normalizedOptions = options || {}; + async search(query, options = {}) { + const paramMappings = { + max_results: "maxResults", + "space.fields": "spaceFields", + "user.fields": "userFields", + "topic.fields": "topicFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + state = void 0, + maxResults = void 0, + spaceFields = [], + expansions = [], + userFields = [], + topicFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/followed_lists"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/spaces/search"; const params = new URLSearchParams(); + if (query !== void 0) { + params.append("query", String(query)); + } + if (state !== void 0) { + params.append("state", String(state)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (spaceFields !== void 0 && spaceFields.length > 0) { + params.append("space.fields", spaceFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (topicFields !== void 0 && topicFields.length > 0) { + params.append("topic.fields", topicFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + BearerToken: [] }, { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/spaces/models.ts +var models_exports5 = {}; + +// src/trends/client.ts +var TrendsClient = class { + client; /** - * Like Post - * Causes the authenticated user to Like a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to like the Post. - + * Creates a new trends client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get personalized Trends + * Retrieves personalized trending topics for the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async likePost(id, options = {}) { - const normalizedOptions = options || {}; + async getPersonalized(options = {}) { + const paramMappings = { + "personalized_trend.fields": "personalizedTrendFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + personalizedTrendFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/likes"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/users/personalized_trends"; const params = new URLSearchParams(); + if (personalizedTrendFields !== void 0 && personalizedTrendFields.length > 0) { + params.append( + "personalized_trend.fields", + personalizedTrendFields.join(",") + ); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["like.write", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -7999,84 +7833,52 @@ var UsersClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get liked Posts - * Retrieves a list of Posts liked by a specific User by their ID. + * Get Trends by WOEID + * Retrieves trending topics for a specific location identified by its WOEID. - * @param id The ID of the User to lookup. + * @param woeid The WOEID of the place to lookup a trend for. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getLikedPosts(id, options = {}) { + async getByWoeid(woeid, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + max_trends: "maxTrends", + "trend.fields": "trendFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + maxTrends = void 0, + trendFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/liked_tweets"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/trends/by/woeid/{woeid}"; + path = path.replace("{woeid}", encodeURIComponent(String(woeid))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (maxTrends !== void 0) { + params.append("max_trends", String(maxTrends)); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (trendFields !== void 0 && trendFields.length > 0) { + params.append("trend.fields", trendFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["like.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } ], ...requestOptions @@ -8088,46 +7890,114 @@ var UsersClient = class { ); } /** - * Get Users by usernames - * Retrieves details of multiple Users by their usernames. + * Get AI Trends by ID + * Retrieves an AI trend by its ID. + * @param id The ID of the ai trend. - * @param usernames A list of usernames, comma-separated. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByUsernames(usernames, options = {}) { + async getAi(id, options = {}) { const paramMappings = { - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "news.fields": "newsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - userFields = [], - expansions = [], - tweetFields = [], + newsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/by"; + let path = "/2/ai_trends/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (usernames !== void 0 && usernames.length > 0) { - params.append("usernames", usernames.join(",")); + if (newsFields !== void 0 && newsFields.length > 0) { + params.append("news.fields", newsFields.join(",")); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } +}; + +// src/trends/models.ts +var models_exports6 = {}; + +// src/media/client.ts +var MediaClient = class { + client; + /** + * Creates a new media client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + return normalized; + } + /** + * Get Media by media key + * Retrieves details of a specific Media file by its media key. + + + * @param mediaKey A single Media Key. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getByKey(mediaKey, options = {}) { + const paramMappings = { + "media.fields": "mediaFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + mediaFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/media/{media_key}"; + path = path.replace("{media_key}", encodeURIComponent(String(mediaKey))); + const params = new URLSearchParams(); + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -8136,7 +8006,7 @@ var UsersClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -8151,33 +8021,28 @@ var UsersClient = class { ); } /** - * Repost Post - * Causes the authenticated user to repost a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to repost the Post. - + * Create Media metadata + * Creates metadata for a Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async repostPost(id, options = {}) { + async createMetadata(options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/retweets"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/metadata"; const params = new URLSearchParams(); const finalRequestOptions = { body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8192,38 +8057,27 @@ var UsersClient = class { ); } /** - * Unfollow User - * Causes the authenticated user to unfollow a specific user by their ID. - - - * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. - + * Finalize Media upload + * Finalizes a Media upload request. - * @param targetUserId The ID of the User that the source User is requesting to unfollow. + * @param id The media id of the targeted media to finalize. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unfollowUser(sourceUserId, targetUserId) { - let path = "/2/users/{source_user_id}/following/{target_user_id}"; - path = path.replace( - "{source_user_id}", - encodeURIComponent(String(sourceUserId)) - ); - path = path.replace( - "{target_user_id}", - encodeURIComponent(String(targetUserId)) - ); + async finalizeUpload(id) { + let path = "/2/media/upload/{id}/finalize"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["follows.write", "tweet.read", "users.read"] + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8232,69 +8086,75 @@ var UsersClient = class { // No optional parameters, using empty request options }; return this.client.request( - "DELETE", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get followers - * Retrieves a list of Users who follow a specific User by their ID. + * Append Media upload + * Appends data to a Media upload request. - * @param id The ID of the User to lookup. + * @param id The media identifier for the media to perform the append operation. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowers(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async appendUpload(id, options = {}) { + const normalizedOptions = options || {}; const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], - expansions = [], - tweetFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/followers"; + let path = "/2/media/upload/{id}/append"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["media.write"] }, { - OAuth2UserToken: ["follows.read", "tweet.read", "users.read"] + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "POST", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Initialize media upload + * Initializes a media upload. + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async initializeUpload(options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/media/upload/initialize"; + const params = new URLSearchParams(); + const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8303,52 +8163,43 @@ var UsersClient = class { ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Users by IDs - * Retrieves details of multiple Users by their IDs. + * Get Media by media keys + * Retrieves details of Media files by their media keys. - * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. + * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByIds(ids, options = {}) { + async getByKeys(mediaKeys, options = {}) { const paramMappings = { - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "media.fields": "mediaFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - userFields = [], - expansions = [], - tweetFields = [], + mediaFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users"; + let path = "/2/media"; const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (mediaKeys !== void 0 && mediaKeys.length > 0) { + params.append("media_keys", mediaKeys.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -8357,7 +8208,7 @@ var UsersClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -8372,35 +8223,47 @@ var UsersClient = class { ); } /** - * Get Bookmarks by folder ID - * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - + * Get Media upload status + * Retrieves the status of a Media upload by its ID. - * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. + * @param mediaId Media id for the requested media upload status. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBookmarksByFolderId(id, folderId) { - let path = "/2/users/{id}/bookmarks/folders/{folder_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{folder_id}", encodeURIComponent(String(folderId))); + async getUploadStatus(mediaId, options = {}) { + const paramMappings = {}; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + command = void 0, + requestOptions = {} + } = normalizedOptions; + let path = "/2/media/upload"; const params = new URLSearchParams(); + if (mediaId !== void 0) { + params.append("media_id", String(mediaId)); + } + if (command !== void 0) { + params.append("command", String(command)); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["bookmark.read", "tweet.read", "users.read"] + OAuth2UserToken: ["media.write"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( "GET", @@ -8409,114 +8272,100 @@ var UsersClient = class { ); } /** - * Get Bookmark folders - * Retrieves a list of Bookmark folders created by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - + * Upload media + * Uploads a media file for use in posts or other content. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBookmarkFolders(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async upload(options = {}) { + const normalizedOptions = options || {}; const { - maxResults = void 0, - paginationToken = void 0, + body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/bookmarks/folders"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/upload"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["bookmark.read", "users.read"] + OAuth2UserToken: ["media.write"] + }, + { + UserToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get following - * Retrieves a list of Users followed by a specific User by their ID. + * Get Media analytics + * Retrieves analytics data for media. - * @param id The ID of the User to lookup. + * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + + + + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + + + + * @param granularity The granularity for the search counts results. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowing(id, options = {}) { + async getAnalytics(mediaKeys, endTime, startTime, granularity, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "media_analytics.fields": "mediaAnalyticsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], - expansions = [], - tweetFields = [], + mediaAnalyticsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/following"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/analytics"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); + if (mediaKeys !== void 0 && mediaKeys.length > 0) { + params.append("media_keys", mediaKeys.join(",")); } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (granularity !== void 0) { + params.append("granularity", String(granularity)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (mediaAnalyticsFields !== void 0 && mediaAnalyticsFields.length > 0) { + params.append("media_analytics.fields", mediaAnalyticsFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["follows.read", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -8531,33 +8380,28 @@ var UsersClient = class { ); } /** - * Follow User - * Causes the authenticated user to follow a specific user by their ID. - - - * @param id The ID of the authenticated source User that is requesting to follow the target User. - + * Create Media subtitles + * Creates subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async followUser(id, options = {}) { + async createSubtitles(options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/following"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/subtitles"; const params = new URLSearchParams(); const finalRequestOptions = { body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["follows.write", "tweet.read", "users.read"] + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8572,99 +8416,28 @@ var UsersClient = class { ); } /** - * Get Timeline - * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. - - - * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. - + * Delete Media subtitles + * Deletes subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getTimeline(id, options = {}) { - const paramMappings = { - since_id: "sinceId", - until_id: "untilId", - max_results: "maxResults", - pagination_token: "paginationToken", - start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async deleteSubtitles(options = {}) { + const normalizedOptions = options || {}; const { - sinceId = void 0, - untilId = void 0, - maxResults = void 0, - paginationToken = void 0, - exclude = [], - startTime = void 0, - endTime = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/timelines/reverse_chronological"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/subtitles"; const params = new URLSearchParams(); - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (exclude !== void 0 && exclude.length > 0) { - params.append("exclude", exclude.join(",")); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8673,29 +8446,71 @@ var UsersClient = class { ...requestOptions }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/media/models.ts +var models_exports7 = {}; + +// src/direct_messages/client.ts +var DirectMessagesClient = class { + client; /** - * Unblock DMs - * Unblocks direct messages to or from a specific User by their ID for the authenticated user. + * Creates a new direct messages client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Create DM message by participant ID + * Sends a new direct message to a specific participant by their ID. - * @param id The ID of the target User that the authenticated user requesting to unblock dms for. + * @param participantId The ID of the recipient user that will receive the DM. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unblockDms(id) { - let path = "/2/users/{id}/dm/unblock"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async createByParticipantId(participantId, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/dm_conversations/with/{participant_id}/messages"; + path = path.replace( + "{participant_id}", + encodeURIComponent(String(participantId)) + ); const params = new URLSearchParams(); const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { @@ -8704,8 +8519,8 @@ var UsersClient = class { { UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( "POST", @@ -8714,74 +8529,52 @@ var UsersClient = class { ); } /** - * Get mentions - * Retrieves a list of Posts that mention a specific User by their ID. - - - * @param id The ID of the User to lookup. - + * Get DM events + * Retrieves a list of recent direct message events across all conversations. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMentions(id, options = {}) { + async getEvents(options = {}) { const paramMappings = { - since_id: "sinceId", - until_id: "untilId", max_results: "maxResults", pagination_token: "paginationToken", - start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", + event_types: "eventTypes", + "dm_event.fields": "dmEventFields", "media.fields": "mediaFields", - "poll.fields": "pollFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - sinceId = void 0, - untilId = void 0, maxResults = void 0, paginationToken = void 0, - startTime = void 0, - endTime = void 0, - tweetFields = [], + eventTypes = [], + dmEventFields = [], expansions = [], mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/mentions"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/dm_events"; const params = new URLSearchParams(); - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); - } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); + if (eventTypes !== void 0 && eventTypes.length > 0) { + params.append("event_types", eventTypes.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (dmEventFields !== void 0 && dmEventFields.length > 0) { + params.append("dm_event.fields", dmEventFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -8789,23 +8582,17 @@ var UsersClient = class { if (mediaFields !== void 0 && mediaFields.length > 0) { params.append("media.fields", mediaFields.join(",")); } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -8820,24 +8607,27 @@ var UsersClient = class { ); } /** - * Get List memberships - * Retrieves a list of Lists that a specific User is a member of by their ID. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. - * @param id The ID of the User to lookup. + * @param participantId The ID of the participant user for the One to One DM conversation. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getListMemberships(id, options = {}) { + async getEventsByParticipantId(participantId, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - "list.fields": "listFields", - "user.fields": "userFields" + event_types: "eventTypes", + "dm_event.fields": "dmEventFields", + "media.fields": "mediaFields", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -8846,13 +8636,19 @@ var UsersClient = class { const { maxResults = void 0, paginationToken = void 0, - listFields = [], + eventTypes = [], + dmEventFields = [], expansions = [], + mediaFields = [], userFields = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/list_memberships"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/dm_conversations/with/{participant_id}/dm_events"; + path = path.replace( + "{participant_id}", + encodeURIComponent(String(participantId)) + ); const params = new URLSearchParams(); if (maxResults !== void 0) { params.append("max_results", String(maxResults)); @@ -8860,23 +8656,29 @@ var UsersClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (eventTypes !== void 0 && eventTypes.length > 0) { + params.append("event_types", eventTypes.join(",")); + } + if (dmEventFields !== void 0 && dmEventFields.length > 0) { + params.append("dm_event.fields", dmEventFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -8891,23 +8693,27 @@ var UsersClient = class { ); } /** - * Get Reposts of me - * Retrieves a list of Posts that repost content from the authenticated user. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. + + * @param id The DM conversation ID. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getRepostsOfMe(options = {}) { + async getEventsByConversationId(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - "tweet.fields": "tweetFields", + event_types: "eventTypes", + "dm_event.fields": "dmEventFields", "media.fields": "mediaFields", - "poll.fields": "pollFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -8916,15 +8722,16 @@ var UsersClient = class { const { maxResults = void 0, paginationToken = void 0, - tweetFields = [], + eventTypes = [], + dmEventFields = [], expansions = [], mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/reposts_of_me"; + let path = "/2/dm_conversations/{id}/dm_events"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { params.append("max_results", String(maxResults)); @@ -8932,8 +8739,11 @@ var UsersClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (eventTypes !== void 0 && eventTypes.length > 0) { + params.append("event_types", eventTypes.join(",")); + } + if (dmEventFields !== void 0 && dmEventFields.length > 0) { + params.append("dm_event.fields", dmEventFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -8941,20 +8751,17 @@ var UsersClient = class { if (mediaFields !== void 0 && mediaFields.length > 0) { params.append("media.fields", mediaFields.join(",")); } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["timeline.read", "tweet.read"] + OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -8968,57 +8775,21 @@ var UsersClient = class { finalRequestOptions ); } -}; - -// src/users/models.ts -var models_exports2 = {}; - -// src/direct_messages/client.ts -var DirectMessagesClient = class { - client; - /** - * Creates a new direct messages client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. + * Get DM event by ID + * Retrieves details of a specific direct message event by its ID. - * @param participantId The ID of the participant user for the One to One DM conversation. + * @param eventId dm event id. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getEventsByParticipantId(participantId, options = {}) { + async getEventsById(eventId, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - event_types: "eventTypes", "dm_event.fields": "dmEventFields", "media.fields": "mediaFields", "user.fields": "userFields", @@ -9029,9 +8800,6 @@ var DirectMessagesClient = class { paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - eventTypes = [], dmEventFields = [], expansions = [], mediaFields = [], @@ -9039,21 +8807,9 @@ var DirectMessagesClient = class { tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/dm_conversations/with/{participant_id}/dm_events"; - path = path.replace( - "{participant_id}", - encodeURIComponent(String(participantId)) - ); + let path = "/2/dm_events/{event_id}"; + path = path.replace("{event_id}", encodeURIComponent(String(eventId))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (eventTypes !== void 0 && eventTypes.length > 0) { - params.append("event_types", eventTypes.join(",")); - } if (dmEventFields !== void 0 && dmEventFields.length > 0) { params.append("dm_event.fields", dmEventFields.join(",")); } @@ -9088,72 +8844,63 @@ var DirectMessagesClient = class { ); } /** - * Create DM message by conversation ID - * Sends a new direct message to a specific conversation by its ID. + * Delete DM event + * Deletes a specific direct message event by its ID, if owned by the authenticated user. - * @param dmConversationId The DM Conversation ID. + * @param eventId The ID of the direct-message event to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createByConversationId(dmConversationId, options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/dm_conversations/{dm_conversation_id}/messages"; - path = path.replace( - "{dm_conversation_id}", - encodeURIComponent(String(dmConversationId)) - ); + async deleteEvents(eventId) { + let path = "/2/dm_events/{event_id}"; + path = path.replace("{event_id}", encodeURIComponent(String(eventId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.write", "tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "dm.write"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create DM message by participant ID - * Sends a new direct message to a specific participant by their ID. + * Create DM message by conversation ID + * Sends a new direct message to a specific conversation by its ID. - * @param participantId The ID of the recipient user that will receive the DM. + * @param dmConversationId The DM Conversation ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createByParticipantId(participantId, options = {}) { + async createByConversationId(dmConversationId, options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/dm_conversations/with/{participant_id}/messages"; + let path = "/2/dm_conversations/{dm_conversation_id}/messages"; path = path.replace( - "{participant_id}", - encodeURIComponent(String(participantId)) + "{dm_conversation_id}", + encodeURIComponent(String(dmConversationId)) ); const params = new URLSearchParams(); const finalRequestOptions = { @@ -9211,61 +8958,91 @@ var DirectMessagesClient = class { finalRequestOptions ); } +}; + +// src/direct_messages/models.ts +var models_exports8 = {}; + +// src/posts/client.ts +var PostsClient = class { + client; + /** + * Creates a new posts client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } /** - * Get DM event by ID - * Retrieves details of a specific direct message event by its ID. + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get 28-hour Post insights + * Retrieves engagement metrics for specified Posts over the last 28 hours. - * @param eventId dm event id. + * @param tweetIds List of PostIds for 28hr metrics. - * @returns {Promise} Promise resolving to the API response + * @param granularity granularity of metrics response. + + + + * @param requestedMetrics request metrics for historical request. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getEventsById(eventId, options = {}) { + async getInsights28hr(tweetIds, granularity, requestedMetrics, options = {}) { const paramMappings = { - "dm_event.fields": "dmEventFields", - "media.fields": "mediaFields", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "engagement.fields": "engagementFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - dmEventFields = [], - expansions = [], - mediaFields = [], - userFields = [], - tweetFields = [], + engagementFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/dm_events/{event_id}"; - path = path.replace("{event_id}", encodeURIComponent(String(eventId))); + let path = "/2/insights/28hr"; const params = new URLSearchParams(); - if (dmEventFields !== void 0 && dmEventFields.length > 0) { - params.append("dm_event.fields", dmEventFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (tweetIds !== void 0 && tweetIds.length > 0) { + params.append("tweet_ids", tweetIds.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); + if (granularity !== void 0) { + params.append("granularity", String(granularity)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (requestedMetrics !== void 0 && requestedMetrics.length > 0) { + params.append("requested_metrics", requestedMetrics.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (engagementFields !== void 0 && engagementFields.length > 0) { + params.append("engagement.fields", engagementFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -9280,58 +9057,27 @@ var DirectMessagesClient = class { ); } /** - * Delete DM event - * Deletes a specific direct message event by its ID, if owned by the authenticated user. + * Get Reposts + * Retrieves a list of Posts that repost a specific Post by its ID. - * @param eventId The ID of the direct-message event to delete. + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteEvents(eventId) { - let path = "/2/dm_events/{event_id}"; - path = path.replace("{event_id}", encodeURIComponent(String(eventId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["dm.read", "dm.write"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Get DM events - * Retrieves a list of recent direct message events across all conversations. - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getEvents(options = {}) { + async getReposts(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - event_types: "eventTypes", - "dm_event.fields": "dmEventFields", + "tweet.fields": "tweetFields", "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -9340,15 +9086,16 @@ var DirectMessagesClient = class { const { maxResults = void 0, paginationToken = void 0, - eventTypes = [], - dmEventFields = [], + tweetFields = [], expansions = [], mediaFields = [], + pollFields = [], userFields = [], - tweetFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/dm_events"; + let path = "/2/tweets/{id}/retweets"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { params.append("max_results", String(maxResults)); @@ -9356,11 +9103,8 @@ var DirectMessagesClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (eventTypes !== void 0 && eventTypes.length > 0) { - params.append("event_types", eventTypes.join(",")); - } - if (dmEventFields !== void 0 && dmEventFields.length > 0) { - params.append("dm_event.fields", dmEventFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -9368,17 +9112,23 @@ var DirectMessagesClient = class { if (mediaFields !== void 0 && mediaFields.length > 0) { params.append("media.fields", mediaFields.join(",")); } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -9393,57 +9143,86 @@ var DirectMessagesClient = class { ); } /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. + * Search all Posts + * Retrieves Posts from the full archive matching a search query. - * @param id The DM conversation ID. + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getEventsByConversationId(id, options = {}) { + async searchAll(query, options = {}) { const paramMappings = { + start_time: "startTime", + end_time: "endTime", + since_id: "sinceId", + until_id: "untilId", max_results: "maxResults", + next_token: "nextToken", pagination_token: "paginationToken", - event_types: "eventTypes", - "dm_event.fields": "dmEventFields", + sort_order: "sortOrder", + "tweet.fields": "tweetFields", "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { + startTime = void 0, + endTime = void 0, + sinceId = void 0, + untilId = void 0, maxResults = void 0, + nextToken = void 0, paginationToken = void 0, - eventTypes = [], - dmEventFields = [], + sortOrder = void 0, + tweetFields = [], expansions = [], mediaFields = [], + pollFields = [], userFields = [], - tweetFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/dm_conversations/{id}/dm_events"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/tweets/search/all"; const params = new URLSearchParams(); + if (query !== void 0) { + params.append("query", String(query)); + } + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); + } + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); + } + if (untilId !== void 0) { + params.append("until_id", String(untilId)); + } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } + if (nextToken !== void 0) { + params.append("next_token", String(nextToken)); + } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (eventTypes !== void 0 && eventTypes.length > 0) { - params.append("event_types", eventTypes.join(",")); + if (sortOrder !== void 0) { + params.append("sort_order", String(sortOrder)); } - if (dmEventFields !== void 0 && dmEventFields.length > 0) { - params.append("dm_event.fields", dmEventFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -9451,20 +9230,20 @@ var DirectMessagesClient = class { if (mediaFields !== void 0 && mediaFields.length > 0) { params.append("media.fields", mediaFields.join(",")); } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } ], ...requestOptions @@ -9475,92 +9254,100 @@ var DirectMessagesClient = class { finalRequestOptions ); } -}; - -// src/direct_messages/models.ts -var models_exports3 = {}; - -// src/community_notes/client.ts -var CommunityNotesClient = class { - client; - /** - * Creates a new community notes client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Delete a Community Note - * Deletes a community note. + * Get historical Post insights + * Retrieves historical engagement metrics for specified Posts within a defined time range. - * @param id The community note id to delete. + * @param tweetIds List of PostIds for historical metrics. - * @returns {Promise} Promise resolving to the API response + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + + + + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + + + + * @param granularity granularity of metrics response. + + + + * @param requestedMetrics request metrics for historical request. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async delete(id) { - let path = "/2/notes/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getInsightsHistorical(tweetIds, endTime, startTime, granularity, requestedMetrics, options = {}) { + const paramMappings = { + "engagement.fields": "engagementFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + engagementFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/insights/historical"; const params = new URLSearchParams(); + if (tweetIds !== void 0 && tweetIds.length > 0) { + params.append("tweet_ids", tweetIds.join(",")); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); + } + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (granularity !== void 0) { + params.append("granularity", String(granularity)); + } + if (requestedMetrics !== void 0 && requestedMetrics.length > 0) { + params.append("requested_metrics", requestedMetrics.join(",")); + } + if (engagementFields !== void 0 && engagementFields.length > 0) { + params.append("engagement.fields", engagementFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.write"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Search for Posts Eligible for Community Notes - * Returns all the posts that are eligible for community notes. + * Get Post by ID + * Retrieves details of a specific Post by its ID. + * @param id A single Post ID. - * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchEligiblePosts(testMode, options = {}) { + async getById(id, options = {}) { const paramMappings = { - pagination_token: "paginationToken", - max_results: "maxResults", - post_selection: "postSelection", "tweet.fields": "tweetFields", "media.fields": "mediaFields", "poll.fields": "pollFields", @@ -9572,9 +9359,6 @@ var CommunityNotesClient = class { paramMappings ); const { - paginationToken = void 0, - maxResults = void 0, - postSelection = void 0, tweetFields = [], expansions = [], mediaFields = [], @@ -9583,20 +9367,9 @@ var CommunityNotesClient = class { placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/notes/search/posts_eligible_for_notes"; + let path = "/2/tweets/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (testMode !== void 0) { - params.append("test_mode", String(testMode)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (postSelection !== void 0) { - params.append("post_selection", String(postSelection)); - } if (tweetFields !== void 0 && tweetFields.length > 0) { params.append("tweet.fields", tweetFields.join(",")); } @@ -9619,7 +9392,10 @@ var CommunityNotesClient = class { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -9634,89 +9410,99 @@ var CommunityNotesClient = class { ); } /** - * Evaluate a Community Note - * Endpoint to evaluate a community note. + * Delete Post + * Deletes a specific Post by its ID, if owned by the authenticated user. + + * @param id The ID of the Post to be deleted. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async evaluate(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/evaluate_note"; + async delete(id) { + let path = "/2/tweets/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.write"] + OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Search for Community Notes Written - * Returns all the community notes written by the user. + * Get Post analytics + * Retrieves analytics data for specified Posts within a defined time range. - * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. + * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + + + + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + + + + * @param granularity The granularity for the search counts results. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchWritten(testMode, options = {}) { + async getAnalytics(ids, endTime, startTime, granularity, options = {}) { const paramMappings = { - pagination_token: "paginationToken", - max_results: "maxResults", - "note.fields": "noteFields" + "analytics.fields": "analyticsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - paginationToken = void 0, - maxResults = void 0, - noteFields = [], + analyticsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/notes/search/notes_written"; + let path = "/2/tweets/analytics"; const params = new URLSearchParams(); - if (testMode !== void 0) { - params.append("test_mode", String(testMode)); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); } - if (noteFields !== void 0 && noteFields.length > 0) { - params.append("note.fields", noteFields.join(",")); + if (granularity !== void 0) { + params.append("granularity", String(granularity)); + } + if (analyticsFields !== void 0 && analyticsFields.length > 0) { + params.append("analytics.fields", analyticsFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -9731,28 +9517,70 @@ var CommunityNotesClient = class { ); } /** - * Create a Community Note - * Creates a community note endpoint for LLM use case. + * Get Posts by IDs + * Retrieves details of multiple Posts by their IDs. - * @returns {Promise} Promise resolving to the API response + * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async create(options = {}) { - const normalizedOptions = options || {}; + async getByIds(ids, options = {}) { + const paramMappings = { + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/notes"; + let path = "/2/tweets"; const params = new URLSearchParams(); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.write"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -9761,226 +9589,116 @@ var CommunityNotesClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } -}; - -// src/community_notes/models.ts -var models_exports4 = {}; - -// src/posts/client.ts -var PostsClient = class { - client; - /** - * Creates a new posts client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Hide reply - * Hides or unhides a reply to a conversation owned by the authenticated user. - - - * @param tweetId The ID of the reply that you want to hide or unhide. + * Create or Edit Post + * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided. + * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async hideReply(tweetId, options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/tweets/{tweet_id}/hidden"; - path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + async create(body) { + let path = "/2/tweets"; const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, + body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.moderate.write", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "PUT", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Post analytics - * Retrieves analytics data for specified Posts within a defined time range. - - - - * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. - - - - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - - - - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + * Get count of recent Posts + * Retrieves the count of Posts from the last 7 days matching a search query. - * @param granularity The granularity for the search counts results. + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getAnalytics(ids, endTime, startTime, granularity, options = {}) { + async getCountsRecent(query, options = {}) { const paramMappings = { - "analytics.fields": "analyticsFields" + start_time: "startTime", + end_time: "endTime", + since_id: "sinceId", + until_id: "untilId", + next_token: "nextToken", + pagination_token: "paginationToken", + "search_count.fields": "searchCountFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - analyticsFields = [], + startTime = void 0, + endTime = void 0, + sinceId = void 0, + untilId = void 0, + nextToken = void 0, + paginationToken = void 0, + granularity = void 0, + searchCountFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/analytics"; + let path = "/2/tweets/counts/recent"; const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); + if (query !== void 0) { + params.append("query", String(query)); } if (startTime !== void 0) { params.append("start_time", String(startTime)); } - if (granularity !== void 0) { - params.append("granularity", String(granularity)); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } - if (analyticsFields !== void 0 && analyticsFields.length > 0) { - params.append("analytics.fields", analyticsFields.join(",")); + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); } - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] - } - ], - ...requestOptions - }; - return this.client.request( - "GET", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Get historical Post insights - * Retrieves historical engagement metrics for specified Posts within a defined time range. - - - - * @param tweetIds List of PostIds for historical metrics. - - - - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - - - - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - - - - * @param granularity granularity of metrics response. - - - - * @param requestedMetrics request metrics for historical request. - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getInsightsHistorical(tweetIds, endTime, startTime, granularity, requestedMetrics, options = {}) { - const paramMappings = { - "engagement.fields": "engagementFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - engagementFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/insights/historical"; - const params = new URLSearchParams(); - if (tweetIds !== void 0 && tweetIds.length > 0) { - params.append("tweet_ids", tweetIds.join(",")); + if (untilId !== void 0) { + params.append("until_id", String(untilId)); } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); + if (nextToken !== void 0) { + params.append("next_token", String(nextToken)); } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } if (granularity !== void 0) { params.append("granularity", String(granularity)); } - if (requestedMetrics !== void 0 && requestedMetrics.length > 0) { - params.append("requested_metrics", requestedMetrics.join(",")); - } - if (engagementFields !== void 0 && engagementFields.length > 0) { - params.append("engagement.fields", engagementFields.join(",")); + if (searchCountFields !== void 0 && searchCountFields.length > 0) { + params.append("search_count.fields", searchCountFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] - }, - { - UserToken: [] + BearerToken: [] } ], ...requestOptions @@ -9992,8 +9710,8 @@ var PostsClient = class { ); } /** - * Get count of recent Posts - * Retrieves the count of Posts from the last 7 days matching a search query. + * Get count of all Posts + * Retrieves the count of Posts matching a search query from the full archive. @@ -10001,10 +9719,10 @@ var PostsClient = class { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getCountsRecent(query, options = {}) { + async getCountsAll(query, options = {}) { const paramMappings = { start_time: "startTime", end_time: "endTime", @@ -10029,7 +9747,7 @@ var PostsClient = class { searchCountFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/counts/recent"; + let path = "/2/tweets/counts/all"; const params = new URLSearchParams(); if (query !== void 0) { params.append("query", String(query)); @@ -10074,8 +9792,8 @@ var PostsClient = class { ); } /** - * Get count of all Posts - * Retrieves the count of Posts matching a search query from the full archive. + * Search recent Posts + * Retrieves Posts from the last 7 days matching a search query. @@ -10083,18 +9801,24 @@ var PostsClient = class { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getCountsAll(query, options = {}) { + async searchRecent(query, options = {}) { const paramMappings = { start_time: "startTime", end_time: "endTime", since_id: "sinceId", until_id: "untilId", + max_results: "maxResults", next_token: "nextToken", pagination_token: "paginationToken", - "search_count.fields": "searchCountFields" + sort_order: "sortOrder", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -10105,13 +9829,19 @@ var PostsClient = class { endTime = void 0, sinceId = void 0, untilId = void 0, + maxResults = void 0, nextToken = void 0, paginationToken = void 0, - granularity = void 0, - searchCountFields = [], + sortOrder = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/counts/all"; + let path = "/2/tweets/search/recent"; const params = new URLSearchParams(); if (query !== void 0) { params.append("query", String(query)); @@ -10128,23 +9858,47 @@ var PostsClient = class { if (untilId !== void 0) { params.append("until_id", String(untilId)); } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } if (nextToken !== void 0) { params.append("next_token", String(nextToken)); } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (granularity !== void 0) { - params.append("granularity", String(granularity)); + if (sortOrder !== void 0) { + params.append("sort_order", String(sortOrder)); } - if (searchCountFields !== void 0 && searchCountFields.length > 0) { - params.append("search_count.fields", searchCountFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] } ], ...requestOptions @@ -10156,8 +9910,49 @@ var PostsClient = class { ); } /** - * Get Reposts - * Retrieves a list of Posts that repost a specific Post by its ID. + * Hide reply + * Hides or unhides a reply to a conversation owned by the authenticated user. + + + * @param tweetId The ID of the reply that you want to hide or unhide. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async hideReply(tweetId, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/tweets/{tweet_id}/hidden"; + path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + const params = new URLSearchParams(); + const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["tweet.moderate.write", "tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "PUT", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Get Reposted by + * Retrieves a list of Users who reposted a specific Post by its ID. * @param id A single Post ID. @@ -10165,18 +9960,15 @@ var PostsClient = class { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getReposts(id, options = {}) { + async getRepostedBy(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -10185,15 +9977,12 @@ var PostsClient = class { const { maxResults = void 0, paginationToken = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/{id}/retweets"; + let path = "/2/tweets/{id}/retweeted_by"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { @@ -10202,23 +9991,14 @@ var PostsClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -10242,8 +10022,8 @@ var PostsClient = class { ); } /** - * Get Post by ID - * Retrieves details of a specific Post by its ID. + * Get Quoted Posts + * Retrieves a list of Posts that quote a specific Post by its ID. * @param id A single Post ID. @@ -10251,11 +10031,13 @@ var PostsClient = class { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { + async getQuoted(id, options = {}) { const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", "tweet.fields": "tweetFields", "media.fields": "mediaFields", "poll.fields": "pollFields", @@ -10267,6 +10049,9 @@ var PostsClient = class { paramMappings ); const { + maxResults = void 0, + paginationToken = void 0, + exclude = [], tweetFields = [], expansions = [], mediaFields = [], @@ -10275,9 +10060,18 @@ var PostsClient = class { placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/{id}"; + let path = "/2/tweets/{id}/quote_tweets"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (exclude !== void 0 && exclude.length > 0) { + params.append("exclude", exclude.join(",")); + } if (tweetFields !== void 0 && tweetFields.length > 0) { params.append("tweet.fields", tweetFields.join(",")); } @@ -10318,54 +10112,120 @@ var PostsClient = class { ); } /** - * Delete Post - * Deletes a specific Post by its ID, if owned by the authenticated user. + * Get Liking Users + * Retrieves a list of Users who liked a specific Post by its ID. - * @param id The ID of the Post to be deleted. + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async delete(id) { - let path = "/2/tweets/{id}"; + async getLikingUsers(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/tweets/{id}/liking_users"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + OAuth2UserToken: ["like.read", "tweet.read", "users.read"] }, { UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/posts/models.ts +var models_exports9 = {}; + +// src/lists/client.ts +var ListsClient = class { + client; + /** + * Creates a new lists client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } /** - * Get Reposted by - * Retrieves a list of Users who reposted a specific Post by its ID. + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get List members + * Retrieves a list of Users who are members of a specific List by its ID. - * @param id A single Post ID. + * @param id The ID of the List. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getRepostedBy(id, options = {}) { + async getMembers(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", @@ -10384,7 +10244,7 @@ var PostsClient = class { tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/{id}/retweeted_by"; + let path = "/2/lists/{id}/members"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { @@ -10409,7 +10269,7 @@ var PostsClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -10424,57 +10284,104 @@ var PostsClient = class { ); } /** - * Get 28-hour Post insights - * Retrieves engagement metrics for specified Posts over the last 28 hours. + * Add List member + * Adds a User to a specific List by its ID. + * @param id The ID of the List for which to add a member. - * @param tweetIds List of PostIds for 28hr metrics. - * @param granularity granularity of metrics response. + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async addMember(id, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/lists/{id}/members"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "POST", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Get List followers + * Retrieves a list of Users who follow a specific List by its ID. + * @param id The ID of the List. - * @param requestedMetrics request metrics for historical request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getInsights28hr(tweetIds, granularity, requestedMetrics, options = {}) { + async getFollowers(id, options = {}) { const paramMappings = { - "engagement.fields": "engagementFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - engagementFields = [], + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/insights/28hr"; + let path = "/2/lists/{id}/followers"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (tweetIds !== void 0 && tweetIds.length > 0) { - params.append("tweet_ids", tweetIds.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - if (granularity !== void 0) { - params.append("granularity", String(granularity)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } - if (requestedMetrics !== void 0 && requestedMetrics.length > 0) { - params.append("requested_metrics", requestedMetrics.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } - if (engagementFields !== void 0 && engagementFields.length > 0) { - params.append("engagement.fields", engagementFields.join(",")); + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -10489,20 +10396,22 @@ var PostsClient = class { ); } /** - * Get Posts by IDs - * Retrieves details of multiple Posts by their IDs. + * Get List Posts + * Retrieves a list of Posts associated with a specific List by its ID. + * @param id The ID of the List. - * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByIds(ids, options = {}) { + async getPosts(id, options = {}) { const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", "tweet.fields": "tweetFields", "media.fields": "mediaFields", "poll.fields": "pollFields", @@ -10514,6 +10423,8 @@ var PostsClient = class { paramMappings ); const { + maxResults = void 0, + paginationToken = void 0, tweetFields = [], expansions = [], mediaFields = [], @@ -10522,10 +10433,14 @@ var PostsClient = class { placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets"; + let path = "/2/lists/{id}/tweets"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } if (tweetFields !== void 0 && tweetFields.length > 0) { params.append("tweet.fields", tweetFields.join(",")); @@ -10552,7 +10467,7 @@ var PostsClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -10567,25 +10482,32 @@ var PostsClient = class { ); } /** - * Create or Edit Post - * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided. + * Remove List member + * Removes a User from a specific List by its ID and the User’s ID. + * @param id The ID of the List to remove a member. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + + * @param userId The ID of User that will be removed from the List. + + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async create(body) { - let path = "/2/tweets"; + async removeMemberByUserId(id, userId) { + let path = "/2/lists/{id}/members/{user_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{user_id}", encodeURIComponent(String(userId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -10594,66 +10516,59 @@ var PostsClient = class { // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Liking Users - * Retrieves a list of Users who liked a specific Post by its ID. + * Get List by ID + * Retrieves details of a specific List by its ID. - * @param id A single Post ID. + * @param id The ID of the List. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getLikingUsers(id, options = {}) { + async getById(id, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], + listFields = [], expansions = [], - tweetFields = [], + userFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/{id}/liking_users"; + let path = "/2/lists/{id}"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["like.read", "tweet.read", "users.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -10668,312 +10583,109 @@ var PostsClient = class { ); } /** - * Search all Posts - * Retrieves Posts from the full archive matching a search query. + * Update List + * Updates the details of a specific List owned by the authenticated user by its ID. + * @param id The ID of the List to modify. - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchAll(query, options = {}) { - const paramMappings = { - start_time: "startTime", - end_time: "endTime", - since_id: "sinceId", - until_id: "untilId", - max_results: "maxResults", - next_token: "nextToken", - pagination_token: "paginationToken", - sort_order: "sortOrder", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async update(id, options = {}) { + const normalizedOptions = options || {}; const { - startTime = void 0, - endTime = void 0, - sinceId = void 0, - untilId = void 0, - maxResults = void 0, - nextToken = void 0, - paginationToken = void 0, - sortOrder = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/all"; + let path = "/2/lists/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (nextToken !== void 0) { - params.append("next_token", String(nextToken)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (sortOrder !== void 0) { - params.append("sort_order", String(sortOrder)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + }, + { + UserToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "PUT", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Quoted Posts - * Retrieves a list of Posts that quote a specific Post by its ID. + * Delete List + * Deletes a specific List owned by the authenticated user by its ID. - * @param id A single Post ID. + * @param id The ID of the List to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getQuoted(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - maxResults = void 0, - paginationToken = void 0, - exclude = [], - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/tweets/{id}/quote_tweets"; + async delete(id) { + let path = "/2/lists/{id}"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (exclude !== void 0 && exclude.length > 0) { - params.append("exclude", exclude.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Search recent Posts - * Retrieves Posts from the last 7 days matching a search query. - - - - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. + * Create List + * Creates a new List for the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchRecent(query, options = {}) { - const paramMappings = { - start_time: "startTime", - end_time: "endTime", - since_id: "sinceId", - until_id: "untilId", - max_results: "maxResults", - next_token: "nextToken", - pagination_token: "paginationToken", - sort_order: "sortOrder", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async create(options = {}) { + const normalizedOptions = options || {}; const { - startTime = void 0, - endTime = void 0, - sinceId = void 0, - untilId = void 0, - maxResults = void 0, - nextToken = void 0, - paginationToken = void 0, - sortOrder = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/recent"; + let path = "/2/lists"; const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (nextToken !== void 0) { - params.append("next_token", String(nextToken)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (sortOrder !== void 0) { - params.append("sort_order", String(sortOrder)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: [ + "list.read", + "list.write", + "tweet.read", + "users.read" + ] }, { UserToken: [] @@ -10982,21 +10694,21 @@ var PostsClient = class { ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } }; -// src/posts/models.ts -var models_exports5 = {}; +// src/lists/models.ts +var models_exports10 = {}; -// src/trends/client.ts -var TrendsClient = class { +// src/community_notes/client.ts +var CommunityNotesClient = class { client; /** - * Creates a new trends client instance + * Creates a new community notes client instance * * @param client - The main X API client instance */ @@ -11021,136 +10733,124 @@ var TrendsClient = class { return normalized; } /** - * Get AI Trends by ID - * Retrieves an AI trend by its ID. + * Delete a Community Note + * Deletes a community note. - * @param id The ID of the ai trend. + * @param id The community note id to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getAi(id, options = {}) { - const paramMappings = { - "news.fields": "newsFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - newsFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/ai_trends/{id}"; + async delete(id) { + let path = "/2/notes/{id}"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (newsFields !== void 0 && newsFields.length > 0) { - params.append("news.fields", newsFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.write"] + }, + { + UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Trends by WOEID - * Retrieves trending topics for a specific location identified by its WOEID. - - - * @param woeid The WOEID of the place to lookup a trend for. - + * Evaluate a Community Note + * Endpoint to evaluate a community note. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByWoeid(woeid, options = {}) { - const paramMappings = { - max_trends: "maxTrends", - "trend.fields": "trendFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async evaluate(options = {}) { + const normalizedOptions = options || {}; const { - maxTrends = void 0, - trendFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/trends/by/woeid/{woeid}"; - path = path.replace("{woeid}", encodeURIComponent(String(woeid))); + let path = "/2/evaluate_note"; const params = new URLSearchParams(); - if (maxTrends !== void 0) { - params.append("max_trends", String(maxTrends)); - } - if (trendFields !== void 0 && trendFields.length > 0) { - params.append("trend.fields", trendFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.write"] + }, + { + UserToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get personalized Trends - * Retrieves personalized trending topics for the authenticated user. + * Search for Community Notes Written + * Returns all the community notes written by the user. - * @returns {Promise} Promise resolving to the API response + * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPersonalized(options = {}) { + async searchWritten(testMode, options = {}) { const paramMappings = { - "personalized_trend.fields": "personalizedTrendFields" + pagination_token: "paginationToken", + max_results: "maxResults", + "note.fields": "noteFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - personalizedTrendFields = [], + paginationToken = void 0, + maxResults = void 0, + noteFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/personalized_trends"; + let path = "/2/notes/search/notes_written"; const params = new URLSearchParams(); - if (personalizedTrendFields !== void 0 && personalizedTrendFields.length > 0) { - params.append( - "personalized_trend.fields", - personalizedTrendFields.join(",") - ); + if (testMode !== void 0) { + params.append("test_mode", String(testMode)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (noteFields !== void 0 && noteFields.length > 0) { + params.append("note.fields", noteFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -11164,216 +10864,122 @@ var TrendsClient = class { finalRequestOptions ); } -}; - -// src/trends/models.ts -var models_exports6 = {}; - -// src/activity/client.ts -var ActivityClient = class { - client; - /** - * Creates a new activity client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Get X activity subscriptions - * Get a list of active subscriptions for XAA + * Create a Community Note + * Creates a community note endpoint for LLM use case. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getSubscriptions() { - let path = "/2/activity/subscriptions"; + async create(options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/notes"; const params = new URLSearchParams(); const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.write"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create X activity subscription - * Creates a subscription for an X activity event + * Search for Posts Eligible for Community Notes + * Returns all the posts that are eligible for community notes. - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async createSubscription(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/activity/subscriptions"; - const params = new URLSearchParams(); - const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ], - ...requestOptions - }; - return this.client.request( - "POST", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Update X activity subscription - * Updates a subscription for an X activity event - - - * @param subscriptionId The ID of the subscription to update. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async updateSubscription(subscriptionId, options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/activity/subscriptions/{subscription_id}"; - path = path.replace( - "{subscription_id}", - encodeURIComponent(String(subscriptionId)) - ); - const params = new URLSearchParams(); - const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ], - ...requestOptions - }; - return this.client.request( - "PUT", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Deletes X activity subscription - * Deletes a subscription for an X activity event - - - * @param subscriptionId The ID of the subscription to delete. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async deleteSubscription(subscriptionId) { - let path = "/2/activity/subscriptions/{subscription_id}"; - path = path.replace( - "{subscription_id}", - encodeURIComponent(String(subscriptionId)) - ); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Activity Stream - * Stream of X Activities + * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async stream(options = {}) { + async searchEligiblePosts(testMode, options = {}) { const paramMappings = { - backfill_minutes: "backfillMinutes", - start_time: "startTime", - end_time: "endTime" + pagination_token: "paginationToken", + max_results: "maxResults", + post_selection: "postSelection", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - backfillMinutes = void 0, - startTime = void 0, - endTime = void 0, + paginationToken = void 0, + maxResults = void 0, + postSelection = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/activity/stream"; + let path = "/2/notes/search/posts_eligible_for_notes"; const params = new URLSearchParams(); - if (backfillMinutes !== void 0) { - params.append("backfill_minutes", String(backfillMinutes)); + if (testMode !== void 0) { + params.append("test_mode", String(testMode)); } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (postSelection !== void 0) { + params.append("post_selection", String(postSelection)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.read"] + }, + { + UserToken: [] } ], ...requestOptions @@ -11386,14 +10992,14 @@ var ActivityClient = class { } }; -// src/activity/models.ts -var models_exports7 = {}; +// src/community_notes/models.ts +var models_exports11 = {}; -// src/usage/client.ts -var UsageClient = class { +// src/general/client.ts +var GeneralClient = class { client; /** - * Creates a new usage client instance + * Creates a new general client instance * * @param client - The main X API client instance */ @@ -11418,43 +11024,19 @@ var UsageClient = class { return normalized; } /** - * Get usage - * Retrieves usage statistics for Posts over a specified number of days. + * Get OpenAPI Spec. + * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async get(options = {}) { - const paramMappings = { - "usage.fields": "usageFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - days = void 0, - usageFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/usage/tweets"; + async getOpenApiSpec() { + let path = "/2/openapi.json"; const params = new URLSearchParams(); - if (days !== void 0) { - params.append("days", String(days)); - } - if (usageFields !== void 0 && usageFields.length > 0) { - params.append("usage.fields", usageFields.join(",")); - } const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ], - ...requestOptions + // No optional parameters, using empty request options }; return this.client.request( "GET", @@ -11464,14 +11046,14 @@ var UsageClient = class { } }; -// src/usage/models.ts -var models_exports8 = {}; +// src/general/models.ts +var models_exports12 = {}; -// src/spaces/client.ts -var SpacesClient = class { +// src/webhooks/client.ts +var WebhooksClient = class { client; /** - * Creates a new spaces client instance + * Creates a new webhooks client instance * * @param client - The main X API client instance */ @@ -11496,73 +11078,36 @@ var SpacesClient = class { return normalized; } /** - * Get Space Posts - * Retrieves a list of Posts shared in a specific Space by its ID. - - - * @param id The ID of the Space to be retrieved. - + * Get webhook + * Get a list of webhook configs associated with a client app. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPosts(id, options = {}) { + async get(options = {}) { const paramMappings = { - max_results: "maxResults", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + "webhook_config.fields": "webhookConfigFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + webhookConfigFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/spaces/{id}/tweets"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/webhooks"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (webhookConfigFields !== void 0 && webhookConfigFields.length > 0) { + params.append("webhook_config.fields", webhookConfigFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -11574,124 +11119,58 @@ var SpacesClient = class { ); } /** - * Search Spaces - * Retrieves a list of Spaces matching the specified search query. - - - - * @param query The search query. + * Create webhook + * Creates a new webhook configuration. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async search(query, options = {}) { - const paramMappings = { - max_results: "maxResults", - "space.fields": "spaceFields", - "user.fields": "userFields", - "topic.fields": "topicFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async create(options = {}) { + const normalizedOptions = options || {}; const { - state = void 0, - maxResults = void 0, - spaceFields = [], - expansions = [], - userFields = [], - topicFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/spaces/search"; + let path = "/2/webhooks"; const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); - } - if (state !== void 0) { - params.append("state", String(state)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (spaceFields !== void 0 && spaceFields.length > 0) { - params.append("space.fields", spaceFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (topicFields !== void 0 && topicFields.length > 0) { - params.append("topic.fields", topicFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { BearerToken: [] }, { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] + UserToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get space by ID - * Retrieves details of a specific space by its ID. + * Validate webhook + * Triggers a CRC check for a given webhook. - * @param id The ID of the Space to be retrieved. + * @param webhookId The ID of the webhook to check. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { - const paramMappings = { - "space.fields": "spaceFields", - "user.fields": "userFields", - "topic.fields": "topicFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - spaceFields = [], - expansions = [], - userFields = [], - topicFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/spaces/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async validate(webhookId) { + let path = "/2/webhooks/{webhook_id}"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); - if (spaceFields !== void 0 && spaceFields.length > 0) { - params.append("space.fields", spaceFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (topicFields !== void 0 && topicFields.length > 0) { - params.append("topic.fields", topicFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ @@ -11699,64 +11178,34 @@ var SpacesClient = class { BearerToken: [] }, { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] + UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "PUT", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Spaces by creator IDs - * Retrieves details of Spaces created by specified User IDs. + * Delete webhook + * Deletes an existing webhook configuration. + * @param webhookId The ID of the webhook to delete. - * @param userIds The IDs of Users to search through. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByCreatorIds(userIds, options = {}) { - const paramMappings = { - "space.fields": "spaceFields", - "user.fields": "userFields", - "topic.fields": "topicFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - spaceFields = [], - expansions = [], - userFields = [], - topicFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/spaces/by/creator_ids"; + async delete(webhookId) { + let path = "/2/webhooks/{webhook_id}"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); - if (userIds !== void 0 && userIds.length > 0) { - params.append("user_ids", userIds.join(",")); - } - if (spaceFields !== void 0 && spaceFields.length > 0) { - params.append("space.fields", spaceFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (topicFields !== void 0 && topicFields.length > 0) { - params.append("topic.fields", topicFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ @@ -11764,140 +11213,139 @@ var SpacesClient = class { BearerToken: [] }, { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] + UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Space ticket buyers - * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + * Create stream link + * Creates a link to deliver FilteredStream events to the given webhook. - * @param id The ID of the Space to be retrieved. + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBuyers(id, options = {}) { + async createStreamLink(webhookId, options = {}) { const paramMappings = { - pagination_token: "paginationToken", - max_results: "maxResults", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - paginationToken = void 0, - maxResults = void 0, - userFields = [], - expansions = [], - tweetFields = [], + tweetFields = void 0, + expansions = void 0, + mediaFields = void 0, + pollFields = void 0, + userFields = void 0, + placeFields = void 0, requestOptions = {} } = normalizedOptions; - let path = "/2/spaces/{id}/buyers"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/tweets/search/webhooks/{webhook_id}"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (tweetFields !== void 0) { + params.append("tweet.fields", String(tweetFields)); } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); + if (expansions !== void 0) { + params.append("expansions", String(expansions)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (mediaFields !== void 0) { + params.append("media.fields", String(mediaFields)); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (pollFields !== void 0) { + params.append("poll.fields", String(pollFields)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0) { + params.append("user.fields", String(userFields)); + } + if (placeFields !== void 0) { + params.append("place.fields", String(placeFields)); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] + BearerToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Spaces by IDs - * Retrieves details of multiple Spaces by their IDs. + * Delete stream link + * Deletes a link from FilteredStream events to the given webhook. + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @param ids The list of Space IDs to return. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByIds(ids, options = {}) { - const paramMappings = { - "space.fields": "spaceFields", - "user.fields": "userFields", - "topic.fields": "topicFields" + async deleteStreamLink(webhookId) { + let path = "/2/tweets/search/webhooks/{webhook_id}"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + } + ] + // No optional parameters, using empty request options }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings + return this.client.request( + "DELETE", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions ); - const { - spaceFields = [], - expansions = [], - userFields = [], - topicFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/spaces"; + } + /** + * Get stream links + * Get a list of webhook links associated with a filtered stream ruleset. + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getStreamLinks() { + let path = "/2/tweets/search/webhooks"; const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); - } - if (spaceFields !== void 0 && spaceFields.length > 0) { - params.append("space.fields", spaceFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (topicFields !== void 0 && topicFields.length > 0) { - params.append("topic.fields", topicFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "GET", @@ -11907,14 +11355,14 @@ var SpacesClient = class { } }; -// src/spaces/models.ts -var models_exports9 = {}; +// src/webhooks/models.ts +var models_exports13 = {}; -// src/communities/client.ts -var CommunitiesClient = class { +// src/users/client.ts +var UsersClient = class { client; /** - * Creates a new communities client instance + * Creates a new users client instance * * @param client - The main X API client instance */ @@ -11939,35 +11387,46 @@ var CommunitiesClient = class { return normalized; } /** - * Get Community by ID - * Retrieves details of a specific Community by its ID. + * Get Users by usernames + * Retrieves details of multiple Users by their usernames. - * @param id The ID of the Community. + * @param usernames A list of usernames, comma-separated. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { + async getByUsernames(usernames, options = {}) { const paramMappings = { - "community.fields": "communityFields" + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - communityFields = [], + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/communities/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/users/by"; const params = new URLSearchParams(); - if (communityFields !== void 0 && communityFields.length > 0) { - params.append("community.fields", communityFields.join(",")); + if (usernames !== void 0 && usernames.length > 0) { + params.append("usernames", usernames.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -11976,7 +11435,7 @@ var CommunitiesClient = class { BearerToken: [] }, { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -11991,24 +11450,24 @@ var CommunitiesClient = class { ); } /** - * Search Communities - * Retrieves a list of Communities matching the specified search query. + * Get List memberships + * Retrieves a list of Lists that a specific User is a member of by their ID. + * @param id The ID of the User to lookup. - * @param query Query to search communities. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async search(query, options = {}) { + async getListMemberships(id, options = {}) { const paramMappings = { max_results: "maxResults", - next_token: "nextToken", pagination_token: "paginationToken", - "community.fields": "communityFields" + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -12016,33 +11475,38 @@ var CommunitiesClient = class { ); const { maxResults = void 0, - nextToken = void 0, paginationToken = void 0, - communityFields = [], + listFields = [], + expansions = [], + userFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/communities/search"; + let path = "/2/users/{id}/list_memberships"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); - } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } - if (nextToken !== void 0) { - params.append("next_token", String(nextToken)); - } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (communityFields !== void 0 && communityFields.length > 0) { - params.append("community.fields", communityFields.join(",")); + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12056,56 +11520,42 @@ var CommunitiesClient = class { finalRequestOptions ); } -}; - -// src/communities/models.ts -var models_exports10 = {}; - -// src/connections/client.ts -var ConnectionsClient = class { - client; - /** - * Creates a new connections client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Terminate all connections - * Terminates all active streaming connections for the authenticated application. + * Unfollow User + * Causes the authenticated user to unfollow a specific user by their ID. + * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. - * @returns {Promise} Promise resolving to the API response + + + * @param targetUserId The ID of the User that the source User is requesting to unfollow. + + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteAll() { - let path = "/2/connections/all"; + async unfollowUser(sourceUserId, targetUserId) { + let path = "/2/users/{source_user_id}/following/{target_user_id}"; + path = path.replace( + "{source_user_id}", + encodeURIComponent(String(sourceUserId)) + ); + path = path.replace( + "{target_user_id}", + encodeURIComponent(String(targetUserId)) + ); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["follows.write", "tweet.read", "users.read"] + }, + { + UserToken: [] } ] // No optional parameters, using empty request options @@ -12116,134 +11566,96 @@ var ConnectionsClient = class { finalRequestOptions ); } -}; - -// src/connections/models.ts -var models_exports11 = {}; - -// src/media/client.ts -var MediaClient = class { - client; - /** - * Creates a new media client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Get Media analytics - * Retrieves analytics data for media. - + * Unfollow List + * Causes the authenticated user to unfollow a specific List by its ID. - * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. + * @param id The ID of the authenticated source User that will unfollow the List. - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + * @param listId The ID of the List to unfollow. - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - - - * @param granularity The granularity for the search counts results. - - - - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getAnalytics(mediaKeys, endTime, startTime, granularity, options = {}) { - const paramMappings = { - "media_analytics.fields": "mediaAnalyticsFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - mediaAnalyticsFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/media/analytics"; + async unfollowList(id, listId) { + let path = "/2/users/{id}/followed_lists/{list_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{list_id}", encodeURIComponent(String(listId))); const params = new URLSearchParams(); - if (mediaKeys !== void 0 && mediaKeys.length > 0) { - params.append("media_keys", mediaKeys.join(",")); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (granularity !== void 0) { - params.append("granularity", String(granularity)); - } - if (mediaAnalyticsFields !== void 0 && mediaAnalyticsFields.length > 0) { - params.append("media_analytics.fields", mediaAnalyticsFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create Media subtitles - * Creates subtitles for a specific Media file. + * Get Users by IDs + * Retrieves details of multiple Users by their IDs. - * @returns {Promise} Promise resolving to the API response + * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createSubtitles(options = {}) { - const normalizedOptions = options || {}; + async getByIds(ids, options = {}) { + const paramMappings = { + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media/subtitles"; + let path = "/2/users"; const params = new URLSearchParams(); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -12252,34 +11664,39 @@ var MediaClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Delete Media subtitles - * Deletes subtitles for a specific Media file. + * Like Post + * Causes the authenticated user to Like a specific Post by its ID. + + * @param id The ID of the authenticated source User that is requesting to like the Post. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteSubtitles(options = {}) { + async likePost(id, options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/media/subtitles"; + let path = "/2/users/{id}/likes"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + OAuth2UserToken: ["like.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -12288,40 +11705,39 @@ var MediaClient = class { ...requestOptions }; return this.client.request( - "DELETE", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Initialize media upload - * Initializes a media upload. + * Block DMs + * Blocks direct messages to or from a specific User by their ID for the authenticated user. + * @param id The ID of the target User that the authenticated user requesting to block dms for. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async initializeUpload(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/media/upload/initialize"; + async blockDms(id) { + let path = "/2/users/{id}/dm/block"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + OAuth2UserToken: ["dm.write", "tweet.read", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "POST", @@ -12330,41 +11746,102 @@ var MediaClient = class { ); } /** - * Get Media upload status - * Retrieves the status of a Media upload by its ID. + * Get Posts + * Retrieves a list of posts authored by a specific User by their ID. + * @param id The ID of the User to lookup. - * @param mediaId Media id for the requested media upload status. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getUploadStatus(mediaId, options = {}) { - const paramMappings = {}; + async getPosts(id, options = {}) { + const paramMappings = { + since_id: "sinceId", + until_id: "untilId", + max_results: "maxResults", + pagination_token: "paginationToken", + start_time: "startTime", + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - command = void 0, + sinceId = void 0, + untilId = void 0, + maxResults = void 0, + paginationToken = void 0, + exclude = [], + startTime = void 0, + endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media/upload"; + let path = "/2/users/{id}/tweets"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (mediaId !== void 0) { - params.append("media_id", String(mediaId)); + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); } - if (command !== void 0) { - params.append("command", String(command)); + if (untilId !== void 0) { + params.append("until_id", String(untilId)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (exclude !== void 0 && exclude.length > 0) { + params.append("exclude", exclude.join(",")); + } + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -12379,80 +11856,97 @@ var MediaClient = class { ); } /** - * Upload media - * Uploads a media file for use in posts or other content. + * Get Bookmarks by folder ID + * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + + + * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. + + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async upload(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/media/upload"; + async getBookmarksByFolderId(id, folderId) { + let path = "/2/users/{id}/bookmarks/folders/{folder_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{folder_id}", encodeURIComponent(String(folderId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] - }, - { - UserToken: [] + OAuth2UserToken: ["bookmark.read", "tweet.read", "users.read"] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Media by media key - * Retrieves details of a specific Media file by its media key. + * Get muting + * Retrieves a list of Users muted by the authenticated user. - * @param mediaKey A single Media Key. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByKey(mediaKey, options = {}) { + async getMuting(id, options = {}) { const paramMappings = { - "media.fields": "mediaFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - mediaFields = [], + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media/{media_key}"; - path = path.replace("{media_key}", encodeURIComponent(String(mediaKey))); + let path = "/2/users/{id}/muting"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read"] + OAuth2UserToken: ["mute.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12467,25 +11961,25 @@ var MediaClient = class { ); } /** - * Append Media upload - * Appends data to a Media upload request. + * Mute User + * Causes the authenticated user to mute a specific User by their ID. - * @param id The media identifier for the media to perform the append operation. + * @param id The ID of the authenticated source User that is requesting to mute the target User. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async appendUpload(id, options = {}) { + async muteUser(id, options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/media/upload/{id}/append"; + let path = "/2/users/{id}/muting"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { @@ -12493,7 +11987,7 @@ var MediaClient = class { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + OAuth2UserToken: ["mute.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -12508,37 +12002,54 @@ var MediaClient = class { ); } /** - * Get Media by media keys - * Retrieves details of Media files by their media keys. + * Get owned Lists + * Retrieves a list of Lists owned by a specific User by their ID. + * @param id The ID of the User to lookup. - * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByKeys(mediaKeys, options = {}) { + async getOwnedLists(id, options = {}) { const paramMappings = { - "media.fields": "mediaFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - mediaFields = [], + maxResults = void 0, + paginationToken = void 0, + listFields = [], + expansions = [], + userFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media"; + let path = "/2/users/{id}/owned_lists"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (mediaKeys !== void 0 && mediaKeys.length > 0) { - params.append("media_keys", mediaKeys.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -12547,7 +12058,7 @@ var MediaClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read"] + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12562,27 +12073,32 @@ var MediaClient = class { ); } /** - * Finalize Media upload - * Finalizes a Media upload request. + * Unpin List + * Causes the authenticated user to unpin a specific List by its ID. - * @param id The media id of the targeted media to finalize. + * @param id The ID of the authenticated source User for whom to return results. + * @param listId The ID of the List to unpin. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async finalizeUpload(id) { - let path = "/2/media/upload/{id}/finalize"; + async unpinList(id, listId) { + let path = "/2/users/{id}/pinned_lists/{list_id}"; path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{list_id}", encodeURIComponent(String(listId))); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -12591,34 +12107,59 @@ var MediaClient = class { // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create Media metadata - * Creates metadata for a Media file. + * Get User by username + * Retrieves details of a specific User by their username. + + * @param username A username. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createMetadata(options = {}) { - const normalizedOptions = options || {}; + async getByUsername(username, options = {}) { + const paramMappings = { + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media/metadata"; + let path = "/2/users/by/username/{username}"; + path = path.replace("{username}", encodeURIComponent(String(username))); const params = new URLSearchParams(); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -12627,132 +12168,66 @@ var MediaClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } -}; - -// src/media/models.ts -var models_exports12 = {}; - -// src/lists/client.ts -var ListsClient = class { - client; - /** - * Creates a new lists client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Remove List member - * Removes a User from a specific List by its ID and the User’s ID. - - - * @param id The ID of the List to remove a member. - + * Get blocking + * Retrieves a list of Users blocked by the specified User ID. - * @param userId The ID of User that will be removed from the List. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async removeMemberByUserId(id, userId) { - let path = "/2/lists/{id}/members/{user_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{user_id}", encodeURIComponent(String(userId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options + async getBlocking(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Get List by ID - * Retrieves details of a specific List by its ID. - - - * @param id The ID of the List. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { - const paramMappings = { - "list.fields": "listFields", - "user.fields": "userFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings ); const { - listFields = [], - expansions = [], + maxResults = void 0, + paginationToken = void 0, userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}"; + let path = "/2/users/{id}/blocking"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + OAuth2UserToken: ["block.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12767,33 +12242,75 @@ var ListsClient = class { ); } /** - * Update List - * Updates the details of a specific List owned by the authenticated user by its ID. + * Get liked Posts + * Retrieves a list of Posts liked by a specific User by their ID. - * @param id The ID of the List to modify. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async update(id, options = {}) { - const normalizedOptions = options || {}; + async getLikedPosts(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + maxResults = void 0, + paginationToken = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}"; + let path = "/2/users/{id}/liked_tweets"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + OAuth2UserToken: ["like.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12802,33 +12319,38 @@ var ListsClient = class { ...requestOptions }; return this.client.request( - "PUT", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Delete List - * Deletes a specific List owned by the authenticated user by its ID. + * Unlike Post + * Causes the authenticated user to Unlike a specific Post by its ID. - * @param id The ID of the List to delete. + * @param id The ID of the authenticated source User that is requesting to unlike the Post. + * @param tweetId The ID of the Post that the User is requesting to unlike. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async delete(id) { - let path = "/2/lists/{id}"; + async unlikePost(id, tweetId) { + let path = "/2/users/{id}/likes/{tweet_id}"; path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + OAuth2UserToken: ["like.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -12843,24 +12365,24 @@ var ListsClient = class { ); } /** - * Get List members - * Retrieves a list of Users who are members of a specific List by its ID. + * Get followed Lists + * Retrieves a list of Lists followed by a specific User by their ID. - * @param id The ID of the List. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMembers(id, options = {}) { + async getFollowedLists(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -12869,12 +12391,12 @@ var ListsClient = class { const { maxResults = void 0, paginationToken = void 0, - userFields = [], + listFields = [], expansions = [], - tweetFields = [], + userFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}/members"; + let path = "/2/users/{id}/followed_lists"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { @@ -12883,14 +12405,14 @@ var ListsClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -12914,25 +12436,25 @@ var ListsClient = class { ); } /** - * Add List member - * Adds a User to a specific List by its ID. + * Follow List + * Causes the authenticated user to follow a specific List by its ID. - * @param id The ID of the List for which to add a member. + * @param id The ID of the authenticated source User that will follow the List. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async addMember(id, options = {}) { + async followList(id, options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}/members"; + let path = "/2/users/{id}/followed_lists"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { @@ -12955,63 +12477,99 @@ var ListsClient = class { ); } /** - * Get List followers - * Retrieves a list of Users who follow a specific List by its ID. + * Get Timeline + * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. - * @param id The ID of the List. + * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowers(id, options = {}) { + async getTimeline(id, options = {}) { const paramMappings = { + since_id: "sinceId", + until_id: "untilId", max_results: "maxResults", pagination_token: "paginationToken", + start_time: "startTime", + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { + sinceId = void 0, + untilId = void 0, maxResults = void 0, paginationToken = void 0, - userFields = [], - expansions = [], + exclude = [], + startTime = void 0, + endTime = void 0, tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}/followers"; + let path = "/2/users/{id}/timelines/reverse_chronological"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); + } + if (untilId !== void 0) { + params.append("until_id", String(untilId)); + } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (exclude !== void 0 && exclude.length > 0) { + params.append("exclude", exclude.join(",")); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } if (tweetFields !== void 0 && tweetFields.length > 0) { params.append("tweet.fields", tweetFields.join(",")); } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -13026,76 +12584,48 @@ var ListsClient = class { ); } /** - * Get List Posts - * Retrieves a list of Posts associated with a specific List by its ID. + * Get pinned Lists + * Retrieves a list of Lists pinned by the authenticated user. - * @param id The ID of the List. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPosts(id, options = {}) { + async getPinnedLists(id, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - tweetFields = [], + listFields = [], expansions = [], - mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}/tweets"; + let path = "/2/users/{id}/pinned_lists"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ - { - BearerToken: [] - }, { OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, @@ -13112,39 +12642,36 @@ var ListsClient = class { ); } /** - * Create List - * Creates a new List for the authenticated user. + * Pin List + * Causes the authenticated user to pin a specific List by its ID. + + * @param id The ID of the authenticated source User that will pin the List. - * @returns {Promise} Promise resolving to the API response + + + * @param body Request body + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async create(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/lists"; + async pinList(id, body) { + let path = "/2/users/{id}/pinned_lists"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, + body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: [ - "list.read", - "list.write", - "tweet.read", - "users.read" - ] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "POST", @@ -13152,75 +12679,74 @@ var ListsClient = class { finalRequestOptions ); } -}; - -// src/lists/models.ts -var models_exports13 = {}; - -// src/compliance/client.ts -var ComplianceClient = class { - client; - /** - * Creates a new compliance client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Get Compliance Job by ID - * Retrieves details of a specific Compliance Job by its ID. - - - * @param id The ID of the Compliance Job to retrieve. - + * Get Reposts of me + * Retrieves a list of Posts that repost content from the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getJobsById(id, options = {}) { + async getRepostsOfMe(options = {}) { const paramMappings = { - "compliance_job.fields": "complianceJobFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - complianceJobFields = [], + maxResults = void 0, + paginationToken = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/compliance/jobs/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/users/reposts_of_me"; const params = new URLSearchParams(); - if (complianceJobFields !== void 0 && complianceJobFields.length > 0) { - params.append("compliance_job.fields", complianceJobFields.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["timeline.read", "tweet.read"] + }, + { + UserToken: [] } ], ...requestOptions @@ -13232,47 +12758,66 @@ var ComplianceClient = class { ); } /** - * Get Compliance Jobs - * Retrieves a list of Compliance Jobs filtered by job type and optional status. + * Get following + * Retrieves a list of Users followed by a specific User by their ID. + * @param id The ID of the User to lookup. - * @param type Type of Compliance Job to list. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getJobs(type, options = {}) { + async getFollowing(id, options = {}) { const paramMappings = { - "compliance_job.fields": "complianceJobFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - status = void 0, - complianceJobFields = [], + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/compliance/jobs"; + let path = "/2/users/{id}/following"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (type !== void 0) { - params.append("type", String(type)); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - if (status !== void 0) { - params.append("status", String(status)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } - if (complianceJobFields !== void 0 && complianceJobFields.length > 0) { - params.append("compliance_job.fields", complianceJobFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] + }, + { + OAuth2UserToken: ["follows.read", "tweet.read", "users.read"] + }, + { + UserToken: [] } ], ...requestOptions @@ -13284,28 +12829,39 @@ var ComplianceClient = class { ); } /** - * Create Compliance Job - * Creates a new Compliance Job for the specified job type. + * Follow User + * Causes the authenticated user to follow a specific user by their ID. + * @param id The ID of the authenticated source User that is requesting to follow the target User. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createJobs(body) { - let path = "/2/compliance/jobs"; + async followUser(id, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/following"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { - body: JSON.stringify(body || {}), + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["follows.write", "tweet.read", "users.read"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( "POST", @@ -13313,53 +12869,443 @@ var ComplianceClient = class { finalRequestOptions ); } -}; - -// src/compliance/models.ts -var models_exports14 = {}; - -// src/general/client.ts -var GeneralClient = class { - client; /** - * Creates a new general client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; + * Unblock DMs + * Unblocks direct messages to or from a specific User by their ID for the authenticated user. + + + * @param id The ID of the target User that the authenticated user requesting to unblock dms for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async unblockDms(id) { + let path = "/2/users/{id}/dm/unblock"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["dm.write", "tweet.read", "users.read"] + }, + { + UserToken: [] + } + ] + // No optional parameters, using empty request options + }; + return this.client.request( + "POST", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Get mentions + * Retrieves a list of Posts that mention a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getMentions(id, options = {}) { + const paramMappings = { + since_id: "sinceId", + until_id: "untilId", + max_results: "maxResults", + pagination_token: "paginationToken", + start_time: "startTime", + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + sinceId = void 0, + untilId = void 0, + maxResults = void 0, + paginationToken = void 0, + startTime = void 0, + endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/mentions"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); + } + if (untilId !== void 0) { + params.append("until_id", String(untilId)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Get Bookmark folders + * Retrieves a list of Bookmark folders created by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getBookmarkFolders(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + paginationToken = void 0, + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/bookmarks/folders"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["bookmark.read", "users.read"] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Unrepost Post + * Causes the authenticated user to unrepost a specific Post by its ID. + + + * @param id The ID of the authenticated source User that is requesting to repost the Post. + + + + * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async unrepostPost(id, sourceTweetId) { + let path = "/2/users/{id}/retweets/{source_tweet_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace( + "{source_tweet_id}", + encodeURIComponent(String(sourceTweetId)) + ); + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + }, + { + UserToken: [] + } + ] + // No optional parameters, using empty request options + }; + return this.client.request( + "DELETE", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Delete Bookmark + * Removes a Post from the authenticated user’s Bookmarks by its ID. + + + * @param id The ID of the authenticated source User whose bookmark is to be removed. + + + + * @param tweetId The ID of the Post that the source User is removing from bookmarks. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async deleteBookmark(id, tweetId) { + let path = "/2/users/{id}/bookmarks/{tweet_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["bookmark.write", "tweet.read", "users.read"] + } + ] + // No optional parameters, using empty request options + }; + return this.client.request( + "DELETE", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Repost Post + * Causes the authenticated user to repost a specific Post by its ID. + + + * @param id The ID of the authenticated source User that is requesting to repost the Post. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async repostPost(id, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/retweets"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "POST", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); } /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + * Search Users + * Retrieves a list of Users matching a search query. + + + + * @param query TThe the query string by which to query for users. + + + + * @returns {Promise} Promise resolving to the API response */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; + // Overload 1: Default behavior (unwrapped response) + async search(query, options = {}) { + const paramMappings = { + max_results: "maxResults", + next_token: "nextToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + nextToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/search"; + const params = new URLSearchParams(); + if (query !== void 0) { + params.append("query", String(query)); } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - return normalized; + if (nextToken !== void 0) { + params.append("next_token", String(nextToken)); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); } /** - * Get OpenAPI Spec. - * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) + * Get User by ID + * Retrieves details of a specific User by their ID. + + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getOpenApiSpec() { - let path = "/2/openapi.json"; + async getById(id, options = {}) { + const paramMappings = { + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + userFields = [], + expansions = [], + tweetFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { - // No optional parameters, using empty request options + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions }; return this.client.request( "GET", @@ -13367,102 +13313,179 @@ var GeneralClient = class { finalRequestOptions ); } -}; - -// src/general/models.ts -var models_exports15 = {}; - -// src/account_activity/client.ts -var AccountActivityClient = class { - client; - /** - * Creates a new account activity client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + * Get Bookmarks + * Retrieves a list of Posts bookmarked by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; + // Overload 1: Default behavior (unwrapped response) + async getBookmarks(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + paginationToken = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/bookmarks"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } - return normalized; + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["bookmark.read", "tweet.read", "users.read"] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); } /** - * Validate subscription - * Checks a user’s Account Activity subscription for a given webhook. + * Create Bookmark + * Adds a post to the authenticated user’s bookmarks. - * @param webhookId The webhook ID to check subscription against. + * @param id The ID of the authenticated source User for whom to add bookmarks. - * @returns {Promise} Promise resolving to the API response + * @param body Request body + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async validateSubscription(webhookId) { - let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + async createBookmark(id, body) { + let path = "/2/users/{id}/bookmarks"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { + body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "dm.write", "tweet.read", "users.read"] - }, - { - UserToken: [] + OAuth2UserToken: ["bookmark.write", "tweet.read", "users.read"] } ] // No optional parameters, using empty request options }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create subscription - * Creates an Account Activity subscription for the user and the given webhook. + * Get followers + * Retrieves a list of Users who follow a specific User by their ID. - * @param webhookId The webhook ID to check subscription against. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createSubscription(webhookId, options = {}) { - const normalizedOptions = options || {}; + async getFollowers(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + let path = "/2/users/{id}/followers"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "dm.write", "tweet.read", "users.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["follows.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -13471,31 +13494,57 @@ var AccountActivityClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get subscription count - * Retrieves a count of currently active Account Activity subscriptions. + * Get my User + * Retrieves details of the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getSubscriptionCount() { - let path = "/2/account_activity/subscriptions/count"; + async getMe(options = {}) { + const paramMappings = { + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + userFields = [], + expansions = [], + tweetFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/me"; const params = new URLSearchParams(); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( "GET", @@ -13504,124 +13553,206 @@ var AccountActivityClient = class { ); } /** - * Get subscriptions - * Retrieves a list of all active subscriptions for a given webhook. + * Unmute User + * Causes the authenticated user to unmute a specific user by their ID. - * @param webhookId The webhook ID to pull subscriptions for. + * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. + * @param targetUserId The ID of the User that the source User is requesting to unmute. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getSubscriptions(webhookId) { - let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + async unmuteUser(sourceUserId, targetUserId) { + let path = "/2/users/{source_user_id}/muting/{target_user_id}"; + path = path.replace( + "{source_user_id}", + encodeURIComponent(String(sourceUserId)) + ); + path = path.replace( + "{target_user_id}", + encodeURIComponent(String(targetUserId)) + ); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["mute.write", "tweet.read", "users.read"] + }, + { + UserToken: [] } ] // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/users/models.ts +var models_exports14 = {}; + +// src/communities/client.ts +var CommunitiesClient = class { + client; /** - * Create replay job - * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook. - - - * @param webhookId The unique identifier for the webhook configuration. - - - - - * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. + * Creates a new communities client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get Community by ID + * Retrieves details of a specific Community by its ID. + * @param id The ID of the Community. - * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createReplayJob(webhookId, fromDate, toDate) { - let path = "/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + async getById(id, options = {}) { + const paramMappings = { + "community.fields": "communityFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + communityFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/communities/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (fromDate !== void 0) { - params.append("from_date", String(fromDate)); - } - if (toDate !== void 0) { - params.append("to_date", String(toDate)); + if (communityFields !== void 0 && communityFields.length > 0) { + params.append("community.fields", communityFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] + }, + { + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Delete subscription - * Deletes an Account Activity subscription for the given webhook and user ID. - - - * @param webhookId The webhook ID to check subscription against. - + * Search Communities + * Retrieves a list of Communities matching the specified search query. - * @param userId User ID to unsubscribe from. + * @param query Query to search communities. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteSubscription(webhookId, userId) { - let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); - path = path.replace("{user_id}", encodeURIComponent(String(userId))); + async search(query, options = {}) { + const paramMappings = { + max_results: "maxResults", + next_token: "nextToken", + pagination_token: "paginationToken", + "community.fields": "communityFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + nextToken = void 0, + paginationToken = void 0, + communityFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/communities/search"; const params = new URLSearchParams(); + if (query !== void 0) { + params.append("query", String(query)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (nextToken !== void 0) { + params.append("next_token", String(nextToken)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (communityFields !== void 0 && communityFields.length > 0) { + params.append("community.fields", communityFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } }; -// src/account_activity/models.ts -var models_exports16 = {}; +// src/communities/models.ts +var models_exports15 = {}; // src/stream/event_driven_stream.ts var StreamEvent = { @@ -13999,8 +14130,8 @@ var StreamClient = class { return eventStream; } /** - * Stream all Posts - * Streams all public Posts in real-time. + * Stream Portuguese Posts + * Streams all public Portuguese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14014,10 +14145,10 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehose(partition, options = {}) { + async postsFirehosePt(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehose"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehosePt"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", @@ -14046,7 +14177,7 @@ var StreamClient = class { signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/firehose/stream"; + let path = "/2/tweets/firehose/stream/lang/pt"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14108,8 +14239,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Post labels - * Streams all labeling events applied to Posts. + * Stream Japanese Posts + * Streams all public Japanese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14117,16 +14248,25 @@ var StreamClient = class { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - async labelsCompliance(options = {}) { + async postsFirehoseJa(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "labelsCompliance"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseJa"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime" + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14136,21 +14276,48 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/label/stream"; + let path = "/2/tweets/firehose/stream/lang/ja"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } + if (partition !== void 0) { + params.append("partition", String(partition)); + } if (startTime !== void 0) { params.append("start_time", String(startTime)); } if (endTime !== void 0) { params.append("end_time", String(endTime)); } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14181,8 +14348,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Likes compliance data - * Streams all compliance data related to Likes for Users. + * Stream 10% sampled Posts + * Streams a 10% sample of public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14190,16 +14357,25 @@ var StreamClient = class { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - async likesCompliance(options = {}) { + async postsSample10(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "likesCompliance"); + this.client.validateAuthentication(requiredAuthTypes, "postsSample10"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime" + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14209,21 +14385,48 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/likes/compliance/stream"; + let path = "/2/tweets/sample10/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } + if (partition !== void 0) { + params.append("partition", String(partition)); + } if (startTime !== void 0) { params.append("start_time", String(startTime)); } if (endTime !== void 0) { params.append("end_time", String(endTime)); } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14254,8 +14457,8 @@ var StreamClient = class { return eventStream; } /** - * Stream sampled Likes - * Streams a 10% sample of public Likes in real-time. + * Stream Korean Posts + * Streams all public Korean-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14269,17 +14472,19 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async likesSample10(partition, options = {}) { + async postsFirehoseKo(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "likesSample10"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseKo"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", end_time: "endTime", - "like_with_tweet_author.fields": "likeWithTweetAuthorFields", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14289,15 +14494,17 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - likeWithTweetAuthorFields = [], + tweetFields = [], expansions = [], + mediaFields = [], + pollFields = [], userFields = [], - tweetFields = [], + placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/likes/sample10/stream"; + let path = "/2/tweets/firehose/stream/lang/ko"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14311,20 +14518,23 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (likeWithTweetAuthorFields !== void 0 && likeWithTweetAuthorFields.length > 0) { - params.append( - "like_with_tweet_author.fields", - likeWithTweetAuthorFields.join(",") - ); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { @@ -14356,8 +14566,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Portuguese Posts - * Streams all public Portuguese-language Posts in real-time. + * Stream Likes compliance data + * Streams all compliance data related to Likes for Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14365,25 +14575,16 @@ var StreamClient = class { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehosePt(partition, options = {}) { + async likesCompliance(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehosePt"); + this.client.validateAuthentication(requiredAuthTypes, "likesCompliance"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + end_time: "endTime" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14392,48 +14593,21 @@ var StreamClient = class { const { backfillMinutes = void 0, startTime = void 0, - endTime = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], - headers = {}, - signal, - requestOptions = {} - } = normalizedOptions; - let path = "/2/tweets/firehose/stream/lang/pt"; - const params = new URLSearchParams(); - if (backfillMinutes !== void 0) { - params.append("backfill_minutes", String(backfillMinutes)); - } - if (partition !== void 0) { - params.append("partition", String(partition)); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); + endTime = void 0, + headers = {}, + signal, + requestOptions = {} + } = normalizedOptions; + let path = "/2/likes/compliance/stream"; + const params = new URLSearchParams(); + if (backfillMinutes !== void 0) { + params.append("backfill_minutes", String(backfillMinutes)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { @@ -14465,8 +14639,8 @@ var StreamClient = class { return eventStream; } /** - * Stream English Posts - * Streams all public English-language Posts in real-time. + * Stream Posts compliance data + * Streams all compliance data related to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14480,19 +14654,14 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehoseEn(partition, options = {}) { + async postsCompliance(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseEn"); + this.client.validateAuthentication(requiredAuthTypes, "postsCompliance"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + end_time: "endTime" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14502,17 +14671,11 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/firehose/stream/lang/en"; + let path = "/2/tweets/compliance/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14526,24 +14689,6 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14574,8 +14719,8 @@ var StreamClient = class { return eventStream; } /** - * Stream filtered Posts - * Streams Posts in real-time matching the active rule set. + * Stream all Likes + * Streams all public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14583,21 +14728,23 @@ var StreamClient = class { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - async posts(options = {}) { + async likesFirehose(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "posts"); + this.client.validateAuthentication(requiredAuthTypes, "likesFirehose"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", + "like_with_tweet_author.fields": "likeWithTweetAuthorFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14607,44 +14754,42 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - tweetFields = [], + likeWithTweetAuthorFields = [], expansions = [], - mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + tweetFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/stream"; + let path = "/2/likes/firehose/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } + if (partition !== void 0) { + params.append("partition", String(partition)); + } if (startTime !== void 0) { params.append("start_time", String(startTime)); } if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (likeWithTweetAuthorFields !== void 0 && likeWithTweetAuthorFields.length > 0) { + params.append( + "like_with_tweet_author.fields", + likeWithTweetAuthorFields.join(",") + ); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { @@ -14676,8 +14821,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Posts compliance data - * Streams all compliance data related to Posts. + * Stream English Posts + * Streams all public English-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14691,14 +14836,19 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsCompliance(partition, options = {}) { + async postsFirehoseEn(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsCompliance"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseEn"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime" + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14708,11 +14858,17 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/compliance/stream"; + let path = "/2/tweets/firehose/stream/lang/en"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14726,6 +14882,24 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14756,8 +14930,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Korean Posts - * Streams all public Korean-language Posts in real-time. + * Stream filtered Posts + * Streams Posts in real-time matching the active rule set. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14765,16 +14939,12 @@ var StreamClient = class { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehoseKo(partition, options = {}) { + async posts(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseKo"); + this.client.validateAuthentication(requiredAuthTypes, "posts"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", @@ -14803,14 +14973,11 @@ var StreamClient = class { signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/firehose/stream/lang/ko"; + let path = "/2/tweets/search/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } - if (partition !== void 0) { - params.append("partition", String(partition)); - } if (startTime !== void 0) { params.append("start_time", String(startTime)); } @@ -14865,8 +15032,8 @@ var StreamClient = class { return eventStream; } /** - * Stream all Likes - * Streams all public Likes in real-time. + * Stream Users compliance data + * Streams all compliance data related to Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14880,17 +15047,14 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async likesFirehose(partition, options = {}) { + async usersCompliance(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "likesFirehose"); + this.client.validateAuthentication(requiredAuthTypes, "usersCompliance"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime", - "like_with_tweet_author.fields": "likeWithTweetAuthorFields", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + end_time: "endTime" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14900,15 +15064,11 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - likeWithTweetAuthorFields = [], - expansions = [], - userFields = [], - tweetFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/likes/firehose/stream"; + let path = "/2/users/compliance/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14922,21 +15082,6 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (likeWithTweetAuthorFields !== void 0 && likeWithTweetAuthorFields.length > 0) { - params.append( - "like_with_tweet_author.fields", - likeWithTweetAuthorFields.join(",") - ); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14967,8 +15112,8 @@ var StreamClient = class { return eventStream; } /** - * Stream 10% sampled Posts - * Streams a 10% sample of public Posts in real-time. + * Stream all Posts + * Streams all public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14982,10 +15127,10 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsSample10(partition, options = {}) { + async postsFirehose(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsSample10"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehose"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", @@ -15014,7 +15159,7 @@ var StreamClient = class { signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/sample10/stream"; + let path = "/2/tweets/firehose/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -15076,8 +15221,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Japanese Posts - * Streams all public Japanese-language Posts in real-time. + * Stream sampled Likes + * Streams a 10% sample of public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -15091,19 +15236,17 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehoseJa(partition, options = {}) { + async likesSample10(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseJa"); + this.client.validateAuthentication(requiredAuthTypes, "likesSample10"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", + "like_with_tweet_author.fields": "likeWithTweetAuthorFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -15113,17 +15256,15 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - tweetFields = [], + likeWithTweetAuthorFields = [], expansions = [], - mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + tweetFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/firehose/stream/lang/ja"; + let path = "/2/likes/sample10/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -15137,23 +15278,20 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (likeWithTweetAuthorFields !== void 0 && likeWithTweetAuthorFields.length > 0) { + params.append( + "like_with_tweet_author.fields", + likeWithTweetAuthorFields.join(",") + ); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { @@ -15185,8 +15323,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Users compliance data - * Streams all compliance data related to Users. + * Stream Post labels + * Streams all labeling events applied to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -15194,16 +15332,12 @@ var StreamClient = class { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - async usersCompliance(partition, options = {}) { + async labelsCompliance(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "usersCompliance"); + this.client.validateAuthentication(requiredAuthTypes, "labelsCompliance"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", @@ -15221,14 +15355,11 @@ var StreamClient = class { signal, requestOptions = {} } = normalizedOptions; - let path = "/2/users/compliance/stream"; + let path = "/2/tweets/label/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } - if (partition !== void 0) { - params.append("partition", String(partition)); - } if (startTime !== void 0) { params.append("start_time", String(startTime)); } @@ -15265,41 +15396,32 @@ var StreamClient = class { return eventStream; } /** - * Get stream rules - * Retrieves the active rule set or a subset of rules for the filtered stream. + * Get stream rule counts + * Retrieves the count of rules in the active rule set for the filtered stream. * * @returns Promise with the API response */ - async getRules(options = {}) { + async getRuleCounts(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "getRules"); + this.client.validateAuthentication(requiredAuthTypes, "getRuleCounts"); const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken" + "rules_count.fields": "rulesCountFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - ids = [], - maxResults = void 0, - paginationToken = void 0, + rulesCountFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/stream/rules"; + let path = "/2/tweets/search/stream/rules/counts"; const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (rulesCountFields !== void 0 && rulesCountFields.length > 0) { + params.append("rules_count.fields", rulesCountFields.join(",")); } const finalRequestOptions = { headers: { @@ -15316,37 +15438,41 @@ var StreamClient = class { ); } /** - * Update stream rules - * Adds or deletes rules from the active rule set for the filtered stream. + * Get stream rules + * Retrieves the active rule set or a subset of rules for the filtered stream. * * @returns Promise with the API response */ - async updateRules(body, options = {}) { + async getRules(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "updateRules"); + this.client.validateAuthentication(requiredAuthTypes, "getRules"); const paramMappings = { - dry_run: "dryRun", - delete_all: "deleteAll" + max_results: "maxResults", + pagination_token: "paginationToken" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - dryRun = void 0, - deleteAll = void 0, + ids = [], + maxResults = void 0, + paginationToken = void 0, headers = {}, signal, requestOptions = {} } = normalizedOptions; let path = "/2/tweets/search/stream/rules"; const params = new URLSearchParams(); - if (dryRun !== void 0) { - params.append("dry_run", String(dryRun)); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); } - if (deleteAll !== void 0) { - params.append("delete_all", String(deleteAll)); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } const finalRequestOptions = { headers: { @@ -15354,272 +15480,160 @@ var StreamClient = class { ...headers }, signal, - body: JSON.stringify(body), ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get stream rule counts - * Retrieves the count of rules in the active rule set for the filtered stream. + * Update stream rules + * Adds or deletes rules from the active rule set for the filtered stream. * * @returns Promise with the API response */ - async getRuleCounts(options = {}) { + async updateRules(body, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "getRuleCounts"); + this.client.validateAuthentication(requiredAuthTypes, "updateRules"); const paramMappings = { - "rules_count.fields": "rulesCountFields" + dry_run: "dryRun", + delete_all: "deleteAll" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - rulesCountFields = [], + dryRun = void 0, + deleteAll = void 0, headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/stream/rules/counts"; + let path = "/2/tweets/search/stream/rules"; const params = new URLSearchParams(); - if (rulesCountFields !== void 0 && rulesCountFields.length > 0) { - params.append("rules_count.fields", rulesCountFields.join(",")); + if (dryRun !== void 0) { + params.append("dry_run", String(dryRun)); + } + if (deleteAll !== void 0) { + params.append("delete_all", String(deleteAll)); } const finalRequestOptions = { headers: { "Content-Type": "application/json", ...headers }, - signal, - ...requestOptions - }; - return this.client.request( - "GET", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } -}; - -// src/webhooks/client.ts -var WebhooksClient = class { - client; - /** - * Creates a new webhooks client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } - /** - * Create stream link - * Creates a link to deliver FilteredStream events to the given webhook. - - - * @param webhookId The webhook ID to link to your FilteredStream ruleset. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async createStreamLink(webhookId, options = {}) { - const paramMappings = { - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - tweetFields = void 0, - expansions = void 0, - mediaFields = void 0, - pollFields = void 0, - userFields = void 0, - placeFields = void 0, - requestOptions = {} - } = normalizedOptions; - let path = "/2/tweets/search/webhooks/{webhook_id}"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); - const params = new URLSearchParams(); - if (tweetFields !== void 0) { - params.append("tweet.fields", String(tweetFields)); - } - if (expansions !== void 0) { - params.append("expansions", String(expansions)); - } - if (mediaFields !== void 0) { - params.append("media.fields", String(mediaFields)); - } - if (pollFields !== void 0) { - params.append("poll.fields", String(pollFields)); - } - if (userFields !== void 0) { - params.append("user.fields", String(userFields)); - } - if (placeFields !== void 0) { - params.append("place.fields", String(placeFields)); - } - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ], - ...requestOptions - }; - return this.client.request( - "POST", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Delete stream link - * Deletes a link from FilteredStream events to the given webhook. - - - * @param webhookId The webhook ID to link to your FilteredStream ruleset. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async deleteStreamLink(webhookId) { - let path = "/2/tweets/search/webhooks/{webhook_id}"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Validate webhook - * Triggers a CRC check for a given webhook. - - - * @param webhookId The ID of the webhook to check. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async validate(webhookId) { - let path = "/2/webhooks/{webhook_id}"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options + signal, + body: JSON.stringify(body), + ...requestOptions }; return this.client.request( - "PUT", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/compliance/client.ts +var ComplianceClient = class { + client; /** - * Delete webhook - * Deletes an existing webhook configuration. + * Creates a new compliance client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get Compliance Jobs + * Retrieves a list of Compliance Jobs filtered by job type and optional status. - * @param webhookId The ID of the webhook to delete. + * @param type Type of Compliance Job to list. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async delete(webhookId) { - let path = "/2/webhooks/{webhook_id}"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + async getJobs(type, options = {}) { + const paramMappings = { + "compliance_job.fields": "complianceJobFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + status = void 0, + complianceJobFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/compliance/jobs"; const params = new URLSearchParams(); + if (type !== void 0) { + params.append("type", String(type)); + } + if (status !== void 0) { + params.append("status", String(status)); + } + if (complianceJobFields !== void 0 && complianceJobFields.length > 0) { + params.append("compliance_job.fields", complianceJobFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get stream links - * Get a list of webhook links associated with a filtered stream ruleset. + * Create Compliance Job + * Creates a new Compliance Job for the specified job type. - * @returns {Promise} Promise resolving to the API response + * @param body Request body + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getStreamLinks() { - let path = "/2/tweets/search/webhooks"; + async createJobs(body) { + let path = "/2/compliance/jobs"; const params = new URLSearchParams(); const finalRequestOptions = { + body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { @@ -15629,36 +15643,41 @@ var WebhooksClient = class { // No optional parameters, using empty request options }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get webhook - * Get a list of webhook configs associated with a client app. + * Get Compliance Job by ID + * Retrieves details of a specific Compliance Job by its ID. + + * @param id The ID of the Compliance Job to retrieve. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async get(options = {}) { + async getJobsById(id, options = {}) { const paramMappings = { - "webhook_config.fields": "webhookConfigFields" + "compliance_job.fields": "complianceJobFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - webhookConfigFields = [], + complianceJobFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/webhooks"; + let path = "/2/compliance/jobs/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (webhookConfigFields !== void 0 && webhookConfigFields.length > 0) { - params.append("webhook_config.fields", webhookConfigFields.join(",")); + if (complianceJobFields !== void 0 && complianceJobFields.length > 0) { + params.append("compliance_job.fields", complianceJobFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -15675,45 +15694,87 @@ var WebhooksClient = class { finalRequestOptions ); } +}; + +// src/compliance/models.ts +var models_exports16 = {}; + +// src/usage/client.ts +var UsageClient = class { + client; /** - * Create webhook - * Creates a new webhook configuration. + * Creates a new usage client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get usage + * Retrieves usage statistics for Posts over a specified number of days. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async create(options = {}) { - const normalizedOptions = options || {}; + async get(options = {}) { + const paramMappings = { + "usage.fields": "usageFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + days = void 0, + usageFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/webhooks"; + let path = "/2/usage/tweets"; const params = new URLSearchParams(); + if (days !== void 0) { + params.append("days", String(days)); + } + if (usageFields !== void 0 && usageFields.length > 0) { + params.append("usage.fields", usageFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - UserToken: [] } ], ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } }; -// src/webhooks/models.ts +// src/usage/models.ts var models_exports17 = {}; // src/client.ts @@ -15750,42 +15811,42 @@ var Client = class { maxRetries; /** HTTP client for making requests */ httpClient = httpClient; - /** news client */ - news; - /** users client */ - users; - /** direct messages client */ - directMessages; - /** community notes client */ - communityNotes; - /** posts client */ - posts; - /** trends client */ - trends; /** activity client */ activity; - /** usage client */ - usage; - /** spaces client */ - spaces; - /** communities client */ - communities; + /** news client */ + news; /** connections client */ connections; + /** account activity client */ + accountActivity; + /** spaces client */ + spaces; + /** trends client */ + trends; /** media client */ media; + /** direct messages client */ + directMessages; + /** posts client */ + posts; /** lists client */ lists; - /** compliance client */ - compliance; + /** community notes client */ + communityNotes; /** general client */ general; - /** account activity client */ - accountActivity; - /** stream client */ - stream; /** webhooks client */ webhooks; + /** users client */ + users; + /** communities client */ + communities; + /** stream client */ + stream; + /** compliance client */ + compliance; + /** usage client */ + usage; /** * Creates a new X API client instance * @@ -15830,24 +15891,24 @@ var Client = class { ...config.headers || {} }; this.headers = httpClient.createHeaders(defaultHeaders); - this.news = new NewsClient(this); - this.users = new UsersClient(this); - this.directMessages = new DirectMessagesClient(this); - this.communityNotes = new CommunityNotesClient(this); - this.posts = new PostsClient(this); - this.trends = new TrendsClient(this); this.activity = new ActivityClient(this); - this.usage = new UsageClient(this); - this.spaces = new SpacesClient(this); - this.communities = new CommunitiesClient(this); + this.news = new NewsClient(this); this.connections = new ConnectionsClient(this); + this.accountActivity = new AccountActivityClient(this); + this.spaces = new SpacesClient(this); + this.trends = new TrendsClient(this); this.media = new MediaClient(this); + this.directMessages = new DirectMessagesClient(this); + this.posts = new PostsClient(this); this.lists = new ListsClient(this); - this.compliance = new ComplianceClient(this); + this.communityNotes = new CommunityNotesClient(this); this.general = new GeneralClient(this); - this.accountActivity = new AccountActivityClient(this); - this.stream = new StreamClient(this); this.webhooks = new WebhooksClient(this); + this.users = new UsersClient(this); + this.communities = new CommunitiesClient(this); + this.stream = new StreamClient(this); + this.compliance = new ComplianceClient(this); + this.usage = new UsageClient(this); } /** * Make an authenticated request to the X API @@ -16929,52 +16990,52 @@ node-domexception/index.js: (*! node-domexception. MIT License. Jimmy Wärting *) */ -exports.AccountActivity = models_exports16; +exports.AccountActivity = models_exports4; exports.AccountActivityClient = AccountActivityClient; -exports.Activity = models_exports7; +exports.Activity = models_exports; exports.ActivityClient = ActivityClient; exports.ApiError = ApiError; exports.Client = Client; -exports.Communities = models_exports10; +exports.Communities = models_exports15; exports.CommunitiesClient = CommunitiesClient; -exports.CommunityNotes = models_exports4; +exports.CommunityNotes = models_exports11; exports.CommunityNotesClient = CommunityNotesClient; -exports.Compliance = models_exports14; +exports.Compliance = models_exports16; exports.ComplianceClient = ComplianceClient; -exports.Connections = models_exports11; +exports.Connections = models_exports3; exports.ConnectionsClient = ConnectionsClient; exports.CryptoUtils = CryptoUtils; -exports.DirectMessages = models_exports3; +exports.DirectMessages = models_exports8; exports.DirectMessagesClient = DirectMessagesClient; exports.EventPaginator = EventPaginator; -exports.General = models_exports15; +exports.General = models_exports12; exports.GeneralClient = GeneralClient; exports.HttpClient = HttpClient; -exports.Lists = models_exports13; +exports.Lists = models_exports10; exports.ListsClient = ListsClient; -exports.Media = models_exports12; +exports.Media = models_exports7; exports.MediaClient = MediaClient; -exports.News = models_exports; +exports.News = models_exports2; exports.NewsClient = NewsClient; exports.OAuth1 = OAuth1; exports.OAuth2 = OAuth2; exports.Paginator = Paginator; exports.PostPaginator = PostPaginator; -exports.Posts = models_exports5; +exports.Posts = models_exports9; exports.PostsClient = PostsClient; exports.Schemas = schemas_exports; -exports.Spaces = models_exports9; +exports.Spaces = models_exports5; exports.SpacesClient = SpacesClient; exports.Stream = models_exports18; exports.StreamClient = StreamClient; exports.Trends = models_exports6; exports.TrendsClient = TrendsClient; -exports.Usage = models_exports8; +exports.Usage = models_exports17; exports.UsageClient = UsageClient; exports.UserPaginator = UserPaginator; -exports.Users = models_exports2; +exports.Users = models_exports14; exports.UsersClient = UsersClient; -exports.Webhooks = models_exports17; +exports.Webhooks = models_exports13; exports.WebhooksClient = WebhooksClient; exports.generateCodeChallenge = generateCodeChallenge; exports.generateCodeVerifier = generateCodeVerifier; diff --git a/xdk/typescript/dist/index.cjs.map b/xdk/typescript/dist/index.cjs.map index 9d214fbc..0140c51b 100644 --- a/xdk/typescript/dist/index.cjs.map +++ b/xdk/typescript/dist/index.cjs.map @@ -1 +1 @@ -{"version":3,"sources":["../node_modules/data-uri-to-buffer/src/index.ts","../node_modules/web-streams-polyfill/src/utils.ts","../node_modules/web-streams-polyfill/src/lib/helpers/miscellaneous.ts","../node_modules/web-streams-polyfill/src/lib/helpers/webidl.ts","../node_modules/web-streams-polyfill/src/lib/simple-queue.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/internal-methods.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/generic-reader.ts","../node_modules/web-streams-polyfill/src/stub/number-isfinite.ts","../node_modules/web-streams-polyfill/src/stub/math-trunc.ts","../node_modules/web-streams-polyfill/src/lib/validators/basic.ts","../node_modules/web-streams-polyfill/src/lib/validators/readable-stream.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/default-reader.ts","../node_modules/web-streams-polyfill/src/target/es2018/stub/async-iterator-prototype.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/async-iterator.ts","../node_modules/web-streams-polyfill/src/stub/number-isnan.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/ecmascript.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/miscellaneous.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/queue-with-sizes.ts","../node_modules/web-streams-polyfill/src/lib/helpers/array-buffer-view.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/byte-stream-controller.ts","../node_modules/web-streams-polyfill/src/lib/validators/reader-options.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/byob-reader.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/underlying-sink.ts","../node_modules/web-streams-polyfill/src/lib/validators/writable-stream.ts","../node_modules/web-streams-polyfill/src/lib/abort-signal.ts","../node_modules/web-streams-polyfill/src/lib/writable-stream.ts","../node_modules/web-streams-polyfill/src/globals.ts","../node_modules/web-streams-polyfill/src/stub/dom-exception.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/pipe.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/default-controller.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/tee.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/readable-stream-like.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/from.ts","../node_modules/web-streams-polyfill/src/lib/validators/underlying-source.ts","../node_modules/web-streams-polyfill/src/lib/validators/iterator-options.ts","../node_modules/web-streams-polyfill/src/lib/validators/pipe-options.ts","../node_modules/web-streams-polyfill/src/lib/validators/readable-writable-pair.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream.ts","../node_modules/web-streams-polyfill/src/lib/validators/queuing-strategy-init.ts","../node_modules/web-streams-polyfill/src/lib/byte-length-queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/count-queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/transformer.ts","../node_modules/web-streams-polyfill/src/lib/transform-stream.ts","../node_modules/fetch-blob/streams.cjs","../node_modules/fetch-blob/index.js","../node_modules/fetch-blob/file.js","../node_modules/formdata-polyfill/esm.min.js","../node_modules/node-fetch/src/errors/base.js","../node_modules/node-fetch/src/errors/fetch-error.js","../node_modules/node-fetch/src/utils/is.js","../node_modules/node-domexception/index.js","../node_modules/fetch-blob/from.js","../node_modules/node-fetch/src/utils/multipart-parser.js","../node_modules/node-fetch/src/body.js","../node_modules/node-fetch/src/headers.js","../node_modules/node-fetch/src/utils/is-redirect.js","../node_modules/node-fetch/src/response.js","../node_modules/node-fetch/src/utils/get-search.js","../node_modules/node-fetch/src/utils/referrer.js","../node_modules/node-fetch/src/request.js","../node_modules/node-fetch/src/errors/abort-error.js","../node_modules/node-fetch/src/index.js","../src/http-client.ts","../src/news/client.ts","../src/news/models.ts","../src/users/client.ts","../src/users/models.ts","../src/direct_messages/client.ts","../src/direct_messages/models.ts","../src/community_notes/client.ts","../src/community_notes/models.ts","../src/posts/client.ts","../src/posts/models.ts","../src/trends/client.ts","../src/trends/models.ts","../src/activity/client.ts","../src/activity/models.ts","../src/usage/client.ts","../src/usage/models.ts","../src/spaces/client.ts","../src/spaces/models.ts","../src/communities/client.ts","../src/communities/models.ts","../src/connections/client.ts","../src/connections/models.ts","../src/media/client.ts","../src/media/models.ts","../src/lists/client.ts","../src/lists/models.ts","../src/compliance/client.ts","../src/compliance/models.ts","../src/general/client.ts","../src/general/models.ts","../src/account_activity/client.ts","../src/account_activity/models.ts","../src/stream/event_driven_stream.ts","../src/stream/stream_client.ts","../src/webhooks/client.ts","../src/webhooks/models.ts","../src/client.ts","../src/crypto_utils.ts","../src/oauth2_auth.ts","../src/oauth1_auth.ts","../src/schemas.ts","../src/stream/models.ts","../src/paginator.ts","../src/index.ts"],"names":["i","noop","x","_a","F","e","queueMicrotask","r","isAbortSignal","streamBrandCheckException","defaultControllerBrandCheckException","DOMException","ReadableStream","POOL_SIZE","process","Blob","clone","size","File","f","FormData","m","stat","Body","clear","Buffer","toFormData","types","Headers","INTERNALS","deprecate","fetch","http","Stream","PassThrough","response","s","models_exports","crypto"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaM,SAAU,gBAAgB,KAAW;AAC1C,MAAI,CAAC,UAAU,KAAK,GAAG,GAAG;AACzB,UAAM,IAAI,UACT,kEAAkE;;AAKpE,QAAM,IAAI,QAAQ,UAAU,EAAE;AAG9B,QAAM,aAAa,IAAI,QAAQ,GAAG;AAClC,MAAI,eAAe,MAAM,cAAc,GAAG;AACzC,UAAM,IAAI,UAAU,qBAAqB;;AAI1C,QAAM,OAAO,IAAI,UAAU,GAAG,UAAU,EAAE,MAAM,GAAG;AAEnD,MAAI,UAAU;AACd,MAAI,SAAS;AACb,QAAM,OAAO,KAAK,CAAC,KAAK;AACxB,MAAI,WAAW;AACf,WAASA,KAAI,GAAGA,KAAI,KAAK,QAAQA,MAAK;AACrC,QAAI,KAAKA,EAAC,MAAM,UAAU;AACzB,eAAS;eACA,KAAKA,EAAC,GAAG;AAClB,kBAAY,IAAM,KAAKA,EAAC,CAAC;AACzB,UAAI,KAAKA,EAAC,EAAE,QAAQ,UAAU,MAAM,GAAG;AACtC,kBAAU,KAAKA,EAAC,EAAE,UAAU,CAAC;;;;AAKhC,MAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,QAAQ;AAChC,gBAAY;AACZ,cAAU;;AAIX,QAAM,WA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}\n\n/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @param {String} uri Data URI to turn into a Buffer instance\n * @returns {Buffer} Buffer instance from Data URI\n * @api public\n */\nexport function dataUriToBuffer(uri: string): MimeBuffer {\n\tif (!/^data:/i.test(uri)) {\n\t\tthrow new TypeError(\n\t\t\t'`uri` does not appear to be a Data URI (must begin with \"data:\")'\n\t\t);\n\t}\n\n\t// strip newlines\n\turi = uri.replace(/\\r?\\n/g, '');\n\n\t// split the URI up into the \"metadata\" and the \"data\" portions\n\tconst firstComma = uri.indexOf(',');\n\tif (firstComma === -1 || firstComma <= 4) {\n\t\tthrow new TypeError('malformed data: URI');\n\t}\n\n\t// remove the \"data:\" scheme and parse the metadata\n\tconst meta = uri.substring(5, firstComma).split(';');\n\n\tlet charset = '';\n\tlet base64 = false;\n\tconst type = meta[0] || 'text/plain';\n\tlet typeFull = type;\n\tfor (let i = 1; i < meta.length; i++) {\n\t\tif (meta[i] === 'base64') {\n\t\t\tbase64 = true;\n\t\t} else if(meta[i]) {\n\t\t\ttypeFull += `;${ meta[i]}`;\n\t\t\tif (meta[i].indexOf('charset=') === 0) {\n\t\t\t\tcharset = meta[i].substring(8);\n\t\t\t}\n\t\t}\n\t}\n\t// defaults to US-ASCII only if type is not provided\n\tif (!meta[0] && !charset.length) {\n\t\ttypeFull += ';charset=US-ASCII';\n\t\tcharset = 'US-ASCII';\n\t}\n\n\t// get the encoded data portion and decode URI-encoded chars\n\tconst encoding = base64 ? 'base64' : 'ascii';\n\tconst data = unescape(uri.substring(firstComma + 1));\n\tconst buffer = Buffer.from(data, encoding) as MimeBuffer;\n\n\t// set `.type` and `.typeFull` properties to MIME type\n\tbuffer.type = type;\n\tbuffer.typeFull = typeFull;\n\n\t// set the `.charset` property\n\tbuffer.charset = charset;\n\n\treturn buffer;\n}\n\nexport default dataUriToBuffer;\n","export function noop(): undefined {\n return undefined;\n}\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n\nexport function setFunctionName(fn: Function, name: string): void {\n try {\n Object.defineProperty(fn, 'name', {\n value: name,\n configurable: true\n });\n } catch {\n // This property is non-configurable in older browsers, so ignore if this throws.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility\n }\n}\n","import { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\n// https://webidl.spec.whatwg.org/#a-new-promise\nexport function newPromise(executor: (\n resolve: (value: T | PromiseLike) => void,\n reject: (reason?: any) => void\n) => void): Promise {\n return new originalPromise(executor);\n}\n\n// https://webidl.spec.whatwg.org/#a-promise-resolved-with\nexport function promiseResolvedWith(value: T | PromiseLike): Promise {\n return newPromise(resolve => resolve(value));\n}\n\n// https://webidl.spec.whatwg.org/#a-promise-rejected-with\nexport function promiseRejectedWith(reason: any): Promise {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen(\n promise: Promise,\n onFulfilled?: (value: T) => TResult1 | PromiseLike,\n onRejected?: (reason: any) => TResult2 | PromiseLike): Promise {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise;\n}\n\n// Bluebird logs a warning when a promise is created within a fulfillment handler, but then isn't returned\n// from that handler. To prevent this, return null instead of void from all handlers.\n// http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-created-in-a-handler-but-was-not-returned-from-it\nexport function uponPromise(\n promise: Promise,\n onFulfilled?: (value: T) => null | PromiseLike,\n onRejected?: (reason: any) => null | PromiseLike): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment(promise: Promise, onFulfilled: (value: T) => null | PromiseLike): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise, onRejected: (reason: any) => null | PromiseLike): void {\n uponPromise(promise, undefined, onRejected);\n}\n\nexport function transformPromiseWith(\n promise: Promise,\n fulfillmentHandler?: (value: T) => TResult1 | PromiseLike,\n rejectionHandler?: (reason: any) => TResult2 | PromiseLike): Promise {\n return PerformPromiseThen(promise, fulfillmentHandler, rejectionHandler);\n}\n\nexport function setPromiseIsHandledToTrue(promise: Promise): void {\n PerformPromiseThen(promise, undefined, rethrowAssertionErrorRejection);\n}\n\nlet _queueMicrotask: (callback: () => void) => void = callback => {\n if (typeof queueMicrotask === 'function') {\n _queueMicrotask = queueMicrotask;\n } else {\n const resolvedPromise = promiseResolvedWith(undefined);\n _queueMicrotask = cb => PerformPromiseThen(resolvedPromise, cb);\n }\n return _queueMicrotask(callback);\n};\n\nexport { _queueMicrotask as queueMicrotask };\n\nexport function reflectCall(F: (this: T, ...fnArgs: A) => R, V: T, args: A): R {\n if (typeof F !== 'function') {\n throw new TypeError('Argument is not a function');\n }\n return Function.prototype.apply.call(F, V, args);\n}\n\nexport function promiseCall(F: (this: T, ...fnArgs: A) => R | PromiseLike,\n V: T,\n args: A): Promise {\n assert(typeof F === 'function');\n assert(V !== undefined);\n assert(Array.isArray(args));\n try {\n return promiseResolvedWith(reflectCall(F, V, args));\n } catch (value) {\n return promiseRejectedWith(value);\n }\n}\n","import assert from '../stub/assert';\n\n// Original from Chromium\n// https://chromium.googlesource.com/chromium/src/+/0aee4434a4dba42a42abaea9bfbc0cd196a63bc1/third_party/blink/renderer/core/streams/SimpleQueue.js\n\nconst QUEUE_MAX_ARRAY_SIZE = 16384;\n\ninterface Node {\n _elements: T[];\n _next: Node | undefined;\n}\n\n/**\n * Simple queue structure.\n *\n * Avoids scalability issues with using a packed array directly by using\n * multiple arrays in a linked list and keeping the array size bounded.\n */\nexport class SimpleQueue {\n private _front: Node;\n private _back: Node;\n private _cursor = 0;\n private _size = 0;\n\n constructor() {\n // _front and _back are always defined.\n this._front = {\n _elements: [],\n _next: undefined\n };\n this._back = this._front;\n // The cursor is used to avoid calling Array.shift().\n // It contains the index of the front element of the array inside the\n // front-most node. It is always in the range [0, QUEUE_MAX_ARRAY_SIZE).\n this._cursor = 0;\n // When there is only one node, size === elements.length - cursor.\n this._size = 0;\n }\n\n get length(): number {\n return this._size;\n }\n\n // For exception safety, this method is structured in order:\n // 1. Read state\n // 2. Calculate required state mutations\n // 3. Perform state mutations\n push(element: T): void {\n const oldBack = this._back;\n let newBack = oldBack;\n assert(oldBack._next === undefined);\n if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) {\n newBack = {\n _elements: [],\n _next: undefined\n };\n }\n\n // push() is the mutation most likely to throw an exception, so it\n // goes first.\n oldBack._elements.push(element);\n if (newBack !== oldBack) {\n this._back = newBack;\n oldBack._next = newBack;\n }\n ++this._size;\n }\n\n // Like push(), shift() follows the read -> calculate -> mutate pattern for\n // exception safety.\n shift(): T {\n assert(this._size > 0); // must not be called on an empty queue\n\n const oldFront = this._front;\n let newFront = oldFront;\n const oldCursor = this._cursor;\n let newCursor = oldCursor + 1;\n\n const elements = oldFront._elements;\n const element = elements[oldCursor];\n\n if (newCursor === QUEUE_MAX_ARRAY_SIZE) {\n assert(elements.length === QUEUE_MAX_ARRAY_SIZE);\n assert(oldFront._next !== undefined);\n newFront = oldFront._next!;\n newCursor = 0;\n }\n\n // No mutations before this point.\n --this._size;\n this._cursor = newCursor;\n if (oldFront !== newFront) {\n this._front = newFront;\n }\n\n // Permit shifted element to be garbage collected.\n elements[oldCursor] = undefined!;\n\n return element;\n }\n\n // The tricky thing about forEach() is that it can be called\n // re-entrantly. The queue may be mutated inside the callback. It is easy to\n // see that push() within the callback has no negative effects since the end\n // of the queue is checked for on every iteration. If shift() is called\n // repeatedly within the callback then the next iteration may return an\n // element that has been removed. In this case the callback will be called\n // with undefined values until we either \"catch up\" with elements that still\n // exist or reach the back of the queue.\n forEach(callback: (element: T) => void): void {\n let i = this._cursor;\n let node = this._front;\n let elements = node._elements;\n while (i !== elements.length || node._next !== undefined) {\n if (i === elements.length) {\n assert(node._next !== undefined);\n assert(i === QUEUE_MAX_ARRAY_SIZE);\n node = node._next!;\n elements = node._elements;\n i = 0;\n if (elements.length === 0) {\n break;\n }\n }\n callback(elements[i]);\n ++i;\n }\n }\n\n // Return the element that would be returned if shift() was called now,\n // without modifying the queue.\n peek(): T {\n assert(this._size > 0); // must not be called on an empty queue\n\n const front = this._front;\n const cursor = this._cursor;\n return front._elements[cursor];\n }\n}\n","export const AbortSteps = Symbol('[[AbortSteps]]');\nexport const ErrorSteps = Symbol('[[ErrorSteps]]');\nexport const CancelSteps = Symbol('[[CancelSteps]]');\nexport const PullSteps = Symbol('[[PullSteps]]');\nexport const ReleaseSteps = Symbol('[[ReleaseSteps]]');\n","import assert from '../../stub/assert';\nimport { ReadableStream, ReadableStreamCancel, type ReadableStreamReader } from '../readable-stream';\nimport { newPromise, setPromiseIsHandledToTrue } from '../helpers/webidl';\nimport { ReleaseSteps } from '../abstract-ops/internal-methods';\n\nexport function ReadableStreamReaderGenericInitialize(reader: ReadableStreamReader, stream: ReadableStream) {\n reader._ownerReadableStream = stream;\n stream._reader = reader;\n\n if (stream._state === 'readable') {\n defaultReaderClosedPromiseInitialize(reader);\n } else if (stream._state === 'closed') {\n defaultReaderClosedPromiseInitializeAsResolved(reader);\n } else {\n assert(stream._state === 'errored');\n\n defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);\n }\n}\n\n// A client of ReadableStreamDefaultReader and ReadableStreamBYOBReader may use these functions directly to bypass state\n// check.\n\nexport function ReadableStreamReaderGenericCancel(reader: ReadableStreamReader, reason: any): Promise {\n const stream = reader._ownerReadableStream;\n assert(stream !== undefined);\n return ReadableStreamCancel(stream, reason);\n}\n\nexport function ReadableStreamReaderGenericRelease(reader: ReadableStreamReader) {\n const stream = reader._ownerReadableStream;\n assert(stream !== undefined);\n assert(stream._reader === reader);\n\n if (stream._state === 'readable') {\n defaultReaderClosedPromiseReject(\n reader,\n new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));\n } else {\n defaultReaderClosedPromiseResetToRejected(\n reader,\n new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));\n }\n\n stream._readableStreamController[ReleaseSteps]();\n\n stream._reader = undefined;\n reader._ownerReadableStream = undefined!;\n}\n\n// Helper functions for the readers.\n\nexport function readerLockException(name: string): TypeError {\n return new TypeError('Cannot ' + name + ' a stream using a released reader');\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nexport function defaultReaderClosedPromiseInitialize(reader: ReadableStreamReader) {\n reader._closedPromise = newPromise((resolve, reject) => {\n reader._closedPromise_resolve = resolve;\n reader._closedPromise_reject = reject;\n });\n}\n\nexport function defaultReaderClosedPromiseInitializeAsRejected(reader: ReadableStreamReader, reason: any) {\n defaultReaderClosedPromiseInitialize(reader);\n defaultReaderClosedPromiseReject(reader, reason);\n}\n\nexport function defaultReaderClosedPromiseInitializeAsResolved(reader: ReadableStreamReader) {\n defaultReaderClosedPromiseInitialize(reader);\n defaultReaderClosedPromiseResolve(reader);\n}\n\nexport function defaultReaderClosedPromiseReject(reader: ReadableStreamReader, reason: any) {\n if (reader._closedPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(reader._closedPromise);\n reader._closedPromise_reject(reason);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n\nexport function defaultReaderClosedPromiseResetToRejected(reader: ReadableStreamReader, reason: any) {\n assert(reader._closedPromise_resolve === undefined);\n assert(reader._closedPromise_reject === undefined);\n\n defaultReaderClosedPromiseInitializeAsRejected(reader, reason);\n}\n\nexport function defaultReaderClosedPromiseResolve(reader: ReadableStreamReader) {\n if (reader._closedPromise_resolve === undefined) {\n return;\n }\n\n reader._closedPromise_resolve(undefined);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite#Polyfill\nconst NumberIsFinite: typeof Number.isFinite = Number.isFinite || function (x) {\n return typeof x === 'number' && isFinite(x);\n};\n\nexport default NumberIsFinite;\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc#Polyfill\nconst MathTrunc: typeof Math.trunc = Math.trunc || function (v) {\n return v < 0 ? Math.ceil(v) : Math.floor(v);\n};\n\nexport default MathTrunc;\n","import NumberIsFinite from '../../stub/number-isfinite';\nimport MathTrunc from '../../stub/math-trunc';\n\n// https://heycam.github.io/webidl/#idl-dictionaries\nexport function isDictionary(x: any): x is object | null {\n return typeof x === 'object' || typeof x === 'function';\n}\n\nexport function assertDictionary(obj: unknown,\n context: string): asserts obj is object | null | undefined {\n if (obj !== undefined && !isDictionary(obj)) {\n throw new TypeError(`${context} is not an object.`);\n }\n}\n\nexport type AnyFunction = (...args: any[]) => any;\n\n// https://heycam.github.io/webidl/#idl-callback-functions\nexport function assertFunction(x: unknown, context: string): asserts x is AnyFunction {\n if (typeof x !== 'function') {\n throw new TypeError(`${context} is not a function.`);\n }\n}\n\n// https://heycam.github.io/webidl/#idl-object\nexport function isObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport function assertObject(x: unknown,\n context: string): asserts x is object {\n if (!isObject(x)) {\n throw new TypeError(`${context} is not an object.`);\n }\n}\n\nexport function assertRequiredArgument(x: T | undefined,\n position: number,\n context: string): asserts x is T {\n if (x === undefined) {\n throw new TypeError(`Parameter ${position} is required in '${context}'.`);\n }\n}\n\nexport function assertRequiredField(x: T | undefined,\n field: string,\n context: string): asserts x is T {\n if (x === undefined) {\n throw new TypeError(`${field} is required in '${context}'.`);\n }\n}\n\n// https://heycam.github.io/webidl/#idl-unrestricted-double\nexport function convertUnrestrictedDouble(value: unknown): number {\n return Number(value);\n}\n\nfunction censorNegativeZero(x: number): number {\n return x === 0 ? 0 : x;\n}\n\nfunction integerPart(x: number): number {\n return censorNegativeZero(MathTrunc(x));\n}\n\n// https://heycam.github.io/webidl/#idl-unsigned-long-long\nexport function convertUnsignedLongLongWithEnforceRange(value: unknown, context: string): number {\n const lowerBound = 0;\n const upperBound = Number.MAX_SAFE_INTEGER;\n\n let x = Number(value);\n x = censorNegativeZero(x);\n\n if (!NumberIsFinite(x)) {\n throw new TypeError(`${context} is not a finite number`);\n }\n\n x = integerPart(x);\n\n if (x < lowerBound || x > upperBound) {\n throw new TypeError(`${context} is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`);\n }\n\n if (!NumberIsFinite(x) || x === 0) {\n return 0;\n }\n\n // TODO Use BigInt if supported?\n // let xBigInt = BigInt(integerPart(x));\n // xBigInt = BigInt.asUintN(64, xBigInt);\n // return Number(xBigInt);\n\n return x;\n}\n","import { IsReadableStream, ReadableStream } from '../readable-stream';\n\nexport function assertReadableStream(x: unknown, context: string): asserts x is ReadableStream {\n if (!IsReadableStream(x)) {\n throw new TypeError(`${context} is not a ReadableStream.`);\n }\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport {\n ReadableStreamReaderGenericCancel,\n ReadableStreamReaderGenericInitialize,\n ReadableStreamReaderGenericRelease,\n readerLockException\n} from './generic-reader';\nimport { IsReadableStreamLocked, ReadableStream } from '../readable-stream';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { PullSteps } from '../abstract-ops/internal-methods';\nimport { newPromise, promiseRejectedWith } from '../helpers/webidl';\nimport { assertRequiredArgument } from '../validators/basic';\nimport { assertReadableStream } from '../validators/readable-stream';\n\n/**\n * A result returned by {@link ReadableStreamDefaultReader.read}.\n *\n * @public\n */\nexport type ReadableStreamDefaultReadResult = {\n done: false;\n value: T;\n} | {\n done: true;\n value?: undefined;\n}\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamDefaultReader(stream: ReadableStream): ReadableStreamDefaultReader {\n return new ReadableStreamDefaultReader(stream);\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamAddReadRequest(stream: ReadableStream,\n readRequest: ReadRequest): void {\n assert(IsReadableStreamDefaultReader(stream._reader));\n assert(stream._state === 'readable');\n\n (stream._reader! as ReadableStreamDefaultReader)._readRequests.push(readRequest);\n}\n\nexport function ReadableStreamFulfillReadRequest(stream: ReadableStream, chunk: R | undefined, done: boolean) {\n const reader = stream._reader as ReadableStreamDefaultReader;\n\n assert(reader._readRequests.length > 0);\n\n const readRequest = reader._readRequests.shift()!;\n if (done) {\n readRequest._closeSteps();\n } else {\n readRequest._chunkSteps(chunk!);\n }\n}\n\nexport function ReadableStreamGetNumReadRequests(stream: ReadableStream): number {\n return (stream._reader as ReadableStreamDefaultReader)._readRequests.length;\n}\n\nexport function ReadableStreamHasDefaultReader(stream: ReadableStream): boolean {\n const reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (!IsReadableStreamDefaultReader(reader)) {\n return false;\n }\n\n return true;\n}\n\n// Readers\n\nexport interface ReadRequest {\n _chunkSteps(chunk: R): void;\n\n _closeSteps(): void;\n\n _errorSteps(e: any): void;\n}\n\n/**\n * A default reader vended by a {@link ReadableStream}.\n *\n * @public\n */\nexport class ReadableStreamDefaultReader {\n /** @internal */\n _ownerReadableStream!: ReadableStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _readRequests: SimpleQueue>;\n\n constructor(stream: ReadableStream) {\n assertRequiredArgument(stream, 1, 'ReadableStreamDefaultReader');\n assertReadableStream(stream, 'First parameter');\n\n if (IsReadableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readRequests = new SimpleQueue();\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed,\n * or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n\n /**\n * Returns a promise that allows access to the next chunk from the stream's internal queue, if available.\n *\n * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.\n */\n read(): Promise> {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('read'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('read from'));\n }\n\n let resolvePromise!: (result: ReadableStreamDefaultReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => resolvePromise({ value: chunk, done: false }),\n _closeSteps: () => resolvePromise({ value: undefined, done: true }),\n _errorSteps: e => rejectPromise(e)\n };\n ReadableStreamDefaultReaderRead(this, readRequest);\n return promise;\n }\n\n /**\n * Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.\n * If the associated stream is errored when the lock is released, the reader will appear errored in the same way\n * from now on; otherwise, the reader will appear closed.\n *\n * A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by\n * the reader's {@link ReadableStreamDefaultReader.read | read()} method has not yet been settled. Attempting to\n * do so will throw a `TypeError` and leave the reader locked to the stream.\n */\n releaseLock(): void {\n if (!IsReadableStreamDefaultReader(this)) {\n throw defaultReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n ReadableStreamDefaultReaderRelease(this);\n }\n}\n\nObject.defineProperties(ReadableStreamDefaultReader.prototype, {\n cancel: { enumerable: true },\n read: { enumerable: true },\n releaseLock: { enumerable: true },\n closed: { enumerable: true }\n});\nsetFunctionName(ReadableStreamDefaultReader.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStreamDefaultReader.prototype.read, 'read');\nsetFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, 'releaseLock');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamDefaultReader.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamDefaultReader',\n configurable: true\n });\n}\n\n// Abstract operations for the readers.\n\nexport function IsReadableStreamDefaultReader(x: any): x is ReadableStreamDefaultReader {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {\n return false;\n }\n\n return x instanceof ReadableStreamDefaultReader;\n}\n\nexport function ReadableStreamDefaultReaderRead(reader: ReadableStreamDefaultReader,\n readRequest: ReadRequest): void {\n const stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n readRequest._closeSteps();\n } else if (stream._state === 'errored') {\n readRequest._errorSteps(stream._storedError);\n } else {\n assert(stream._state === 'readable');\n stream._readableStreamController[PullSteps](readRequest as ReadRequest);\n }\n}\n\nexport function ReadableStreamDefaultReaderRelease(reader: ReadableStreamDefaultReader) {\n ReadableStreamReaderGenericRelease(reader);\n const e = new TypeError('Reader was released');\n ReadableStreamDefaultReaderErrorReadRequests(reader, e);\n}\n\nexport function ReadableStreamDefaultReaderErrorReadRequests(reader: ReadableStreamDefaultReader, e: any) {\n const readRequests = reader._readRequests;\n reader._readRequests = new SimpleQueue();\n readRequests.forEach(readRequest => {\n readRequest._errorSteps(e);\n });\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nfunction defaultReaderBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamDefaultReader.prototype.${name} can only be used on a ReadableStreamDefaultReader`);\n}\n","/// \n\n/* eslint-disable @typescript-eslint/no-empty-function */\nexport const AsyncIteratorPrototype: AsyncIterable =\n Object.getPrototypeOf(Object.getPrototypeOf(async function* (): AsyncIterableIterator {}).prototype);\n","/// \n\nimport { ReadableStream } from '../readable-stream';\nimport {\n AcquireReadableStreamDefaultReader,\n ReadableStreamDefaultReader,\n ReadableStreamDefaultReaderRead,\n type ReadableStreamDefaultReadResult,\n type ReadRequest\n} from './default-reader';\nimport { ReadableStreamReaderGenericCancel, ReadableStreamReaderGenericRelease } from './generic-reader';\nimport assert from '../../stub/assert';\nimport { AsyncIteratorPrototype } from '@@target/stub/async-iterator-prototype';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n queueMicrotask,\n transformPromiseWith\n} from '../helpers/webidl';\n\n/**\n * An async iterator returned by {@link ReadableStream.values}.\n *\n * @public\n */\nexport interface ReadableStreamAsyncIterator extends AsyncIterableIterator {\n next(): Promise>;\n\n return(value?: any): Promise>;\n}\n\nexport class ReadableStreamAsyncIteratorImpl {\n private readonly _reader: ReadableStreamDefaultReader;\n private readonly _preventCancel: boolean;\n private _ongoingPromise: Promise> | undefined = undefined;\n private _isFinished = false;\n\n constructor(reader: ReadableStreamDefaultReader, preventCancel: boolean) {\n this._reader = reader;\n this._preventCancel = preventCancel;\n }\n\n next(): Promise> {\n const nextSteps = () => this._nextSteps();\n this._ongoingPromise = this._ongoingPromise ?\n transformPromiseWith(this._ongoingPromise, nextSteps, nextSteps) :\n nextSteps();\n return this._ongoingPromise;\n }\n\n return(value: any): Promise> {\n const returnSteps = () => this._returnSteps(value);\n return this._ongoingPromise ?\n transformPromiseWith(this._ongoingPromise, returnSteps, returnSteps) :\n returnSteps();\n }\n\n private _nextSteps(): Promise> {\n if (this._isFinished) {\n return Promise.resolve({ value: undefined, done: true });\n }\n\n const reader = this._reader;\n assert(reader._ownerReadableStream !== undefined);\n\n let resolvePromise!: (result: ReadableStreamDefaultReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => {\n this._ongoingPromise = undefined;\n // This needs to be delayed by one microtask, otherwise we stop pulling too early which breaks a test.\n // FIXME Is this a bug in the specification, or in the test?\n queueMicrotask(() => resolvePromise({ value: chunk, done: false }));\n },\n _closeSteps: () => {\n this._ongoingPromise = undefined;\n this._isFinished = true;\n ReadableStreamReaderGenericRelease(reader);\n resolvePromise({ value: undefined, done: true });\n },\n _errorSteps: reason => {\n this._ongoingPromise = undefined;\n this._isFinished = true;\n ReadableStreamReaderGenericRelease(reader);\n rejectPromise(reason);\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n return promise;\n }\n\n private _returnSteps(value: any): Promise> {\n if (this._isFinished) {\n return Promise.resolve({ value, done: true });\n }\n this._isFinished = true;\n\n const reader = this._reader;\n assert(reader._ownerReadableStream !== undefined);\n assert(reader._readRequests.length === 0);\n\n if (!this._preventCancel) {\n const result = ReadableStreamReaderGenericCancel(reader, value);\n ReadableStreamReaderGenericRelease(reader);\n return transformPromiseWith(result, () => ({ value, done: true }));\n }\n\n ReadableStreamReaderGenericRelease(reader);\n return promiseResolvedWith({ value, done: true });\n }\n}\n\ninterface ReadableStreamAsyncIteratorInstance extends ReadableStreamAsyncIterator {\n /** @interal */\n _asyncIteratorImpl: ReadableStreamAsyncIteratorImpl;\n\n next(): Promise>;\n\n return(value?: any): Promise>;\n}\n\nconst ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIteratorInstance = {\n next(this: ReadableStreamAsyncIteratorInstance): Promise> {\n if (!IsReadableStreamAsyncIterator(this)) {\n return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next'));\n }\n return this._asyncIteratorImpl.next();\n },\n\n return(this: ReadableStreamAsyncIteratorInstance, value: any): Promise> {\n if (!IsReadableStreamAsyncIterator(this)) {\n return promiseRejectedWith(streamAsyncIteratorBrandCheckException('return'));\n }\n return this._asyncIteratorImpl.return(value);\n }\n} as any;\nObject.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamAsyncIterator(stream: ReadableStream,\n preventCancel: boolean): ReadableStreamAsyncIterator {\n const reader = AcquireReadableStreamDefaultReader(stream);\n const impl = new ReadableStreamAsyncIteratorImpl(reader, preventCancel);\n const iterator: ReadableStreamAsyncIteratorInstance = Object.create(ReadableStreamAsyncIteratorPrototype);\n iterator._asyncIteratorImpl = impl;\n return iterator;\n}\n\nfunction IsReadableStreamAsyncIterator(x: any): x is ReadableStreamAsyncIterator {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_asyncIteratorImpl')) {\n return false;\n }\n\n try {\n // noinspection SuspiciousTypeOfGuard\n return (x as ReadableStreamAsyncIteratorInstance)._asyncIteratorImpl instanceof\n ReadableStreamAsyncIteratorImpl;\n } catch {\n return false;\n }\n}\n\n// Helper functions for the ReadableStream.\n\nfunction streamAsyncIteratorBrandCheckException(name: string): TypeError {\n return new TypeError(`ReadableStreamAsyncIterator.${name} can only be used on a ReadableSteamAsyncIterator`);\n}\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#Polyfill\nconst NumberIsNaN: typeof Number.isNaN = Number.isNaN || function (x) {\n // eslint-disable-next-line no-self-compare\n return x !== x;\n};\n\nexport default NumberIsNaN;\n","import { reflectCall } from 'lib/helpers/webidl';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport assert from '../../stub/assert';\n\ndeclare global {\n interface ArrayBuffer {\n readonly detached: boolean;\n\n transfer(): ArrayBuffer;\n }\n\n function structuredClone(value: T, options: { transfer: ArrayBuffer[] }): T;\n}\n\nexport function CreateArrayFromList(elements: T): T {\n // We use arrays to represent lists, so this is basically a no-op.\n // Do a slice though just in case we happen to depend on the unique-ness.\n return elements.slice() as T;\n}\n\nexport function CopyDataBlockBytes(dest: ArrayBuffer,\n destOffset: number,\n src: ArrayBuffer,\n srcOffset: number,\n n: number) {\n new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);\n}\n\nexport let TransferArrayBuffer = (O: ArrayBuffer): ArrayBuffer => {\n if (typeof O.transfer === 'function') {\n TransferArrayBuffer = buffer => buffer.transfer();\n } else if (typeof structuredClone === 'function') {\n TransferArrayBuffer = buffer => structuredClone(buffer, { transfer: [buffer] });\n } else {\n // Not implemented correctly\n TransferArrayBuffer = buffer => buffer;\n }\n return TransferArrayBuffer(O);\n};\n\nexport function CanTransferArrayBuffer(O: ArrayBuffer): boolean {\n return !IsDetachedBuffer(O);\n}\n\nexport let IsDetachedBuffer = (O: ArrayBuffer): boolean => {\n if (typeof O.detached === 'boolean') {\n IsDetachedBuffer = buffer => buffer.detached;\n } else {\n // Not implemented correctly\n IsDetachedBuffer = buffer => buffer.byteLength === 0;\n }\n return IsDetachedBuffer(O);\n};\n\nexport function ArrayBufferSlice(buffer: ArrayBuffer, begin: number, end: number): ArrayBuffer {\n // ArrayBuffer.prototype.slice is not available on IE10\n // https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice\n if (buffer.slice) {\n return buffer.slice(begin, end);\n }\n const length = end - begin;\n const slice = new ArrayBuffer(length);\n CopyDataBlockBytes(slice, 0, buffer, begin, length);\n return slice;\n}\n\nexport type MethodName = {\n [P in keyof T]: T[P] extends Function | undefined ? P : never;\n}[keyof T];\n\nexport function GetMethod>(receiver: T, prop: K): T[K] | undefined {\n const func = receiver[prop];\n if (func === undefined || func === null) {\n return undefined;\n }\n if (typeof func !== 'function') {\n throw new TypeError(`${String(prop)} is not a function`);\n }\n return func;\n}\n\nexport interface SyncIteratorRecord {\n iterator: Iterator,\n nextMethod: Iterator['next'],\n done: boolean;\n}\n\nexport interface AsyncIteratorRecord {\n iterator: AsyncIterator,\n nextMethod: AsyncIterator['next'],\n done: boolean;\n}\n\nexport type SyncOrAsyncIteratorRecord = SyncIteratorRecord | AsyncIteratorRecord;\n\nexport function CreateAsyncFromSyncIterator(syncIteratorRecord: SyncIteratorRecord): AsyncIteratorRecord {\n // Instead of re-implementing CreateAsyncFromSyncIterator and %AsyncFromSyncIteratorPrototype%,\n // we use yield* inside an async generator function to achieve the same result.\n\n // Wrap the sync iterator inside a sync iterable, so we can use it with yield*.\n const syncIterable = {\n [Symbol.iterator]: () => syncIteratorRecord.iterator\n };\n // Create an async generator function and immediately invoke it.\n const asyncIterator = (async function* () {\n return yield* syncIterable;\n }());\n // Return as an async iterator record.\n const nextMethod = asyncIterator.next;\n return { iterator: asyncIterator, nextMethod, done: false };\n}\n\n// Aligns with core-js/modules/es.symbol.async-iterator.js\nexport const SymbolAsyncIterator: (typeof Symbol)['asyncIterator'] =\n Symbol.asyncIterator ??\n Symbol.for?.('Symbol.asyncIterator') ??\n '@@asyncIterator';\n\nexport type SyncOrAsyncIterable = Iterable | AsyncIterable;\nexport type SyncOrAsyncIteratorMethod = () => (Iterator | AsyncIterator);\n\nfunction GetIterator(\n obj: SyncOrAsyncIterable,\n hint: 'async',\n method?: SyncOrAsyncIteratorMethod\n): AsyncIteratorRecord;\nfunction GetIterator(\n obj: Iterable,\n hint: 'sync',\n method?: SyncOrAsyncIteratorMethod\n): SyncIteratorRecord;\nfunction GetIterator(\n obj: SyncOrAsyncIterable,\n hint = 'sync',\n method?: SyncOrAsyncIteratorMethod\n): SyncOrAsyncIteratorRecord {\n assert(hint === 'sync' || hint === 'async');\n if (method === undefined) {\n if (hint === 'async') {\n method = GetMethod(obj as AsyncIterable, SymbolAsyncIterator);\n if (method === undefined) {\n const syncMethod = GetMethod(obj as Iterable, Symbol.iterator);\n const syncIteratorRecord = GetIterator(obj as Iterable, 'sync', syncMethod);\n return CreateAsyncFromSyncIterator(syncIteratorRecord);\n }\n } else {\n method = GetMethod(obj as Iterable, Symbol.iterator);\n }\n }\n if (method === undefined) {\n throw new TypeError('The object is not iterable');\n }\n const iterator = reflectCall(method, obj, []);\n if (!typeIsObject(iterator)) {\n throw new TypeError('The iterator method must return an object');\n }\n const nextMethod = iterator.next;\n return { iterator, nextMethod, done: false } as SyncOrAsyncIteratorRecord;\n}\n\nexport { GetIterator };\n\nexport function IteratorNext(iteratorRecord: AsyncIteratorRecord): Promise> {\n const result = reflectCall(iteratorRecord.nextMethod, iteratorRecord.iterator, []);\n if (!typeIsObject(result)) {\n throw new TypeError('The iterator.next() method must return an object');\n }\n return result;\n}\n\nexport function IteratorComplete(\n iterResult: IteratorResult\n): iterResult is IteratorReturnResult {\n assert(typeIsObject(iterResult));\n return Boolean(iterResult.done);\n}\n\nexport function IteratorValue(iterResult: IteratorYieldResult): T {\n assert(typeIsObject(iterResult));\n return iterResult.value;\n}\n","import NumberIsNaN from '../../stub/number-isnan';\nimport { ArrayBufferSlice } from './ecmascript';\nimport type { NonShared } from '../helpers/array-buffer-view';\n\nexport function IsNonNegativeNumber(v: number): boolean {\n if (typeof v !== 'number') {\n return false;\n }\n\n if (NumberIsNaN(v)) {\n return false;\n }\n\n if (v < 0) {\n return false;\n }\n\n return true;\n}\n\nexport function CloneAsUint8Array(O: NonShared): NonShared {\n const buffer = ArrayBufferSlice(O.buffer, O.byteOffset, O.byteOffset + O.byteLength);\n return new Uint8Array(buffer) as NonShared;\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport { IsNonNegativeNumber } from './miscellaneous';\n\nexport interface QueueContainer {\n _queue: SimpleQueue;\n _queueTotalSize: number;\n}\n\nexport interface QueuePair {\n value: T;\n size: number;\n}\n\nexport function DequeueValue(container: QueueContainer>): T {\n assert('_queue' in container && '_queueTotalSize' in container);\n assert(container._queue.length > 0);\n\n const pair = container._queue.shift()!;\n container._queueTotalSize -= pair.size;\n if (container._queueTotalSize < 0) {\n container._queueTotalSize = 0;\n }\n\n return pair.value;\n}\n\nexport function EnqueueValueWithSize(container: QueueContainer>, value: T, size: number) {\n assert('_queue' in container && '_queueTotalSize' in container);\n\n if (!IsNonNegativeNumber(size) || size === Infinity) {\n throw new RangeError('Size must be a finite, non-NaN, non-negative number.');\n }\n\n container._queue.push({ value, size });\n container._queueTotalSize += size;\n}\n\nexport function PeekQueueValue(container: QueueContainer>): T {\n assert('_queue' in container && '_queueTotalSize' in container);\n assert(container._queue.length > 0);\n\n const pair = container._queue.peek();\n return pair.value;\n}\n\nexport function ResetQueue(container: QueueContainer) {\n assert('_queue' in container && '_queueTotalSize' in container);\n\n container._queue = new SimpleQueue();\n container._queueTotalSize = 0;\n}\n","export type TypedArray =\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Float32Array\n | Float64Array;\n\nexport type NonShared = T & {\n buffer: ArrayBuffer;\n}\n\nexport interface ArrayBufferViewConstructor {\n new(buffer: ArrayBuffer, byteOffset: number, length?: number): T;\n\n readonly prototype: T;\n}\n\nexport interface TypedArrayConstructor extends ArrayBufferViewConstructor {\n readonly BYTES_PER_ELEMENT: number;\n}\n\nexport type DataViewConstructor = ArrayBufferViewConstructor;\n\nfunction isDataViewConstructor(ctor: Function): ctor is DataViewConstructor {\n return ctor === DataView;\n}\n\nexport function isDataView(view: ArrayBufferView): view is DataView {\n return isDataViewConstructor(view.constructor);\n}\n\nexport function arrayBufferViewElementSize(ctor: ArrayBufferViewConstructor): number {\n if (isDataViewConstructor(ctor)) {\n return 1;\n }\n return (ctor as unknown as TypedArrayConstructor).BYTES_PER_ELEMENT;\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport { ResetQueue } from '../abstract-ops/queue-with-sizes';\nimport {\n IsReadableStreamDefaultReader,\n ReadableStreamAddReadRequest,\n ReadableStreamFulfillReadRequest,\n ReadableStreamGetNumReadRequests,\n ReadableStreamHasDefaultReader,\n type ReadRequest\n} from './default-reader';\nimport {\n ReadableStreamAddReadIntoRequest,\n ReadableStreamFulfillReadIntoRequest,\n ReadableStreamGetNumReadIntoRequests,\n ReadableStreamHasBYOBReader,\n type ReadIntoRequest\n} from './byob-reader';\nimport NumberIsInteger from '../../stub/number-isinteger';\nimport {\n IsReadableStreamLocked,\n type ReadableByteStream,\n ReadableStreamClose,\n ReadableStreamError\n} from '../readable-stream';\nimport type { ValidatedUnderlyingByteSource } from './underlying-source';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport {\n ArrayBufferSlice,\n CanTransferArrayBuffer,\n CopyDataBlockBytes,\n IsDetachedBuffer,\n TransferArrayBuffer\n} from '../abstract-ops/ecmascript';\nimport { CancelSteps, PullSteps, ReleaseSteps } from '../abstract-ops/internal-methods';\nimport { promiseResolvedWith, uponPromise } from '../helpers/webidl';\nimport { assertRequiredArgument, convertUnsignedLongLongWithEnforceRange } from '../validators/basic';\nimport {\n type ArrayBufferViewConstructor,\n arrayBufferViewElementSize,\n type NonShared,\n type TypedArrayConstructor\n} from '../helpers/array-buffer-view';\n\n/**\n * A pull-into request in a {@link ReadableByteStreamController}.\n *\n * @public\n */\nexport class ReadableStreamBYOBRequest {\n /** @internal */\n _associatedReadableByteStreamController!: ReadableByteStreamController;\n /** @internal */\n _view!: NonShared | null;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the view for writing in to, or `null` if the BYOB request has already been responded to.\n */\n get view(): ArrayBufferView | null {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('view');\n }\n\n return this._view;\n }\n\n /**\n * Indicates to the associated readable byte stream that `bytesWritten` bytes were written into\n * {@link ReadableStreamBYOBRequest.view | view}, causing the result be surfaced to the consumer.\n *\n * After this method is called, {@link ReadableStreamBYOBRequest.view | view} will be transferred and no longer\n * modifiable.\n */\n respond(bytesWritten: number): void;\n respond(bytesWritten: number | undefined): void {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('respond');\n }\n assertRequiredArgument(bytesWritten, 1, 'respond');\n bytesWritten = convertUnsignedLongLongWithEnforceRange(bytesWritten, 'First parameter');\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n if (IsDetachedBuffer(this._view!.buffer)) {\n throw new TypeError(`The BYOB request's buffer has been detached and so cannot be used as a response`);\n }\n\n assert(this._view!.byteLength > 0);\n assert(this._view!.buffer.byteLength > 0);\n\n ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);\n }\n\n /**\n * Indicates to the associated readable byte stream that instead of writing into\n * {@link ReadableStreamBYOBRequest.view | view}, the underlying byte source is providing a new `ArrayBufferView`,\n * which will be given to the consumer of the readable byte stream.\n *\n * After this method is called, `view` will be transferred and no longer modifiable.\n */\n respondWithNewView(view: ArrayBufferView): void;\n respondWithNewView(view: NonShared): void {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('respondWithNewView');\n }\n assertRequiredArgument(view, 1, 'respondWithNewView');\n\n if (!ArrayBuffer.isView(view)) {\n throw new TypeError('You can only respond with array buffer views');\n }\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n if (IsDetachedBuffer(view.buffer)) {\n throw new TypeError('The given view\\'s buffer has been detached and so cannot be used as a response');\n }\n\n ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);\n }\n}\n\nObject.defineProperties(ReadableStreamBYOBRequest.prototype, {\n respond: { enumerable: true },\n respondWithNewView: { enumerable: true },\n view: { enumerable: true }\n});\nsetFunctionName(ReadableStreamBYOBRequest.prototype.respond, 'respond');\nsetFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, 'respondWithNewView');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamBYOBRequest.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamBYOBRequest',\n configurable: true\n });\n}\n\ninterface ByteQueueElement {\n buffer: ArrayBuffer;\n byteOffset: number;\n byteLength: number;\n}\n\ntype PullIntoDescriptor = NonShared> =\n DefaultPullIntoDescriptor\n | BYOBPullIntoDescriptor;\n\ninterface DefaultPullIntoDescriptor {\n buffer: ArrayBuffer;\n bufferByteLength: number;\n byteOffset: number;\n byteLength: number;\n bytesFilled: number;\n minimumFill: number;\n elementSize: number;\n viewConstructor: TypedArrayConstructor;\n readerType: 'default' | 'none';\n}\n\ninterface BYOBPullIntoDescriptor = NonShared> {\n buffer: ArrayBuffer;\n bufferByteLength: number;\n byteOffset: number;\n byteLength: number;\n bytesFilled: number;\n minimumFill: number;\n elementSize: number;\n viewConstructor: ArrayBufferViewConstructor;\n readerType: 'byob' | 'none';\n}\n\n/**\n * Allows control of a {@link ReadableStream | readable byte stream}'s state and internal queue.\n *\n * @public\n */\nexport class ReadableByteStreamController {\n /** @internal */\n _controlledReadableByteStream!: ReadableByteStream;\n /** @internal */\n _queue!: SimpleQueue;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _closeRequested!: boolean;\n /** @internal */\n _pullAgain!: boolean;\n /** @internal */\n _pulling !: boolean;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _pullAlgorithm!: () => Promise;\n /** @internal */\n _cancelAlgorithm!: (reason: any) => Promise;\n /** @internal */\n _autoAllocateChunkSize: number | undefined;\n /** @internal */\n _byobRequest: ReadableStreamBYOBRequest | null;\n /** @internal */\n _pendingPullIntos!: SimpleQueue;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the current BYOB pull request, or `null` if there isn't one.\n */\n get byobRequest(): ReadableStreamBYOBRequest | null {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('byobRequest');\n }\n\n return ReadableByteStreamControllerGetBYOBRequest(this);\n }\n\n /**\n * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is\n * over-full. An underlying byte source ought to use this information to determine when and how to apply backpressure.\n */\n get desiredSize(): number | null {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('desiredSize');\n }\n\n return ReadableByteStreamControllerGetDesiredSize(this);\n }\n\n /**\n * Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from\n * the stream, but once those are read, the stream will become closed.\n */\n close(): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('close');\n }\n\n if (this._closeRequested) {\n throw new TypeError('The stream has already been closed; do not close it again!');\n }\n\n const state = this._controlledReadableByteStream._state;\n if (state !== 'readable') {\n throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be closed`);\n }\n\n ReadableByteStreamControllerClose(this);\n }\n\n /**\n * Enqueues the given chunk chunk in the controlled readable stream.\n * The chunk has to be an `ArrayBufferView` instance, or else a `TypeError` will be thrown.\n */\n enqueue(chunk: ArrayBufferView): void;\n enqueue(chunk: NonShared): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('enqueue');\n }\n\n assertRequiredArgument(chunk, 1, 'enqueue');\n if (!ArrayBuffer.isView(chunk)) {\n throw new TypeError('chunk must be an array buffer view');\n }\n if (chunk.byteLength === 0) {\n throw new TypeError('chunk must have non-zero byteLength');\n }\n if (chunk.buffer.byteLength === 0) {\n throw new TypeError(`chunk's buffer must have non-zero byteLength`);\n }\n\n if (this._closeRequested) {\n throw new TypeError('stream is closed or draining');\n }\n\n const state = this._controlledReadableByteStream._state;\n if (state !== 'readable') {\n throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be enqueued to`);\n }\n\n ReadableByteStreamControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.\n */\n error(e: any = undefined): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('error');\n }\n\n ReadableByteStreamControllerError(this, e);\n }\n\n /** @internal */\n [CancelSteps](reason: any): Promise {\n ReadableByteStreamControllerClearPendingPullIntos(this);\n\n ResetQueue(this);\n\n const result = this._cancelAlgorithm(reason);\n ReadableByteStreamControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [PullSteps](readRequest: ReadRequest>): void {\n const stream = this._controlledReadableByteStream;\n assert(ReadableStreamHasDefaultReader(stream));\n\n if (this._queueTotalSize > 0) {\n assert(ReadableStreamGetNumReadRequests(stream) === 0);\n\n ReadableByteStreamControllerFillReadRequestFromQueue(this, readRequest);\n return;\n }\n\n const autoAllocateChunkSize = this._autoAllocateChunkSize;\n if (autoAllocateChunkSize !== undefined) {\n let buffer: ArrayBuffer;\n try {\n buffer = new ArrayBuffer(autoAllocateChunkSize);\n } catch (bufferE) {\n readRequest._errorSteps(bufferE);\n return;\n }\n\n const pullIntoDescriptor: DefaultPullIntoDescriptor = {\n buffer,\n bufferByteLength: autoAllocateChunkSize,\n byteOffset: 0,\n byteLength: autoAllocateChunkSize,\n bytesFilled: 0,\n minimumFill: 1,\n elementSize: 1,\n viewConstructor: Uint8Array,\n readerType: 'default'\n };\n\n this._pendingPullIntos.push(pullIntoDescriptor);\n }\n\n ReadableStreamAddReadRequest(stream, readRequest);\n ReadableByteStreamControllerCallPullIfNeeded(this);\n }\n\n /** @internal */\n [ReleaseSteps](): void {\n if (this._pendingPullIntos.length > 0) {\n const firstPullInto = this._pendingPullIntos.peek();\n firstPullInto.readerType = 'none';\n\n this._pendingPullIntos = new SimpleQueue();\n this._pendingPullIntos.push(firstPullInto);\n }\n }\n}\n\nObject.defineProperties(ReadableByteStreamController.prototype, {\n close: { enumerable: true },\n enqueue: { enumerable: true },\n error: { enumerable: true },\n byobRequest: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(ReadableByteStreamController.prototype.close, 'close');\nsetFunctionName(ReadableByteStreamController.prototype.enqueue, 'enqueue');\nsetFunctionName(ReadableByteStreamController.prototype.error, 'error');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableByteStreamController.prototype, Symbol.toStringTag, {\n value: 'ReadableByteStreamController',\n configurable: true\n });\n}\n\n// Abstract operations for the ReadableByteStreamController.\n\nexport function IsReadableByteStreamController(x: any): x is ReadableByteStreamController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableByteStream')) {\n return false;\n }\n\n return x instanceof ReadableByteStreamController;\n}\n\nfunction IsReadableStreamBYOBRequest(x: any): x is ReadableStreamBYOBRequest {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {\n return false;\n }\n\n return x instanceof ReadableStreamBYOBRequest;\n}\n\nfunction ReadableByteStreamControllerCallPullIfNeeded(controller: ReadableByteStreamController): void {\n const shouldPull = ReadableByteStreamControllerShouldCallPull(controller);\n if (!shouldPull) {\n return;\n }\n\n if (controller._pulling) {\n controller._pullAgain = true;\n return;\n }\n\n assert(!controller._pullAgain);\n\n controller._pulling = true;\n\n // TODO: Test controller argument\n const pullPromise = controller._pullAlgorithm();\n uponPromise(\n pullPromise,\n () => {\n controller._pulling = false;\n\n if (controller._pullAgain) {\n controller._pullAgain = false;\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n\n return null;\n },\n e => {\n ReadableByteStreamControllerError(controller, e);\n return null;\n }\n );\n}\n\nfunction ReadableByteStreamControllerClearPendingPullIntos(controller: ReadableByteStreamController) {\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n controller._pendingPullIntos = new SimpleQueue();\n}\n\nfunction ReadableByteStreamControllerCommitPullIntoDescriptor>(\n stream: ReadableByteStream,\n pullIntoDescriptor: PullIntoDescriptor\n) {\n assert(stream._state !== 'errored');\n assert(pullIntoDescriptor.readerType !== 'none');\n\n let done = false;\n if (stream._state === 'closed') {\n assert(pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize === 0);\n done = true;\n }\n\n const filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n if (pullIntoDescriptor.readerType === 'default') {\n ReadableStreamFulfillReadRequest(stream, filledView as unknown as NonShared, done);\n } else {\n assert(pullIntoDescriptor.readerType === 'byob');\n ReadableStreamFulfillReadIntoRequest(stream, filledView, done);\n }\n}\n\nfunction ReadableByteStreamControllerConvertPullIntoDescriptor>(\n pullIntoDescriptor: PullIntoDescriptor\n): T {\n const bytesFilled = pullIntoDescriptor.bytesFilled;\n const elementSize = pullIntoDescriptor.elementSize;\n\n assert(bytesFilled <= pullIntoDescriptor.byteLength);\n assert(bytesFilled % elementSize === 0);\n\n return new pullIntoDescriptor.viewConstructor(\n pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize) as T;\n}\n\nfunction ReadableByteStreamControllerEnqueueChunkToQueue(controller: ReadableByteStreamController,\n buffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number) {\n controller._queue.push({ buffer, byteOffset, byteLength });\n controller._queueTotalSize += byteLength;\n}\n\nfunction ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller: ReadableByteStreamController,\n buffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number) {\n let clonedChunk;\n try {\n clonedChunk = ArrayBufferSlice(buffer, byteOffset, byteOffset + byteLength);\n } catch (cloneE) {\n ReadableByteStreamControllerError(controller, cloneE);\n throw cloneE;\n }\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, clonedChunk, 0, byteLength);\n}\n\nfunction ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller: ReadableByteStreamController,\n firstDescriptor: PullIntoDescriptor) {\n assert(firstDescriptor.readerType === 'none');\n if (firstDescriptor.bytesFilled > 0) {\n ReadableByteStreamControllerEnqueueClonedChunkToQueue(\n controller,\n firstDescriptor.buffer,\n firstDescriptor.byteOffset,\n firstDescriptor.bytesFilled\n );\n }\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n}\n\nfunction ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller: ReadableByteStreamController,\n pullIntoDescriptor: PullIntoDescriptor) {\n const maxBytesToCopy = Math.min(controller._queueTotalSize,\n pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);\n const maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;\n\n let totalBytesToCopyRemaining = maxBytesToCopy;\n let ready = false;\n assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill);\n const remainderBytes = maxBytesFilled % pullIntoDescriptor.elementSize;\n const maxAlignedBytes = maxBytesFilled - remainderBytes;\n // A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head\n // of the queue, so the underlying source can keep filling it.\n if (maxAlignedBytes >= pullIntoDescriptor.minimumFill) {\n totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;\n ready = true;\n }\n\n const queue = controller._queue;\n\n while (totalBytesToCopyRemaining > 0) {\n const headOfQueue = queue.peek();\n\n const bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);\n\n const destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n CopyDataBlockBytes(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);\n\n if (headOfQueue.byteLength === bytesToCopy) {\n queue.shift();\n } else {\n headOfQueue.byteOffset += bytesToCopy;\n headOfQueue.byteLength -= bytesToCopy;\n }\n controller._queueTotalSize -= bytesToCopy;\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);\n\n totalBytesToCopyRemaining -= bytesToCopy;\n }\n\n if (!ready) {\n assert(controller._queueTotalSize === 0);\n assert(pullIntoDescriptor.bytesFilled > 0);\n assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill);\n }\n\n return ready;\n}\n\nfunction ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller: ReadableByteStreamController,\n size: number,\n pullIntoDescriptor: PullIntoDescriptor) {\n assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos.peek() === pullIntoDescriptor);\n assert(controller._byobRequest === null);\n pullIntoDescriptor.bytesFilled += size;\n}\n\nfunction ReadableByteStreamControllerHandleQueueDrain(controller: ReadableByteStreamController) {\n assert(controller._controlledReadableByteStream._state === 'readable');\n\n if (controller._queueTotalSize === 0 && controller._closeRequested) {\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamClose(controller._controlledReadableByteStream);\n } else {\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n}\n\nfunction ReadableByteStreamControllerInvalidateBYOBRequest(controller: ReadableByteStreamController) {\n if (controller._byobRequest === null) {\n return;\n }\n\n controller._byobRequest._associatedReadableByteStreamController = undefined!;\n controller._byobRequest._view = null!;\n controller._byobRequest = null;\n}\n\nfunction ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller: ReadableByteStreamController) {\n assert(!controller._closeRequested);\n\n while (controller._pendingPullIntos.length > 0) {\n if (controller._queueTotalSize === 0) {\n return;\n }\n\n const pullIntoDescriptor = controller._pendingPullIntos.peek();\n assert(pullIntoDescriptor.readerType !== 'none');\n\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor)) {\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n ReadableByteStreamControllerCommitPullIntoDescriptor(\n controller._controlledReadableByteStream,\n pullIntoDescriptor\n );\n }\n }\n}\n\nfunction ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller: ReadableByteStreamController) {\n const reader = controller._controlledReadableByteStream._reader;\n assert(IsReadableStreamDefaultReader(reader));\n while (reader._readRequests.length > 0) {\n if (controller._queueTotalSize === 0) {\n return;\n }\n const readRequest = reader._readRequests.shift();\n ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest);\n }\n}\n\nexport function ReadableByteStreamControllerPullInto>(\n controller: ReadableByteStreamController,\n view: T,\n min: number,\n readIntoRequest: ReadIntoRequest\n): void {\n const stream = controller._controlledReadableByteStream;\n\n const ctor = view.constructor as ArrayBufferViewConstructor;\n const elementSize = arrayBufferViewElementSize(ctor);\n\n const { byteOffset, byteLength } = view;\n\n const minimumFill = min * elementSize;\n assert(minimumFill >= elementSize && minimumFill <= byteLength);\n assert(minimumFill % elementSize === 0);\n\n let buffer: ArrayBuffer;\n try {\n buffer = TransferArrayBuffer(view.buffer);\n } catch (e) {\n readIntoRequest._errorSteps(e);\n return;\n }\n\n const pullIntoDescriptor: BYOBPullIntoDescriptor = {\n buffer,\n bufferByteLength: buffer.byteLength,\n byteOffset,\n byteLength,\n bytesFilled: 0,\n minimumFill,\n elementSize,\n viewConstructor: ctor,\n readerType: 'byob'\n };\n\n if (controller._pendingPullIntos.length > 0) {\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n // No ReadableByteStreamControllerCallPullIfNeeded() call since:\n // - No change happens on desiredSize\n // - The source has already been notified of that there's at least 1 pending read(view)\n\n ReadableStreamAddReadIntoRequest(stream, readIntoRequest);\n return;\n }\n\n if (stream._state === 'closed') {\n const emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);\n readIntoRequest._closeSteps(emptyView);\n return;\n }\n\n if (controller._queueTotalSize > 0) {\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor)) {\n const filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n\n ReadableByteStreamControllerHandleQueueDrain(controller);\n\n readIntoRequest._chunkSteps(filledView);\n return;\n }\n\n if (controller._closeRequested) {\n const e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n readIntoRequest._errorSteps(e);\n return;\n }\n }\n\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n ReadableStreamAddReadIntoRequest(stream, readIntoRequest);\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nfunction ReadableByteStreamControllerRespondInClosedState(controller: ReadableByteStreamController,\n firstDescriptor: PullIntoDescriptor) {\n assert(firstDescriptor.bytesFilled % firstDescriptor.elementSize === 0);\n\n if (firstDescriptor.readerType === 'none') {\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n }\n\n const stream = controller._controlledReadableByteStream;\n if (ReadableStreamHasBYOBReader(stream)) {\n while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n const pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);\n ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);\n }\n }\n}\n\nfunction ReadableByteStreamControllerRespondInReadableState(controller: ReadableByteStreamController,\n bytesWritten: number,\n pullIntoDescriptor: PullIntoDescriptor) {\n assert(pullIntoDescriptor.bytesFilled + bytesWritten <= pullIntoDescriptor.byteLength);\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);\n\n if (pullIntoDescriptor.readerType === 'none') {\n ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, pullIntoDescriptor);\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n return;\n }\n\n if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill) {\n // A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head\n // of the queue, so the underlying source can keep filling it.\n return;\n }\n\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;\n if (remainderSize > 0) {\n const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n ReadableByteStreamControllerEnqueueClonedChunkToQueue(\n controller,\n pullIntoDescriptor.buffer,\n end - remainderSize,\n remainderSize\n );\n }\n\n pullIntoDescriptor.bytesFilled -= remainderSize;\n ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);\n\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n}\n\nfunction ReadableByteStreamControllerRespondInternal(controller: ReadableByteStreamController, bytesWritten: number) {\n const firstDescriptor = controller._pendingPullIntos.peek();\n assert(CanTransferArrayBuffer(firstDescriptor.buffer));\n\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n\n const state = controller._controlledReadableByteStream._state;\n if (state === 'closed') {\n assert(bytesWritten === 0);\n ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);\n } else {\n assert(state === 'readable');\n assert(bytesWritten > 0);\n ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);\n }\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nfunction ReadableByteStreamControllerShiftPendingPullInto(\n controller: ReadableByteStreamController\n): PullIntoDescriptor {\n assert(controller._byobRequest === null);\n const descriptor = controller._pendingPullIntos.shift()!;\n return descriptor;\n}\n\nfunction ReadableByteStreamControllerShouldCallPull(controller: ReadableByteStreamController): boolean {\n const stream = controller._controlledReadableByteStream;\n\n if (stream._state !== 'readable') {\n return false;\n }\n\n if (controller._closeRequested) {\n return false;\n }\n\n if (!controller._started) {\n return false;\n }\n\n if (ReadableStreamHasDefaultReader(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n if (ReadableStreamHasBYOBReader(stream) && ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n return true;\n }\n\n const desiredSize = ReadableByteStreamControllerGetDesiredSize(controller);\n assert(desiredSize !== null);\n if (desiredSize! > 0) {\n return true;\n }\n\n return false;\n}\n\nfunction ReadableByteStreamControllerClearAlgorithms(controller: ReadableByteStreamController) {\n controller._pullAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n}\n\n// A client of ReadableByteStreamController may use these functions directly to bypass state check.\n\nexport function ReadableByteStreamControllerClose(controller: ReadableByteStreamController) {\n const stream = controller._controlledReadableByteStream;\n\n if (controller._closeRequested || stream._state !== 'readable') {\n return;\n }\n\n if (controller._queueTotalSize > 0) {\n controller._closeRequested = true;\n\n return;\n }\n\n if (controller._pendingPullIntos.length > 0) {\n const firstPendingPullInto = controller._pendingPullIntos.peek();\n if (firstPendingPullInto.bytesFilled % firstPendingPullInto.elementSize !== 0) {\n const e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n throw e;\n }\n }\n\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamClose(stream);\n}\n\nexport function ReadableByteStreamControllerEnqueue(\n controller: ReadableByteStreamController,\n chunk: NonShared\n) {\n const stream = controller._controlledReadableByteStream;\n\n if (controller._closeRequested || stream._state !== 'readable') {\n return;\n }\n\n const { buffer, byteOffset, byteLength } = chunk;\n if (IsDetachedBuffer(buffer)) {\n throw new TypeError('chunk\\'s buffer is detached and so cannot be enqueued');\n }\n const transferredBuffer = TransferArrayBuffer(buffer);\n\n if (controller._pendingPullIntos.length > 0) {\n const firstPendingPullInto = controller._pendingPullIntos.peek();\n if (IsDetachedBuffer(firstPendingPullInto.buffer)) {\n throw new TypeError(\n 'The BYOB request\\'s buffer has been detached and so cannot be filled with an enqueued chunk'\n );\n }\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);\n if (firstPendingPullInto.readerType === 'none') {\n ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto);\n }\n }\n\n if (ReadableStreamHasDefaultReader(stream)) {\n ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller);\n if (ReadableStreamGetNumReadRequests(stream) === 0) {\n assert(controller._pendingPullIntos.length === 0);\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n } else {\n assert(controller._queue.length === 0);\n if (controller._pendingPullIntos.length > 0) {\n assert(controller._pendingPullIntos.peek().readerType === 'default');\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n }\n const transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);\n ReadableStreamFulfillReadRequest(stream, transferredView as NonShared, false);\n }\n } else if (ReadableStreamHasBYOBReader(stream)) {\n // TODO: Ideally in this branch detaching should happen only if the buffer is not consumed fully.\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n } else {\n assert(!IsReadableStreamLocked(stream));\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n }\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nexport function ReadableByteStreamControllerError(controller: ReadableByteStreamController, e: any) {\n const stream = controller._controlledReadableByteStream;\n\n if (stream._state !== 'readable') {\n return;\n }\n\n ReadableByteStreamControllerClearPendingPullIntos(controller);\n\n ResetQueue(controller);\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamError(stream, e);\n}\n\nexport function ReadableByteStreamControllerFillReadRequestFromQueue(\n controller: ReadableByteStreamController,\n readRequest: ReadRequest>\n) {\n assert(controller._queueTotalSize > 0);\n\n const entry = controller._queue.shift();\n controller._queueTotalSize -= entry.byteLength;\n\n ReadableByteStreamControllerHandleQueueDrain(controller);\n\n const view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);\n readRequest._chunkSteps(view as NonShared);\n}\n\nexport function ReadableByteStreamControllerGetBYOBRequest(\n controller: ReadableByteStreamController\n): ReadableStreamBYOBRequest | null {\n if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {\n const firstDescriptor = controller._pendingPullIntos.peek();\n const view = new Uint8Array(firstDescriptor.buffer,\n firstDescriptor.byteOffset + firstDescriptor.bytesFilled,\n firstDescriptor.byteLength - firstDescriptor.bytesFilled);\n\n const byobRequest: ReadableStreamBYOBRequest = Object.create(ReadableStreamBYOBRequest.prototype);\n SetUpReadableStreamBYOBRequest(byobRequest, controller, view as NonShared);\n controller._byobRequest = byobRequest;\n }\n return controller._byobRequest;\n}\n\nfunction ReadableByteStreamControllerGetDesiredSize(controller: ReadableByteStreamController): number | null {\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nexport function ReadableByteStreamControllerRespond(controller: ReadableByteStreamController, bytesWritten: number) {\n assert(controller._pendingPullIntos.length > 0);\n\n const firstDescriptor = controller._pendingPullIntos.peek();\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'closed') {\n if (bytesWritten !== 0) {\n throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');\n }\n } else {\n assert(state === 'readable');\n if (bytesWritten === 0) {\n throw new TypeError('bytesWritten must be greater than 0 when calling respond() on a readable stream');\n }\n if (firstDescriptor.bytesFilled + bytesWritten > firstDescriptor.byteLength) {\n throw new RangeError('bytesWritten out of range');\n }\n }\n\n firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);\n\n ReadableByteStreamControllerRespondInternal(controller, bytesWritten);\n}\n\nexport function ReadableByteStreamControllerRespondWithNewView(controller: ReadableByteStreamController,\n view: NonShared) {\n assert(controller._pendingPullIntos.length > 0);\n assert(!IsDetachedBuffer(view.buffer));\n\n const firstDescriptor = controller._pendingPullIntos.peek();\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'closed') {\n if (view.byteLength !== 0) {\n throw new TypeError('The view\\'s length must be 0 when calling respondWithNewView() on a closed stream');\n }\n } else {\n assert(state === 'readable');\n if (view.byteLength === 0) {\n throw new TypeError(\n 'The view\\'s length must be greater than 0 when calling respondWithNewView() on a readable stream'\n );\n }\n }\n\n if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {\n throw new RangeError('The region specified by view does not match byobRequest');\n }\n if (firstDescriptor.bufferByteLength !== view.buffer.byteLength) {\n throw new RangeError('The buffer of view has different capacity than byobRequest');\n }\n if (firstDescriptor.bytesFilled + view.byteLength > firstDescriptor.byteLength) {\n throw new RangeError('The region specified by view is larger than byobRequest');\n }\n\n const viewByteLength = view.byteLength;\n firstDescriptor.buffer = TransferArrayBuffer(view.buffer);\n ReadableByteStreamControllerRespondInternal(controller, viewByteLength);\n}\n\nexport function SetUpReadableByteStreamController(stream: ReadableByteStream,\n controller: ReadableByteStreamController,\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n autoAllocateChunkSize: number | undefined) {\n assert(stream._readableStreamController === undefined);\n if (autoAllocateChunkSize !== undefined) {\n assert(NumberIsInteger(autoAllocateChunkSize));\n assert(autoAllocateChunkSize > 0);\n }\n\n controller._controlledReadableByteStream = stream;\n\n controller._pullAgain = false;\n controller._pulling = false;\n\n controller._byobRequest = null;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n controller._queue = controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._closeRequested = false;\n controller._started = false;\n\n controller._strategyHWM = highWaterMark;\n\n controller._pullAlgorithm = pullAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n controller._autoAllocateChunkSize = autoAllocateChunkSize;\n\n controller._pendingPullIntos = new SimpleQueue();\n\n stream._readableStreamController = controller;\n\n const startResult = startAlgorithm();\n uponPromise(\n promiseResolvedWith(startResult),\n () => {\n controller._started = true;\n\n assert(!controller._pulling);\n assert(!controller._pullAgain);\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n return null;\n },\n r => {\n ReadableByteStreamControllerError(controller, r);\n return null;\n }\n );\n}\n\nexport function SetUpReadableByteStreamControllerFromUnderlyingSource(\n stream: ReadableByteStream,\n underlyingByteSource: ValidatedUnderlyingByteSource,\n highWaterMark: number\n) {\n const controller: ReadableByteStreamController = Object.create(ReadableByteStreamController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let pullAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (underlyingByteSource.start !== undefined) {\n startAlgorithm = () => underlyingByteSource.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingByteSource.pull !== undefined) {\n pullAlgorithm = () => underlyingByteSource.pull!(controller);\n } else {\n pullAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingByteSource.cancel !== undefined) {\n cancelAlgorithm = reason => underlyingByteSource.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n const autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;\n if (autoAllocateChunkSize === 0) {\n throw new TypeError('autoAllocateChunkSize must be greater than 0');\n }\n\n SetUpReadableByteStreamController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize\n );\n}\n\nfunction SetUpReadableStreamBYOBRequest(request: ReadableStreamBYOBRequest,\n controller: ReadableByteStreamController,\n view: NonShared) {\n assert(IsReadableByteStreamController(controller));\n assert(typeof view === 'object');\n assert(ArrayBuffer.isView(view));\n assert(!IsDetachedBuffer(view.buffer));\n request._associatedReadableByteStreamController = controller;\n request._view = view;\n}\n\n// Helper functions for the ReadableStreamBYOBRequest.\n\nfunction byobRequestBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamBYOBRequest.prototype.${name} can only be used on a ReadableStreamBYOBRequest`);\n}\n\n// Helper functions for the ReadableByteStreamController.\n\nfunction byteStreamControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableByteStreamController.prototype.${name} can only be used on a ReadableByteStreamController`);\n}\n","import { assertDictionary, convertUnsignedLongLongWithEnforceRange } from './basic';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ReadableStreamGetReaderOptions,\n ValidatedReadableStreamBYOBReaderReadOptions\n} from '../readable-stream/reader-options';\n\nexport function convertReaderOptions(options: ReadableStreamGetReaderOptions | null | undefined,\n context: string): ReadableStreamGetReaderOptions {\n assertDictionary(options, context);\n const mode = options?.mode;\n return {\n mode: mode === undefined ? undefined : convertReadableStreamReaderMode(mode, `${context} has member 'mode' that`)\n };\n}\n\nfunction convertReadableStreamReaderMode(mode: string, context: string): 'byob' {\n mode = `${mode}`;\n if (mode !== 'byob') {\n throw new TypeError(`${context} '${mode}' is not a valid enumeration value for ReadableStreamReaderMode`);\n }\n return mode;\n}\n\nexport function convertByobReadOptions(\n options: ReadableStreamBYOBReaderReadOptions | null | undefined,\n context: string\n): ValidatedReadableStreamBYOBReaderReadOptions {\n assertDictionary(options, context);\n const min = options?.min ?? 1;\n return {\n min: convertUnsignedLongLongWithEnforceRange(\n min,\n `${context} has member 'min' that`\n )\n };\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport {\n ReadableStreamReaderGenericCancel,\n ReadableStreamReaderGenericInitialize,\n ReadableStreamReaderGenericRelease,\n readerLockException\n} from './generic-reader';\nimport { IsReadableStreamLocked, type ReadableByteStream, type ReadableStream } from '../readable-stream';\nimport {\n IsReadableByteStreamController,\n ReadableByteStreamController,\n ReadableByteStreamControllerPullInto\n} from './byte-stream-controller';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { newPromise, promiseRejectedWith } from '../helpers/webidl';\nimport { assertRequiredArgument } from '../validators/basic';\nimport { assertReadableStream } from '../validators/readable-stream';\nimport { IsDetachedBuffer } from '../abstract-ops/ecmascript';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ValidatedReadableStreamBYOBReaderReadOptions\n} from './reader-options';\nimport { convertByobReadOptions } from '../validators/reader-options';\nimport { isDataView, type NonShared, type TypedArray } from '../helpers/array-buffer-view';\n\n/**\n * A result returned by {@link ReadableStreamBYOBReader.read}.\n *\n * @public\n */\nexport type ReadableStreamBYOBReadResult = {\n done: false;\n value: T;\n} | {\n done: true;\n value: T | undefined;\n};\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamBYOBReader(stream: ReadableByteStream): ReadableStreamBYOBReader {\n return new ReadableStreamBYOBReader(stream as ReadableStream);\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamAddReadIntoRequest>(\n stream: ReadableByteStream,\n readIntoRequest: ReadIntoRequest\n): void {\n assert(IsReadableStreamBYOBReader(stream._reader));\n assert(stream._state === 'readable' || stream._state === 'closed');\n\n (stream._reader! as ReadableStreamBYOBReader)._readIntoRequests.push(readIntoRequest);\n}\n\nexport function ReadableStreamFulfillReadIntoRequest(stream: ReadableByteStream,\n chunk: ArrayBufferView,\n done: boolean) {\n const reader = stream._reader as ReadableStreamBYOBReader;\n\n assert(reader._readIntoRequests.length > 0);\n\n const readIntoRequest = reader._readIntoRequests.shift()!;\n if (done) {\n readIntoRequest._closeSteps(chunk);\n } else {\n readIntoRequest._chunkSteps(chunk);\n }\n}\n\nexport function ReadableStreamGetNumReadIntoRequests(stream: ReadableByteStream): number {\n return (stream._reader as ReadableStreamBYOBReader)._readIntoRequests.length;\n}\n\nexport function ReadableStreamHasBYOBReader(stream: ReadableByteStream): boolean {\n const reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (!IsReadableStreamBYOBReader(reader)) {\n return false;\n }\n\n return true;\n}\n\n// Readers\n\nexport interface ReadIntoRequest> {\n _chunkSteps(chunk: T): void;\n\n _closeSteps(chunk: T | undefined): void;\n\n _errorSteps(e: any): void;\n}\n\n/**\n * A BYOB reader vended by a {@link ReadableStream}.\n *\n * @public\n */\nexport class ReadableStreamBYOBReader {\n /** @internal */\n _ownerReadableStream!: ReadableByteStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _readIntoRequests: SimpleQueue>;\n\n constructor(stream: ReadableStream) {\n assertRequiredArgument(stream, 1, 'ReadableStreamBYOBReader');\n assertReadableStream(stream, 'First parameter');\n\n if (IsReadableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n if (!IsReadableByteStreamController(stream._readableStreamController)) {\n throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' +\n 'source');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readIntoRequests = new SimpleQueue();\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or\n * the reader's lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n\n /**\n * Attempts to reads bytes into view, and returns a promise resolved with the result.\n *\n * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.\n */\n read(\n view: T,\n options?: ReadableStreamBYOBReaderReadOptions\n ): Promise>;\n read>(\n view: T,\n rawOptions: ReadableStreamBYOBReaderReadOptions | null | undefined = {}\n ): Promise> {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('read'));\n }\n\n if (!ArrayBuffer.isView(view)) {\n return promiseRejectedWith(new TypeError('view must be an array buffer view'));\n }\n if (view.byteLength === 0) {\n return promiseRejectedWith(new TypeError('view must have non-zero byteLength'));\n }\n if (view.buffer.byteLength === 0) {\n return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`));\n }\n if (IsDetachedBuffer(view.buffer)) {\n return promiseRejectedWith(new TypeError('view\\'s buffer has been detached'));\n }\n\n let options: ValidatedReadableStreamBYOBReaderReadOptions;\n try {\n options = convertByobReadOptions(rawOptions, 'options');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const min = options.min;\n if (min === 0) {\n return promiseRejectedWith(new TypeError('options.min must be greater than 0'));\n }\n if (!isDataView(view)) {\n if (min > (view as unknown as TypedArray).length) {\n return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\\'s length'));\n }\n } else if (min > view.byteLength) {\n return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\\'s byteLength'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('read from'));\n }\n\n let resolvePromise!: (result: ReadableStreamBYOBReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readIntoRequest: ReadIntoRequest = {\n _chunkSteps: chunk => resolvePromise({ value: chunk, done: false }),\n _closeSteps: chunk => resolvePromise({ value: chunk, done: true }),\n _errorSteps: e => rejectPromise(e)\n };\n ReadableStreamBYOBReaderRead(this, view, min, readIntoRequest);\n return promise;\n }\n\n /**\n * Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.\n * If the associated stream is errored when the lock is released, the reader will appear errored in the same way\n * from now on; otherwise, the reader will appear closed.\n *\n * A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by\n * the reader's {@link ReadableStreamBYOBReader.read | read()} method has not yet been settled. Attempting to\n * do so will throw a `TypeError` and leave the reader locked to the stream.\n */\n releaseLock(): void {\n if (!IsReadableStreamBYOBReader(this)) {\n throw byobReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n ReadableStreamBYOBReaderRelease(this);\n }\n}\n\nObject.defineProperties(ReadableStreamBYOBReader.prototype, {\n cancel: { enumerable: true },\n read: { enumerable: true },\n releaseLock: { enumerable: true },\n closed: { enumerable: true }\n});\nsetFunctionName(ReadableStreamBYOBReader.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStreamBYOBReader.prototype.read, 'read');\nsetFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, 'releaseLock');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamBYOBReader.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamBYOBReader',\n configurable: true\n });\n}\n\n// Abstract operations for the readers.\n\nexport function IsReadableStreamBYOBReader(x: any): x is ReadableStreamBYOBReader {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {\n return false;\n }\n\n return x instanceof ReadableStreamBYOBReader;\n}\n\nexport function ReadableStreamBYOBReaderRead>(\n reader: ReadableStreamBYOBReader,\n view: T,\n min: number,\n readIntoRequest: ReadIntoRequest\n): void {\n const stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'errored') {\n readIntoRequest._errorSteps(stream._storedError);\n } else {\n ReadableByteStreamControllerPullInto(\n stream._readableStreamController as ReadableByteStreamController,\n view,\n min,\n readIntoRequest\n );\n }\n}\n\nexport function ReadableStreamBYOBReaderRelease(reader: ReadableStreamBYOBReader) {\n ReadableStreamReaderGenericRelease(reader);\n const e = new TypeError('Reader was released');\n ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);\n}\n\nexport function ReadableStreamBYOBReaderErrorReadIntoRequests(reader: ReadableStreamBYOBReader, e: any) {\n const readIntoRequests = reader._readIntoRequests;\n reader._readIntoRequests = new SimpleQueue();\n readIntoRequests.forEach(readIntoRequest => {\n readIntoRequest._errorSteps(e);\n });\n}\n\n// Helper functions for the ReadableStreamBYOBReader.\n\nfunction byobReaderBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamBYOBReader.prototype.${name} can only be used on a ReadableStreamBYOBReader`);\n}\n","import type { QueuingStrategy, QueuingStrategySizeCallback } from '../queuing-strategy';\nimport NumberIsNaN from '../../stub/number-isnan';\n\nexport function ExtractHighWaterMark(strategy: QueuingStrategy, defaultHWM: number): number {\n const { highWaterMark } = strategy;\n\n if (highWaterMark === undefined) {\n return defaultHWM;\n }\n\n if (NumberIsNaN(highWaterMark) || highWaterMark < 0) {\n throw new RangeError('Invalid highWaterMark');\n }\n\n return highWaterMark;\n}\n\nexport function ExtractSizeAlgorithm(strategy: QueuingStrategy): QueuingStrategySizeCallback {\n const { size } = strategy;\n\n if (!size) {\n return () => 1;\n }\n\n return size;\n}\n","import type { QueuingStrategy, QueuingStrategySizeCallback } from '../queuing-strategy';\nimport { assertDictionary, assertFunction, convertUnrestrictedDouble } from './basic';\n\nexport function convertQueuingStrategy(init: QueuingStrategy | null | undefined,\n context: string): QueuingStrategy {\n assertDictionary(init, context);\n const highWaterMark = init?.highWaterMark;\n const size = init?.size;\n return {\n highWaterMark: highWaterMark === undefined ? undefined : convertUnrestrictedDouble(highWaterMark),\n size: size === undefined ? undefined : convertQueuingStrategySize(size, `${context} has member 'size' that`)\n };\n}\n\nfunction convertQueuingStrategySize(fn: QueuingStrategySizeCallback,\n context: string): QueuingStrategySizeCallback {\n assertFunction(fn, context);\n return chunk => convertUnrestrictedDouble(fn(chunk));\n}\n","import { assertDictionary, assertFunction } from './basic';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\nimport type {\n UnderlyingSink,\n UnderlyingSinkAbortCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n ValidatedUnderlyingSink\n} from '../writable-stream/underlying-sink';\nimport { WritableStreamDefaultController } from '../writable-stream';\n\nexport function convertUnderlyingSink(original: UnderlyingSink | null,\n context: string): ValidatedUnderlyingSink {\n assertDictionary(original, context);\n const abort = original?.abort;\n const close = original?.close;\n const start = original?.start;\n const type = original?.type;\n const write = original?.write;\n return {\n abort: abort === undefined ?\n undefined :\n convertUnderlyingSinkAbortCallback(abort, original!, `${context} has member 'abort' that`),\n close: close === undefined ?\n undefined :\n convertUnderlyingSinkCloseCallback(close, original!, `${context} has member 'close' that`),\n start: start === undefined ?\n undefined :\n convertUnderlyingSinkStartCallback(start, original!, `${context} has member 'start' that`),\n write: write === undefined ?\n undefined :\n convertUnderlyingSinkWriteCallback(write, original!, `${context} has member 'write' that`),\n type\n };\n}\n\nfunction convertUnderlyingSinkAbortCallback(\n fn: UnderlyingSinkAbortCallback,\n original: UnderlyingSink,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n\nfunction convertUnderlyingSinkCloseCallback(\n fn: UnderlyingSinkCloseCallback,\n original: UnderlyingSink,\n context: string\n): () => Promise {\n assertFunction(fn, context);\n return () => promiseCall(fn, original, []);\n}\n\nfunction convertUnderlyingSinkStartCallback(\n fn: UnderlyingSinkStartCallback,\n original: UnderlyingSink,\n context: string\n): UnderlyingSinkStartCallback {\n assertFunction(fn, context);\n return (controller: WritableStreamDefaultController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertUnderlyingSinkWriteCallback(\n fn: UnderlyingSinkWriteCallback,\n original: UnderlyingSink,\n context: string\n): (chunk: W, controller: WritableStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (chunk: W, controller: WritableStreamDefaultController) => promiseCall(fn, original, [chunk, controller]);\n}\n","import { IsWritableStream, WritableStream } from '../writable-stream';\n\nexport function assertWritableStream(x: unknown, context: string): asserts x is WritableStream {\n if (!IsWritableStream(x)) {\n throw new TypeError(`${context} is not a WritableStream.`);\n }\n}\n","/**\n * A signal object that allows you to communicate with a request and abort it if required\n * via its associated `AbortController` object.\n *\n * @remarks\n * This interface is compatible with the `AbortSignal` interface defined in TypeScript's DOM types.\n * It is redefined here, so it can be polyfilled without a DOM, for example with\n * {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.\n *\n * @public\n */\nexport interface AbortSignal {\n /**\n * Whether the request is aborted.\n */\n readonly aborted: boolean;\n\n /**\n * If aborted, returns the reason for aborting.\n */\n readonly reason?: any;\n\n /**\n * Add an event listener to be triggered when this signal becomes aborted.\n */\n addEventListener(type: 'abort', listener: () => void): void;\n\n /**\n * Remove an event listener that was previously added with {@link AbortSignal.addEventListener}.\n */\n removeEventListener(type: 'abort', listener: () => void): void;\n}\n\nexport function isAbortSignal(value: unknown): value is AbortSignal {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n try {\n return typeof (value as AbortSignal).aborted === 'boolean';\n } catch {\n // AbortSignal.prototype.aborted throws if its brand check fails\n return false;\n }\n}\n\n/**\n * A controller object that allows you to abort an `AbortSignal` when desired.\n *\n * @remarks\n * This interface is compatible with the `AbortController` interface defined in TypeScript's DOM types.\n * It is redefined here, so it can be polyfilled without a DOM, for example with\n * {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.\n *\n * @internal\n */\nexport interface AbortController {\n readonly signal: AbortSignal;\n\n abort(reason?: any): void;\n}\n\ninterface AbortControllerConstructor {\n new(): AbortController;\n}\n\nconst supportsAbortController = typeof (AbortController as any) === 'function';\n\n/**\n * Construct a new AbortController, if supported by the platform.\n *\n * @internal\n */\nexport function createAbortController(): AbortController | undefined {\n if (supportsAbortController) {\n return new (AbortController as AbortControllerConstructor)();\n }\n return undefined;\n}\n","import assert from '../stub/assert';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n uponPromise\n} from './helpers/webidl';\nimport {\n DequeueValue,\n EnqueueValueWithSize,\n PeekQueueValue,\n type QueuePair,\n ResetQueue\n} from './abstract-ops/queue-with-sizes';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { SimpleQueue } from './simple-queue';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { AbortSteps, ErrorSteps } from './abstract-ops/internal-methods';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport type {\n UnderlyingSink,\n UnderlyingSinkAbortCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n ValidatedUnderlyingSink\n} from './writable-stream/underlying-sink';\nimport { assertObject, assertRequiredArgument } from './validators/basic';\nimport { convertUnderlyingSink } from './validators/underlying-sink';\nimport { assertWritableStream } from './validators/writable-stream';\nimport { type AbortController, type AbortSignal, createAbortController } from './abort-signal';\n\ntype WritableStreamState = 'writable' | 'closed' | 'erroring' | 'errored';\n\ninterface WriteOrCloseRequest {\n _resolve: (value?: undefined) => void;\n _reject: (reason: any) => void;\n}\n\ntype WriteRequest = WriteOrCloseRequest;\ntype CloseRequest = WriteOrCloseRequest;\n\ninterface PendingAbortRequest {\n _promise: Promise;\n _resolve: (value?: undefined) => void;\n _reject: (reason: any) => void;\n _reason: any;\n _wasAlreadyErroring: boolean;\n}\n\n/**\n * A writable stream represents a destination for data, into which you can write.\n *\n * @public\n */\nclass WritableStream {\n /** @internal */\n _state!: WritableStreamState;\n /** @internal */\n _storedError: any;\n /** @internal */\n _writer: WritableStreamDefaultWriter | undefined;\n /** @internal */\n _writableStreamController!: WritableStreamDefaultController;\n /** @internal */\n _writeRequests!: SimpleQueue;\n /** @internal */\n _inFlightWriteRequest: WriteRequest | undefined;\n /** @internal */\n _closeRequest: CloseRequest | undefined;\n /** @internal */\n _inFlightCloseRequest: CloseRequest | undefined;\n /** @internal */\n _pendingAbortRequest: PendingAbortRequest | undefined;\n /** @internal */\n _backpressure!: boolean;\n\n constructor(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy);\n constructor(rawUnderlyingSink: UnderlyingSink | null | undefined = {},\n rawStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawUnderlyingSink === undefined) {\n rawUnderlyingSink = null;\n } else {\n assertObject(rawUnderlyingSink, 'First parameter');\n }\n\n const strategy = convertQueuingStrategy(rawStrategy, 'Second parameter');\n const underlyingSink = convertUnderlyingSink(rawUnderlyingSink, 'First parameter');\n\n InitializeWritableStream(this);\n\n const type = underlyingSink.type;\n if (type !== undefined) {\n throw new RangeError('Invalid type is specified');\n }\n\n const sizeAlgorithm = ExtractSizeAlgorithm(strategy);\n const highWaterMark = ExtractHighWaterMark(strategy, 1);\n\n SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, highWaterMark, sizeAlgorithm);\n }\n\n /**\n * Returns whether or not the writable stream is locked to a writer.\n */\n get locked(): boolean {\n if (!IsWritableStream(this)) {\n throw streamBrandCheckException('locked');\n }\n\n return IsWritableStreamLocked(this);\n }\n\n /**\n * Aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be\n * immediately moved to an errored state, with any queued-up writes discarded. This will also execute any abort\n * mechanism of the underlying sink.\n *\n * The returned promise will fulfill if the stream shuts down successfully, or reject if the underlying sink signaled\n * that there was an error doing so. Additionally, it will reject with a `TypeError` (without attempting to cancel\n * the stream) if the stream is currently locked.\n */\n abort(reason: any = undefined): Promise {\n if (!IsWritableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('abort'));\n }\n\n if (IsWritableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));\n }\n\n return WritableStreamAbort(this, reason);\n }\n\n /**\n * Closes the stream. The underlying sink will finish processing any previously-written chunks, before invoking its\n * close behavior. During this time any further attempts to write will fail (without erroring the stream).\n *\n * The method returns a promise that will fulfill if all remaining chunks are successfully written and the stream\n * successfully closes, or rejects if an error is encountered during this process. Additionally, it will reject with\n * a `TypeError` (without attempting to cancel the stream) if the stream is currently locked.\n */\n close() {\n if (!IsWritableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('close'));\n }\n\n if (IsWritableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));\n }\n\n if (WritableStreamCloseQueuedOrInFlight(this)) {\n return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));\n }\n\n return WritableStreamClose(this);\n }\n\n /**\n * Creates a {@link WritableStreamDefaultWriter | writer} and locks the stream to the new writer. While the stream\n * is locked, no other writer can be acquired until this one is released.\n *\n * This functionality is especially useful for creating abstractions that desire the ability to write to a stream\n * without interruption or interleaving. By getting a writer for the stream, you can ensure nobody else can write at\n * the same time, which would cause the resulting written data to be unpredictable and probably useless.\n */\n getWriter(): WritableStreamDefaultWriter {\n if (!IsWritableStream(this)) {\n throw streamBrandCheckException('getWriter');\n }\n\n return AcquireWritableStreamDefaultWriter(this);\n }\n}\n\nObject.defineProperties(WritableStream.prototype, {\n abort: { enumerable: true },\n close: { enumerable: true },\n getWriter: { enumerable: true },\n locked: { enumerable: true }\n});\nsetFunctionName(WritableStream.prototype.abort, 'abort');\nsetFunctionName(WritableStream.prototype.close, 'close');\nsetFunctionName(WritableStream.prototype.getWriter, 'getWriter');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStream.prototype, Symbol.toStringTag, {\n value: 'WritableStream',\n configurable: true\n });\n}\n\nexport {\n AcquireWritableStreamDefaultWriter,\n CreateWritableStream,\n IsWritableStream,\n IsWritableStreamLocked,\n WritableStream,\n WritableStreamAbort,\n WritableStreamDefaultControllerErrorIfNeeded,\n WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite,\n WritableStreamCloseQueuedOrInFlight\n};\n\nexport type {\n UnderlyingSink,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkAbortCallback\n};\n\n// Abstract operations for the WritableStream.\n\nfunction AcquireWritableStreamDefaultWriter(stream: WritableStream): WritableStreamDefaultWriter {\n return new WritableStreamDefaultWriter(stream);\n}\n\n// Throws if and only if startAlgorithm throws.\nfunction CreateWritableStream(startAlgorithm: () => void | PromiseLike,\n writeAlgorithm: (chunk: W) => Promise,\n closeAlgorithm: () => Promise,\n abortAlgorithm: (reason: any) => Promise,\n highWaterMark = 1,\n sizeAlgorithm: QueuingStrategySizeCallback = () => 1) {\n assert(IsNonNegativeNumber(highWaterMark));\n\n const stream: WritableStream = Object.create(WritableStream.prototype);\n InitializeWritableStream(stream);\n\n const controller: WritableStreamDefaultController = Object.create(WritableStreamDefaultController.prototype);\n\n SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm,\n abortAlgorithm, highWaterMark, sizeAlgorithm);\n return stream;\n}\n\nfunction InitializeWritableStream(stream: WritableStream) {\n stream._state = 'writable';\n\n // The error that will be reported by new method calls once the state becomes errored. Only set when [[state]] is\n // 'erroring' or 'errored'. May be set to an undefined value.\n stream._storedError = undefined;\n\n stream._writer = undefined;\n\n // Initialize to undefined first because the constructor of the controller checks this\n // variable to validate the caller.\n stream._writableStreamController = undefined!;\n\n // This queue is placed here instead of the writer class in order to allow for passing a writer to the next data\n // producer without waiting for the queued writes to finish.\n stream._writeRequests = new SimpleQueue();\n\n // Write requests are removed from _writeRequests when write() is called on the underlying sink. This prevents\n // them from being erroneously rejected on error. If a write() call is in-flight, the request is stored here.\n stream._inFlightWriteRequest = undefined;\n\n // The promise that was returned from writer.close(). Stored here because it may be fulfilled after the writer\n // has been detached.\n stream._closeRequest = undefined;\n\n // Close request is removed from _closeRequest when close() is called on the underlying sink. This prevents it\n // from being erroneously rejected on error. If a close() call is in-flight, the request is stored here.\n stream._inFlightCloseRequest = undefined;\n\n // The promise that was returned from writer.abort(). This may also be fulfilled after the writer has detached.\n stream._pendingAbortRequest = undefined;\n\n // The backpressure signal set by the controller.\n stream._backpressure = false;\n}\n\nfunction IsWritableStream(x: unknown): x is WritableStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {\n return false;\n }\n\n return x instanceof WritableStream;\n}\n\nfunction IsWritableStreamLocked(stream: WritableStream): boolean {\n assert(IsWritableStream(stream));\n\n if (stream._writer === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamAbort(stream: WritableStream, reason: any): Promise {\n if (stream._state === 'closed' || stream._state === 'errored') {\n return promiseResolvedWith(undefined);\n }\n stream._writableStreamController._abortReason = reason;\n stream._writableStreamController._abortController?.abort(reason);\n\n // TypeScript narrows the type of `stream._state` down to 'writable' | 'erroring',\n // but it doesn't know that signaling abort runs author code that might have changed the state.\n // Widen the type again by casting to WritableStreamState.\n const state = stream._state as WritableStreamState;\n\n if (state === 'closed' || state === 'errored') {\n return promiseResolvedWith(undefined);\n }\n if (stream._pendingAbortRequest !== undefined) {\n return stream._pendingAbortRequest._promise;\n }\n\n assert(state === 'writable' || state === 'erroring');\n\n let wasAlreadyErroring = false;\n if (state === 'erroring') {\n wasAlreadyErroring = true;\n // reason will not be used, so don't keep a reference to it.\n reason = undefined;\n }\n\n const promise = newPromise((resolve, reject) => {\n stream._pendingAbortRequest = {\n _promise: undefined!,\n _resolve: resolve,\n _reject: reject,\n _reason: reason,\n _wasAlreadyErroring: wasAlreadyErroring\n };\n });\n stream._pendingAbortRequest!._promise = promise;\n\n if (!wasAlreadyErroring) {\n WritableStreamStartErroring(stream, reason);\n }\n\n return promise;\n}\n\nfunction WritableStreamClose(stream: WritableStream): Promise {\n const state = stream._state;\n if (state === 'closed' || state === 'errored') {\n return promiseRejectedWith(new TypeError(\n `The stream (in ${state} state) is not in the writable state and cannot be closed`));\n }\n\n assert(state === 'writable' || state === 'erroring');\n assert(!WritableStreamCloseQueuedOrInFlight(stream));\n\n const promise = newPromise((resolve, reject) => {\n const closeRequest: CloseRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._closeRequest = closeRequest;\n });\n\n const writer = stream._writer;\n if (writer !== undefined && stream._backpressure && state === 'writable') {\n defaultWriterReadyPromiseResolve(writer);\n }\n\n WritableStreamDefaultControllerClose(stream._writableStreamController);\n\n return promise;\n}\n\n// WritableStream API exposed for controllers.\n\nfunction WritableStreamAddWriteRequest(stream: WritableStream): Promise {\n assert(IsWritableStreamLocked(stream));\n assert(stream._state === 'writable');\n\n const promise = newPromise((resolve, reject) => {\n const writeRequest: WriteRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._writeRequests.push(writeRequest);\n });\n\n return promise;\n}\n\nfunction WritableStreamDealWithRejection(stream: WritableStream, error: any) {\n const state = stream._state;\n\n if (state === 'writable') {\n WritableStreamStartErroring(stream, error);\n return;\n }\n\n assert(state === 'erroring');\n WritableStreamFinishErroring(stream);\n}\n\nfunction WritableStreamStartErroring(stream: WritableStream, reason: any) {\n assert(stream._storedError === undefined);\n assert(stream._state === 'writable');\n\n const controller = stream._writableStreamController;\n assert(controller !== undefined);\n\n stream._state = 'erroring';\n stream._storedError = reason;\n const writer = stream._writer;\n if (writer !== undefined) {\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);\n }\n\n if (!WritableStreamHasOperationMarkedInFlight(stream) && controller._started) {\n WritableStreamFinishErroring(stream);\n }\n}\n\nfunction WritableStreamFinishErroring(stream: WritableStream) {\n assert(stream._state === 'erroring');\n assert(!WritableStreamHasOperationMarkedInFlight(stream));\n stream._state = 'errored';\n stream._writableStreamController[ErrorSteps]();\n\n const storedError = stream._storedError;\n stream._writeRequests.forEach(writeRequest => {\n writeRequest._reject(storedError);\n });\n stream._writeRequests = new SimpleQueue();\n\n if (stream._pendingAbortRequest === undefined) {\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n const abortRequest = stream._pendingAbortRequest;\n stream._pendingAbortRequest = undefined;\n\n if (abortRequest._wasAlreadyErroring) {\n abortRequest._reject(storedError);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n const promise = stream._writableStreamController[AbortSteps](abortRequest._reason);\n uponPromise(\n promise,\n () => {\n abortRequest._resolve();\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return null;\n },\n (reason: any) => {\n abortRequest._reject(reason);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return null;\n });\n}\n\nfunction WritableStreamFinishInFlightWrite(stream: WritableStream) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest!._resolve(undefined);\n stream._inFlightWriteRequest = undefined;\n}\n\nfunction WritableStreamFinishInFlightWriteWithError(stream: WritableStream, error: any) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest!._reject(error);\n stream._inFlightWriteRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n WritableStreamDealWithRejection(stream, error);\n}\n\nfunction WritableStreamFinishInFlightClose(stream: WritableStream) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest!._resolve(undefined);\n stream._inFlightCloseRequest = undefined;\n\n const state = stream._state;\n\n assert(state === 'writable' || state === 'erroring');\n\n if (state === 'erroring') {\n // The error was too late to do anything, so it is ignored.\n stream._storedError = undefined;\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._resolve();\n stream._pendingAbortRequest = undefined;\n }\n }\n\n stream._state = 'closed';\n\n const writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseResolve(writer);\n }\n\n assert(stream._pendingAbortRequest === undefined);\n assert(stream._storedError === undefined);\n}\n\nfunction WritableStreamFinishInFlightCloseWithError(stream: WritableStream, error: any) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest!._reject(error);\n stream._inFlightCloseRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n // Never execute sink abort() after sink close().\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._reject(error);\n stream._pendingAbortRequest = undefined;\n }\n WritableStreamDealWithRejection(stream, error);\n}\n\n// TODO(ricea): Fix alphabetical order.\nfunction WritableStreamCloseQueuedOrInFlight(stream: WritableStream): boolean {\n if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamHasOperationMarkedInFlight(stream: WritableStream): boolean {\n if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamMarkCloseRequestInFlight(stream: WritableStream) {\n assert(stream._inFlightCloseRequest === undefined);\n assert(stream._closeRequest !== undefined);\n stream._inFlightCloseRequest = stream._closeRequest;\n stream._closeRequest = undefined;\n}\n\nfunction WritableStreamMarkFirstWriteRequestInFlight(stream: WritableStream) {\n assert(stream._inFlightWriteRequest === undefined);\n assert(stream._writeRequests.length !== 0);\n stream._inFlightWriteRequest = stream._writeRequests.shift();\n}\n\nfunction WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream: WritableStream) {\n assert(stream._state === 'errored');\n if (stream._closeRequest !== undefined) {\n assert(stream._inFlightCloseRequest === undefined);\n\n stream._closeRequest._reject(stream._storedError);\n stream._closeRequest = undefined;\n }\n const writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseReject(writer, stream._storedError);\n }\n}\n\nfunction WritableStreamUpdateBackpressure(stream: WritableStream, backpressure: boolean) {\n assert(stream._state === 'writable');\n assert(!WritableStreamCloseQueuedOrInFlight(stream));\n\n const writer = stream._writer;\n if (writer !== undefined && backpressure !== stream._backpressure) {\n if (backpressure) {\n defaultWriterReadyPromiseReset(writer);\n } else {\n assert(!backpressure);\n\n defaultWriterReadyPromiseResolve(writer);\n }\n }\n\n stream._backpressure = backpressure;\n}\n\n/**\n * A default writer vended by a {@link WritableStream}.\n *\n * @public\n */\nexport class WritableStreamDefaultWriter {\n /** @internal */\n _ownerWritableStream: WritableStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _closedPromiseState!: 'pending' | 'resolved' | 'rejected';\n /** @internal */\n _readyPromise!: Promise;\n /** @internal */\n _readyPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _readyPromise_reject?: (reason: any) => void;\n /** @internal */\n _readyPromiseState!: 'pending' | 'fulfilled' | 'rejected';\n\n constructor(stream: WritableStream) {\n assertRequiredArgument(stream, 1, 'WritableStreamDefaultWriter');\n assertWritableStream(stream, 'First parameter');\n\n if (IsWritableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive writing by another writer');\n }\n\n this._ownerWritableStream = stream;\n stream._writer = this;\n\n const state = stream._state;\n\n if (state === 'writable') {\n if (!WritableStreamCloseQueuedOrInFlight(stream) && stream._backpressure) {\n defaultWriterReadyPromiseInitialize(this);\n } else {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n }\n\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'erroring') {\n defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'closed') {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n defaultWriterClosedPromiseInitializeAsResolved(this);\n } else {\n assert(state === 'errored');\n\n const storedError = stream._storedError;\n defaultWriterReadyPromiseInitializeAsRejected(this, storedError);\n defaultWriterClosedPromiseInitializeAsRejected(this, storedError);\n }\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or\n * the writer’s lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * Returns the desired size to fill the stream’s internal queue. It can be negative, if the queue is over-full.\n * A producer can use this information to determine the right amount of data to write.\n *\n * It will be `null` if the stream cannot be successfully written to (due to either being errored, or having an abort\n * queued up). It will return zero if the stream is closed. And the getter will throw an exception if invoked when\n * the writer’s lock is released.\n */\n get desiredSize(): number | null {\n if (!IsWritableStreamDefaultWriter(this)) {\n throw defaultWriterBrandCheckException('desiredSize');\n }\n\n if (this._ownerWritableStream === undefined) {\n throw defaultWriterLockException('desiredSize');\n }\n\n return WritableStreamDefaultWriterGetDesiredSize(this);\n }\n\n /**\n * Returns a promise that will be fulfilled when the desired size to fill the stream’s internal queue transitions\n * from non-positive to positive, signaling that it is no longer applying backpressure. Once the desired size dips\n * back to zero or below, the getter will return a new promise that stays pending until the next transition.\n *\n * If the stream becomes errored or aborted, or the writer’s lock is released, the returned promise will become\n * rejected.\n */\n get ready(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('ready'));\n }\n\n return this._readyPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link WritableStream.abort | stream.abort(reason)}.\n */\n abort(reason: any = undefined): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('abort'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('abort'));\n }\n\n return WritableStreamDefaultWriterAbort(this, reason);\n }\n\n /**\n * If the reader is active, behaves the same as {@link WritableStream.close | stream.close()}.\n */\n close(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('close'));\n }\n\n const stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('close'));\n }\n\n if (WritableStreamCloseQueuedOrInFlight(stream)) {\n return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));\n }\n\n return WritableStreamDefaultWriterClose(this);\n }\n\n /**\n * Releases the writer’s lock on the corresponding stream. After the lock is released, the writer is no longer active.\n * If the associated stream is errored when the lock is released, the writer will appear errored in the same way from\n * now on; otherwise, the writer will appear closed.\n *\n * Note that the lock can still be released even if some ongoing writes have not yet finished (i.e. even if the\n * promises returned from previous calls to {@link WritableStreamDefaultWriter.write | write()} have not yet settled).\n * It’s not necessary to hold the lock on the writer for the duration of the write; the lock instead simply prevents\n * other producers from writing in an interleaved manner.\n */\n releaseLock(): void {\n if (!IsWritableStreamDefaultWriter(this)) {\n throw defaultWriterBrandCheckException('releaseLock');\n }\n\n const stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return;\n }\n\n assert(stream._writer !== undefined);\n\n WritableStreamDefaultWriterRelease(this);\n }\n\n /**\n * Writes the given chunk to the writable stream, by waiting until any previous writes have finished successfully,\n * and then sending the chunk to the underlying sink's {@link UnderlyingSink.write | write()} method. It will return\n * a promise that fulfills with undefined upon a successful write, or rejects if the write fails or stream becomes\n * errored before the writing process is initiated.\n *\n * Note that what \"success\" means is up to the underlying sink; it might indicate simply that the chunk has been\n * accepted, and not necessarily that it is safely saved to its ultimate destination.\n */\n write(chunk: W): Promise;\n write(chunk: W = undefined!): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('write'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('write to'));\n }\n\n return WritableStreamDefaultWriterWrite(this, chunk);\n }\n}\n\nObject.defineProperties(WritableStreamDefaultWriter.prototype, {\n abort: { enumerable: true },\n close: { enumerable: true },\n releaseLock: { enumerable: true },\n write: { enumerable: true },\n closed: { enumerable: true },\n desiredSize: { enumerable: true },\n ready: { enumerable: true }\n});\nsetFunctionName(WritableStreamDefaultWriter.prototype.abort, 'abort');\nsetFunctionName(WritableStreamDefaultWriter.prototype.close, 'close');\nsetFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, 'releaseLock');\nsetFunctionName(WritableStreamDefaultWriter.prototype.write, 'write');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStreamDefaultWriter.prototype, Symbol.toStringTag, {\n value: 'WritableStreamDefaultWriter',\n configurable: true\n });\n}\n\n// Abstract operations for the WritableStreamDefaultWriter.\n\nfunction IsWritableStreamDefaultWriter(x: any): x is WritableStreamDefaultWriter {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {\n return false;\n }\n\n return x instanceof WritableStreamDefaultWriter;\n}\n\n// A client of WritableStreamDefaultWriter may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultWriterAbort(writer: WritableStreamDefaultWriter, reason: any) {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n return WritableStreamAbort(stream, reason);\n}\n\nfunction WritableStreamDefaultWriterClose(writer: WritableStreamDefaultWriter): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n return WritableStreamClose(stream);\n}\n\nfunction WritableStreamDefaultWriterCloseWithErrorPropagation(writer: WritableStreamDefaultWriter): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n const state = stream._state;\n if (WritableStreamCloseQueuedOrInFlight(stream) || state === 'closed') {\n return promiseResolvedWith(undefined);\n }\n\n if (state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n\n assert(state === 'writable' || state === 'erroring');\n\n return WritableStreamDefaultWriterClose(writer);\n}\n\nfunction WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer: WritableStreamDefaultWriter, error: any) {\n if (writer._closedPromiseState === 'pending') {\n defaultWriterClosedPromiseReject(writer, error);\n } else {\n defaultWriterClosedPromiseResetToRejected(writer, error);\n }\n}\n\nfunction WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer: WritableStreamDefaultWriter, error: any) {\n if (writer._readyPromiseState === 'pending') {\n defaultWriterReadyPromiseReject(writer, error);\n } else {\n defaultWriterReadyPromiseResetToRejected(writer, error);\n }\n}\n\nfunction WritableStreamDefaultWriterGetDesiredSize(writer: WritableStreamDefaultWriter): number | null {\n const stream = writer._ownerWritableStream;\n const state = stream._state;\n\n if (state === 'errored' || state === 'erroring') {\n return null;\n }\n\n if (state === 'closed') {\n return 0;\n }\n\n return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);\n}\n\nfunction WritableStreamDefaultWriterRelease(writer: WritableStreamDefaultWriter) {\n const stream = writer._ownerWritableStream;\n assert(stream !== undefined);\n assert(stream._writer === writer);\n\n const releasedError = new TypeError(\n `Writer was released and can no longer be used to monitor the stream's closedness`);\n\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);\n\n // The state transitions to \"errored\" before the sink abort() method runs, but the writer.closed promise is not\n // rejected until afterwards. This means that simply testing state will not work.\n WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);\n\n stream._writer = undefined;\n writer._ownerWritableStream = undefined!;\n}\n\nfunction WritableStreamDefaultWriterWrite(writer: WritableStreamDefaultWriter, chunk: W): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n const controller = stream._writableStreamController;\n\n const chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);\n\n if (stream !== writer._ownerWritableStream) {\n return promiseRejectedWith(defaultWriterLockException('write to'));\n }\n\n const state = stream._state;\n if (state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n if (WritableStreamCloseQueuedOrInFlight(stream) || state === 'closed') {\n return promiseRejectedWith(new TypeError('The stream is closing or closed and cannot be written to'));\n }\n if (state === 'erroring') {\n return promiseRejectedWith(stream._storedError);\n }\n\n assert(state === 'writable');\n\n const promise = WritableStreamAddWriteRequest(stream);\n\n WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);\n\n return promise;\n}\n\nconst closeSentinel: unique symbol = {} as any;\n\ntype QueueRecord = W | typeof closeSentinel;\n\n/**\n * Allows control of a {@link WritableStream | writable stream}'s state and internal queue.\n *\n * @public\n */\nexport class WritableStreamDefaultController {\n /** @internal */\n _controlledWritableStream!: WritableStream;\n /** @internal */\n _queue!: SimpleQueue>>;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _abortReason: any;\n /** @internal */\n _abortController: AbortController | undefined;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _strategySizeAlgorithm!: QueuingStrategySizeCallback;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _writeAlgorithm!: (chunk: W) => Promise;\n /** @internal */\n _closeAlgorithm!: () => Promise;\n /** @internal */\n _abortAlgorithm!: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.\n *\n * @deprecated\n * This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.\n * Use {@link WritableStreamDefaultController.signal}'s `reason` instead.\n */\n get abortReason(): any {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('abortReason');\n }\n return this._abortReason;\n }\n\n /**\n * An `AbortSignal` that can be used to abort the pending write or close operation when the stream is aborted.\n */\n get signal(): AbortSignal {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('signal');\n }\n if (this._abortController === undefined) {\n // Older browsers or older Node versions may not support `AbortController` or `AbortSignal`.\n // We don't want to bundle and ship an `AbortController` polyfill together with our polyfill,\n // so instead we only implement support for `signal` if we find a global `AbortController` constructor.\n throw new TypeError('WritableStreamDefaultController.prototype.signal is not supported');\n }\n return this._abortController.signal;\n }\n\n /**\n * Closes the controlled writable stream, making all future interactions with it fail with the given error `e`.\n *\n * This method is rarely used, since usually it suffices to return a rejected promise from one of the underlying\n * sink's methods. However, it can be useful for suddenly shutting down a stream in response to an event outside the\n * normal lifecycle of interactions with the underlying sink.\n */\n error(e: any = undefined): void {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n const state = this._controlledWritableStream._state;\n if (state !== 'writable') {\n // The stream is closed, errored or will be soon. The sink can't do anything useful if it gets an error here, so\n // just treat it as a no-op.\n return;\n }\n\n WritableStreamDefaultControllerError(this, e);\n }\n\n /** @internal */\n [AbortSteps](reason: any): Promise {\n const result = this._abortAlgorithm(reason);\n WritableStreamDefaultControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [ErrorSteps]() {\n ResetQueue(this);\n }\n}\n\nObject.defineProperties(WritableStreamDefaultController.prototype, {\n abortReason: { enumerable: true },\n signal: { enumerable: true },\n error: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'WritableStreamDefaultController',\n configurable: true\n });\n}\n\n// Abstract operations implementing interface required by the WritableStream.\n\nfunction IsWritableStreamDefaultController(x: any): x is WritableStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledWritableStream')) {\n return false;\n }\n\n return x instanceof WritableStreamDefaultController;\n}\n\nfunction SetUpWritableStreamDefaultController(stream: WritableStream,\n controller: WritableStreamDefaultController,\n startAlgorithm: () => void | PromiseLike,\n writeAlgorithm: (chunk: W) => Promise,\n closeAlgorithm: () => Promise,\n abortAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n assert(IsWritableStream(stream));\n assert(stream._writableStreamController === undefined);\n\n controller._controlledWritableStream = stream;\n stream._writableStreamController = controller;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n controller._queue = undefined!;\n controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._abortReason = undefined;\n controller._abortController = createAbortController();\n controller._started = false;\n\n controller._strategySizeAlgorithm = sizeAlgorithm;\n controller._strategyHWM = highWaterMark;\n\n controller._writeAlgorithm = writeAlgorithm;\n controller._closeAlgorithm = closeAlgorithm;\n controller._abortAlgorithm = abortAlgorithm;\n\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n\n const startResult = startAlgorithm();\n const startPromise = promiseResolvedWith(startResult);\n uponPromise(\n startPromise,\n () => {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n controller._started = true;\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n return null;\n },\n r => {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n controller._started = true;\n WritableStreamDealWithRejection(stream, r);\n return null;\n }\n );\n}\n\nfunction SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream: WritableStream,\n underlyingSink: ValidatedUnderlyingSink,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n const controller = Object.create(WritableStreamDefaultController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let writeAlgorithm: (chunk: W) => Promise;\n let closeAlgorithm: () => Promise;\n let abortAlgorithm: (reason: any) => Promise;\n\n if (underlyingSink.start !== undefined) {\n startAlgorithm = () => underlyingSink.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingSink.write !== undefined) {\n writeAlgorithm = chunk => underlyingSink.write!(chunk, controller);\n } else {\n writeAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSink.close !== undefined) {\n closeAlgorithm = () => underlyingSink.close!();\n } else {\n closeAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSink.abort !== undefined) {\n abortAlgorithm = reason => underlyingSink.abort!(reason);\n } else {\n abortAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpWritableStreamDefaultController(\n stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm\n );\n}\n\n// ClearAlgorithms may be called twice. Erroring the same stream in multiple ways will often result in redundant calls.\nfunction WritableStreamDefaultControllerClearAlgorithms(controller: WritableStreamDefaultController) {\n controller._writeAlgorithm = undefined!;\n controller._closeAlgorithm = undefined!;\n controller._abortAlgorithm = undefined!;\n controller._strategySizeAlgorithm = undefined!;\n}\n\nfunction WritableStreamDefaultControllerClose(controller: WritableStreamDefaultController) {\n EnqueueValueWithSize(controller, closeSentinel, 0);\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\nfunction WritableStreamDefaultControllerGetChunkSize(controller: WritableStreamDefaultController,\n chunk: W): number {\n try {\n return controller._strategySizeAlgorithm(chunk);\n } catch (chunkSizeE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);\n return 1;\n }\n}\n\nfunction WritableStreamDefaultControllerGetDesiredSize(controller: WritableStreamDefaultController): number {\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nfunction WritableStreamDefaultControllerWrite(controller: WritableStreamDefaultController,\n chunk: W,\n chunkSize: number) {\n try {\n EnqueueValueWithSize(controller, chunk, chunkSize);\n } catch (enqueueE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);\n return;\n }\n\n const stream = controller._controlledWritableStream;\n if (!WritableStreamCloseQueuedOrInFlight(stream) && stream._state === 'writable') {\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\n// Abstract operations for the WritableStreamDefaultController.\n\nfunction WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller: WritableStreamDefaultController) {\n const stream = controller._controlledWritableStream;\n\n if (!controller._started) {\n return;\n }\n\n if (stream._inFlightWriteRequest !== undefined) {\n return;\n }\n\n const state = stream._state;\n assert(state !== 'closed' && state !== 'errored');\n if (state === 'erroring') {\n WritableStreamFinishErroring(stream);\n return;\n }\n\n if (controller._queue.length === 0) {\n return;\n }\n\n const value = PeekQueueValue(controller);\n if (value === closeSentinel) {\n WritableStreamDefaultControllerProcessClose(controller);\n } else {\n WritableStreamDefaultControllerProcessWrite(controller, value);\n }\n}\n\nfunction WritableStreamDefaultControllerErrorIfNeeded(controller: WritableStreamDefaultController, error: any) {\n if (controller._controlledWritableStream._state === 'writable') {\n WritableStreamDefaultControllerError(controller, error);\n }\n}\n\nfunction WritableStreamDefaultControllerProcessClose(controller: WritableStreamDefaultController) {\n const stream = controller._controlledWritableStream;\n\n WritableStreamMarkCloseRequestInFlight(stream);\n\n DequeueValue(controller);\n assert(controller._queue.length === 0);\n\n const sinkClosePromise = controller._closeAlgorithm();\n WritableStreamDefaultControllerClearAlgorithms(controller);\n uponPromise(\n sinkClosePromise,\n () => {\n WritableStreamFinishInFlightClose(stream);\n return null;\n },\n reason => {\n WritableStreamFinishInFlightCloseWithError(stream, reason);\n return null;\n }\n );\n}\n\nfunction WritableStreamDefaultControllerProcessWrite(controller: WritableStreamDefaultController, chunk: W) {\n const stream = controller._controlledWritableStream;\n\n WritableStreamMarkFirstWriteRequestInFlight(stream);\n\n const sinkWritePromise = controller._writeAlgorithm(chunk);\n uponPromise(\n sinkWritePromise,\n () => {\n WritableStreamFinishInFlightWrite(stream);\n\n const state = stream._state;\n assert(state === 'writable' || state === 'erroring');\n\n DequeueValue(controller);\n\n if (!WritableStreamCloseQueuedOrInFlight(stream) && state === 'writable') {\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n return null;\n },\n reason => {\n if (stream._state === 'writable') {\n WritableStreamDefaultControllerClearAlgorithms(controller);\n }\n WritableStreamFinishInFlightWriteWithError(stream, reason);\n return null;\n }\n );\n}\n\nfunction WritableStreamDefaultControllerGetBackpressure(controller: WritableStreamDefaultController): boolean {\n const desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);\n return desiredSize <= 0;\n}\n\n// A client of WritableStreamDefaultController may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultControllerError(controller: WritableStreamDefaultController, error: any) {\n const stream = controller._controlledWritableStream;\n\n assert(stream._state === 'writable');\n\n WritableStreamDefaultControllerClearAlgorithms(controller);\n WritableStreamStartErroring(stream, error);\n}\n\n// Helper functions for the WritableStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`);\n}\n\n// Helper functions for the WritableStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `WritableStreamDefaultController.prototype.${name} can only be used on a WritableStreamDefaultController`);\n}\n\n\n// Helper functions for the WritableStreamDefaultWriter.\n\nfunction defaultWriterBrandCheckException(name: string): TypeError {\n return new TypeError(\n `WritableStreamDefaultWriter.prototype.${name} can only be used on a WritableStreamDefaultWriter`);\n}\n\nfunction defaultWriterLockException(name: string): TypeError {\n return new TypeError('Cannot ' + name + ' a stream using a released writer');\n}\n\nfunction defaultWriterClosedPromiseInitialize(writer: WritableStreamDefaultWriter) {\n writer._closedPromise = newPromise((resolve, reject) => {\n writer._closedPromise_resolve = resolve;\n writer._closedPromise_reject = reject;\n writer._closedPromiseState = 'pending';\n });\n}\n\nfunction defaultWriterClosedPromiseInitializeAsRejected(writer: WritableStreamDefaultWriter, reason: any) {\n defaultWriterClosedPromiseInitialize(writer);\n defaultWriterClosedPromiseReject(writer, reason);\n}\n\nfunction defaultWriterClosedPromiseInitializeAsResolved(writer: WritableStreamDefaultWriter) {\n defaultWriterClosedPromiseInitialize(writer);\n defaultWriterClosedPromiseResolve(writer);\n}\n\nfunction defaultWriterClosedPromiseReject(writer: WritableStreamDefaultWriter, reason: any) {\n if (writer._closedPromise_reject === undefined) {\n return;\n }\n assert(writer._closedPromiseState === 'pending');\n\n setPromiseIsHandledToTrue(writer._closedPromise);\n writer._closedPromise_reject(reason);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'rejected';\n}\n\nfunction defaultWriterClosedPromiseResetToRejected(writer: WritableStreamDefaultWriter, reason: any) {\n assert(writer._closedPromise_resolve === undefined);\n assert(writer._closedPromise_reject === undefined);\n assert(writer._closedPromiseState !== 'pending');\n\n defaultWriterClosedPromiseInitializeAsRejected(writer, reason);\n}\n\nfunction defaultWriterClosedPromiseResolve(writer: WritableStreamDefaultWriter) {\n if (writer._closedPromise_resolve === undefined) {\n return;\n }\n assert(writer._closedPromiseState === 'pending');\n\n writer._closedPromise_resolve(undefined);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'resolved';\n}\n\nfunction defaultWriterReadyPromiseInitialize(writer: WritableStreamDefaultWriter) {\n writer._readyPromise = newPromise((resolve, reject) => {\n writer._readyPromise_resolve = resolve;\n writer._readyPromise_reject = reject;\n });\n writer._readyPromiseState = 'pending';\n}\n\nfunction defaultWriterReadyPromiseInitializeAsRejected(writer: WritableStreamDefaultWriter, reason: any) {\n defaultWriterReadyPromiseInitialize(writer);\n defaultWriterReadyPromiseReject(writer, reason);\n}\n\nfunction defaultWriterReadyPromiseInitializeAsResolved(writer: WritableStreamDefaultWriter) {\n defaultWriterReadyPromiseInitialize(writer);\n defaultWriterReadyPromiseResolve(writer);\n}\n\nfunction defaultWriterReadyPromiseReject(writer: WritableStreamDefaultWriter, reason: any) {\n if (writer._readyPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(writer._readyPromise);\n writer._readyPromise_reject(reason);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'rejected';\n}\n\nfunction defaultWriterReadyPromiseReset(writer: WritableStreamDefaultWriter) {\n assert(writer._readyPromise_resolve === undefined);\n assert(writer._readyPromise_reject === undefined);\n\n defaultWriterReadyPromiseInitialize(writer);\n}\n\nfunction defaultWriterReadyPromiseResetToRejected(writer: WritableStreamDefaultWriter, reason: any) {\n assert(writer._readyPromise_resolve === undefined);\n assert(writer._readyPromise_reject === undefined);\n\n defaultWriterReadyPromiseInitializeAsRejected(writer, reason);\n}\n\nfunction defaultWriterReadyPromiseResolve(writer: WritableStreamDefaultWriter) {\n if (writer._readyPromise_resolve === undefined) {\n return;\n }\n\n writer._readyPromise_resolve(undefined);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'fulfilled';\n}\n","/// \n\nfunction getGlobals(): typeof globalThis | undefined {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n } else if (typeof self !== 'undefined') {\n return self;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","/// \nimport { globals } from '../globals';\nimport { setFunctionName } from '../lib/helpers/miscellaneous';\n\ninterface DOMException extends Error {\n name: string;\n message: string;\n}\n\ntype DOMExceptionConstructor = new (message?: string, name?: string) => DOMException;\n\nfunction isDOMExceptionConstructor(ctor: unknown): ctor is DOMExceptionConstructor {\n if (!(typeof ctor === 'function' || typeof ctor === 'object')) {\n return false;\n }\n if ((ctor as DOMExceptionConstructor).name !== 'DOMException') {\n return false;\n }\n try {\n new (ctor as DOMExceptionConstructor)();\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Support:\n * - Web browsers\n * - Node 18 and higher (https://github.com/nodejs/node/commit/e4b1fb5e6422c1ff151234bb9de792d45dd88d87)\n */\nfunction getFromGlobal(): DOMExceptionConstructor | undefined {\n const ctor = globals?.DOMException;\n return isDOMExceptionConstructor(ctor) ? ctor : undefined;\n}\n\n/**\n * Support:\n * - All platforms\n */\nfunction createPolyfill(): DOMExceptionConstructor {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const ctor = function DOMException(this: DOMException, message?: string, name?: string) {\n this.message = message || '';\n this.name = name || 'Error';\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n } as any;\n setFunctionName(ctor, 'DOMException');\n ctor.prototype = Object.create(Error.prototype);\n Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });\n return ctor;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nconst DOMException: DOMExceptionConstructor = getFromGlobal() || createPolyfill();\n\nexport { DOMException };\n","import { IsReadableStream, IsReadableStreamLocked, ReadableStream, ReadableStreamCancel } from '../readable-stream';\nimport { AcquireReadableStreamDefaultReader, ReadableStreamDefaultReaderRead } from './default-reader';\nimport { ReadableStreamReaderGenericRelease } from './generic-reader';\nimport {\n AcquireWritableStreamDefaultWriter,\n IsWritableStream,\n IsWritableStreamLocked,\n WritableStream,\n WritableStreamAbort,\n WritableStreamCloseQueuedOrInFlight,\n WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite\n} from '../writable-stream';\nimport assert from '../../stub/assert';\nimport {\n newPromise,\n PerformPromiseThen,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n uponFulfillment,\n uponPromise,\n uponRejection\n} from '../helpers/webidl';\nimport { noop } from '../../utils';\nimport { type AbortSignal, isAbortSignal } from '../abort-signal';\nimport { DOMException } from '../../stub/dom-exception';\n\nexport function ReadableStreamPipeTo(source: ReadableStream,\n dest: WritableStream,\n preventClose: boolean,\n preventAbort: boolean,\n preventCancel: boolean,\n signal: AbortSignal | undefined): Promise {\n assert(IsReadableStream(source));\n assert(IsWritableStream(dest));\n assert(typeof preventClose === 'boolean');\n assert(typeof preventAbort === 'boolean');\n assert(typeof preventCancel === 'boolean');\n assert(signal === undefined || isAbortSignal(signal));\n assert(!IsReadableStreamLocked(source));\n assert(!IsWritableStreamLocked(dest));\n\n const reader = AcquireReadableStreamDefaultReader(source);\n const writer = AcquireWritableStreamDefaultWriter(dest);\n\n source._disturbed = true;\n\n let shuttingDown = false;\n\n // This is used to keep track of the spec's requirement that we wait for ongoing writes during shutdown.\n let currentWrite = promiseResolvedWith(undefined);\n\n return newPromise((resolve, reject) => {\n let abortAlgorithm: () => void;\n if (signal !== undefined) {\n abortAlgorithm = () => {\n const error = signal.reason !== undefined ? signal.reason : new DOMException('Aborted', 'AbortError');\n const actions: Array<() => Promise> = [];\n if (!preventAbort) {\n actions.push(() => {\n if (dest._state === 'writable') {\n return WritableStreamAbort(dest, error);\n }\n return promiseResolvedWith(undefined);\n });\n }\n if (!preventCancel) {\n actions.push(() => {\n if (source._state === 'readable') {\n return ReadableStreamCancel(source, error);\n }\n return promiseResolvedWith(undefined);\n });\n }\n shutdownWithAction(() => Promise.all(actions.map(action => action())), true, error);\n };\n\n if (signal.aborted) {\n abortAlgorithm();\n return;\n }\n\n signal.addEventListener('abort', abortAlgorithm);\n }\n\n // Using reader and writer, read all chunks from this and write them to dest\n // - Backpressure must be enforced\n // - Shutdown must stop all activity\n function pipeLoop() {\n return newPromise((resolveLoop, rejectLoop) => {\n function next(done: boolean) {\n if (done) {\n resolveLoop();\n } else {\n // Use `PerformPromiseThen` instead of `uponPromise` to avoid\n // adding unnecessary `.catch(rethrowAssertionErrorRejection)` handlers\n PerformPromiseThen(pipeStep(), next, rejectLoop);\n }\n }\n\n next(false);\n });\n }\n\n function pipeStep(): Promise {\n if (shuttingDown) {\n return promiseResolvedWith(true);\n }\n\n return PerformPromiseThen(writer._readyPromise, () => {\n return newPromise((resolveRead, rejectRead) => {\n ReadableStreamDefaultReaderRead(\n reader,\n {\n _chunkSteps: chunk => {\n currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, chunk), undefined, noop);\n resolveRead(false);\n },\n _closeSteps: () => resolveRead(true),\n _errorSteps: rejectRead\n }\n );\n });\n });\n }\n\n // Errors must be propagated forward\n isOrBecomesErrored(source, reader._closedPromise, storedError => {\n if (!preventAbort) {\n shutdownWithAction(() => WritableStreamAbort(dest, storedError), true, storedError);\n } else {\n shutdown(true, storedError);\n }\n return null;\n });\n\n // Errors must be propagated backward\n isOrBecomesErrored(dest, writer._closedPromise, storedError => {\n if (!preventCancel) {\n shutdownWithAction(() => ReadableStreamCancel(source, storedError), true, storedError);\n } else {\n shutdown(true, storedError);\n }\n return null;\n });\n\n // Closing must be propagated forward\n isOrBecomesClosed(source, reader._closedPromise, () => {\n if (!preventClose) {\n shutdownWithAction(() => WritableStreamDefaultWriterCloseWithErrorPropagation(writer));\n } else {\n shutdown();\n }\n return null;\n });\n\n // Closing must be propagated backward\n if (WritableStreamCloseQueuedOrInFlight(dest) || dest._state === 'closed') {\n const destClosed = new TypeError('the destination writable stream closed before all data could be piped to it');\n\n if (!preventCancel) {\n shutdownWithAction(() => ReadableStreamCancel(source, destClosed), true, destClosed);\n } else {\n shutdown(true, destClosed);\n }\n }\n\n setPromiseIsHandledToTrue(pipeLoop());\n\n function waitForWritesToFinish(): Promise {\n // Another write may have started while we were waiting on this currentWrite, so we have to be sure to wait\n // for that too.\n const oldCurrentWrite = currentWrite;\n return PerformPromiseThen(\n currentWrite,\n () => oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined\n );\n }\n\n function isOrBecomesErrored(stream: ReadableStream | WritableStream,\n promise: Promise,\n action: (reason: any) => null) {\n if (stream._state === 'errored') {\n action(stream._storedError);\n } else {\n uponRejection(promise, action);\n }\n }\n\n function isOrBecomesClosed(stream: ReadableStream | WritableStream, promise: Promise, action: () => null) {\n if (stream._state === 'closed') {\n action();\n } else {\n uponFulfillment(promise, action);\n }\n }\n\n function shutdownWithAction(action: () => Promise, originalIsError?: boolean, originalError?: any) {\n if (shuttingDown) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && !WritableStreamCloseQueuedOrInFlight(dest)) {\n uponFulfillment(waitForWritesToFinish(), doTheRest);\n } else {\n doTheRest();\n }\n\n function doTheRest(): null {\n uponPromise(\n action(),\n () => finalize(originalIsError, originalError),\n newError => finalize(true, newError)\n );\n return null;\n }\n }\n\n function shutdown(isError?: boolean, error?: any) {\n if (shuttingDown) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && !WritableStreamCloseQueuedOrInFlight(dest)) {\n uponFulfillment(waitForWritesToFinish(), () => finalize(isError, error));\n } else {\n finalize(isError, error);\n }\n }\n\n function finalize(isError?: boolean, error?: any): null {\n WritableStreamDefaultWriterRelease(writer);\n ReadableStreamReaderGenericRelease(reader);\n\n if (signal !== undefined) {\n signal.removeEventListener('abort', abortAlgorithm);\n }\n if (isError) {\n reject(error);\n } else {\n resolve(undefined);\n }\n\n return null;\n }\n });\n}\n","import type { QueuingStrategySizeCallback } from '../queuing-strategy';\nimport assert from '../../stub/assert';\nimport { DequeueValue, EnqueueValueWithSize, type QueuePair, ResetQueue } from '../abstract-ops/queue-with-sizes';\nimport {\n ReadableStreamAddReadRequest,\n ReadableStreamFulfillReadRequest,\n ReadableStreamGetNumReadRequests,\n type ReadRequest\n} from './default-reader';\nimport { SimpleQueue } from '../simple-queue';\nimport { IsReadableStreamLocked, ReadableStream, ReadableStreamClose, ReadableStreamError } from '../readable-stream';\nimport type { ValidatedUnderlyingSource } from './underlying-source';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { CancelSteps, PullSteps, ReleaseSteps } from '../abstract-ops/internal-methods';\nimport { promiseResolvedWith, uponPromise } from '../helpers/webidl';\n\n/**\n * Allows control of a {@link ReadableStream | readable stream}'s state and internal queue.\n *\n * @public\n */\nexport class ReadableStreamDefaultController {\n /** @internal */\n _controlledReadableStream!: ReadableStream;\n /** @internal */\n _queue!: SimpleQueue>;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _closeRequested!: boolean;\n /** @internal */\n _pullAgain!: boolean;\n /** @internal */\n _pulling !: boolean;\n /** @internal */\n _strategySizeAlgorithm!: QueuingStrategySizeCallback;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _pullAlgorithm!: () => Promise;\n /** @internal */\n _cancelAlgorithm!: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is\n * over-full. An underlying source ought to use this information to determine when and how to apply backpressure.\n */\n get desiredSize(): number | null {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n return ReadableStreamDefaultControllerGetDesiredSize(this);\n }\n\n /**\n * Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from\n * the stream, but once those are read, the stream will become closed.\n */\n close(): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('close');\n }\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {\n throw new TypeError('The stream is not in a state that permits close');\n }\n\n ReadableStreamDefaultControllerClose(this);\n }\n\n /**\n * Enqueues the given chunk `chunk` in the controlled readable stream.\n */\n enqueue(chunk: R): void;\n enqueue(chunk: R = undefined!): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {\n throw new TypeError('The stream is not in a state that permits enqueue');\n }\n\n return ReadableStreamDefaultControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.\n */\n error(e: any = undefined): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n\n ReadableStreamDefaultControllerError(this, e);\n }\n\n /** @internal */\n [CancelSteps](reason: any): Promise {\n ResetQueue(this);\n const result = this._cancelAlgorithm(reason);\n ReadableStreamDefaultControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [PullSteps](readRequest: ReadRequest): void {\n const stream = this._controlledReadableStream;\n\n if (this._queue.length > 0) {\n const chunk = DequeueValue(this);\n\n if (this._closeRequested && this._queue.length === 0) {\n ReadableStreamDefaultControllerClearAlgorithms(this);\n ReadableStreamClose(stream);\n } else {\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n }\n\n readRequest._chunkSteps(chunk);\n } else {\n ReadableStreamAddReadRequest(stream, readRequest);\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n }\n }\n\n /** @internal */\n [ReleaseSteps](): void {\n // Do nothing.\n }\n}\n\nObject.defineProperties(ReadableStreamDefaultController.prototype, {\n close: { enumerable: true },\n enqueue: { enumerable: true },\n error: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(ReadableStreamDefaultController.prototype.close, 'close');\nsetFunctionName(ReadableStreamDefaultController.prototype.enqueue, 'enqueue');\nsetFunctionName(ReadableStreamDefaultController.prototype.error, 'error');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamDefaultController',\n configurable: true\n });\n}\n\n// Abstract operations for the ReadableStreamDefaultController.\n\nfunction IsReadableStreamDefaultController(x: any): x is ReadableStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableStream')) {\n return false;\n }\n\n return x instanceof ReadableStreamDefaultController;\n}\n\nfunction ReadableStreamDefaultControllerCallPullIfNeeded(controller: ReadableStreamDefaultController): void {\n const shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);\n if (!shouldPull) {\n return;\n }\n\n if (controller._pulling) {\n controller._pullAgain = true;\n return;\n }\n\n assert(!controller._pullAgain);\n\n controller._pulling = true;\n\n const pullPromise = controller._pullAlgorithm();\n uponPromise(\n pullPromise,\n () => {\n controller._pulling = false;\n\n if (controller._pullAgain) {\n controller._pullAgain = false;\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n }\n\n return null;\n },\n e => {\n ReadableStreamDefaultControllerError(controller, e);\n return null;\n }\n );\n}\n\nfunction ReadableStreamDefaultControllerShouldCallPull(controller: ReadableStreamDefaultController): boolean {\n const stream = controller._controlledReadableStream;\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return false;\n }\n\n if (!controller._started) {\n return false;\n }\n\n if (IsReadableStreamLocked(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n const desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);\n assert(desiredSize !== null);\n if (desiredSize! > 0) {\n return true;\n }\n\n return false;\n}\n\nfunction ReadableStreamDefaultControllerClearAlgorithms(controller: ReadableStreamDefaultController) {\n controller._pullAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n controller._strategySizeAlgorithm = undefined!;\n}\n\n// A client of ReadableStreamDefaultController may use these functions directly to bypass state check.\n\nexport function ReadableStreamDefaultControllerClose(controller: ReadableStreamDefaultController) {\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return;\n }\n\n const stream = controller._controlledReadableStream;\n\n controller._closeRequested = true;\n\n if (controller._queue.length === 0) {\n ReadableStreamDefaultControllerClearAlgorithms(controller);\n ReadableStreamClose(stream);\n }\n}\n\nexport function ReadableStreamDefaultControllerEnqueue(\n controller: ReadableStreamDefaultController,\n chunk: R\n): void {\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return;\n }\n\n const stream = controller._controlledReadableStream;\n\n if (IsReadableStreamLocked(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n ReadableStreamFulfillReadRequest(stream, chunk, false);\n } else {\n let chunkSize;\n try {\n chunkSize = controller._strategySizeAlgorithm(chunk);\n } catch (chunkSizeE) {\n ReadableStreamDefaultControllerError(controller, chunkSizeE);\n throw chunkSizeE;\n }\n\n try {\n EnqueueValueWithSize(controller, chunk, chunkSize);\n } catch (enqueueE) {\n ReadableStreamDefaultControllerError(controller, enqueueE);\n throw enqueueE;\n }\n }\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n}\n\nexport function ReadableStreamDefaultControllerError(controller: ReadableStreamDefaultController, e: any) {\n const stream = controller._controlledReadableStream;\n\n if (stream._state !== 'readable') {\n return;\n }\n\n ResetQueue(controller);\n\n ReadableStreamDefaultControllerClearAlgorithms(controller);\n ReadableStreamError(stream, e);\n}\n\nexport function ReadableStreamDefaultControllerGetDesiredSize(\n controller: ReadableStreamDefaultController\n): number | null {\n const state = controller._controlledReadableStream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\n// This is used in the implementation of TransformStream.\nexport function ReadableStreamDefaultControllerHasBackpressure(\n controller: ReadableStreamDefaultController\n): boolean {\n if (ReadableStreamDefaultControllerShouldCallPull(controller)) {\n return false;\n }\n\n return true;\n}\n\nexport function ReadableStreamDefaultControllerCanCloseOrEnqueue(\n controller: ReadableStreamDefaultController\n): boolean {\n const state = controller._controlledReadableStream._state;\n\n if (!controller._closeRequested && state === 'readable') {\n return true;\n }\n\n return false;\n}\n\nexport function SetUpReadableStreamDefaultController(stream: ReadableStream,\n controller: ReadableStreamDefaultController,\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n assert(stream._readableStreamController === undefined);\n\n controller._controlledReadableStream = stream;\n\n controller._queue = undefined!;\n controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._started = false;\n controller._closeRequested = false;\n controller._pullAgain = false;\n controller._pulling = false;\n\n controller._strategySizeAlgorithm = sizeAlgorithm;\n controller._strategyHWM = highWaterMark;\n\n controller._pullAlgorithm = pullAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n stream._readableStreamController = controller;\n\n const startResult = startAlgorithm();\n uponPromise(\n promiseResolvedWith(startResult),\n () => {\n controller._started = true;\n\n assert(!controller._pulling);\n assert(!controller._pullAgain);\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n return null;\n },\n r => {\n ReadableStreamDefaultControllerError(controller, r);\n return null;\n }\n );\n}\n\nexport function SetUpReadableStreamDefaultControllerFromUnderlyingSource(\n stream: ReadableStream,\n underlyingSource: ValidatedUnderlyingSource,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback\n) {\n const controller: ReadableStreamDefaultController = Object.create(ReadableStreamDefaultController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let pullAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (underlyingSource.start !== undefined) {\n startAlgorithm = () => underlyingSource.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingSource.pull !== undefined) {\n pullAlgorithm = () => underlyingSource.pull!(controller);\n } else {\n pullAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSource.cancel !== undefined) {\n cancelAlgorithm = reason => underlyingSource.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpReadableStreamDefaultController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm\n );\n}\n\n// Helper functions for the ReadableStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamDefaultController.prototype.${name} can only be used on a ReadableStreamDefaultController`);\n}\n","import {\n CreateReadableByteStream,\n CreateReadableStream,\n type DefaultReadableStream,\n IsReadableStream,\n type ReadableByteStream,\n ReadableStream,\n ReadableStreamCancel,\n type ReadableStreamReader\n} from '../readable-stream';\nimport { ReadableStreamReaderGenericRelease } from './generic-reader';\nimport {\n AcquireReadableStreamDefaultReader,\n IsReadableStreamDefaultReader,\n ReadableStreamDefaultReaderRead,\n type ReadRequest\n} from './default-reader';\nimport {\n AcquireReadableStreamBYOBReader,\n IsReadableStreamBYOBReader,\n ReadableStreamBYOBReaderRead,\n type ReadIntoRequest\n} from './byob-reader';\nimport assert from '../../stub/assert';\nimport { newPromise, promiseResolvedWith, queueMicrotask, uponRejection } from '../helpers/webidl';\nimport {\n ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError\n} from './default-controller';\nimport {\n IsReadableByteStreamController,\n ReadableByteStreamControllerClose,\n ReadableByteStreamControllerEnqueue,\n ReadableByteStreamControllerError,\n ReadableByteStreamControllerGetBYOBRequest,\n ReadableByteStreamControllerRespond,\n ReadableByteStreamControllerRespondWithNewView\n} from './byte-stream-controller';\nimport { CreateArrayFromList } from '../abstract-ops/ecmascript';\nimport { CloneAsUint8Array } from '../abstract-ops/miscellaneous';\nimport type { NonShared } from '../helpers/array-buffer-view';\n\nexport function ReadableStreamTee(stream: ReadableStream,\n cloneForBranch2: boolean): [ReadableStream, ReadableStream] {\n assert(IsReadableStream(stream));\n assert(typeof cloneForBranch2 === 'boolean');\n if (IsReadableByteStreamController(stream._readableStreamController)) {\n return ReadableByteStreamTee(stream as unknown as ReadableByteStream) as\n unknown as [ReadableStream, ReadableStream];\n }\n return ReadableStreamDefaultTee(stream, cloneForBranch2);\n}\n\nexport function ReadableStreamDefaultTee(\n stream: ReadableStream,\n cloneForBranch2: boolean\n): [DefaultReadableStream, DefaultReadableStream] {\n assert(IsReadableStream(stream));\n assert(typeof cloneForBranch2 === 'boolean');\n\n const reader = AcquireReadableStreamDefaultReader(stream);\n\n let reading = false;\n let readAgain = false;\n let canceled1 = false;\n let canceled2 = false;\n let reason1: any;\n let reason2: any;\n let branch1: DefaultReadableStream;\n let branch2: DefaultReadableStream;\n\n let resolveCancelPromise: (value: undefined | Promise) => void;\n const cancelPromise = newPromise(resolve => {\n resolveCancelPromise = resolve;\n });\n\n function pullAlgorithm(): Promise {\n if (reading) {\n readAgain = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgain = false;\n const chunk1 = chunk;\n const chunk2 = chunk;\n\n // There is no way to access the cloning code right now in the reference implementation.\n // If we add one then we'll need an implementation for serializable objects.\n // if (!canceled2 && cloneForBranch2) {\n // chunk2 = StructuredDeserialize(StructuredSerialize(chunk2));\n // }\n\n if (!canceled1) {\n ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, chunk1);\n }\n if (!canceled2) {\n ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, chunk2);\n }\n\n reading = false;\n if (readAgain) {\n pullAlgorithm();\n }\n });\n },\n _closeSteps: () => {\n reading = false;\n if (!canceled1) {\n ReadableStreamDefaultControllerClose(branch1._readableStreamController);\n }\n if (!canceled2) {\n ReadableStreamDefaultControllerClose(branch2._readableStreamController);\n }\n\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n\n return promiseResolvedWith(undefined);\n }\n\n function cancel1Algorithm(reason: any): Promise {\n canceled1 = true;\n reason1 = reason;\n if (canceled2) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function cancel2Algorithm(reason: any): Promise {\n canceled2 = true;\n reason2 = reason;\n if (canceled1) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function startAlgorithm() {\n // do nothing\n }\n\n branch1 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel1Algorithm);\n branch2 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel2Algorithm);\n\n uponRejection(reader._closedPromise, (r: any) => {\n ReadableStreamDefaultControllerError(branch1._readableStreamController, r);\n ReadableStreamDefaultControllerError(branch2._readableStreamController, r);\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n return null;\n });\n\n return [branch1, branch2];\n}\n\nexport function ReadableByteStreamTee(stream: ReadableByteStream): [ReadableByteStream, ReadableByteStream] {\n assert(IsReadableStream(stream));\n assert(IsReadableByteStreamController(stream._readableStreamController));\n\n let reader: ReadableStreamReader> = AcquireReadableStreamDefaultReader(stream);\n let reading = false;\n let readAgainForBranch1 = false;\n let readAgainForBranch2 = false;\n let canceled1 = false;\n let canceled2 = false;\n let reason1: any;\n let reason2: any;\n let branch1: ReadableByteStream;\n let branch2: ReadableByteStream;\n\n let resolveCancelPromise: (value: undefined | Promise) => void;\n const cancelPromise = newPromise(resolve => {\n resolveCancelPromise = resolve;\n });\n\n function forwardReaderError(thisReader: ReadableStreamReader>) {\n uponRejection(thisReader._closedPromise, r => {\n if (thisReader !== reader) {\n return null;\n }\n ReadableByteStreamControllerError(branch1._readableStreamController, r);\n ReadableByteStreamControllerError(branch2._readableStreamController, r);\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n return null;\n });\n }\n\n function pullWithDefaultReader() {\n if (IsReadableStreamBYOBReader(reader)) {\n assert(reader._readIntoRequests.length === 0);\n ReadableStreamReaderGenericRelease(reader);\n\n reader = AcquireReadableStreamDefaultReader(stream);\n forwardReaderError(reader);\n }\n\n const readRequest: ReadRequest> = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgainForBranch1 = false;\n readAgainForBranch2 = false;\n\n const chunk1 = chunk;\n let chunk2 = chunk;\n if (!canceled1 && !canceled2) {\n try {\n chunk2 = CloneAsUint8Array(chunk);\n } catch (cloneE) {\n ReadableByteStreamControllerError(branch1._readableStreamController, cloneE);\n ReadableByteStreamControllerError(branch2._readableStreamController, cloneE);\n resolveCancelPromise(ReadableStreamCancel(stream, cloneE));\n return;\n }\n }\n\n if (!canceled1) {\n ReadableByteStreamControllerEnqueue(branch1._readableStreamController, chunk1);\n }\n if (!canceled2) {\n ReadableByteStreamControllerEnqueue(branch2._readableStreamController, chunk2);\n }\n\n reading = false;\n if (readAgainForBranch1) {\n pull1Algorithm();\n } else if (readAgainForBranch2) {\n pull2Algorithm();\n }\n });\n },\n _closeSteps: () => {\n reading = false;\n if (!canceled1) {\n ReadableByteStreamControllerClose(branch1._readableStreamController);\n }\n if (!canceled2) {\n ReadableByteStreamControllerClose(branch2._readableStreamController);\n }\n if (branch1._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(branch1._readableStreamController, 0);\n }\n if (branch2._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(branch2._readableStreamController, 0);\n }\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n }\n\n function pullWithBYOBReader(view: NonShared, forBranch2: boolean) {\n if (IsReadableStreamDefaultReader>(reader)) {\n assert(reader._readRequests.length === 0);\n ReadableStreamReaderGenericRelease(reader);\n\n reader = AcquireReadableStreamBYOBReader(stream);\n forwardReaderError(reader);\n }\n\n const byobBranch = forBranch2 ? branch2 : branch1;\n const otherBranch = forBranch2 ? branch1 : branch2;\n\n const readIntoRequest: ReadIntoRequest> = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgainForBranch1 = false;\n readAgainForBranch2 = false;\n\n const byobCanceled = forBranch2 ? canceled2 : canceled1;\n const otherCanceled = forBranch2 ? canceled1 : canceled2;\n\n if (!otherCanceled) {\n let clonedChunk;\n try {\n clonedChunk = CloneAsUint8Array(chunk);\n } catch (cloneE) {\n ReadableByteStreamControllerError(byobBranch._readableStreamController, cloneE);\n ReadableByteStreamControllerError(otherBranch._readableStreamController, cloneE);\n resolveCancelPromise(ReadableStreamCancel(stream, cloneE));\n return;\n }\n if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n ReadableByteStreamControllerEnqueue(otherBranch._readableStreamController, clonedChunk);\n } else if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n\n reading = false;\n if (readAgainForBranch1) {\n pull1Algorithm();\n } else if (readAgainForBranch2) {\n pull2Algorithm();\n }\n });\n },\n _closeSteps: chunk => {\n reading = false;\n\n const byobCanceled = forBranch2 ? canceled2 : canceled1;\n const otherCanceled = forBranch2 ? canceled1 : canceled2;\n\n if (!byobCanceled) {\n ReadableByteStreamControllerClose(byobBranch._readableStreamController);\n }\n if (!otherCanceled) {\n ReadableByteStreamControllerClose(otherBranch._readableStreamController);\n }\n\n if (chunk !== undefined) {\n assert(chunk.byteLength === 0);\n\n if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n if (!otherCanceled && otherBranch._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(otherBranch._readableStreamController, 0);\n }\n }\n\n if (!byobCanceled || !otherCanceled) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamBYOBReaderRead(reader, view, 1, readIntoRequest);\n }\n\n function pull1Algorithm(): Promise {\n if (reading) {\n readAgainForBranch1 = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch1._readableStreamController);\n if (byobRequest === null) {\n pullWithDefaultReader();\n } else {\n pullWithBYOBReader(byobRequest._view!, false);\n }\n\n return promiseResolvedWith(undefined);\n }\n\n function pull2Algorithm(): Promise {\n if (reading) {\n readAgainForBranch2 = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch2._readableStreamController);\n if (byobRequest === null) {\n pullWithDefaultReader();\n } else {\n pullWithBYOBReader(byobRequest._view!, true);\n }\n\n return promiseResolvedWith(undefined);\n }\n\n function cancel1Algorithm(reason: any): Promise {\n canceled1 = true;\n reason1 = reason;\n if (canceled2) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function cancel2Algorithm(reason: any): Promise {\n canceled2 = true;\n reason2 = reason;\n if (canceled1) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function startAlgorithm(): void {\n return;\n }\n\n branch1 = CreateReadableByteStream(startAlgorithm, pull1Algorithm, cancel1Algorithm);\n branch2 = CreateReadableByteStream(startAlgorithm, pull2Algorithm, cancel2Algorithm);\n\n forwardReaderError(reader);\n\n return [branch1, branch2];\n}\n","import { typeIsObject } from '../helpers/miscellaneous';\nimport type { ReadableStreamDefaultReadResult } from './default-reader';\n\n/**\n * A common interface for a `ReadadableStream` implementation.\n *\n * @public\n */\nexport interface ReadableStreamLike {\n readonly locked: boolean;\n\n getReader(): ReadableStreamDefaultReaderLike;\n}\n\n/**\n * A common interface for a `ReadableStreamDefaultReader` implementation.\n *\n * @public\n */\nexport interface ReadableStreamDefaultReaderLike {\n readonly closed: Promise;\n\n cancel(reason?: any): Promise;\n\n read(): Promise>;\n\n releaseLock(): void;\n}\n\nexport function isReadableStreamLike(stream: unknown): stream is ReadableStreamLike {\n return typeIsObject(stream) && typeof (stream as ReadableStreamLike).getReader !== 'undefined';\n}\n","import { CreateReadableStream, type DefaultReadableStream } from '../readable-stream';\nimport {\n isReadableStreamLike,\n type ReadableStreamDefaultReaderLike,\n type ReadableStreamLike\n} from './readable-stream-like';\nimport { ReadableStreamDefaultControllerClose, ReadableStreamDefaultControllerEnqueue } from './default-controller';\nimport { GetIterator, GetMethod, IteratorComplete, IteratorNext, IteratorValue } from '../abstract-ops/ecmascript';\nimport { promiseRejectedWith, promiseResolvedWith, reflectCall, transformPromiseWith } from '../helpers/webidl';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport { noop } from '../../utils';\n\nexport function ReadableStreamFrom(\n source: Iterable | AsyncIterable | ReadableStreamLike\n): DefaultReadableStream {\n if (isReadableStreamLike(source)) {\n return ReadableStreamFromDefaultReader(source.getReader());\n }\n return ReadableStreamFromIterable(source);\n}\n\nexport function ReadableStreamFromIterable(asyncIterable: Iterable | AsyncIterable): DefaultReadableStream {\n let stream: DefaultReadableStream;\n const iteratorRecord = GetIterator(asyncIterable, 'async');\n\n const startAlgorithm = noop;\n\n function pullAlgorithm(): Promise {\n let nextResult;\n try {\n nextResult = IteratorNext(iteratorRecord);\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const nextPromise = promiseResolvedWith(nextResult);\n return transformPromiseWith(nextPromise, iterResult => {\n if (!typeIsObject(iterResult)) {\n throw new TypeError('The promise returned by the iterator.next() method must fulfill with an object');\n }\n const done = IteratorComplete(iterResult);\n if (done) {\n ReadableStreamDefaultControllerClose(stream._readableStreamController);\n } else {\n const value = IteratorValue(iterResult);\n ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);\n }\n });\n }\n\n function cancelAlgorithm(reason: any): Promise {\n const iterator = iteratorRecord.iterator;\n let returnMethod: (typeof iterator)['return'] | undefined;\n try {\n returnMethod = GetMethod(iterator, 'return');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n if (returnMethod === undefined) {\n return promiseResolvedWith(undefined);\n }\n let returnResult: IteratorResult | Promise>;\n try {\n returnResult = reflectCall(returnMethod, iterator, [reason]);\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const returnPromise = promiseResolvedWith(returnResult);\n return transformPromiseWith(returnPromise, iterResult => {\n if (!typeIsObject(iterResult)) {\n throw new TypeError('The promise returned by the iterator.return() method must fulfill with an object');\n }\n return undefined;\n });\n }\n\n stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);\n return stream;\n}\n\nexport function ReadableStreamFromDefaultReader(\n reader: ReadableStreamDefaultReaderLike\n): DefaultReadableStream {\n let stream: DefaultReadableStream;\n\n const startAlgorithm = noop;\n\n function pullAlgorithm(): Promise {\n let readPromise;\n try {\n readPromise = reader.read();\n } catch (e) {\n return promiseRejectedWith(e);\n }\n return transformPromiseWith(readPromise, readResult => {\n if (!typeIsObject(readResult)) {\n throw new TypeError('The promise returned by the reader.read() method must fulfill with an object');\n }\n if (readResult.done) {\n ReadableStreamDefaultControllerClose(stream._readableStreamController);\n } else {\n const value = readResult.value;\n ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);\n }\n });\n }\n\n function cancelAlgorithm(reason: any): Promise {\n try {\n return promiseResolvedWith(reader.cancel(reason));\n } catch (e) {\n return promiseRejectedWith(e);\n }\n }\n\n stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);\n return stream;\n}\n","import { assertDictionary, assertFunction, convertUnsignedLongLongWithEnforceRange } from './basic';\nimport type {\n ReadableStreamController,\n UnderlyingByteSource,\n UnderlyingDefaultOrByteSource,\n UnderlyingDefaultOrByteSourcePullCallback,\n UnderlyingDefaultOrByteSourceStartCallback,\n UnderlyingSource,\n UnderlyingSourceCancelCallback,\n ValidatedUnderlyingDefaultOrByteSource\n} from '../readable-stream/underlying-source';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\n\nexport function convertUnderlyingDefaultOrByteSource(\n source: UnderlyingSource | UnderlyingByteSource | null,\n context: string\n): ValidatedUnderlyingDefaultOrByteSource {\n assertDictionary(source, context);\n const original = source as (UnderlyingDefaultOrByteSource | null);\n const autoAllocateChunkSize = original?.autoAllocateChunkSize;\n const cancel = original?.cancel;\n const pull = original?.pull;\n const start = original?.start;\n const type = original?.type;\n return {\n autoAllocateChunkSize: autoAllocateChunkSize === undefined ?\n undefined :\n convertUnsignedLongLongWithEnforceRange(\n autoAllocateChunkSize,\n `${context} has member 'autoAllocateChunkSize' that`\n ),\n cancel: cancel === undefined ?\n undefined :\n convertUnderlyingSourceCancelCallback(cancel, original!, `${context} has member 'cancel' that`),\n pull: pull === undefined ?\n undefined :\n convertUnderlyingSourcePullCallback(pull, original!, `${context} has member 'pull' that`),\n start: start === undefined ?\n undefined :\n convertUnderlyingSourceStartCallback(start, original!, `${context} has member 'start' that`),\n type: type === undefined ? undefined : convertReadableStreamType(type, `${context} has member 'type' that`)\n };\n}\n\nfunction convertUnderlyingSourceCancelCallback(\n fn: UnderlyingSourceCancelCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n\nfunction convertUnderlyingSourcePullCallback(\n fn: UnderlyingDefaultOrByteSourcePullCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): (controller: ReadableStreamController) => Promise {\n assertFunction(fn, context);\n return (controller: ReadableStreamController) => promiseCall(fn, original, [controller]);\n}\n\nfunction convertUnderlyingSourceStartCallback(\n fn: UnderlyingDefaultOrByteSourceStartCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): UnderlyingDefaultOrByteSourceStartCallback {\n assertFunction(fn, context);\n return (controller: ReadableStreamController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertReadableStreamType(type: string, context: string): 'bytes' {\n type = `${type}`;\n if (type !== 'bytes') {\n throw new TypeError(`${context} '${type}' is not a valid enumeration value for ReadableStreamType`);\n }\n return type;\n}\n","import { assertDictionary } from './basic';\nimport type {\n ReadableStreamIteratorOptions,\n ValidatedReadableStreamIteratorOptions\n} from '../readable-stream/iterator-options';\n\nexport function convertIteratorOptions(options: ReadableStreamIteratorOptions | null | undefined,\n context: string): ValidatedReadableStreamIteratorOptions {\n assertDictionary(options, context);\n const preventCancel = options?.preventCancel;\n return { preventCancel: Boolean(preventCancel) };\n}\n","import { assertDictionary } from './basic';\nimport type { StreamPipeOptions, ValidatedStreamPipeOptions } from '../readable-stream/pipe-options';\nimport { type AbortSignal, isAbortSignal } from '../abort-signal';\n\nexport function convertPipeOptions(options: StreamPipeOptions | null | undefined,\n context: string): ValidatedStreamPipeOptions {\n assertDictionary(options, context);\n const preventAbort = options?.preventAbort;\n const preventCancel = options?.preventCancel;\n const preventClose = options?.preventClose;\n const signal = options?.signal;\n if (signal !== undefined) {\n assertAbortSignal(signal, `${context} has member 'signal' that`);\n }\n return {\n preventAbort: Boolean(preventAbort),\n preventCancel: Boolean(preventCancel),\n preventClose: Boolean(preventClose),\n signal\n };\n}\n\nfunction assertAbortSignal(signal: unknown, context: string): asserts signal is AbortSignal {\n if (!isAbortSignal(signal)) {\n throw new TypeError(`${context} is not an AbortSignal.`);\n }\n}\n","import { assertDictionary, assertRequiredField } from './basic';\nimport { ReadableStream } from '../readable-stream';\nimport { WritableStream } from '../writable-stream';\nimport { assertReadableStream } from './readable-stream';\nimport { assertWritableStream } from './writable-stream';\n\nexport function convertReadableWritablePair(\n pair: { readable: RS; writable: WS } | null | undefined,\n context: string\n): { readable: RS; writable: WS } {\n assertDictionary(pair, context);\n\n const readable = pair?.readable;\n assertRequiredField(readable, 'readable', 'ReadableWritablePair');\n assertReadableStream(readable, `${context} has member 'readable' that`);\n\n const writable = pair?.writable;\n assertRequiredField(writable, 'writable', 'ReadableWritablePair');\n assertWritableStream(writable, `${context} has member 'writable' that`);\n\n return { readable, writable };\n}\n","import assert from '../stub/assert';\nimport {\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n transformPromiseWith\n} from './helpers/webidl';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { AcquireReadableStreamAsyncIterator, type ReadableStreamAsyncIterator } from './readable-stream/async-iterator';\nimport { defaultReaderClosedPromiseReject, defaultReaderClosedPromiseResolve } from './readable-stream/generic-reader';\nimport {\n AcquireReadableStreamDefaultReader,\n IsReadableStreamDefaultReader,\n ReadableStreamDefaultReader,\n ReadableStreamDefaultReaderErrorReadRequests,\n type ReadableStreamDefaultReadResult\n} from './readable-stream/default-reader';\nimport {\n AcquireReadableStreamBYOBReader,\n IsReadableStreamBYOBReader,\n ReadableStreamBYOBReader,\n ReadableStreamBYOBReaderErrorReadIntoRequests,\n type ReadableStreamBYOBReadResult\n} from './readable-stream/byob-reader';\nimport { ReadableStreamPipeTo } from './readable-stream/pipe';\nimport { ReadableStreamTee } from './readable-stream/tee';\nimport { ReadableStreamFrom } from './readable-stream/from';\nimport { IsWritableStream, IsWritableStreamLocked, WritableStream } from './writable-stream';\nimport { SimpleQueue } from './simple-queue';\nimport {\n ReadableByteStreamController,\n ReadableStreamBYOBRequest,\n SetUpReadableByteStreamController,\n SetUpReadableByteStreamControllerFromUnderlyingSource\n} from './readable-stream/byte-stream-controller';\nimport {\n ReadableStreamDefaultController,\n SetUpReadableStreamDefaultController,\n SetUpReadableStreamDefaultControllerFromUnderlyingSource\n} from './readable-stream/default-controller';\nimport type {\n UnderlyingByteSource,\n UnderlyingByteSourcePullCallback,\n UnderlyingByteSourceStartCallback,\n UnderlyingSource,\n UnderlyingSourceCancelCallback,\n UnderlyingSourcePullCallback,\n UnderlyingSourceStartCallback\n} from './readable-stream/underlying-source';\nimport { noop } from '../utils';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { CreateArrayFromList, SymbolAsyncIterator } from './abstract-ops/ecmascript';\nimport { CancelSteps } from './abstract-ops/internal-methods';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { assertObject, assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport { convertUnderlyingDefaultOrByteSource } from './validators/underlying-source';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ReadableStreamGetReaderOptions\n} from './readable-stream/reader-options';\nimport { convertReaderOptions } from './validators/reader-options';\nimport type { StreamPipeOptions, ValidatedStreamPipeOptions } from './readable-stream/pipe-options';\nimport type { ReadableStreamIteratorOptions } from './readable-stream/iterator-options';\nimport { convertIteratorOptions } from './validators/iterator-options';\nimport { convertPipeOptions } from './validators/pipe-options';\nimport type { ReadableWritablePair } from './readable-stream/readable-writable-pair';\nimport { convertReadableWritablePair } from './validators/readable-writable-pair';\nimport type { ReadableStreamDefaultReaderLike, ReadableStreamLike } from './readable-stream/readable-stream-like';\nimport type { NonShared } from './helpers/array-buffer-view';\n\nexport type DefaultReadableStream = ReadableStream & {\n _readableStreamController: ReadableStreamDefaultController\n};\n\nexport type ReadableByteStream = ReadableStream> & {\n _readableStreamController: ReadableByteStreamController\n};\n\ntype ReadableStreamState = 'readable' | 'closed' | 'errored';\n\n/**\n * A readable stream represents a source of data, from which you can read.\n *\n * @public\n */\nexport class ReadableStream implements AsyncIterable {\n /** @internal */\n _state!: ReadableStreamState;\n /** @internal */\n _reader: ReadableStreamReader | undefined;\n /** @internal */\n _storedError: any;\n /** @internal */\n _disturbed!: boolean;\n /** @internal */\n _readableStreamController!: ReadableStreamDefaultController | ReadableByteStreamController;\n\n constructor(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number; size?: undefined });\n constructor(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy);\n constructor(rawUnderlyingSource: UnderlyingSource | UnderlyingByteSource | null | undefined = {},\n rawStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawUnderlyingSource === undefined) {\n rawUnderlyingSource = null;\n } else {\n assertObject(rawUnderlyingSource, 'First parameter');\n }\n\n const strategy = convertQueuingStrategy(rawStrategy, 'Second parameter');\n const underlyingSource = convertUnderlyingDefaultOrByteSource(rawUnderlyingSource, 'First parameter');\n\n InitializeReadableStream(this);\n\n if (underlyingSource.type === 'bytes') {\n if (strategy.size !== undefined) {\n throw new RangeError('The strategy for a byte stream cannot have a size function');\n }\n const highWaterMark = ExtractHighWaterMark(strategy, 0);\n SetUpReadableByteStreamControllerFromUnderlyingSource(\n this as unknown as ReadableByteStream,\n underlyingSource,\n highWaterMark\n );\n } else {\n assert(underlyingSource.type === undefined);\n const sizeAlgorithm = ExtractSizeAlgorithm(strategy);\n const highWaterMark = ExtractHighWaterMark(strategy, 1);\n SetUpReadableStreamDefaultControllerFromUnderlyingSource(\n this,\n underlyingSource,\n highWaterMark,\n sizeAlgorithm\n );\n }\n }\n\n /**\n * Whether or not the readable stream is locked to a {@link ReadableStreamDefaultReader | reader}.\n */\n get locked(): boolean {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('locked');\n }\n\n return IsReadableStreamLocked(this);\n }\n\n /**\n * Cancels the stream, signaling a loss of interest in the stream by a consumer.\n *\n * The supplied `reason` argument will be given to the underlying source's {@link UnderlyingSource.cancel | cancel()}\n * method, which might or might not use it.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('cancel'));\n }\n\n if (IsReadableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot cancel a stream that already has a reader'));\n }\n\n return ReadableStreamCancel(this, reason);\n }\n\n /**\n * Creates a {@link ReadableStreamBYOBReader} and locks the stream to the new reader.\n *\n * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams,\n * i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading.\n * The returned BYOB reader provides the ability to directly read individual chunks from the stream via its\n * {@link ReadableStreamBYOBReader.read | read()} method, into developer-supplied buffers, allowing more precise\n * control over allocation.\n */\n getReader({ mode }: { mode: 'byob' }): ReadableStreamBYOBReader;\n /**\n * Creates a {@link ReadableStreamDefaultReader} and locks the stream to the new reader.\n * While the stream is locked, no other reader can be acquired until this one is released.\n *\n * This functionality is especially useful for creating abstractions that desire the ability to consume a stream\n * in its entirety. By getting a reader for the stream, you can ensure nobody else can interleave reads with yours\n * or cancel the stream, which would interfere with your abstraction.\n */\n getReader(): ReadableStreamDefaultReader;\n getReader(\n rawOptions: ReadableStreamGetReaderOptions | null | undefined = undefined\n ): ReadableStreamDefaultReader | ReadableStreamBYOBReader {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('getReader');\n }\n\n const options = convertReaderOptions(rawOptions, 'First parameter');\n\n if (options.mode === undefined) {\n return AcquireReadableStreamDefaultReader(this);\n }\n\n assert(options.mode === 'byob');\n return AcquireReadableStreamBYOBReader(this as unknown as ReadableByteStream);\n }\n\n /**\n * Provides a convenient, chainable way of piping this readable stream through a transform stream\n * (or any other `{ writable, readable }` pair). It simply {@link ReadableStream.pipeTo | pipes} the stream\n * into the writable side of the supplied pair, and returns the readable side for further use.\n *\n * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n */\n pipeThrough(\n transform: { readable: RS; writable: WritableStream },\n options?: StreamPipeOptions\n ): RS;\n pipeThrough(\n rawTransform: { readable: RS; writable: WritableStream } | null | undefined,\n rawOptions: StreamPipeOptions | null | undefined = {}\n ): RS {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('pipeThrough');\n }\n assertRequiredArgument(rawTransform, 1, 'pipeThrough');\n\n const transform = convertReadableWritablePair(rawTransform, 'First parameter');\n const options = convertPipeOptions(rawOptions, 'Second parameter');\n\n if (IsReadableStreamLocked(this)) {\n throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream');\n }\n if (IsWritableStreamLocked(transform.writable)) {\n throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream');\n }\n\n const promise = ReadableStreamPipeTo(\n this, transform.writable, options.preventClose, options.preventAbort, options.preventCancel, options.signal\n );\n\n setPromiseIsHandledToTrue(promise);\n\n return transform.readable;\n }\n\n /**\n * Pipes this readable stream to a given writable stream. The way in which the piping process behaves under\n * various error conditions can be customized with a number of passed options. It returns a promise that fulfills\n * when the piping process completes successfully, or rejects if any errors were encountered.\n *\n * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n */\n pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise;\n pipeTo(destination: WritableStream | null | undefined,\n rawOptions: StreamPipeOptions | null | undefined = {}): Promise {\n if (!IsReadableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('pipeTo'));\n }\n\n if (destination === undefined) {\n return promiseRejectedWith(`Parameter 1 is required in 'pipeTo'.`);\n }\n if (!IsWritableStream(destination)) {\n return promiseRejectedWith(\n new TypeError(`ReadableStream.prototype.pipeTo's first argument must be a WritableStream`)\n );\n }\n\n let options: ValidatedStreamPipeOptions;\n try {\n options = convertPipeOptions(rawOptions, 'Second parameter');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n\n if (IsReadableStreamLocked(this)) {\n return promiseRejectedWith(\n new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream')\n );\n }\n if (IsWritableStreamLocked(destination)) {\n return promiseRejectedWith(\n new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream')\n );\n }\n\n return ReadableStreamPipeTo(\n this, destination, options.preventClose, options.preventAbort, options.preventCancel, options.signal\n );\n }\n\n /**\n * Tees this readable stream, returning a two-element array containing the two resulting branches as\n * new {@link ReadableStream} instances.\n *\n * Teeing a stream will lock it, preventing any other consumer from acquiring a reader.\n * To cancel the stream, cancel both of the resulting branches; a composite cancellation reason will then be\n * propagated to the stream's underlying source.\n *\n * Note that the chunks seen in each branch will be the same object. If the chunks are not immutable,\n * this could allow interference between the two branches.\n */\n tee(): [ReadableStream, ReadableStream] {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('tee');\n }\n\n const branches = ReadableStreamTee(this, false);\n return CreateArrayFromList(branches);\n }\n\n /**\n * Asynchronously iterates over the chunks in the stream's internal queue.\n *\n * Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader.\n * The lock will be released if the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method\n * is called, e.g. by breaking out of the loop.\n *\n * By default, calling the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method will also\n * cancel the stream. To prevent this, use the stream's {@link ReadableStream.values | values()} method, passing\n * `true` for the `preventCancel` option.\n */\n values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator;\n values(rawOptions: ReadableStreamIteratorOptions | null | undefined = undefined): ReadableStreamAsyncIterator {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('values');\n }\n\n const options = convertIteratorOptions(rawOptions, 'First parameter');\n return AcquireReadableStreamAsyncIterator(this, options.preventCancel);\n }\n\n /**\n * {@inheritDoc ReadableStream.values}\n */\n [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator;\n\n [SymbolAsyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator {\n // Stub implementation, overridden below\n return this.values(options);\n }\n\n /**\n * Creates a new ReadableStream wrapping the provided iterable or async iterable.\n *\n * This can be used to adapt various kinds of objects into a readable stream,\n * such as an array, an async generator, or a Node.js readable stream.\n */\n static from(asyncIterable: Iterable | AsyncIterable | ReadableStreamLike): ReadableStream {\n return ReadableStreamFrom(asyncIterable);\n }\n}\n\nObject.defineProperties(ReadableStream, {\n from: { enumerable: true }\n});\nObject.defineProperties(ReadableStream.prototype, {\n cancel: { enumerable: true },\n getReader: { enumerable: true },\n pipeThrough: { enumerable: true },\n pipeTo: { enumerable: true },\n tee: { enumerable: true },\n values: { enumerable: true },\n locked: { enumerable: true }\n});\nsetFunctionName(ReadableStream.from, 'from');\nsetFunctionName(ReadableStream.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStream.prototype.getReader, 'getReader');\nsetFunctionName(ReadableStream.prototype.pipeThrough, 'pipeThrough');\nsetFunctionName(ReadableStream.prototype.pipeTo, 'pipeTo');\nsetFunctionName(ReadableStream.prototype.tee, 'tee');\nsetFunctionName(ReadableStream.prototype.values, 'values');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStream.prototype, Symbol.toStringTag, {\n value: 'ReadableStream',\n configurable: true\n });\n}\nObject.defineProperty(ReadableStream.prototype, SymbolAsyncIterator, {\n value: ReadableStream.prototype.values,\n writable: true,\n configurable: true\n});\n\nexport type {\n ReadableStreamAsyncIterator,\n ReadableStreamDefaultReadResult,\n ReadableStreamBYOBReadResult,\n ReadableStreamBYOBReaderReadOptions,\n UnderlyingByteSource,\n UnderlyingSource,\n UnderlyingSourceStartCallback,\n UnderlyingSourcePullCallback,\n UnderlyingSourceCancelCallback,\n UnderlyingByteSourceStartCallback,\n UnderlyingByteSourcePullCallback,\n StreamPipeOptions,\n ReadableWritablePair,\n ReadableStreamIteratorOptions,\n ReadableStreamLike,\n ReadableStreamDefaultReaderLike\n};\n\n// Abstract operations for the ReadableStream.\n\n// Throws if and only if startAlgorithm throws.\nexport function CreateReadableStream(\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark = 1,\n sizeAlgorithm: QueuingStrategySizeCallback = () => 1\n): DefaultReadableStream {\n assert(IsNonNegativeNumber(highWaterMark));\n\n const stream: DefaultReadableStream = Object.create(ReadableStream.prototype);\n InitializeReadableStream(stream);\n\n const controller: ReadableStreamDefaultController = Object.create(ReadableStreamDefaultController.prototype);\n SetUpReadableStreamDefaultController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm\n );\n\n return stream;\n}\n\n// Throws if and only if startAlgorithm throws.\nexport function CreateReadableByteStream(\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise\n): ReadableByteStream {\n const stream: ReadableByteStream = Object.create(ReadableStream.prototype);\n InitializeReadableStream(stream);\n\n const controller: ReadableByteStreamController = Object.create(ReadableByteStreamController.prototype);\n SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, 0, undefined);\n\n return stream;\n}\n\nfunction InitializeReadableStream(stream: ReadableStream) {\n stream._state = 'readable';\n stream._reader = undefined;\n stream._storedError = undefined;\n stream._disturbed = false;\n}\n\nexport function IsReadableStream(x: unknown): x is ReadableStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {\n return false;\n }\n\n return x instanceof ReadableStream;\n}\n\nexport function IsReadableStreamDisturbed(stream: ReadableStream): boolean {\n assert(IsReadableStream(stream));\n\n return stream._disturbed;\n}\n\nexport function IsReadableStreamLocked(stream: ReadableStream): boolean {\n assert(IsReadableStream(stream));\n\n if (stream._reader === undefined) {\n return false;\n }\n\n return true;\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamCancel(stream: ReadableStream, reason: any): Promise {\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n return promiseResolvedWith(undefined);\n }\n if (stream._state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n\n ReadableStreamClose(stream);\n\n const reader = stream._reader;\n if (reader !== undefined && IsReadableStreamBYOBReader(reader)) {\n const readIntoRequests = reader._readIntoRequests;\n reader._readIntoRequests = new SimpleQueue();\n readIntoRequests.forEach(readIntoRequest => {\n readIntoRequest._closeSteps(undefined);\n });\n }\n\n const sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);\n return transformPromiseWith(sourceCancelPromise, noop);\n}\n\nexport function ReadableStreamClose(stream: ReadableStream): void {\n assert(stream._state === 'readable');\n\n stream._state = 'closed';\n\n const reader = stream._reader;\n\n if (reader === undefined) {\n return;\n }\n\n defaultReaderClosedPromiseResolve(reader);\n\n if (IsReadableStreamDefaultReader(reader)) {\n const readRequests = reader._readRequests;\n reader._readRequests = new SimpleQueue();\n readRequests.forEach(readRequest => {\n readRequest._closeSteps();\n });\n }\n}\n\nexport function ReadableStreamError(stream: ReadableStream, e: any): void {\n assert(IsReadableStream(stream));\n assert(stream._state === 'readable');\n\n stream._state = 'errored';\n stream._storedError = e;\n\n const reader = stream._reader;\n\n if (reader === undefined) {\n return;\n }\n\n defaultReaderClosedPromiseReject(reader, e);\n\n if (IsReadableStreamDefaultReader(reader)) {\n ReadableStreamDefaultReaderErrorReadRequests(reader, e);\n } else {\n assert(IsReadableStreamBYOBReader(reader));\n ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);\n }\n}\n\n// Readers\n\nexport type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader;\n\nexport {\n ReadableStreamDefaultReader,\n ReadableStreamBYOBReader\n};\n\n// Controllers\n\nexport {\n ReadableStreamDefaultController,\n ReadableStreamBYOBRequest,\n ReadableByteStreamController\n};\n\n// Helper functions for the ReadableStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(`ReadableStream.prototype.${name} can only be used on a ReadableStream`);\n}\n","import type { QueuingStrategyInit } from '../queuing-strategy';\nimport { assertDictionary, assertRequiredField, convertUnrestrictedDouble } from './basic';\n\nexport function convertQueuingStrategyInit(init: QueuingStrategyInit | null | undefined,\n context: string): QueuingStrategyInit {\n assertDictionary(init, context);\n const highWaterMark = init?.highWaterMark;\n assertRequiredField(highWaterMark, 'highWaterMark', 'QueuingStrategyInit');\n return {\n highWaterMark: convertUnrestrictedDouble(highWaterMark)\n };\n}\n","import type { QueuingStrategy, QueuingStrategyInit } from './queuing-strategy';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategyInit } from './validators/queuing-strategy-init';\n\n// The size function must not have a prototype property nor be a constructor\nconst byteLengthSizeFunction = (chunk: ArrayBufferView): number => {\n return chunk.byteLength;\n};\nsetFunctionName(byteLengthSizeFunction, 'size');\n\n/**\n * A queuing strategy that counts the number of bytes in each chunk.\n *\n * @public\n */\nexport default class ByteLengthQueuingStrategy implements QueuingStrategy {\n /** @internal */\n readonly _byteLengthQueuingStrategyHighWaterMark: number;\n\n constructor(options: QueuingStrategyInit) {\n assertRequiredArgument(options, 1, 'ByteLengthQueuingStrategy');\n options = convertQueuingStrategyInit(options, 'First parameter');\n this._byteLengthQueuingStrategyHighWaterMark = options.highWaterMark;\n }\n\n /**\n * Returns the high water mark provided to the constructor.\n */\n get highWaterMark(): number {\n if (!IsByteLengthQueuingStrategy(this)) {\n throw byteLengthBrandCheckException('highWaterMark');\n }\n return this._byteLengthQueuingStrategyHighWaterMark;\n }\n\n /**\n * Measures the size of `chunk` by returning the value of its `byteLength` property.\n */\n get size(): (chunk: ArrayBufferView) => number {\n if (!IsByteLengthQueuingStrategy(this)) {\n throw byteLengthBrandCheckException('size');\n }\n return byteLengthSizeFunction;\n }\n}\n\nObject.defineProperties(ByteLengthQueuingStrategy.prototype, {\n highWaterMark: { enumerable: true },\n size: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ByteLengthQueuingStrategy.prototype, Symbol.toStringTag, {\n value: 'ByteLengthQueuingStrategy',\n configurable: true\n });\n}\n\n// Helper functions for the ByteLengthQueuingStrategy.\n\nfunction byteLengthBrandCheckException(name: string): TypeError {\n return new TypeError(`ByteLengthQueuingStrategy.prototype.${name} can only be used on a ByteLengthQueuingStrategy`);\n}\n\nexport function IsByteLengthQueuingStrategy(x: any): x is ByteLengthQueuingStrategy {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_byteLengthQueuingStrategyHighWaterMark')) {\n return false;\n }\n\n return x instanceof ByteLengthQueuingStrategy;\n}\n","import type { QueuingStrategy, QueuingStrategyInit } from './queuing-strategy';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategyInit } from './validators/queuing-strategy-init';\n\n// The size function must not have a prototype property nor be a constructor\nconst countSizeFunction = (): 1 => {\n return 1;\n};\nsetFunctionName(countSizeFunction, 'size');\n\n/**\n * A queuing strategy that counts the number of chunks.\n *\n * @public\n */\nexport default class CountQueuingStrategy implements QueuingStrategy {\n /** @internal */\n readonly _countQueuingStrategyHighWaterMark!: number;\n\n constructor(options: QueuingStrategyInit) {\n assertRequiredArgument(options, 1, 'CountQueuingStrategy');\n options = convertQueuingStrategyInit(options, 'First parameter');\n this._countQueuingStrategyHighWaterMark = options.highWaterMark;\n }\n\n /**\n * Returns the high water mark provided to the constructor.\n */\n get highWaterMark(): number {\n if (!IsCountQueuingStrategy(this)) {\n throw countBrandCheckException('highWaterMark');\n }\n return this._countQueuingStrategyHighWaterMark;\n }\n\n /**\n * Measures the size of `chunk` by always returning 1.\n * This ensures that the total queue size is a count of the number of chunks in the queue.\n */\n get size(): (chunk: any) => 1 {\n if (!IsCountQueuingStrategy(this)) {\n throw countBrandCheckException('size');\n }\n return countSizeFunction;\n }\n}\n\nObject.defineProperties(CountQueuingStrategy.prototype, {\n highWaterMark: { enumerable: true },\n size: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(CountQueuingStrategy.prototype, Symbol.toStringTag, {\n value: 'CountQueuingStrategy',\n configurable: true\n });\n}\n\n// Helper functions for the CountQueuingStrategy.\n\nfunction countBrandCheckException(name: string): TypeError {\n return new TypeError(`CountQueuingStrategy.prototype.${name} can only be used on a CountQueuingStrategy`);\n}\n\nexport function IsCountQueuingStrategy(x: any): x is CountQueuingStrategy {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_countQueuingStrategyHighWaterMark')) {\n return false;\n }\n\n return x instanceof CountQueuingStrategy;\n}\n","import { assertDictionary, assertFunction } from './basic';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\nimport type {\n Transformer,\n TransformerCancelCallback,\n TransformerFlushCallback,\n TransformerStartCallback,\n TransformerTransformCallback,\n ValidatedTransformer\n} from '../transform-stream/transformer';\nimport { TransformStreamDefaultController } from '../transform-stream';\n\nexport function convertTransformer(original: Transformer | null,\n context: string): ValidatedTransformer {\n assertDictionary(original, context);\n const cancel = original?.cancel;\n const flush = original?.flush;\n const readableType = original?.readableType;\n const start = original?.start;\n const transform = original?.transform;\n const writableType = original?.writableType;\n return {\n cancel: cancel === undefined ?\n undefined :\n convertTransformerCancelCallback(cancel, original!, `${context} has member 'cancel' that`),\n flush: flush === undefined ?\n undefined :\n convertTransformerFlushCallback(flush, original!, `${context} has member 'flush' that`),\n readableType,\n start: start === undefined ?\n undefined :\n convertTransformerStartCallback(start, original!, `${context} has member 'start' that`),\n transform: transform === undefined ?\n undefined :\n convertTransformerTransformCallback(transform, original!, `${context} has member 'transform' that`),\n writableType\n };\n}\n\nfunction convertTransformerFlushCallback(\n fn: TransformerFlushCallback,\n original: Transformer,\n context: string\n): (controller: TransformStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (controller: TransformStreamDefaultController) => promiseCall(fn, original, [controller]);\n}\n\nfunction convertTransformerStartCallback(\n fn: TransformerStartCallback,\n original: Transformer,\n context: string\n): TransformerStartCallback {\n assertFunction(fn, context);\n return (controller: TransformStreamDefaultController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertTransformerTransformCallback(\n fn: TransformerTransformCallback,\n original: Transformer,\n context: string\n): (chunk: I, controller: TransformStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (chunk: I, controller: TransformStreamDefaultController) => promiseCall(fn, original, [chunk, controller]);\n}\n\nfunction convertTransformerCancelCallback(\n fn: TransformerCancelCallback,\n original: Transformer,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n","import assert from '../stub/assert';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n transformPromiseWith,\n uponPromise\n} from './helpers/webidl';\nimport { CreateReadableStream, type DefaultReadableStream, ReadableStream } from './readable-stream';\nimport {\n ReadableStreamDefaultControllerCanCloseOrEnqueue,\n ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError,\n ReadableStreamDefaultControllerGetDesiredSize,\n ReadableStreamDefaultControllerHasBackpressure\n} from './readable-stream/default-controller';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { CreateWritableStream, WritableStream, WritableStreamDefaultControllerErrorIfNeeded } from './writable-stream';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport type {\n Transformer,\n TransformerCancelCallback,\n TransformerFlushCallback,\n TransformerStartCallback,\n TransformerTransformCallback,\n ValidatedTransformer\n} from './transform-stream/transformer';\nimport { convertTransformer } from './validators/transformer';\n\n// Class TransformStream\n\n/**\n * A transform stream consists of a pair of streams: a {@link WritableStream | writable stream},\n * known as its writable side, and a {@link ReadableStream | readable stream}, known as its readable side.\n * In a manner specific to the transform stream in question, writes to the writable side result in new data being\n * made available for reading from the readable side.\n *\n * @public\n */\nexport class TransformStream {\n /** @internal */\n _writable!: WritableStream;\n /** @internal */\n _readable!: DefaultReadableStream;\n /** @internal */\n _backpressure!: boolean;\n /** @internal */\n _backpressureChangePromise!: Promise;\n /** @internal */\n _backpressureChangePromise_resolve!: () => void;\n /** @internal */\n _transformStreamController!: TransformStreamDefaultController;\n\n constructor(\n transformer?: Transformer,\n writableStrategy?: QueuingStrategy,\n readableStrategy?: QueuingStrategy\n );\n constructor(rawTransformer: Transformer | null | undefined = {},\n rawWritableStrategy: QueuingStrategy | null | undefined = {},\n rawReadableStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawTransformer === undefined) {\n rawTransformer = null;\n }\n\n const writableStrategy = convertQueuingStrategy(rawWritableStrategy, 'Second parameter');\n const readableStrategy = convertQueuingStrategy(rawReadableStrategy, 'Third parameter');\n\n const transformer = convertTransformer(rawTransformer, 'First parameter');\n if (transformer.readableType !== undefined) {\n throw new RangeError('Invalid readableType specified');\n }\n if (transformer.writableType !== undefined) {\n throw new RangeError('Invalid writableType specified');\n }\n\n const readableHighWaterMark = ExtractHighWaterMark(readableStrategy, 0);\n const readableSizeAlgorithm = ExtractSizeAlgorithm(readableStrategy);\n const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);\n const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);\n\n let startPromise_resolve!: (value: void | PromiseLike) => void;\n const startPromise = newPromise(resolve => {\n startPromise_resolve = resolve;\n });\n\n InitializeTransformStream(\n this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm\n );\n SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);\n\n if (transformer.start !== undefined) {\n startPromise_resolve(transformer.start(this._transformStreamController));\n } else {\n startPromise_resolve(undefined);\n }\n }\n\n /**\n * The readable side of the transform stream.\n */\n get readable(): ReadableStream {\n if (!IsTransformStream(this)) {\n throw streamBrandCheckException('readable');\n }\n\n return this._readable;\n }\n\n /**\n * The writable side of the transform stream.\n */\n get writable(): WritableStream {\n if (!IsTransformStream(this)) {\n throw streamBrandCheckException('writable');\n }\n\n return this._writable;\n }\n}\n\nObject.defineProperties(TransformStream.prototype, {\n readable: { enumerable: true },\n writable: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(TransformStream.prototype, Symbol.toStringTag, {\n value: 'TransformStream',\n configurable: true\n });\n}\n\nexport type {\n Transformer,\n TransformerCancelCallback,\n TransformerStartCallback,\n TransformerFlushCallback,\n TransformerTransformCallback\n};\n\n// Transform Stream Abstract Operations\n\nexport function CreateTransformStream(startAlgorithm: () => void | PromiseLike,\n transformAlgorithm: (chunk: I) => Promise,\n flushAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n writableHighWaterMark = 1,\n writableSizeAlgorithm: QueuingStrategySizeCallback = () => 1,\n readableHighWaterMark = 0,\n readableSizeAlgorithm: QueuingStrategySizeCallback = () => 1) {\n assert(IsNonNegativeNumber(writableHighWaterMark));\n assert(IsNonNegativeNumber(readableHighWaterMark));\n\n const stream: TransformStream = Object.create(TransformStream.prototype);\n\n let startPromise_resolve!: (value: void | PromiseLike) => void;\n const startPromise = newPromise(resolve => {\n startPromise_resolve = resolve;\n });\n\n InitializeTransformStream(stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark,\n readableSizeAlgorithm);\n\n const controller: TransformStreamDefaultController = Object.create(TransformStreamDefaultController.prototype);\n\n SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);\n\n const startResult = startAlgorithm();\n startPromise_resolve(startResult);\n return stream;\n}\n\nfunction InitializeTransformStream(stream: TransformStream,\n startPromise: Promise,\n writableHighWaterMark: number,\n writableSizeAlgorithm: QueuingStrategySizeCallback,\n readableHighWaterMark: number,\n readableSizeAlgorithm: QueuingStrategySizeCallback) {\n function startAlgorithm(): Promise {\n return startPromise;\n }\n\n function writeAlgorithm(chunk: I): Promise {\n return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk);\n }\n\n function abortAlgorithm(reason: any): Promise {\n return TransformStreamDefaultSinkAbortAlgorithm(stream, reason);\n }\n\n function closeAlgorithm(): Promise {\n return TransformStreamDefaultSinkCloseAlgorithm(stream);\n }\n\n stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm,\n writableHighWaterMark, writableSizeAlgorithm);\n\n function pullAlgorithm(): Promise {\n return TransformStreamDefaultSourcePullAlgorithm(stream);\n }\n\n function cancelAlgorithm(reason: any): Promise {\n return TransformStreamDefaultSourceCancelAlgorithm(stream, reason);\n }\n\n stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark,\n readableSizeAlgorithm);\n\n // The [[backpressure]] slot is set to undefined so that it can be initialised by TransformStreamSetBackpressure.\n stream._backpressure = undefined!;\n stream._backpressureChangePromise = undefined!;\n stream._backpressureChangePromise_resolve = undefined!;\n TransformStreamSetBackpressure(stream, true);\n\n stream._transformStreamController = undefined!;\n}\n\nfunction IsTransformStream(x: unknown): x is TransformStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {\n return false;\n }\n\n return x instanceof TransformStream;\n}\n\n// This is a no-op if both sides are already errored.\nfunction TransformStreamError(stream: TransformStream, e: any) {\n ReadableStreamDefaultControllerError(stream._readable._readableStreamController, e);\n TransformStreamErrorWritableAndUnblockWrite(stream, e);\n}\n\nfunction TransformStreamErrorWritableAndUnblockWrite(stream: TransformStream, e: any) {\n TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);\n WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e);\n TransformStreamUnblockWrite(stream);\n}\n\nfunction TransformStreamUnblockWrite(stream: TransformStream) {\n if (stream._backpressure) {\n // Pretend that pull() was called to permit any pending write() calls to complete. TransformStreamSetBackpressure()\n // cannot be called from enqueue() or pull() once the ReadableStream is errored, so this will will be the final time\n // _backpressure is set.\n TransformStreamSetBackpressure(stream, false);\n }\n}\n\nfunction TransformStreamSetBackpressure(stream: TransformStream, backpressure: boolean) {\n // Passes also when called during construction.\n assert(stream._backpressure !== backpressure);\n\n if (stream._backpressureChangePromise !== undefined) {\n stream._backpressureChangePromise_resolve();\n }\n\n stream._backpressureChangePromise = newPromise(resolve => {\n stream._backpressureChangePromise_resolve = resolve;\n });\n\n stream._backpressure = backpressure;\n}\n\n// Class TransformStreamDefaultController\n\n/**\n * Allows control of the {@link ReadableStream} and {@link WritableStream} of the associated {@link TransformStream}.\n *\n * @public\n */\nexport class TransformStreamDefaultController {\n /** @internal */\n _controlledTransformStream: TransformStream;\n /** @internal */\n _finishPromise: Promise | undefined;\n /** @internal */\n _finishPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _finishPromise_reject?: (reason: any) => void;\n /** @internal */\n _transformAlgorithm: (chunk: any) => Promise;\n /** @internal */\n _flushAlgorithm: () => Promise;\n /** @internal */\n _cancelAlgorithm: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the desired size to fill the readable side’s internal queue. It can be negative, if the queue is over-full.\n */\n get desiredSize(): number | null {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n const readableController = this._controlledTransformStream._readable._readableStreamController;\n return ReadableStreamDefaultControllerGetDesiredSize(readableController);\n }\n\n /**\n * Enqueues the given chunk `chunk` in the readable side of the controlled transform stream.\n */\n enqueue(chunk: O): void;\n enqueue(chunk: O = undefined!): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n TransformStreamDefaultControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors both the readable side and the writable side of the controlled transform stream, making all future\n * interactions with it fail with the given error `e`. Any chunks queued for transformation will be discarded.\n */\n error(reason: any = undefined): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n\n TransformStreamDefaultControllerError(this, reason);\n }\n\n /**\n * Closes the readable side and errors the writable side of the controlled transform stream. This is useful when the\n * transformer only needs to consume a portion of the chunks written to the writable side.\n */\n terminate(): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('terminate');\n }\n\n TransformStreamDefaultControllerTerminate(this);\n }\n}\n\nObject.defineProperties(TransformStreamDefaultController.prototype, {\n enqueue: { enumerable: true },\n error: { enumerable: true },\n terminate: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(TransformStreamDefaultController.prototype.enqueue, 'enqueue');\nsetFunctionName(TransformStreamDefaultController.prototype.error, 'error');\nsetFunctionName(TransformStreamDefaultController.prototype.terminate, 'terminate');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(TransformStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'TransformStreamDefaultController',\n configurable: true\n });\n}\n\n// Transform Stream Default Controller Abstract Operations\n\nfunction IsTransformStreamDefaultController(x: any): x is TransformStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {\n return false;\n }\n\n return x instanceof TransformStreamDefaultController;\n}\n\nfunction SetUpTransformStreamDefaultController(stream: TransformStream,\n controller: TransformStreamDefaultController,\n transformAlgorithm: (chunk: I) => Promise,\n flushAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise) {\n assert(IsTransformStream(stream));\n assert(stream._transformStreamController === undefined);\n\n controller._controlledTransformStream = stream;\n stream._transformStreamController = controller;\n\n controller._transformAlgorithm = transformAlgorithm;\n controller._flushAlgorithm = flushAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n controller._finishPromise = undefined;\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\nfunction SetUpTransformStreamDefaultControllerFromTransformer(stream: TransformStream,\n transformer: ValidatedTransformer) {\n const controller: TransformStreamDefaultController = Object.create(TransformStreamDefaultController.prototype);\n\n let transformAlgorithm: (chunk: I) => Promise;\n let flushAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (transformer.transform !== undefined) {\n transformAlgorithm = chunk => transformer.transform!(chunk, controller);\n } else {\n transformAlgorithm = chunk => {\n try {\n TransformStreamDefaultControllerEnqueue(controller, chunk as unknown as O);\n return promiseResolvedWith(undefined);\n } catch (transformResultE) {\n return promiseRejectedWith(transformResultE);\n }\n };\n }\n\n if (transformer.flush !== undefined) {\n flushAlgorithm = () => transformer.flush!(controller);\n } else {\n flushAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n if (transformer.cancel !== undefined) {\n cancelAlgorithm = reason => transformer.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);\n}\n\nfunction TransformStreamDefaultControllerClearAlgorithms(controller: TransformStreamDefaultController) {\n controller._transformAlgorithm = undefined!;\n controller._flushAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n}\n\nfunction TransformStreamDefaultControllerEnqueue(controller: TransformStreamDefaultController, chunk: O) {\n const stream = controller._controlledTransformStream;\n const readableController = stream._readable._readableStreamController;\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController)) {\n throw new TypeError('Readable side is not in a state that permits enqueue');\n }\n\n // We throttle transform invocations based on the backpressure of the ReadableStream, but we still\n // accept TransformStreamDefaultControllerEnqueue() calls.\n\n try {\n ReadableStreamDefaultControllerEnqueue(readableController, chunk);\n } catch (e) {\n // This happens when readableStrategy.size() throws.\n TransformStreamErrorWritableAndUnblockWrite(stream, e);\n\n throw stream._readable._storedError;\n }\n\n const backpressure = ReadableStreamDefaultControllerHasBackpressure(readableController);\n if (backpressure !== stream._backpressure) {\n assert(backpressure);\n TransformStreamSetBackpressure(stream, true);\n }\n}\n\nfunction TransformStreamDefaultControllerError(controller: TransformStreamDefaultController, e: any) {\n TransformStreamError(controller._controlledTransformStream, e);\n}\n\nfunction TransformStreamDefaultControllerPerformTransform(controller: TransformStreamDefaultController,\n chunk: I) {\n const transformPromise = controller._transformAlgorithm(chunk);\n return transformPromiseWith(transformPromise, undefined, r => {\n TransformStreamError(controller._controlledTransformStream, r);\n throw r;\n });\n}\n\nfunction TransformStreamDefaultControllerTerminate(controller: TransformStreamDefaultController) {\n const stream = controller._controlledTransformStream;\n const readableController = stream._readable._readableStreamController;\n\n ReadableStreamDefaultControllerClose(readableController);\n\n const error = new TypeError('TransformStream terminated');\n TransformStreamErrorWritableAndUnblockWrite(stream, error);\n}\n\n// TransformStreamDefaultSink Algorithms\n\nfunction TransformStreamDefaultSinkWriteAlgorithm(stream: TransformStream, chunk: I): Promise {\n assert(stream._writable._state === 'writable');\n\n const controller = stream._transformStreamController;\n\n if (stream._backpressure) {\n const backpressureChangePromise = stream._backpressureChangePromise;\n assert(backpressureChangePromise !== undefined);\n return transformPromiseWith(backpressureChangePromise, () => {\n const writable = stream._writable;\n const state = writable._state;\n if (state === 'erroring') {\n throw writable._storedError;\n }\n assert(state === 'writable');\n return TransformStreamDefaultControllerPerformTransform(controller, chunk);\n });\n }\n\n return TransformStreamDefaultControllerPerformTransform(controller, chunk);\n}\n\nfunction TransformStreamDefaultSinkAbortAlgorithm(stream: TransformStream, reason: any): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._readable cannot change after construction, so caching it across a call to user code is safe.\n const readable = stream._readable;\n\n // Assign the _finishPromise now so that if _cancelAlgorithm calls readable.cancel() internally,\n // we don't run the _cancelAlgorithm again.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const cancelPromise = controller._cancelAlgorithm(reason);\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(cancelPromise, () => {\n if (readable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, readable._storedError);\n } else {\n ReadableStreamDefaultControllerError(readable._readableStreamController, reason);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n ReadableStreamDefaultControllerError(readable._readableStreamController, r);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\nfunction TransformStreamDefaultSinkCloseAlgorithm(stream: TransformStream): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._readable cannot change after construction, so caching it across a call to user code is safe.\n const readable = stream._readable;\n\n // Assign the _finishPromise now so that if _flushAlgorithm calls readable.cancel() internally,\n // we don't also run the _cancelAlgorithm.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const flushPromise = controller._flushAlgorithm();\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(flushPromise, () => {\n if (readable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, readable._storedError);\n } else {\n ReadableStreamDefaultControllerClose(readable._readableStreamController);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n ReadableStreamDefaultControllerError(readable._readableStreamController, r);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\n// TransformStreamDefaultSource Algorithms\n\nfunction TransformStreamDefaultSourcePullAlgorithm(stream: TransformStream): Promise {\n // Invariant. Enforced by the promises returned by start() and pull().\n assert(stream._backpressure);\n\n assert(stream._backpressureChangePromise !== undefined);\n\n TransformStreamSetBackpressure(stream, false);\n\n // Prevent the next pull() call until there is backpressure.\n return stream._backpressureChangePromise;\n}\n\nfunction TransformStreamDefaultSourceCancelAlgorithm(stream: TransformStream, reason: any): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._writable cannot change after construction, so caching it across a call to user code is safe.\n const writable = stream._writable;\n\n // Assign the _finishPromise now so that if _flushAlgorithm calls writable.abort() or\n // writable.cancel() internally, we don't run the _cancelAlgorithm again, or also run the\n // _flushAlgorithm.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const cancelPromise = controller._cancelAlgorithm(reason);\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(cancelPromise, () => {\n if (writable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, writable._storedError);\n } else {\n WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, reason);\n TransformStreamUnblockWrite(stream);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, r);\n TransformStreamUnblockWrite(stream);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\n// Helper functions for the TransformStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`);\n}\n\nexport function defaultControllerFinishPromiseResolve(controller: TransformStreamDefaultController) {\n if (controller._finishPromise_resolve === undefined) {\n return;\n }\n\n controller._finishPromise_resolve();\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\nexport function defaultControllerFinishPromiseReject(controller: TransformStreamDefaultController, reason: any) {\n if (controller._finishPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(controller._finishPromise!);\n controller._finishPromise_reject(reason);\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\n// Helper functions for the TransformStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(\n `TransformStream.prototype.${name} can only be used on a TransformStream`);\n}\n","/* c8 ignore start */\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\nif (!globalThis.ReadableStream) {\n // `node:stream/web` got introduced in v16.5.0 as experimental\n // and it's preferred over the polyfilled version. So we also\n // suppress the warning that gets emitted by NodeJS for using it.\n try {\n const process = require('node:process')\n const { emitWarning } = process\n try {\n process.emitWarning = () => {}\n Object.assign(globalThis, require('node:stream/web'))\n process.emitWarning = emitWarning\n } catch (error) {\n process.emitWarning = emitWarning\n throw error\n }\n } catch (error) {\n // fallback to polyfill implementation\n Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js'))\n }\n}\n\ntry {\n // Don't use node: prefix for this, require+node: is not supported until node v14.14\n // Only `import()` can use prefix in 12.20 and later\n const { Blob } = require('buffer')\n if (Blob && !Blob.prototype.stream) {\n Blob.prototype.stream = function name (params) {\n let position = 0\n const blob = this\n\n return new ReadableStream({\n type: 'bytes',\n async pull (ctrl) {\n const chunk = blob.slice(position, Math.min(blob.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n ctrl.enqueue(new Uint8Array(buffer))\n\n if (position === blob.size) {\n ctrl.close()\n }\n }\n })\n }\n }\n} catch (error) {}\n/* c8 ignore end */\n","/*! fetch-blob. MIT License. Jimmy Wärting */\n\n// TODO (jimmywarting): in the feature use conditional loading with top level await (requires 14.x)\n// Node has recently added whatwg stream into core\n\nimport './streams.cjs'\n\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\n/** @param {(Blob | Uint8Array)[]} parts */\nasync function * toIterator (parts, clone = true) {\n for (const part of parts) {\n if ('stream' in part) {\n yield * (/** @type {AsyncIterableIterator} */ (part.stream()))\n } else if (ArrayBuffer.isView(part)) {\n if (clone) {\n let position = part.byteOffset\n const end = part.byteOffset + part.byteLength\n while (position !== end) {\n const size = Math.min(end - position, POOL_SIZE)\n const chunk = part.buffer.slice(position, position + size)\n position += chunk.byteLength\n yield new Uint8Array(chunk)\n }\n } else {\n yield part\n }\n /* c8 ignore next 10 */\n } else {\n // For blobs that have arrayBuffer but no stream method (nodes buffer.Blob)\n let position = 0, b = (/** @type {Blob} */ (part))\n while (position !== b.size) {\n const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n yield new Uint8Array(buffer)\n }\n }\n }\n}\n\nconst _Blob = class Blob {\n /** @type {Array.<(Blob|Uint8Array)>} */\n #parts = []\n #type = ''\n #size = 0\n #endings = 'transparent'\n\n /**\n * The Blob() constructor returns a new Blob object. The content\n * of the blob consists of the concatenation of the values given\n * in the parameter array.\n *\n * @param {*} blobParts\n * @param {{ type?: string, endings?: string }} [options]\n */\n constructor (blobParts = [], options = {}) {\n if (typeof blobParts !== 'object' || blobParts === null) {\n throw new TypeError('Failed to construct \\'Blob\\': The provided value cannot be converted to a sequence.')\n }\n\n if (typeof blobParts[Symbol.iterator] !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': The object must have a callable @@iterator property.')\n }\n\n if (typeof options !== 'object' && typeof options !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': parameter 2 cannot convert to dictionary.')\n }\n\n if (options === null) options = {}\n\n const encoder = new TextEncoder()\n for (const element of blobParts) {\n let part\n if (ArrayBuffer.isView(element)) {\n part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength))\n } else if (element instanceof ArrayBuffer) {\n part = new Uint8Array(element.slice(0))\n } else if (element instanceof Blob) {\n part = element\n } else {\n part = encoder.encode(`${element}`)\n }\n\n this.#size += ArrayBuffer.isView(part) ? part.byteLength : part.size\n this.#parts.push(part)\n }\n\n this.#endings = `${options.endings === undefined ? 'transparent' : options.endings}`\n const type = options.type === undefined ? '' : String(options.type)\n this.#type = /^[\\x20-\\x7E]*$/.test(type) ? type : ''\n }\n\n /**\n * The Blob interface's size property returns the\n * size of the Blob in bytes.\n */\n get size () {\n return this.#size\n }\n\n /**\n * The type property of a Blob object returns the MIME type of the file.\n */\n get type () {\n return this.#type\n }\n\n /**\n * The text() method in the Blob interface returns a Promise\n * that resolves with a string containing the contents of\n * the blob, interpreted as UTF-8.\n *\n * @return {Promise}\n */\n async text () {\n // More optimized than using this.arrayBuffer()\n // that requires twice as much ram\n const decoder = new TextDecoder()\n let str = ''\n for await (const part of toIterator(this.#parts, false)) {\n str += decoder.decode(part, { stream: true })\n }\n // Remaining\n str += decoder.decode()\n return str\n }\n\n /**\n * The arrayBuffer() method in the Blob interface returns a\n * Promise that resolves with the contents of the blob as\n * binary data contained in an ArrayBuffer.\n *\n * @return {Promise}\n */\n async arrayBuffer () {\n // Easier way... Just a unnecessary overhead\n // const view = new Uint8Array(this.size);\n // await this.stream().getReader({mode: 'byob'}).read(view);\n // return view.buffer;\n\n const data = new Uint8Array(this.size)\n let offset = 0\n for await (const chunk of toIterator(this.#parts, false)) {\n data.set(chunk, offset)\n offset += chunk.length\n }\n\n return data.buffer\n }\n\n stream () {\n const it = toIterator(this.#parts, true)\n\n return new globalThis.ReadableStream({\n // @ts-ignore\n type: 'bytes',\n async pull (ctrl) {\n const chunk = await it.next()\n chunk.done ? ctrl.close() : ctrl.enqueue(chunk.value)\n },\n\n async cancel () {\n await it.return()\n }\n })\n }\n\n /**\n * The Blob interface's slice() method creates and returns a\n * new Blob object which contains data from a subset of the\n * blob on which it's called.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @param {string} [type]\n */\n slice (start = 0, end = this.size, type = '') {\n const { size } = this\n\n let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size)\n let relativeEnd = end < 0 ? Math.max(size + end, 0) : Math.min(end, size)\n\n const span = Math.max(relativeEnd - relativeStart, 0)\n const parts = this.#parts\n const blobParts = []\n let added = 0\n\n for (const part of parts) {\n // don't add the overflow to new blobParts\n if (added >= span) {\n break\n }\n\n const size = ArrayBuffer.isView(part) ? part.byteLength : part.size\n if (relativeStart && size <= relativeStart) {\n // Skip the beginning and change the relative\n // start & end position as we skip the unwanted parts\n relativeStart -= size\n relativeEnd -= size\n } else {\n let chunk\n if (ArrayBuffer.isView(part)) {\n chunk = part.subarray(relativeStart, Math.min(size, relativeEnd))\n added += chunk.byteLength\n } else {\n chunk = part.slice(relativeStart, Math.min(size, relativeEnd))\n added += chunk.size\n }\n relativeEnd -= size\n blobParts.push(chunk)\n relativeStart = 0 // All next sequential parts should start at 0\n }\n }\n\n const blob = new Blob([], { type: String(type).toLowerCase() })\n blob.#size = span\n blob.#parts = blobParts\n\n return blob\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n\n static [Symbol.hasInstance] (object) {\n return (\n object &&\n typeof object === 'object' &&\n typeof object.constructor === 'function' &&\n (\n typeof object.stream === 'function' ||\n typeof object.arrayBuffer === 'function'\n ) &&\n /^(Blob|File)$/.test(object[Symbol.toStringTag])\n )\n }\n}\n\nObject.defineProperties(_Blob.prototype, {\n size: { enumerable: true },\n type: { enumerable: true },\n slice: { enumerable: true }\n})\n\n/** @type {typeof globalThis.Blob} */\nexport const Blob = _Blob\nexport default Blob\n","import Blob from './index.js'\n\nconst _File = class File extends Blob {\n #lastModified = 0\n #name = ''\n\n /**\n * @param {*[]} fileBits\n * @param {string} fileName\n * @param {{lastModified?: number, type?: string}} options\n */// @ts-ignore\n constructor (fileBits, fileName, options = {}) {\n if (arguments.length < 2) {\n throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)\n }\n super(fileBits, options)\n\n if (options === null) options = {}\n\n // Simulate WebIDL type casting for NaN value in lastModified option.\n const lastModified = options.lastModified === undefined ? Date.now() : Number(options.lastModified)\n if (!Number.isNaN(lastModified)) {\n this.#lastModified = lastModified\n }\n\n this.#name = String(fileName)\n }\n\n get name () {\n return this.#name\n }\n\n get lastModified () {\n return this.#lastModified\n }\n\n get [Symbol.toStringTag] () {\n return 'File'\n }\n\n static [Symbol.hasInstance] (object) {\n return !!object && object instanceof Blob &&\n /^(File)$/.test(object[Symbol.toStringTag])\n }\n}\n\n/** @type {typeof globalThis.File} */// @ts-ignore\nexport const File = _File\nexport default File\n","/*! formdata-polyfill. MIT License. Jimmy Wärting */\n\nimport C from 'fetch-blob'\nimport F from 'fetch-blob/file.js'\n\nvar {toStringTag:t,iterator:i,hasInstance:h}=Symbol,\nr=Math.random,\nm='append,set,get,getAll,delete,keys,values,entries,forEach,constructor'.split(','),\nf=(a,b,c)=>(a+='',/^(Blob|File)$/.test(b && b[t])?[(c=c!==void 0?c+'':b[t]=='File'?b.name:'blob',a),b.name!==c||b[t]=='blob'?new F([b],c,b):b]:[a,b+'']),\ne=(c,f)=>(f?c:c.replace(/\\r?\\n|\\r/g,'\\r\\n')).replace(/\\n/g,'%0A').replace(/\\r/g,'%0D').replace(/\"/g,'%22'),\nx=(n, a, e)=>{if(a.lengthtypeof o[m]!='function')}\nappend(...a){x('append',arguments,2);this.#d.push(f(...a))}\ndelete(a){x('delete',arguments,1);a+='';this.#d=this.#d.filter(([b])=>b!==a)}\nget(a){x('get',arguments,1);a+='';for(var b=this.#d,l=b.length,c=0;cc[0]===a&&b.push(c[1]));return b}\nhas(a){x('has',arguments,1);a+='';return this.#d.some(b=>b[0]===a)}\nforEach(a,b){x('forEach',arguments,1);for(var [c,d]of this)a.call(b,d,c,this)}\nset(...a){x('set',arguments,2);var b=[],c=!0;a=f(...a);this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)});c&&b.push(a);this.#d=b}\n*entries(){yield*this.#d}\n*keys(){for(var[a]of this)yield a}\n*values(){for(var[,a]of this)yield a}}\n\n/** @param {FormData} F */\nexport function formDataToBlob (F,B=C){\nvar b=`${r()}${r()}`.replace(/\\./g, '').slice(-28).padStart(32, '-'),c=[],p=`--${b}\\r\\nContent-Disposition: form-data; name=\"`\nF.forEach((v,n)=>typeof v=='string'\n?c.push(p+e(n)+`\"\\r\\n\\r\\n${v.replace(/\\r(?!\\n)|(? {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.append === 'function' &&\n\t\ttypeof object.delete === 'function' &&\n\t\ttypeof object.get === 'function' &&\n\t\ttypeof object.getAll === 'function' &&\n\t\ttypeof object.has === 'function' &&\n\t\ttypeof object.set === 'function' &&\n\t\ttypeof object.sort === 'function' &&\n\t\tobject[NAME] === 'URLSearchParams'\n\t);\n};\n\n/**\n * Check if `object` is a W3C `Blob` object (which `File` inherits from)\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isBlob = object => {\n\treturn (\n\t\tobject &&\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.arrayBuffer === 'function' &&\n\t\ttypeof object.type === 'string' &&\n\t\ttypeof object.stream === 'function' &&\n\t\ttypeof object.constructor === 'function' &&\n\t\t/^(Blob|File)$/.test(object[NAME])\n\t);\n};\n\n/**\n * Check if `obj` is an instance of AbortSignal.\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isAbortSignal = object => {\n\treturn (\n\t\ttypeof object === 'object' && (\n\t\t\tobject[NAME] === 'AbortSignal' ||\n\t\t\tobject[NAME] === 'EventTarget'\n\t\t)\n\t);\n};\n\n/**\n * isDomainOrSubdomain reports whether sub is a subdomain (or exact match) of\n * the parent domain.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isDomainOrSubdomain = (destination, original) => {\n\tconst orig = new URL(original).hostname;\n\tconst dest = new URL(destination).hostname;\n\n\treturn orig === dest || orig.endsWith(`.${dest}`);\n};\n\n/**\n * isSameProtocol reports whether the two provided URLs use the same protocol.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isSameProtocol = (destination, original) => {\n\tconst orig = new URL(original).protocol;\n\tconst dest = new URL(destination).protocol;\n\n\treturn orig === dest;\n};\n","/*! node-domexception. MIT License. Jimmy Wärting */\n\nif (!globalThis.DOMException) {\n try {\n const { MessageChannel } = require('worker_threads'),\n port = new MessageChannel().port1,\n ab = new ArrayBuffer()\n port.postMessage(ab, [ab, ab])\n } catch (err) {\n err.constructor.name === 'DOMException' && (\n globalThis.DOMException = err.constructor\n )\n }\n}\n\nmodule.exports = globalThis.DOMException\n","import { statSync, createReadStream, promises as fs } from 'node:fs'\nimport { basename } from 'node:path'\nimport DOMException from 'node-domexception'\n\nimport File from './file.js'\nimport Blob from './index.js'\n\nconst { stat } = fs\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n */\nconst blobFromSync = (path, type) => fromBlob(statSync(path), path, type)\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n * @returns {Promise}\n */\nconst blobFrom = (path, type) => stat(path).then(stat => fromBlob(stat, path, type))\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n * @returns {Promise}\n */\nconst fileFrom = (path, type) => stat(path).then(stat => fromFile(stat, path, type))\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n */\nconst fileFromSync = (path, type) => fromFile(statSync(path), path, type)\n\n// @ts-ignore\nconst fromBlob = (stat, path, type = '') => new Blob([new BlobDataItem({\n path,\n size: stat.size,\n lastModified: stat.mtimeMs,\n start: 0\n})], { type })\n\n// @ts-ignore\nconst fromFile = (stat, path, type = '') => new File([new BlobDataItem({\n path,\n size: stat.size,\n lastModified: stat.mtimeMs,\n start: 0\n})], basename(path), { type, lastModified: stat.mtimeMs })\n\n/**\n * This is a blob backed up by a file on the disk\n * with minium requirement. Its wrapped around a Blob as a blobPart\n * so you have no direct access to this.\n *\n * @private\n */\nclass BlobDataItem {\n #path\n #start\n\n constructor (options) {\n this.#path = options.path\n this.#start = options.start\n this.size = options.size\n this.lastModified = options.lastModified\n }\n\n /**\n * Slicing arguments is first validated and formatted\n * to not be out of range by Blob.prototype.slice\n */\n slice (start, end) {\n return new BlobDataItem({\n path: this.#path,\n lastModified: this.lastModified,\n size: end - start,\n start: this.#start + start\n })\n }\n\n async * stream () {\n const { mtimeMs } = await stat(this.#path)\n if (mtimeMs > this.lastModified) {\n throw new DOMException('The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.', 'NotReadableError')\n }\n yield * createReadStream(this.#path, {\n start: this.#start,\n end: this.#start + this.size - 1\n })\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n}\n\nexport default blobFromSync\nexport { File, Blob, blobFrom, blobFromSync, fileFrom, fileFromSync }\n","import {File} from 'fetch-blob/from.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\n\nlet s = 0;\nconst S = {\n\tSTART_BOUNDARY: s++,\n\tHEADER_FIELD_START: s++,\n\tHEADER_FIELD: s++,\n\tHEADER_VALUE_START: s++,\n\tHEADER_VALUE: s++,\n\tHEADER_VALUE_ALMOST_DONE: s++,\n\tHEADERS_ALMOST_DONE: s++,\n\tPART_DATA_START: s++,\n\tPART_DATA: s++,\n\tEND: s++\n};\n\nlet f = 1;\nconst F = {\n\tPART_BOUNDARY: f,\n\tLAST_BOUNDARY: f *= 2\n};\n\nconst LF = 10;\nconst CR = 13;\nconst SPACE = 32;\nconst HYPHEN = 45;\nconst COLON = 58;\nconst A = 97;\nconst Z = 122;\n\nconst lower = c => c | 0x20;\n\nconst noop = () => {};\n\nclass MultipartParser {\n\t/**\n\t * @param {string} boundary\n\t */\n\tconstructor(boundary) {\n\t\tthis.index = 0;\n\t\tthis.flags = 0;\n\n\t\tthis.onHeaderEnd = noop;\n\t\tthis.onHeaderField = noop;\n\t\tthis.onHeadersEnd = noop;\n\t\tthis.onHeaderValue = noop;\n\t\tthis.onPartBegin = noop;\n\t\tthis.onPartData = noop;\n\t\tthis.onPartEnd = noop;\n\n\t\tthis.boundaryChars = {};\n\n\t\tboundary = '\\r\\n--' + boundary;\n\t\tconst ui8a = new Uint8Array(boundary.length);\n\t\tfor (let i = 0; i < boundary.length; i++) {\n\t\t\tui8a[i] = boundary.charCodeAt(i);\n\t\t\tthis.boundaryChars[ui8a[i]] = true;\n\t\t}\n\n\t\tthis.boundary = ui8a;\n\t\tthis.lookbehind = new Uint8Array(this.boundary.length + 8);\n\t\tthis.state = S.START_BOUNDARY;\n\t}\n\n\t/**\n\t * @param {Uint8Array} data\n\t */\n\twrite(data) {\n\t\tlet i = 0;\n\t\tconst length_ = data.length;\n\t\tlet previousIndex = this.index;\n\t\tlet {lookbehind, boundary, boundaryChars, index, state, flags} = this;\n\t\tconst boundaryLength = this.boundary.length;\n\t\tconst boundaryEnd = boundaryLength - 1;\n\t\tconst bufferLength = data.length;\n\t\tlet c;\n\t\tlet cl;\n\n\t\tconst mark = name => {\n\t\t\tthis[name + 'Mark'] = i;\n\t\t};\n\n\t\tconst clear = name => {\n\t\t\tdelete this[name + 'Mark'];\n\t\t};\n\n\t\tconst callback = (callbackSymbol, start, end, ui8a) => {\n\t\t\tif (start === undefined || start !== end) {\n\t\t\t\tthis[callbackSymbol](ui8a && ui8a.subarray(start, end));\n\t\t\t}\n\t\t};\n\n\t\tconst dataCallback = (name, clear) => {\n\t\t\tconst markSymbol = name + 'Mark';\n\t\t\tif (!(markSymbol in this)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (clear) {\n\t\t\t\tcallback(name, this[markSymbol], i, data);\n\t\t\t\tdelete this[markSymbol];\n\t\t\t} else {\n\t\t\t\tcallback(name, this[markSymbol], data.length, data);\n\t\t\t\tthis[markSymbol] = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (i = 0; i < length_; i++) {\n\t\t\tc = data[i];\n\n\t\t\tswitch (state) {\n\t\t\t\tcase S.START_BOUNDARY:\n\t\t\t\t\tif (index === boundary.length - 2) {\n\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else if (c !== CR) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if (index - 1 === boundary.length - 2) {\n\t\t\t\t\t\tif (flags & F.LAST_BOUNDARY && c === HYPHEN) {\n\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c !== boundary[index + 2]) {\n\t\t\t\t\t\tindex = -2;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === boundary[index + 2]) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_FIELD_START:\n\t\t\t\t\tstate = S.HEADER_FIELD;\n\t\t\t\t\tmark('onHeaderField');\n\t\t\t\t\tindex = 0;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_FIELD:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tclear('onHeaderField');\n\t\t\t\t\t\tstate = S.HEADERS_ALMOST_DONE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === COLON) {\n\t\t\t\t\t\tif (index === 1) {\n\t\t\t\t\t\t\t// empty header field\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdataCallback('onHeaderField', true);\n\t\t\t\t\t\tstate = S.HEADER_VALUE_START;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcl = lower(c);\n\t\t\t\t\tif (cl < A || cl > Z) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_START:\n\t\t\t\t\tif (c === SPACE) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tmark('onHeaderValue');\n\t\t\t\t\tstate = S.HEADER_VALUE;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_VALUE:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tdataCallback('onHeaderValue', true);\n\t\t\t\t\t\tcallback('onHeaderEnd');\n\t\t\t\t\t\tstate = S.HEADER_VALUE_ALMOST_DONE;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADERS_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tcallback('onHeadersEnd');\n\t\t\t\t\tstate = S.PART_DATA_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.PART_DATA_START:\n\t\t\t\t\tstate = S.PART_DATA;\n\t\t\t\t\tmark('onPartData');\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.PART_DATA:\n\t\t\t\t\tpreviousIndex = index;\n\n\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t// boyer-moore derrived algorithm to safely skip non-boundary data\n\t\t\t\t\t\ti += boundaryEnd;\n\t\t\t\t\t\twhile (i < bufferLength && !(data[i] in boundaryChars)) {\n\t\t\t\t\t\t\ti += boundaryLength;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ti -= boundaryEnd;\n\t\t\t\t\t\tc = data[i];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index < boundary.length) {\n\t\t\t\t\t\tif (boundary[index] === c) {\n\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\tdataCallback('onPartData', true);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === boundary.length) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\t\t// CR = part boundary\n\t\t\t\t\t\t\tflags |= F.PART_BOUNDARY;\n\t\t\t\t\t\t} else if (c === HYPHEN) {\n\t\t\t\t\t\t\t// HYPHEN = end boundary\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index - 1 === boundary.length) {\n\t\t\t\t\t\tif (flags & F.PART_BOUNDARY) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tif (c === LF) {\n\t\t\t\t\t\t\t\t// unset the PART_BOUNDARY flag\n\t\t\t\t\t\t\t\tflags &= ~F.PART_BOUNDARY;\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (flags & F.LAST_BOUNDARY) {\n\t\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index > 0) {\n\t\t\t\t\t\t// when matching a possible boundary, keep a lookbehind reference\n\t\t\t\t\t\t// in case it turns out to be a false lead\n\t\t\t\t\t\tlookbehind[index - 1] = c;\n\t\t\t\t\t} else if (previousIndex > 0) {\n\t\t\t\t\t\t// if our boundary turned out to be rubbish, the captured lookbehind\n\t\t\t\t\t\t// belongs to partData\n\t\t\t\t\t\tconst _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);\n\t\t\t\t\t\tcallback('onPartData', 0, previousIndex, _lookbehind);\n\t\t\t\t\t\tpreviousIndex = 0;\n\t\t\t\t\t\tmark('onPartData');\n\n\t\t\t\t\t\t// reconsider the current character even so it interrupted the sequence\n\t\t\t\t\t\t// it could be the beginning of a new sequence\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.END:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Unexpected state entered: ${state}`);\n\t\t\t}\n\t\t}\n\n\t\tdataCallback('onHeaderField');\n\t\tdataCallback('onHeaderValue');\n\t\tdataCallback('onPartData');\n\n\t\t// Update properties for the next call\n\t\tthis.index = index;\n\t\tthis.state = state;\n\t\tthis.flags = flags;\n\t}\n\n\tend() {\n\t\tif ((this.state === S.HEADER_FIELD_START && this.index === 0) ||\n\t\t\t(this.state === S.PART_DATA && this.index === this.boundary.length)) {\n\t\t\tthis.onPartEnd();\n\t\t} else if (this.state !== S.END) {\n\t\t\tthrow new Error('MultipartParser.end(): stream ended unexpectedly');\n\t\t}\n\t}\n}\n\nfunction _fileName(headerValue) {\n\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\tconst m = headerValue.match(/\\bfilename=(\"(.*?)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))($|;\\s)/i);\n\tif (!m) {\n\t\treturn;\n\t}\n\n\tconst match = m[2] || m[3] || '';\n\tlet filename = match.slice(match.lastIndexOf('\\\\') + 1);\n\tfilename = filename.replace(/%22/g, '\"');\n\tfilename = filename.replace(/&#(\\d{4});/g, (m, code) => {\n\t\treturn String.fromCharCode(code);\n\t});\n\treturn filename;\n}\n\nexport async function toFormData(Body, ct) {\n\tif (!/multipart/i.test(ct)) {\n\t\tthrow new TypeError('Failed to fetch');\n\t}\n\n\tconst m = ct.match(/boundary=(?:\"([^\"]+)\"|([^;]+))/i);\n\n\tif (!m) {\n\t\tthrow new TypeError('no or bad content-type header, no multipart boundary');\n\t}\n\n\tconst parser = new MultipartParser(m[1] || m[2]);\n\n\tlet headerField;\n\tlet headerValue;\n\tlet entryValue;\n\tlet entryName;\n\tlet contentType;\n\tlet filename;\n\tconst entryChunks = [];\n\tconst formData = new FormData();\n\n\tconst onPartData = ui8a => {\n\t\tentryValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tconst appendToFile = ui8a => {\n\t\tentryChunks.push(ui8a);\n\t};\n\n\tconst appendFileToFormData = () => {\n\t\tconst file = new File(entryChunks, filename, {type: contentType});\n\t\tformData.append(entryName, file);\n\t};\n\n\tconst appendEntryToFormData = () => {\n\t\tformData.append(entryName, entryValue);\n\t};\n\n\tconst decoder = new TextDecoder('utf-8');\n\tdecoder.decode();\n\n\tparser.onPartBegin = function () {\n\t\tparser.onPartData = onPartData;\n\t\tparser.onPartEnd = appendEntryToFormData;\n\n\t\theaderField = '';\n\t\theaderValue = '';\n\t\tentryValue = '';\n\t\tentryName = '';\n\t\tcontentType = '';\n\t\tfilename = null;\n\t\tentryChunks.length = 0;\n\t};\n\n\tparser.onHeaderField = function (ui8a) {\n\t\theaderField += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderValue = function (ui8a) {\n\t\theaderValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderEnd = function () {\n\t\theaderValue += decoder.decode();\n\t\theaderField = headerField.toLowerCase();\n\n\t\tif (headerField === 'content-disposition') {\n\t\t\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\t\t\tconst m = headerValue.match(/\\bname=(\"([^\"]*)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))/i);\n\n\t\t\tif (m) {\n\t\t\t\tentryName = m[2] || m[3] || '';\n\t\t\t}\n\n\t\t\tfilename = _fileName(headerValue);\n\n\t\t\tif (filename) {\n\t\t\t\tparser.onPartData = appendToFile;\n\t\t\t\tparser.onPartEnd = appendFileToFormData;\n\t\t\t}\n\t\t} else if (headerField === 'content-type') {\n\t\t\tcontentType = headerValue;\n\t\t}\n\n\t\theaderValue = '';\n\t\theaderField = '';\n\t};\n\n\tfor await (const chunk of Body) {\n\t\tparser.write(chunk);\n\t}\n\n\tparser.end();\n\n\treturn formData;\n}\n","\n/**\n * Body.js\n *\n * Body interface provides common methods for Request and Response\n */\n\nimport Stream, {PassThrough} from 'node:stream';\nimport {types, deprecate, promisify} from 'node:util';\nimport {Buffer} from 'node:buffer';\n\nimport Blob from 'fetch-blob';\nimport {FormData, formDataToBlob} from 'formdata-polyfill/esm.min.js';\n\nimport {FetchError} from './errors/fetch-error.js';\nimport {FetchBaseError} from './errors/base.js';\nimport {isBlob, isURLSearchParameters} from './utils/is.js';\n\nconst pipeline = promisify(Stream.pipeline);\nconst INTERNALS = Symbol('Body internals');\n\n/**\n * Body mixin\n *\n * Ref: https://fetch.spec.whatwg.org/#body\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Body {\n\tconstructor(body, {\n\t\tsize = 0\n\t} = {}) {\n\t\tlet boundary = null;\n\n\t\tif (body === null) {\n\t\t\t// Body is undefined or null\n\t\t\tbody = null;\n\t\t} else if (isURLSearchParameters(body)) {\n\t\t\t// Body is a URLSearchParams\n\t\t\tbody = Buffer.from(body.toString());\n\t\t} else if (isBlob(body)) {\n\t\t\t// Body is blob\n\t\t} else if (Buffer.isBuffer(body)) {\n\t\t\t// Body is Buffer\n\t\t} else if (types.isAnyArrayBuffer(body)) {\n\t\t\t// Body is ArrayBuffer\n\t\t\tbody = Buffer.from(body);\n\t\t} else if (ArrayBuffer.isView(body)) {\n\t\t\t// Body is ArrayBufferView\n\t\t\tbody = Buffer.from(body.buffer, body.byteOffset, body.byteLength);\n\t\t} else if (body instanceof Stream) {\n\t\t\t// Body is stream\n\t\t} else if (body instanceof FormData) {\n\t\t\t// Body is FormData\n\t\t\tbody = formDataToBlob(body);\n\t\t\tboundary = body.type.split('=')[1];\n\t\t} else {\n\t\t\t// None of the above\n\t\t\t// coerce to string then buffer\n\t\t\tbody = Buffer.from(String(body));\n\t\t}\n\n\t\tlet stream = body;\n\n\t\tif (Buffer.isBuffer(body)) {\n\t\t\tstream = Stream.Readable.from(body);\n\t\t} else if (isBlob(body)) {\n\t\t\tstream = Stream.Readable.from(body.stream());\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\tbody,\n\t\t\tstream,\n\t\t\tboundary,\n\t\t\tdisturbed: false,\n\t\t\terror: null\n\t\t};\n\t\tthis.size = size;\n\n\t\tif (body instanceof Stream) {\n\t\t\tbody.on('error', error_ => {\n\t\t\t\tconst error = error_ instanceof FetchBaseError ?\n\t\t\t\t\terror_ :\n\t\t\t\t\tnew FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, 'system', error_);\n\t\t\t\tthis[INTERNALS].error = error;\n\t\t\t});\n\t\t}\n\t}\n\n\tget body() {\n\t\treturn this[INTERNALS].stream;\n\t}\n\n\tget bodyUsed() {\n\t\treturn this[INTERNALS].disturbed;\n\t}\n\n\t/**\n\t * Decode response as ArrayBuffer\n\t *\n\t * @return Promise\n\t */\n\tasync arrayBuffer() {\n\t\tconst {buffer, byteOffset, byteLength} = await consumeBody(this);\n\t\treturn buffer.slice(byteOffset, byteOffset + byteLength);\n\t}\n\n\tasync formData() {\n\t\tconst ct = this.headers.get('content-type');\n\n\t\tif (ct.startsWith('application/x-www-form-urlencoded')) {\n\t\t\tconst formData = new FormData();\n\t\t\tconst parameters = new URLSearchParams(await this.text());\n\n\t\t\tfor (const [name, value] of parameters) {\n\t\t\t\tformData.append(name, value);\n\t\t\t}\n\n\t\t\treturn formData;\n\t\t}\n\n\t\tconst {toFormData} = await import('./utils/multipart-parser.js');\n\t\treturn toFormData(this.body, ct);\n\t}\n\n\t/**\n\t * Return raw response as Blob\n\t *\n\t * @return Promise\n\t */\n\tasync blob() {\n\t\tconst ct = (this.headers && this.headers.get('content-type')) || (this[INTERNALS].body && this[INTERNALS].body.type) || '';\n\t\tconst buf = await this.arrayBuffer();\n\n\t\treturn new Blob([buf], {\n\t\t\ttype: ct\n\t\t});\n\t}\n\n\t/**\n\t * Decode response as json\n\t *\n\t * @return Promise\n\t */\n\tasync json() {\n\t\tconst text = await this.text();\n\t\treturn JSON.parse(text);\n\t}\n\n\t/**\n\t * Decode response as text\n\t *\n\t * @return Promise\n\t */\n\tasync text() {\n\t\tconst buffer = await consumeBody(this);\n\t\treturn new TextDecoder().decode(buffer);\n\t}\n\n\t/**\n\t * Decode response as buffer (non-spec api)\n\t *\n\t * @return Promise\n\t */\n\tbuffer() {\n\t\treturn consumeBody(this);\n\t}\n}\n\nBody.prototype.buffer = deprecate(Body.prototype.buffer, 'Please use \\'response.arrayBuffer()\\' instead of \\'response.buffer()\\'', 'node-fetch#buffer');\n\n// In browsers, all properties are enumerable.\nObject.defineProperties(Body.prototype, {\n\tbody: {enumerable: true},\n\tbodyUsed: {enumerable: true},\n\tarrayBuffer: {enumerable: true},\n\tblob: {enumerable: true},\n\tjson: {enumerable: true},\n\ttext: {enumerable: true},\n\tdata: {get: deprecate(() => {},\n\t\t'data doesn\\'t exist, use json(), text(), arrayBuffer(), or body instead',\n\t\t'https://github.com/node-fetch/node-fetch/issues/1000 (response)')}\n});\n\n/**\n * Consume and convert an entire Body to a Buffer.\n *\n * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body\n *\n * @return Promise\n */\nasync function consumeBody(data) {\n\tif (data[INTERNALS].disturbed) {\n\t\tthrow new TypeError(`body used already for: ${data.url}`);\n\t}\n\n\tdata[INTERNALS].disturbed = true;\n\n\tif (data[INTERNALS].error) {\n\t\tthrow data[INTERNALS].error;\n\t}\n\n\tconst {body} = data;\n\n\t// Body is null\n\tif (body === null) {\n\t\treturn Buffer.alloc(0);\n\t}\n\n\t/* c8 ignore next 3 */\n\tif (!(body instanceof Stream)) {\n\t\treturn Buffer.alloc(0);\n\t}\n\n\t// Body is stream\n\t// get ready to actually consume the body\n\tconst accum = [];\n\tlet accumBytes = 0;\n\n\ttry {\n\t\tfor await (const chunk of body) {\n\t\t\tif (data.size > 0 && accumBytes + chunk.length > data.size) {\n\t\t\t\tconst error = new FetchError(`content size at ${data.url} over limit: ${data.size}`, 'max-size');\n\t\t\t\tbody.destroy(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\taccumBytes += chunk.length;\n\t\t\taccum.push(chunk);\n\t\t}\n\t} catch (error) {\n\t\tconst error_ = error instanceof FetchBaseError ? error : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`, 'system', error);\n\t\tthrow error_;\n\t}\n\n\tif (body.readableEnded === true || body._readableState.ended === true) {\n\t\ttry {\n\t\t\tif (accum.every(c => typeof c === 'string')) {\n\t\t\t\treturn Buffer.from(accum.join(''));\n\t\t\t}\n\n\t\t\treturn Buffer.concat(accum, accumBytes);\n\t\t} catch (error) {\n\t\t\tthrow new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`, 'system', error);\n\t\t}\n\t} else {\n\t\tthrow new FetchError(`Premature close of server response while trying to fetch ${data.url}`);\n\t}\n}\n\n/**\n * Clone body given Res/Req instance\n *\n * @param Mixed instance Response or Request instance\n * @param String highWaterMark highWaterMark for both PassThrough body streams\n * @return Mixed\n */\nexport const clone = (instance, highWaterMark) => {\n\tlet p1;\n\tlet p2;\n\tlet {body} = instance[INTERNALS];\n\n\t// Don't allow cloning a used body\n\tif (instance.bodyUsed) {\n\t\tthrow new Error('cannot clone body after it is used');\n\t}\n\n\t// Check that body is a stream and not form-data object\n\t// note: we can't clone the form-data object without having it as a dependency\n\tif ((body instanceof Stream) && (typeof body.getBoundary !== 'function')) {\n\t\t// Tee instance body\n\t\tp1 = new PassThrough({highWaterMark});\n\t\tp2 = new PassThrough({highWaterMark});\n\t\tbody.pipe(p1);\n\t\tbody.pipe(p2);\n\t\t// Set instance body to teed body and return the other teed body\n\t\tinstance[INTERNALS].stream = p1;\n\t\tbody = p2;\n\t}\n\n\treturn body;\n};\n\nconst getNonSpecFormDataBoundary = deprecate(\n\tbody => body.getBoundary(),\n\t'form-data doesn\\'t follow the spec and requires special treatment. Use alternative package',\n\t'https://github.com/node-fetch/node-fetch/issues/1167'\n);\n\n/**\n * Performs the operation \"extract a `Content-Type` value from |object|\" as\n * specified in the specification:\n * https://fetch.spec.whatwg.org/#concept-bodyinit-extract\n *\n * This function assumes that instance.body is present.\n *\n * @param {any} body Any options.body input\n * @returns {string | null}\n */\nexport const extractContentType = (body, request) => {\n\t// Body is null or undefined\n\tif (body === null) {\n\t\treturn null;\n\t}\n\n\t// Body is string\n\tif (typeof body === 'string') {\n\t\treturn 'text/plain;charset=UTF-8';\n\t}\n\n\t// Body is a URLSearchParams\n\tif (isURLSearchParameters(body)) {\n\t\treturn 'application/x-www-form-urlencoded;charset=UTF-8';\n\t}\n\n\t// Body is blob\n\tif (isBlob(body)) {\n\t\treturn body.type || null;\n\t}\n\n\t// Body is a Buffer (Buffer, ArrayBuffer or ArrayBufferView)\n\tif (Buffer.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {\n\t\treturn null;\n\t}\n\n\tif (body instanceof FormData) {\n\t\treturn `multipart/form-data; boundary=${request[INTERNALS].boundary}`;\n\t}\n\n\t// Detect form data input from form-data module\n\tif (body && typeof body.getBoundary === 'function') {\n\t\treturn `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`;\n\t}\n\n\t// Body is stream - can't really do much about this\n\tif (body instanceof Stream) {\n\t\treturn null;\n\t}\n\n\t// Body constructor defaults other things to string\n\treturn 'text/plain;charset=UTF-8';\n};\n\n/**\n * The Fetch Standard treats this as if \"total bytes\" is a property on the body.\n * For us, we have to explicitly get it with a function.\n *\n * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes\n *\n * @param {any} obj.body Body object from the Body instance.\n * @returns {number | null}\n */\nexport const getTotalBytes = request => {\n\tconst {body} = request[INTERNALS];\n\n\t// Body is null or undefined\n\tif (body === null) {\n\t\treturn 0;\n\t}\n\n\t// Body is Blob\n\tif (isBlob(body)) {\n\t\treturn body.size;\n\t}\n\n\t// Body is Buffer\n\tif (Buffer.isBuffer(body)) {\n\t\treturn body.length;\n\t}\n\n\t// Detect form data input from form-data module\n\tif (body && typeof body.getLengthSync === 'function') {\n\t\treturn body.hasKnownLength && body.hasKnownLength() ? body.getLengthSync() : null;\n\t}\n\n\t// Body is stream\n\treturn null;\n};\n\n/**\n * Write a Body to a Node.js WritableStream (e.g. http.Request) object.\n *\n * @param {Stream.Writable} dest The stream to write to.\n * @param obj.body Body object from the Body instance.\n * @returns {Promise}\n */\nexport const writeToStream = async (dest, {body}) => {\n\tif (body === null) {\n\t\t// Body is null\n\t\tdest.end();\n\t} else {\n\t\t// Body is stream\n\t\tawait pipeline(body, dest);\n\t}\n};\n","/**\n * Headers.js\n *\n * Headers class offers convenient helpers\n */\n\nimport {types} from 'node:util';\nimport http from 'node:http';\n\n/* c8 ignore next 9 */\nconst validateHeaderName = typeof http.validateHeaderName === 'function' ?\n\thttp.validateHeaderName :\n\tname => {\n\t\tif (!/^[\\^`\\-\\w!#$%&'*+.|~]+$/.test(name)) {\n\t\t\tconst error = new TypeError(`Header name must be a valid HTTP token [${name}]`);\n\t\t\tObject.defineProperty(error, 'code', {value: 'ERR_INVALID_HTTP_TOKEN'});\n\t\t\tthrow error;\n\t\t}\n\t};\n\n/* c8 ignore next 9 */\nconst validateHeaderValue = typeof http.validateHeaderValue === 'function' ?\n\thttp.validateHeaderValue :\n\t(name, value) => {\n\t\tif (/[^\\t\\u0020-\\u007E\\u0080-\\u00FF]/.test(value)) {\n\t\t\tconst error = new TypeError(`Invalid character in header content [\"${name}\"]`);\n\t\t\tObject.defineProperty(error, 'code', {value: 'ERR_INVALID_CHAR'});\n\t\t\tthrow error;\n\t\t}\n\t};\n\n/**\n * @typedef {Headers | Record | Iterable | Iterable>} HeadersInit\n */\n\n/**\n * This Fetch API interface allows you to perform various actions on HTTP request and response headers.\n * These actions include retrieving, setting, adding to, and removing.\n * A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.\n * You can add to this using methods like append() (see Examples.)\n * In all methods of this interface, header names are matched by case-insensitive byte sequence.\n *\n */\nexport default class Headers extends URLSearchParams {\n\t/**\n\t * Headers class\n\t *\n\t * @constructor\n\t * @param {HeadersInit} [init] - Response headers\n\t */\n\tconstructor(init) {\n\t\t// Validate and normalize init object in [name, value(s)][]\n\t\t/** @type {string[][]} */\n\t\tlet result = [];\n\t\tif (init instanceof Headers) {\n\t\t\tconst raw = init.raw();\n\t\t\tfor (const [name, values] of Object.entries(raw)) {\n\t\t\t\tresult.push(...values.map(value => [name, value]));\n\t\t\t}\n\t\t} else if (init == null) { // eslint-disable-line no-eq-null, eqeqeq\n\t\t\t// No op\n\t\t} else if (typeof init === 'object' && !types.isBoxedPrimitive(init)) {\n\t\t\tconst method = init[Symbol.iterator];\n\t\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\t\tif (method == null) {\n\t\t\t\t// Record\n\t\t\t\tresult.push(...Object.entries(init));\n\t\t\t} else {\n\t\t\t\tif (typeof method !== 'function') {\n\t\t\t\t\tthrow new TypeError('Header pairs must be iterable');\n\t\t\t\t}\n\n\t\t\t\t// Sequence>\n\t\t\t\t// Note: per spec we have to first exhaust the lists then process them\n\t\t\t\tresult = [...init]\n\t\t\t\t\t.map(pair => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof pair !== 'object' || types.isBoxedPrimitive(pair)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new TypeError('Each header pair must be an iterable object');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn [...pair];\n\t\t\t\t\t}).map(pair => {\n\t\t\t\t\t\tif (pair.length !== 2) {\n\t\t\t\t\t\t\tthrow new TypeError('Each header pair must be a name/value tuple');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn [...pair];\n\t\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new TypeError('Failed to construct \\'Headers\\': The provided value is not of type \\'(sequence> or record)');\n\t\t}\n\n\t\t// Validate and lowercase\n\t\tresult =\n\t\t\tresult.length > 0 ?\n\t\t\t\tresult.map(([name, value]) => {\n\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\treturn [String(name).toLowerCase(), String(value)];\n\t\t\t\t}) :\n\t\t\t\tundefined;\n\n\t\tsuper(result);\n\n\t\t// Returning a Proxy that will lowercase key names, validate parameters and sort keys\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn new Proxy(this, {\n\t\t\tget(target, p, receiver) {\n\t\t\t\tswitch (p) {\n\t\t\t\t\tcase 'append':\n\t\t\t\t\tcase 'set':\n\t\t\t\t\t\treturn (name, value) => {\n\t\t\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\t\t\treturn URLSearchParams.prototype[p].call(\n\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\tString(name).toLowerCase(),\n\t\t\t\t\t\t\t\tString(value)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase 'delete':\n\t\t\t\t\tcase 'has':\n\t\t\t\t\tcase 'getAll':\n\t\t\t\t\t\treturn name => {\n\t\t\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\t\t\treturn URLSearchParams.prototype[p].call(\n\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\tString(name).toLowerCase()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase 'keys':\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\ttarget.sort();\n\t\t\t\t\t\t\treturn new Set(URLSearchParams.prototype.keys.call(target)).keys();\n\t\t\t\t\t\t};\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn Reflect.get(target, p, receiver);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t/* c8 ignore next */\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn this.constructor.name;\n\t}\n\n\ttoString() {\n\t\treturn Object.prototype.toString.call(this);\n\t}\n\n\tget(name) {\n\t\tconst values = this.getAll(name);\n\t\tif (values.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet value = values.join(', ');\n\t\tif (/^content-encoding$/i.test(name)) {\n\t\t\tvalue = value.toLowerCase();\n\t\t}\n\n\t\treturn value;\n\t}\n\n\tforEach(callback, thisArg = undefined) {\n\t\tfor (const name of this.keys()) {\n\t\t\tReflect.apply(callback, thisArg, [this.get(name), name, this]);\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const name of this.keys()) {\n\t\t\tyield this.get(name);\n\t\t}\n\t}\n\n\t/**\n\t * @type {() => IterableIterator<[string, string]>}\n\t */\n\t* entries() {\n\t\tfor (const name of this.keys()) {\n\t\t\tyield [name, this.get(name)];\n\t\t}\n\t}\n\n\t[Symbol.iterator]() {\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Node-fetch non-spec method\n\t * returning all headers and their values as array\n\t * @returns {Record}\n\t */\n\traw() {\n\t\treturn [...this.keys()].reduce((result, key) => {\n\t\t\tresult[key] = this.getAll(key);\n\t\t\treturn result;\n\t\t}, {});\n\t}\n\n\t/**\n\t * For better console.log(headers) and also to convert Headers into Node.js Request compatible format\n\t */\n\t[Symbol.for('nodejs.util.inspect.custom')]() {\n\t\treturn [...this.keys()].reduce((result, key) => {\n\t\t\tconst values = this.getAll(key);\n\t\t\t// Http.request() only supports string as Host header.\n\t\t\t// This hack makes specifying custom Host header possible.\n\t\t\tif (key === 'host') {\n\t\t\t\tresult[key] = values[0];\n\t\t\t} else {\n\t\t\t\tresult[key] = values.length > 1 ? values : values[0];\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}, {});\n\t}\n}\n\n/**\n * Re-shaping object for Web IDL tests\n * Only need to do it for overridden methods\n */\nObject.defineProperties(\n\tHeaders.prototype,\n\t['get', 'entries', 'forEach', 'values'].reduce((result, property) => {\n\t\tresult[property] = {enumerable: true};\n\t\treturn result;\n\t}, {})\n);\n\n/**\n * Create a Headers object from an http.IncomingMessage.rawHeaders, ignoring those that do\n * not conform to HTTP grammar productions.\n * @param {import('http').IncomingMessage['rawHeaders']} headers\n */\nexport function fromRawHeaders(headers = []) {\n\treturn new Headers(\n\t\theaders\n\t\t\t// Split into pairs\n\t\t\t.reduce((result, value, index, array) => {\n\t\t\t\tif (index % 2 === 0) {\n\t\t\t\t\tresult.push(array.slice(index, index + 2));\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}, [])\n\t\t\t.filter(([name, value]) => {\n\t\t\t\ttry {\n\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\treturn true;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t})\n\n\t);\n}\n","const redirectStatus = new Set([301, 302, 303, 307, 308]);\n\n/**\n * Redirect code matching\n *\n * @param {number} code - Status code\n * @return {boolean}\n */\nexport const isRedirect = code => {\n\treturn redirectStatus.has(code);\n};\n","/**\n * Response.js\n *\n * Response class provides content decoding\n */\n\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType} from './body.js';\nimport {isRedirect} from './utils/is-redirect.js';\n\nconst INTERNALS = Symbol('Response internals');\n\n/**\n * Response class\n *\n * Ref: https://fetch.spec.whatwg.org/#response-class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Response extends Body {\n\tconstructor(body = null, options = {}) {\n\t\tsuper(body, options);\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq, no-negated-condition\n\t\tconst status = options.status != null ? options.status : 200;\n\n\t\tconst headers = new Headers(options.headers);\n\n\t\tif (body !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\ttype: 'default',\n\t\t\turl: options.url,\n\t\t\tstatus,\n\t\t\tstatusText: options.statusText || '',\n\t\t\theaders,\n\t\t\tcounter: options.counter,\n\t\t\thighWaterMark: options.highWaterMark\n\t\t};\n\t}\n\n\tget type() {\n\t\treturn this[INTERNALS].type;\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS].status;\n\t}\n\n\t/**\n\t * Convenience property representing if the request ended normally\n\t */\n\tget ok() {\n\t\treturn this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget highWaterMark() {\n\t\treturn this[INTERNALS].highWaterMark;\n\t}\n\n\t/**\n\t * Clone this response\n\t *\n\t * @return Response\n\t */\n\tclone() {\n\t\treturn new Response(clone(this, this.highWaterMark), {\n\t\t\ttype: this.type,\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected,\n\t\t\tsize: this.size,\n\t\t\thighWaterMark: this.highWaterMark\n\t\t});\n\t}\n\n\t/**\n\t * @param {string} url The URL that the new response is to originate from.\n\t * @param {number} status An optional status code for the response (e.g., 302.)\n\t * @returns {Response} A Response object.\n\t */\n\tstatic redirect(url, status = 302) {\n\t\tif (!isRedirect(status)) {\n\t\t\tthrow new RangeError('Failed to execute \"redirect\" on \"response\": Invalid status code');\n\t\t}\n\n\t\treturn new Response(null, {\n\t\t\theaders: {\n\t\t\t\tlocation: new URL(url).toString()\n\t\t\t},\n\t\t\tstatus\n\t\t});\n\t}\n\n\tstatic error() {\n\t\tconst response = new Response(null, {status: 0, statusText: ''});\n\t\tresponse[INTERNALS].type = 'error';\n\t\treturn response;\n\t}\n\n\tstatic json(data = undefined, init = {}) {\n\t\tconst body = JSON.stringify(data);\n\n\t\tif (body === undefined) {\n\t\t\tthrow new TypeError('data is not JSON serializable');\n\t\t}\n\n\t\tconst headers = new Headers(init && init.headers);\n\n\t\tif (!headers.has('content-type')) {\n\t\t\theaders.set('content-type', 'application/json');\n\t\t}\n\n\t\treturn new Response(body, {\n\t\t\t...init,\n\t\t\theaders\n\t\t});\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Response';\n\t}\n}\n\nObject.defineProperties(Response.prototype, {\n\ttype: {enumerable: true},\n\turl: {enumerable: true},\n\tstatus: {enumerable: true},\n\tok: {enumerable: true},\n\tredirected: {enumerable: true},\n\tstatusText: {enumerable: true},\n\theaders: {enumerable: true},\n\tclone: {enumerable: true}\n});\n","export const getSearch = parsedURL => {\n\tif (parsedURL.search) {\n\t\treturn parsedURL.search;\n\t}\n\n\tconst lastOffset = parsedURL.href.length - 1;\n\tconst hash = parsedURL.hash || (parsedURL.href[lastOffset] === '#' ? '#' : '');\n\treturn parsedURL.href[lastOffset - hash.length] === '?' ? '?' : '';\n};\n","import {isIP} from 'node:net';\n\n/**\n * @external URL\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/URL|URL}\n */\n\n/**\n * @module utils/referrer\n * @private\n */\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#strip-url|Referrer Policy §8.4. Strip url for use as a referrer}\n * @param {string} URL\n * @param {boolean} [originOnly=false]\n */\nexport function stripURLForUseAsAReferrer(url, originOnly = false) {\n\t// 1. If url is null, return no referrer.\n\tif (url == null) { // eslint-disable-line no-eq-null, eqeqeq\n\t\treturn 'no-referrer';\n\t}\n\n\turl = new URL(url);\n\n\t// 2. If url's scheme is a local scheme, then return no referrer.\n\tif (/^(about|blob|data):$/.test(url.protocol)) {\n\t\treturn 'no-referrer';\n\t}\n\n\t// 3. Set url's username to the empty string.\n\turl.username = '';\n\n\t// 4. Set url's password to null.\n\t// Note: `null` appears to be a mistake as this actually results in the password being `\"null\"`.\n\turl.password = '';\n\n\t// 5. Set url's fragment to null.\n\t// Note: `null` appears to be a mistake as this actually results in the fragment being `\"#null\"`.\n\turl.hash = '';\n\n\t// 6. If the origin-only flag is true, then:\n\tif (originOnly) {\n\t\t// 6.1. Set url's path to null.\n\t\t// Note: `null` appears to be a mistake as this actually results in the path being `\"/null\"`.\n\t\turl.pathname = '';\n\n\t\t// 6.2. Set url's query to null.\n\t\t// Note: `null` appears to be a mistake as this actually results in the query being `\"?null\"`.\n\t\turl.search = '';\n\t}\n\n\t// 7. Return url.\n\treturn url;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#enumdef-referrerpolicy|enum ReferrerPolicy}\n */\nexport const ReferrerPolicy = new Set([\n\t'',\n\t'no-referrer',\n\t'no-referrer-when-downgrade',\n\t'same-origin',\n\t'origin',\n\t'strict-origin',\n\t'origin-when-cross-origin',\n\t'strict-origin-when-cross-origin',\n\t'unsafe-url'\n]);\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#default-referrer-policy|default referrer policy}\n */\nexport const DEFAULT_REFERRER_POLICY = 'strict-origin-when-cross-origin';\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#referrer-policies|Referrer Policy §3. Referrer Policies}\n * @param {string} referrerPolicy\n * @returns {string} referrerPolicy\n */\nexport function validateReferrerPolicy(referrerPolicy) {\n\tif (!ReferrerPolicy.has(referrerPolicy)) {\n\t\tthrow new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);\n\t}\n\n\treturn referrerPolicy;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy|Referrer Policy §3.2. Is origin potentially trustworthy?}\n * @param {external:URL} url\n * @returns `true`: \"Potentially Trustworthy\", `false`: \"Not Trustworthy\"\n */\nexport function isOriginPotentiallyTrustworthy(url) {\n\t// 1. If origin is an opaque origin, return \"Not Trustworthy\".\n\t// Not applicable\n\n\t// 2. Assert: origin is a tuple origin.\n\t// Not for implementations\n\n\t// 3. If origin's scheme is either \"https\" or \"wss\", return \"Potentially Trustworthy\".\n\tif (/^(http|ws)s:$/.test(url.protocol)) {\n\t\treturn true;\n\t}\n\n\t// 4. If origin's host component matches one of the CIDR notations 127.0.0.0/8 or ::1/128 [RFC4632], return \"Potentially Trustworthy\".\n\tconst hostIp = url.host.replace(/(^\\[)|(]$)/g, '');\n\tconst hostIPVersion = isIP(hostIp);\n\n\tif (hostIPVersion === 4 && /^127\\./.test(hostIp)) {\n\t\treturn true;\n\t}\n\n\tif (hostIPVersion === 6 && /^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)) {\n\t\treturn true;\n\t}\n\n\t// 5. If origin's host component is \"localhost\" or falls within \".localhost\", and the user agent conforms to the name resolution rules in [let-localhost-be-localhost], return \"Potentially Trustworthy\".\n\t// We are returning FALSE here because we cannot ensure conformance to\n\t// let-localhost-be-loalhost (https://tools.ietf.org/html/draft-west-let-localhost-be-localhost)\n\tif (url.host === 'localhost' || url.host.endsWith('.localhost')) {\n\t\treturn false;\n\t}\n\n\t// 6. If origin's scheme component is file, return \"Potentially Trustworthy\".\n\tif (url.protocol === 'file:') {\n\t\treturn true;\n\t}\n\n\t// 7. If origin's scheme component is one which the user agent considers to be authenticated, return \"Potentially Trustworthy\".\n\t// Not supported\n\n\t// 8. If origin has been configured as a trustworthy origin, return \"Potentially Trustworthy\".\n\t// Not supported\n\n\t// 9. Return \"Not Trustworthy\".\n\treturn false;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-url-trustworthy|Referrer Policy §3.3. Is url potentially trustworthy?}\n * @param {external:URL} url\n * @returns `true`: \"Potentially Trustworthy\", `false`: \"Not Trustworthy\"\n */\nexport function isUrlPotentiallyTrustworthy(url) {\n\t// 1. If url is \"about:blank\" or \"about:srcdoc\", return \"Potentially Trustworthy\".\n\tif (/^about:(blank|srcdoc)$/.test(url)) {\n\t\treturn true;\n\t}\n\n\t// 2. If url's scheme is \"data\", return \"Potentially Trustworthy\".\n\tif (url.protocol === 'data:') {\n\t\treturn true;\n\t}\n\n\t// Note: The origin of blob: and filesystem: URLs is the origin of the context in which they were\n\t// created. Therefore, blobs created in a trustworthy origin will themselves be potentially\n\t// trustworthy.\n\tif (/^(blob|filesystem):$/.test(url.protocol)) {\n\t\treturn true;\n\t}\n\n\t// 3. Return the result of executing §3.2 Is origin potentially trustworthy? on url's origin.\n\treturn isOriginPotentiallyTrustworthy(url);\n}\n\n/**\n * Modifies the referrerURL to enforce any extra security policy considerations.\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7\n * @callback module:utils/referrer~referrerURLCallback\n * @param {external:URL} referrerURL\n * @returns {external:URL} modified referrerURL\n */\n\n/**\n * Modifies the referrerOrigin to enforce any extra security policy considerations.\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7\n * @callback module:utils/referrer~referrerOriginCallback\n * @param {external:URL} referrerOrigin\n * @returns {external:URL} modified referrerOrigin\n */\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}\n * @param {Request} request\n * @param {object} o\n * @param {module:utils/referrer~referrerURLCallback} o.referrerURLCallback\n * @param {module:utils/referrer~referrerOriginCallback} o.referrerOriginCallback\n * @returns {external:URL} Request's referrer\n */\nexport function determineRequestsReferrer(request, {referrerURLCallback, referrerOriginCallback} = {}) {\n\t// There are 2 notes in the specification about invalid pre-conditions. We return null, here, for\n\t// these cases:\n\t// > Note: If request's referrer is \"no-referrer\", Fetch will not call into this algorithm.\n\t// > Note: If request's referrer policy is the empty string, Fetch will not call into this\n\t// > algorithm.\n\tif (request.referrer === 'no-referrer' || request.referrerPolicy === '') {\n\t\treturn null;\n\t}\n\n\t// 1. Let policy be request's associated referrer policy.\n\tconst policy = request.referrerPolicy;\n\n\t// 2. Let environment be request's client.\n\t// not applicable to node.js\n\n\t// 3. Switch on request's referrer:\n\tif (request.referrer === 'about:client') {\n\t\treturn 'no-referrer';\n\t}\n\n\t// \"a URL\": Let referrerSource be request's referrer.\n\tconst referrerSource = request.referrer;\n\n\t// 4. Let request's referrerURL be the result of stripping referrerSource for use as a referrer.\n\tlet referrerURL = stripURLForUseAsAReferrer(referrerSource);\n\n\t// 5. Let referrerOrigin be the result of stripping referrerSource for use as a referrer, with the\n\t// origin-only flag set to true.\n\tlet referrerOrigin = stripURLForUseAsAReferrer(referrerSource, true);\n\n\t// 6. If the result of serializing referrerURL is a string whose length is greater than 4096, set\n\t// referrerURL to referrerOrigin.\n\tif (referrerURL.toString().length > 4096) {\n\t\treferrerURL = referrerOrigin;\n\t}\n\n\t// 7. The user agent MAY alter referrerURL or referrerOrigin at this point to enforce arbitrary\n\t// policy considerations in the interests of minimizing data leakage. For example, the user\n\t// agent could strip the URL down to an origin, modify its host, replace it with an empty\n\t// string, etc.\n\tif (referrerURLCallback) {\n\t\treferrerURL = referrerURLCallback(referrerURL);\n\t}\n\n\tif (referrerOriginCallback) {\n\t\treferrerOrigin = referrerOriginCallback(referrerOrigin);\n\t}\n\n\t// 8.Execute the statements corresponding to the value of policy:\n\tconst currentURL = new URL(request.url);\n\n\tswitch (policy) {\n\t\tcase 'no-referrer':\n\t\t\treturn 'no-referrer';\n\n\t\tcase 'origin':\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'unsafe-url':\n\t\t\treturn referrerURL;\n\n\t\tcase 'strict-origin':\n\t\t\t// 1. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 2. Return referrerOrigin.\n\t\t\treturn referrerOrigin.toString();\n\n\t\tcase 'strict-origin-when-cross-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// 2. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 3. Return referrerOrigin.\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'same-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// 2. Return no referrer.\n\t\t\treturn 'no-referrer';\n\n\t\tcase 'origin-when-cross-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// Return referrerOrigin.\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'no-referrer-when-downgrade':\n\t\t\t// 1. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 2. Return referrerURL.\n\t\t\treturn referrerURL;\n\n\t\tdefault:\n\t\t\tthrow new TypeError(`Invalid referrerPolicy: ${policy}`);\n\t}\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#parse-referrer-policy-from-header|Referrer Policy §8.1. Parse a referrer policy from a Referrer-Policy header}\n * @param {Headers} headers Response headers\n * @returns {string} policy\n */\nexport function parseReferrerPolicyFromHeader(headers) {\n\t// 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy`\n\t// and response’s header list.\n\tconst policyTokens = (headers.get('referrer-policy') || '').split(/[,\\s]+/);\n\n\t// 2. Let policy be the empty string.\n\tlet policy = '';\n\n\t// 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty\n\t// string, then set policy to token.\n\t// Note: This algorithm loops over multiple policy values to allow deployment of new policy\n\t// values with fallbacks for older user agents, as described in § 11.1 Unknown Policy Values.\n\tfor (const token of policyTokens) {\n\t\tif (token && ReferrerPolicy.has(token)) {\n\t\t\tpolicy = token;\n\t\t}\n\t}\n\n\t// 4. Return policy.\n\treturn policy;\n}\n","/**\n * Request.js\n *\n * Request class contains server only options\n *\n * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.\n */\n\nimport {format as formatUrl} from 'node:url';\nimport {deprecate} from 'node:util';\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType, getTotalBytes} from './body.js';\nimport {isAbortSignal} from './utils/is.js';\nimport {getSearch} from './utils/get-search.js';\nimport {\n\tvalidateReferrerPolicy, determineRequestsReferrer, DEFAULT_REFERRER_POLICY\n} from './utils/referrer.js';\n\nconst INTERNALS = Symbol('Request internals');\n\n/**\n * Check if `obj` is an instance of Request.\n *\n * @param {*} object\n * @return {boolean}\n */\nconst isRequest = object => {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object[INTERNALS] === 'object'\n\t);\n};\n\nconst doBadDataWarn = deprecate(() => {},\n\t'.data is not a valid RequestInit property, use .body instead',\n\t'https://github.com/node-fetch/node-fetch/issues/1000 (request)');\n\n/**\n * Request class\n *\n * Ref: https://fetch.spec.whatwg.org/#request-class\n *\n * @param Mixed input Url or Request instance\n * @param Object init Custom options\n * @return Void\n */\nexport default class Request extends Body {\n\tconstructor(input, init = {}) {\n\t\tlet parsedURL;\n\n\t\t// Normalize input and force URL to be encoded as UTF-8 (https://github.com/node-fetch/node-fetch/issues/245)\n\t\tif (isRequest(input)) {\n\t\t\tparsedURL = new URL(input.url);\n\t\t} else {\n\t\t\tparsedURL = new URL(input);\n\t\t\tinput = {};\n\t\t}\n\n\t\tif (parsedURL.username !== '' || parsedURL.password !== '') {\n\t\t\tthrow new TypeError(`${parsedURL} is an url with embedded credentials.`);\n\t\t}\n\n\t\tlet method = init.method || input.method || 'GET';\n\t\tif (/^(delete|get|head|options|post|put)$/i.test(method)) {\n\t\t\tmethod = method.toUpperCase();\n\t\t}\n\n\t\tif (!isRequest(init) && 'data' in init) {\n\t\t\tdoBadDataWarn();\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif ((init.body != null || (isRequest(input) && input.body !== null)) &&\n\t\t\t(method === 'GET' || method === 'HEAD')) {\n\t\t\tthrow new TypeError('Request with GET/HEAD method cannot have body');\n\t\t}\n\n\t\tconst inputBody = init.body ?\n\t\t\tinit.body :\n\t\t\t(isRequest(input) && input.body !== null ?\n\t\t\t\tclone(input) :\n\t\t\t\tnull);\n\n\t\tsuper(inputBody, {\n\t\t\tsize: init.size || input.size || 0\n\t\t});\n\n\t\tconst headers = new Headers(init.headers || input.headers || {});\n\n\t\tif (inputBody !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(inputBody, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.set('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tlet signal = isRequest(input) ?\n\t\t\tinput.signal :\n\t\t\tnull;\n\t\tif ('signal' in init) {\n\t\t\tsignal = init.signal;\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif (signal != null && !isAbortSignal(signal)) {\n\t\t\tthrow new TypeError('Expected signal to be an instanceof AbortSignal or EventTarget');\n\t\t}\n\n\t\t// §5.4, Request constructor steps, step 15.1\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tlet referrer = init.referrer == null ? input.referrer : init.referrer;\n\t\tif (referrer === '') {\n\t\t\t// §5.4, Request constructor steps, step 15.2\n\t\t\treferrer = 'no-referrer';\n\t\t} else if (referrer) {\n\t\t\t// §5.4, Request constructor steps, step 15.3.1, 15.3.2\n\t\t\tconst parsedReferrer = new URL(referrer);\n\t\t\t// §5.4, Request constructor steps, step 15.3.3, 15.3.4\n\t\t\treferrer = /^about:(\\/\\/)?client$/.test(parsedReferrer) ? 'client' : parsedReferrer;\n\t\t} else {\n\t\t\treferrer = undefined;\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\tmethod,\n\t\t\tredirect: init.redirect || input.redirect || 'follow',\n\t\t\theaders,\n\t\t\tparsedURL,\n\t\t\tsignal,\n\t\t\treferrer\n\t\t};\n\n\t\t// Node-fetch-only options\n\t\tthis.follow = init.follow === undefined ? (input.follow === undefined ? 20 : input.follow) : init.follow;\n\t\tthis.compress = init.compress === undefined ? (input.compress === undefined ? true : input.compress) : init.compress;\n\t\tthis.counter = init.counter || input.counter || 0;\n\t\tthis.agent = init.agent || input.agent;\n\t\tthis.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;\n\t\tthis.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;\n\n\t\t// §5.4, Request constructor steps, step 16.\n\t\t// Default is empty string per https://fetch.spec.whatwg.org/#concept-request-referrer-policy\n\t\tthis.referrerPolicy = init.referrerPolicy || input.referrerPolicy || '';\n\t}\n\n\t/** @returns {string} */\n\tget method() {\n\t\treturn this[INTERNALS].method;\n\t}\n\n\t/** @returns {string} */\n\tget url() {\n\t\treturn formatUrl(this[INTERNALS].parsedURL);\n\t}\n\n\t/** @returns {Headers} */\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget redirect() {\n\t\treturn this[INTERNALS].redirect;\n\t}\n\n\t/** @returns {AbortSignal} */\n\tget signal() {\n\t\treturn this[INTERNALS].signal;\n\t}\n\n\t// https://fetch.spec.whatwg.org/#dom-request-referrer\n\tget referrer() {\n\t\tif (this[INTERNALS].referrer === 'no-referrer') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer === 'client') {\n\t\t\treturn 'about:client';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer) {\n\t\t\treturn this[INTERNALS].referrer.toString();\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tget referrerPolicy() {\n\t\treturn this[INTERNALS].referrerPolicy;\n\t}\n\n\tset referrerPolicy(referrerPolicy) {\n\t\tthis[INTERNALS].referrerPolicy = validateReferrerPolicy(referrerPolicy);\n\t}\n\n\t/**\n\t * Clone this request\n\t *\n\t * @return Request\n\t */\n\tclone() {\n\t\treturn new Request(this);\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Request';\n\t}\n}\n\nObject.defineProperties(Request.prototype, {\n\tmethod: {enumerable: true},\n\turl: {enumerable: true},\n\theaders: {enumerable: true},\n\tredirect: {enumerable: true},\n\tclone: {enumerable: true},\n\tsignal: {enumerable: true},\n\treferrer: {enumerable: true},\n\treferrerPolicy: {enumerable: true}\n});\n\n/**\n * Convert a Request to Node.js http request options.\n *\n * @param {Request} request - A Request instance\n * @return The options object to be passed to http.request\n */\nexport const getNodeRequestOptions = request => {\n\tconst {parsedURL} = request[INTERNALS];\n\tconst headers = new Headers(request[INTERNALS].headers);\n\n\t// Fetch step 1.3\n\tif (!headers.has('Accept')) {\n\t\theaders.set('Accept', '*/*');\n\t}\n\n\t// HTTP-network-or-cache fetch steps 2.4-2.7\n\tlet contentLengthValue = null;\n\tif (request.body === null && /^(post|put)$/i.test(request.method)) {\n\t\tcontentLengthValue = '0';\n\t}\n\n\tif (request.body !== null) {\n\t\tconst totalBytes = getTotalBytes(request);\n\t\t// Set Content-Length if totalBytes is a number (that is not NaN)\n\t\tif (typeof totalBytes === 'number' && !Number.isNaN(totalBytes)) {\n\t\t\tcontentLengthValue = String(totalBytes);\n\t\t}\n\t}\n\n\tif (contentLengthValue) {\n\t\theaders.set('Content-Length', contentLengthValue);\n\t}\n\n\t// 4.1. Main fetch, step 2.6\n\t// > If request's referrer policy is the empty string, then set request's referrer policy to the\n\t// > default referrer policy.\n\tif (request.referrerPolicy === '') {\n\t\trequest.referrerPolicy = DEFAULT_REFERRER_POLICY;\n\t}\n\n\t// 4.1. Main fetch, step 2.7\n\t// > If request's referrer is not \"no-referrer\", set request's referrer to the result of invoking\n\t// > determine request's referrer.\n\tif (request.referrer && request.referrer !== 'no-referrer') {\n\t\trequest[INTERNALS].referrer = determineRequestsReferrer(request);\n\t} else {\n\t\trequest[INTERNALS].referrer = 'no-referrer';\n\t}\n\n\t// 4.5. HTTP-network-or-cache fetch, step 6.9\n\t// > If httpRequest's referrer is a URL, then append `Referer`/httpRequest's referrer, serialized\n\t// > and isomorphic encoded, to httpRequest's header list.\n\tif (request[INTERNALS].referrer instanceof URL) {\n\t\theaders.set('Referer', request.referrer);\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.11\n\tif (!headers.has('User-Agent')) {\n\t\theaders.set('User-Agent', 'node-fetch');\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.15\n\tif (request.compress && !headers.has('Accept-Encoding')) {\n\t\theaders.set('Accept-Encoding', 'gzip, deflate, br');\n\t}\n\n\tlet {agent} = request;\n\tif (typeof agent === 'function') {\n\t\tagent = agent(parsedURL);\n\t}\n\n\t// HTTP-network fetch step 4.2\n\t// chunked encoding is handled by Node.js\n\n\tconst search = getSearch(parsedURL);\n\n\t// Pass the full URL directly to request(), but overwrite the following\n\t// options:\n\tconst options = {\n\t\t// Overwrite search to retain trailing ? (issue #776)\n\t\tpath: parsedURL.pathname + search,\n\t\t// The following options are not expressed in the URL\n\t\tmethod: request.method,\n\t\theaders: headers[Symbol.for('nodejs.util.inspect.custom')](),\n\t\tinsecureHTTPParser: request.insecureHTTPParser,\n\t\tagent\n\t};\n\n\treturn {\n\t\t/** @type {URL} */\n\t\tparsedURL,\n\t\toptions\n\t};\n};\n","import {FetchBaseError} from './base.js';\n\n/**\n * AbortError interface for cancelled requests\n */\nexport class AbortError extends FetchBaseError {\n\tconstructor(message, type = 'aborted') {\n\t\tsuper(message, type);\n\t}\n}\n","/**\n * Index.js\n *\n * a request API compatible with window.fetch\n *\n * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.\n */\n\nimport http from 'node:http';\nimport https from 'node:https';\nimport zlib from 'node:zlib';\nimport Stream, {PassThrough, pipeline as pump} from 'node:stream';\nimport {Buffer} from 'node:buffer';\n\nimport dataUriToBuffer from 'data-uri-to-buffer';\n\nimport {writeToStream, clone} from './body.js';\nimport Response from './response.js';\nimport Headers, {fromRawHeaders} from './headers.js';\nimport Request, {getNodeRequestOptions} from './request.js';\nimport {FetchError} from './errors/fetch-error.js';\nimport {AbortError} from './errors/abort-error.js';\nimport {isRedirect} from './utils/is-redirect.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\nimport {isDomainOrSubdomain, isSameProtocol} from './utils/is.js';\nimport {parseReferrerPolicyFromHeader} from './utils/referrer.js';\nimport {\n\tBlob,\n\tFile,\n\tfileFromSync,\n\tfileFrom,\n\tblobFromSync,\n\tblobFrom\n} from 'fetch-blob/from.js';\n\nexport {FormData, Headers, Request, Response, FetchError, AbortError, isRedirect};\nexport {Blob, File, fileFromSync, fileFrom, blobFromSync, blobFrom};\n\nconst supportedSchemas = new Set(['data:', 'http:', 'https:']);\n\n/**\n * Fetch function\n *\n * @param {string | URL | import('./request').default} url - Absolute url or Request instance\n * @param {*} [options_] - Fetch options\n * @return {Promise}\n */\nexport default async function fetch(url, options_) {\n\treturn new Promise((resolve, reject) => {\n\t\t// Build request object\n\t\tconst request = new Request(url, options_);\n\t\tconst {parsedURL, options} = getNodeRequestOptions(request);\n\t\tif (!supportedSchemas.has(parsedURL.protocol)) {\n\t\t\tthrow new TypeError(`node-fetch cannot load ${url}. URL scheme \"${parsedURL.protocol.replace(/:$/, '')}\" is not supported.`);\n\t\t}\n\n\t\tif (parsedURL.protocol === 'data:') {\n\t\t\tconst data = dataUriToBuffer(request.url);\n\t\t\tconst response = new Response(data, {headers: {'Content-Type': data.typeFull}});\n\t\t\tresolve(response);\n\t\t\treturn;\n\t\t}\n\n\t\t// Wrap http.request into fetch\n\t\tconst send = (parsedURL.protocol === 'https:' ? https : http).request;\n\t\tconst {signal} = request;\n\t\tlet response = null;\n\n\t\tconst abort = () => {\n\t\t\tconst error = new AbortError('The operation was aborted.');\n\t\t\treject(error);\n\t\t\tif (request.body && request.body instanceof Stream.Readable) {\n\t\t\t\trequest.body.destroy(error);\n\t\t\t}\n\n\t\t\tif (!response || !response.body) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tresponse.body.emit('error', error);\n\t\t};\n\n\t\tif (signal && signal.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\n\t\tconst abortAndFinalize = () => {\n\t\t\tabort();\n\t\t\tfinalize();\n\t\t};\n\n\t\t// Send request\n\t\tconst request_ = send(parsedURL.toString(), options);\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', abortAndFinalize);\n\t\t}\n\n\t\tconst finalize = () => {\n\t\t\trequest_.abort();\n\t\t\tif (signal) {\n\t\t\t\tsignal.removeEventListener('abort', abortAndFinalize);\n\t\t\t}\n\t\t};\n\n\t\trequest_.on('error', error => {\n\t\t\treject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, 'system', error));\n\t\t\tfinalize();\n\t\t});\n\n\t\tfixResponseChunkedTransferBadEnding(request_, error => {\n\t\t\tif (response && response.body) {\n\t\t\t\tresponse.body.destroy(error);\n\t\t\t}\n\t\t});\n\n\t\t/* c8 ignore next 18 */\n\t\tif (process.version < 'v14') {\n\t\t\t// Before Node.js 14, pipeline() does not fully support async iterators and does not always\n\t\t\t// properly handle when the socket close/end events are out of order.\n\t\t\trequest_.on('socket', s => {\n\t\t\t\tlet endedWithEventsCount;\n\t\t\t\ts.prependListener('end', () => {\n\t\t\t\t\tendedWithEventsCount = s._eventsCount;\n\t\t\t\t});\n\t\t\t\ts.prependListener('close', hadError => {\n\t\t\t\t\t// if end happened before close but the socket didn't emit an error, do it now\n\t\t\t\t\tif (response && endedWithEventsCount < s._eventsCount && !hadError) {\n\t\t\t\t\t\tconst error = new Error('Premature close');\n\t\t\t\t\t\terror.code = 'ERR_STREAM_PREMATURE_CLOSE';\n\t\t\t\t\t\tresponse.body.emit('error', error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\trequest_.on('response', response_ => {\n\t\t\trequest_.setTimeout(0);\n\t\t\tconst headers = fromRawHeaders(response_.rawHeaders);\n\n\t\t\t// HTTP fetch step 5\n\t\t\tif (isRedirect(response_.statusCode)) {\n\t\t\t\t// HTTP fetch step 5.2\n\t\t\t\tconst location = headers.get('Location');\n\n\t\t\t\t// HTTP fetch step 5.3\n\t\t\t\tlet locationURL = null;\n\t\t\t\ttry {\n\t\t\t\t\tlocationURL = location === null ? null : new URL(location, request.url);\n\t\t\t\t} catch {\n\t\t\t\t\t// error here can only be invalid URL in Location: header\n\t\t\t\t\t// do not throw when options.redirect == manual\n\t\t\t\t\t// let the user extract the errorneous redirect URL\n\t\t\t\t\tif (request.redirect !== 'manual') {\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// HTTP fetch step 5.5\n\t\t\t\tswitch (request.redirect) {\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase 'manual':\n\t\t\t\t\t\t// Nothing to do\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'follow': {\n\t\t\t\t\t\t// HTTP-redirect fetch step 2\n\t\t\t\t\t\tif (locationURL === null) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 5\n\t\t\t\t\t\tif (request.counter >= request.follow) {\n\t\t\t\t\t\t\treject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 6 (counter increment)\n\t\t\t\t\t\t// Create a new Request object.\n\t\t\t\t\t\tconst requestOptions = {\n\t\t\t\t\t\t\theaders: new Headers(request.headers),\n\t\t\t\t\t\t\tfollow: request.follow,\n\t\t\t\t\t\t\tcounter: request.counter + 1,\n\t\t\t\t\t\t\tagent: request.agent,\n\t\t\t\t\t\t\tcompress: request.compress,\n\t\t\t\t\t\t\tmethod: request.method,\n\t\t\t\t\t\t\tbody: clone(request),\n\t\t\t\t\t\t\tsignal: request.signal,\n\t\t\t\t\t\t\tsize: request.size,\n\t\t\t\t\t\t\treferrer: request.referrer,\n\t\t\t\t\t\t\treferrerPolicy: request.referrerPolicy\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// when forwarding sensitive headers like \"Authorization\",\n\t\t\t\t\t\t// \"WWW-Authenticate\", and \"Cookie\" to untrusted targets,\n\t\t\t\t\t\t// headers will be ignored when following a redirect to a domain\n\t\t\t\t\t\t// that is not a subdomain match or exact match of the initial domain.\n\t\t\t\t\t\t// For example, a redirect from \"foo.com\" to either \"foo.com\" or \"sub.foo.com\"\n\t\t\t\t\t\t// will forward the sensitive headers, but a redirect to \"bar.com\" will not.\n\t\t\t\t\t\t// headers will also be ignored when following a redirect to a domain using\n\t\t\t\t\t\t// a different protocol. For example, a redirect from \"https://foo.com\" to \"http://foo.com\"\n\t\t\t\t\t\t// will not forward the sensitive headers\n\t\t\t\t\t\tif (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {\n\t\t\t\t\t\t\tfor (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {\n\t\t\t\t\t\t\t\trequestOptions.headers.delete(name);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 9\n\t\t\t\t\t\tif (response_.statusCode !== 303 && request.body && options_.body instanceof Stream.Readable) {\n\t\t\t\t\t\t\treject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 11\n\t\t\t\t\t\tif (response_.statusCode === 303 || ((response_.statusCode === 301 || response_.statusCode === 302) && request.method === 'POST')) {\n\t\t\t\t\t\t\trequestOptions.method = 'GET';\n\t\t\t\t\t\t\trequestOptions.body = undefined;\n\t\t\t\t\t\t\trequestOptions.headers.delete('content-length');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 14\n\t\t\t\t\t\tconst responseReferrerPolicy = parseReferrerPolicyFromHeader(headers);\n\t\t\t\t\t\tif (responseReferrerPolicy) {\n\t\t\t\t\t\t\trequestOptions.referrerPolicy = responseReferrerPolicy;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 15\n\t\t\t\t\t\tresolve(fetch(new Request(locationURL, requestOptions)));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Prepare response\n\t\t\tif (signal) {\n\t\t\t\tresponse_.once('end', () => {\n\t\t\t\t\tsignal.removeEventListener('abort', abortAndFinalize);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet body = pump(response_, new PassThrough(), error => {\n\t\t\t\tif (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\t\t\t});\n\t\t\t// see https://github.com/nodejs/node/pull/29376\n\t\t\t/* c8 ignore next 3 */\n\t\t\tif (process.version < 'v12.10') {\n\t\t\t\tresponse_.on('aborted', abortAndFinalize);\n\t\t\t}\n\n\t\t\tconst responseOptions = {\n\t\t\t\turl: request.url,\n\t\t\t\tstatus: response_.statusCode,\n\t\t\t\tstatusText: response_.statusMessage,\n\t\t\t\theaders,\n\t\t\t\tsize: request.size,\n\t\t\t\tcounter: request.counter,\n\t\t\t\thighWaterMark: request.highWaterMark\n\t\t\t};\n\n\t\t\t// HTTP-network fetch step 12.1.1.3\n\t\t\tconst codings = headers.get('Content-Encoding');\n\n\t\t\t// HTTP-network fetch step 12.1.1.4: handle content codings\n\n\t\t\t// in following scenarios we ignore compression support\n\t\t\t// 1. compression support is disabled\n\t\t\t// 2. HEAD request\n\t\t\t// 3. no Content-Encoding header\n\t\t\t// 4. no content response (204)\n\t\t\t// 5. content not modified response (304)\n\t\t\tif (!request.compress || request.method === 'HEAD' || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For Node v6+\n\t\t\t// Be less strict when decoding compressed responses, since sometimes\n\t\t\t// servers send slightly invalid responses that are still accepted\n\t\t\t// by common browsers.\n\t\t\t// Always using Z_SYNC_FLUSH is what cURL does.\n\t\t\tconst zlibOptions = {\n\t\t\t\tflush: zlib.Z_SYNC_FLUSH,\n\t\t\t\tfinishFlush: zlib.Z_SYNC_FLUSH\n\t\t\t};\n\n\t\t\t// For gzip\n\t\t\tif (codings === 'gzip' || codings === 'x-gzip') {\n\t\t\t\tbody = pump(body, zlib.createGunzip(zlibOptions), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For deflate\n\t\t\tif (codings === 'deflate' || codings === 'x-deflate') {\n\t\t\t\t// Handle the infamous raw deflate response from old servers\n\t\t\t\t// a hack for old IIS and Apache servers\n\t\t\t\tconst raw = pump(response_, new PassThrough(), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\traw.once('data', chunk => {\n\t\t\t\t\t// See http://stackoverflow.com/questions/37519828\n\t\t\t\t\tif ((chunk[0] & 0x0F) === 0x08) {\n\t\t\t\t\t\tbody = pump(body, zlib.createInflate(), error => {\n\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbody = pump(body, zlib.createInflateRaw(), error => {\n\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\t\tresolve(response);\n\t\t\t\t});\n\t\t\t\traw.once('end', () => {\n\t\t\t\t\t// Some old IIS servers return zero-length OK deflate responses, so\n\t\t\t\t\t// 'data' is never emitted. See https://github.com/node-fetch/node-fetch/pull/903\n\t\t\t\t\tif (!response) {\n\t\t\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\t\t\tresolve(response);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For br\n\t\t\tif (codings === 'br') {\n\t\t\t\tbody = pump(body, zlib.createBrotliDecompress(), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise, use response as-is\n\t\t\tresponse = new Response(body, responseOptions);\n\t\t\tresolve(response);\n\t\t});\n\n\t\t// eslint-disable-next-line promise/prefer-await-to-then\n\t\twriteToStream(request_, request).catch(reject);\n\t});\n}\n\nfunction fixResponseChunkedTransferBadEnding(request, errorCallback) {\n\tconst LAST_CHUNK = Buffer.from('0\\r\\n\\r\\n');\n\n\tlet isChunkedTransfer = false;\n\tlet properLastChunkReceived = false;\n\tlet previousChunk;\n\n\trequest.on('response', response => {\n\t\tconst {headers} = response;\n\t\tisChunkedTransfer = headers['transfer-encoding'] === 'chunked' && !headers['content-length'];\n\t});\n\n\trequest.on('socket', socket => {\n\t\tconst onSocketClose = () => {\n\t\t\tif (isChunkedTransfer && !properLastChunkReceived) {\n\t\t\t\tconst error = new Error('Premature close');\n\t\t\t\terror.code = 'ERR_STREAM_PREMATURE_CLOSE';\n\t\t\t\terrorCallback(error);\n\t\t\t}\n\t\t};\n\n\t\tconst onData = buf => {\n\t\t\tproperLastChunkReceived = Buffer.compare(buf.slice(-5), LAST_CHUNK) === 0;\n\n\t\t\t// Sometimes final 0-length chunk and end of message code are in separate packets\n\t\t\tif (!properLastChunkReceived && previousChunk) {\n\t\t\t\tproperLastChunkReceived = (\n\t\t\t\t\tBuffer.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 &&\n\t\t\t\t\tBuffer.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpreviousChunk = buf;\n\t\t};\n\n\t\tsocket.prependListener('close', onSocketClose);\n\t\tsocket.on('data', onData);\n\n\t\trequest.on('close', () => {\n\t\t\tsocket.removeListener('close', onSocketClose);\n\t\t\tsocket.removeListener('data', onData);\n\t\t});\n\t});\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Environment-aware HTTP client for the X API SDK.\n * \n * This module provides a universal HTTP client that works in both Node.js and browser environments\n * without requiring manual polyfills.\n */\n\n// Environment detection\nconst isNode =\n typeof process !== 'undefined' && process.versions && process.versions.node;\nconst isBrowser =\n typeof window !== 'undefined' && typeof window.fetch === 'function';\n\n// Type definitions\nexport interface RequestOptions {\n method?: string;\n headers?: Record | Headers;\n body?: string | Buffer | ArrayBuffer | ArrayBufferView;\n signal?: AbortSignal;\n timeout?: number;\n}\n\nexport interface HttpResponse {\n ok: boolean;\n status: number;\n statusText: string;\n headers: Headers;\n url: string;\n json(): Promise;\n text(): Promise;\n arrayBuffer(): Promise;\n}\n\n/**\n * Universal HTTP client that works in both Node.js and browser environments\n */\nexport class HttpClient {\n private fetch: any;\n private HeadersClass: any;\n\n constructor() {\n this.initializeEnvironment();\n }\n\n private initializeEnvironment(): void {\n if (isNode) {\n // Node.js environment - set up polyfills synchronously\n this.initializeNodeEnvironment();\n } else if (isBrowser) {\n // Browser environment - use native APIs\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n } else {\n // Fallback for other environments (Deno, etc.)\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n }\n }\n\n private initializeNodeEnvironment(): void {\n // Check if native fetch is available (Node.js 18+)\n if (\n typeof globalThis.fetch === 'function' &&\n typeof globalThis.Headers === 'function'\n ) {\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n return;\n }\n\n // Try to use node-fetch for older Node.js versions\n try {\n const nodeFetch = require('node-fetch');\n const { Headers: NodeHeaders } = nodeFetch;\n\n this.fetch = nodeFetch.default || nodeFetch;\n this.HeadersClass = NodeHeaders;\n } catch (error) {\n // If node-fetch is not available, provide a helpful error\n throw new Error(\n 'X API SDK: node-fetch not found. For Node.js environments, please install node-fetch:\\n' +\n 'npm install node-fetch\\n' +\n 'Or upgrade to Node.js 18+ for native fetch support.'\n );\n }\n }\n\n /**\n * Create a new Headers instance\n */\n createHeaders(init?: Record | Headers): Headers {\n return new this.HeadersClass(init) as Headers;\n }\n\n /**\n * Make an HTTP request\n */\n async request(\n url: string,\n options: RequestOptions = {}\n ): Promise {\n // Convert body to string if it's a Buffer or ArrayBuffer\n let body = options.body;\n if (body && typeof body !== 'string') {\n if (Buffer.isBuffer(body)) {\n body = body.toString();\n } else if (body instanceof ArrayBuffer) {\n body = new TextDecoder().decode(body);\n } else if (ArrayBuffer.isView(body)) {\n body = new TextDecoder().decode(body);\n }\n }\n\n // Handle timeout\n let signal = options.signal;\n if (options.timeout && options.timeout > 0 && !signal) {\n const controller = new AbortController();\n setTimeout(() => controller.abort(), options.timeout);\n signal = controller.signal;\n }\n\n const response = await this.fetch(url, {\n method: options.method || 'GET',\n headers: options.headers as any,\n body: body as any,\n signal: signal,\n });\n\n return response as HttpResponse;\n }\n\n /**\n * Make a GET request\n */\n async get(\n url: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'GET',\n headers,\n });\n }\n\n /**\n * Make a POST request\n */\n async post(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'POST',\n headers,\n body,\n });\n }\n\n /**\n * Make a PUT request\n */\n async put(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'PUT',\n headers,\n body,\n });\n }\n\n /**\n * Make a DELETE request\n */\n async delete(\n url: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'DELETE',\n headers,\n });\n }\n\n /**\n * Make a PATCH request\n */\n async patch(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'PATCH',\n headers,\n body,\n });\n }\n}\n\n// Export a singleton instance\nexport const httpClient = new HttpClient();\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * news client for the X API.\n *\n * This module provides a client for interacting with the news endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetResponse } from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for news operations\n * \n * This client provides methods for interacting with the news endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all news related operations.\n * \n * @category news\n */\nexport class NewsClient {\n private client: Client;\n\n /**\n * Creates a new news client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get news stories by ID\n * Retrieves news story by its ID.\n\n\n * @param id The ID of the news story.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(id: string, options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/news/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for news operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2NewsIdResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * users client for the X API.\n *\n * This module provides a client for interacting with the users endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n UnlikePostResponse,\n GetOwnedListsResponse,\n GetBlockingResponse,\n DeleteBookmarkResponse,\n GetByUsernameResponse,\n UnpinListResponse,\n GetPostsResponse,\n GetBookmarksResponse,\n CreateBookmarkRequest,\n CreateBookmarkResponse,\n BlockDmsResponse,\n UnfollowListResponse,\n GetMutingResponse,\n MuteUserRequest,\n MuteUserResponse,\n GetByIdResponse,\n GetMeResponse,\n UnrepostPostResponse,\n UnmuteUserResponse,\n SearchResponse,\n GetPinnedListsResponse,\n PinListRequest,\n PinListResponse,\n GetFollowedListsResponse,\n FollowListRequest,\n FollowListResponse,\n LikePostRequest,\n LikePostResponse,\n GetLikedPostsResponse,\n GetByUsernamesResponse,\n RepostPostRequest,\n RepostPostResponse,\n UnfollowUserResponse,\n GetFollowersResponse,\n GetByIdsResponse,\n GetBookmarksByFolderIdResponse,\n GetBookmarkFoldersResponse,\n GetFollowingResponse,\n FollowUserRequest,\n FollowUserResponse,\n GetTimelineResponse,\n UnblockDmsResponse,\n GetMentionsResponse,\n GetListMembershipsResponse,\n GetRepostsOfMeResponse,\n} from './models.js';\n\n/**\n * Options for getOwnedLists method\n * \n * @public\n */\nexport interface GetOwnedListsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBlocking method\n * \n * @public\n */\nexport interface GetBlockingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByUsername method\n * \n * @public\n */\nexport interface GetByUsernameOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBookmarks method\n * \n * @public\n */\nexport interface GetBookmarksOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMuting method\n * \n * @public\n */\nexport interface GetMutingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for muteUser method\n * \n * @public\n */\nexport interface MuteUserOptions {\n /** Request body */\n body?: MuteUserRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMe method\n * \n * @public\n */\nexport interface GetMeOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPinnedLists method\n * \n * @public\n */\nexport interface GetPinnedListsOptions {\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowedLists method\n * \n * @public\n */\nexport interface GetFollowedListsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for followList method\n * \n * @public\n */\nexport interface FollowListOptions {\n /** Request body */\n body?: FollowListRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for likePost method\n * \n * @public\n */\nexport interface LikePostOptions {\n /** Request body */\n body?: LikePostRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getLikedPosts method\n * \n * @public\n */\nexport interface GetLikedPostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByUsernames method\n * \n * @public\n */\nexport interface GetByUsernamesOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for repostPost method\n * \n * @public\n */\nexport interface RepostPostOptions {\n /** Request body */\n body?: RepostPostRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowers method\n * \n * @public\n */\nexport interface GetFollowersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBookmarkFolders method\n * \n * @public\n */\nexport interface GetBookmarkFoldersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowing method\n * \n * @public\n */\nexport interface GetFollowingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for followUser method\n * \n * @public\n */\nexport interface FollowUserOptions {\n /** Request body */\n body?: FollowUserRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getTimeline method\n * \n * @public\n */\nexport interface GetTimelineOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMentions method\n * \n * @public\n */\nexport interface GetMentionsOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getListMemberships method\n * \n * @public\n */\nexport interface GetListMembershipsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getRepostsOfMe method\n * \n * @public\n */\nexport interface GetRepostsOfMeOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for users operations\n * \n * This client provides methods for interacting with the users endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all users related operations.\n * \n * @category users\n */\nexport class UsersClient {\n private client: Client;\n\n /**\n * Creates a new users client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Unlike Post\n * Causes the authenticated user to Unlike a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to unlike the Post.\n\n\n\n * @param tweetId The ID of the Post that the User is requesting to unlike.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unlikePost(id: string, tweetId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/likes/{tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get owned Lists\n * Retrieves a list of Lists owned by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getOwnedLists(\n id: string,\n options: GetOwnedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/owned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get blocking\n * Retrieves a list of Users blocked by the specified User ID.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBlocking(\n id: string,\n options: GetBlockingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/blocking';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['block.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Bookmark\n * Removes a Post from the authenticated user’s Bookmarks by its ID.\n\n\n * @param id The ID of the authenticated source User whose bookmark is to be removed.\n\n\n\n * @param tweetId The ID of the Post that the source User is removing from bookmarks.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteBookmark(\n id: string,\n tweetId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/{tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get User by username\n * Retrieves details of a specific User by their username.\n\n\n * @param username A username.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByUsername(\n username: string,\n options: GetByUsernameOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/by/username/{username}';\n\n path = path.replace('{username}', encodeURIComponent(String(username)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unpin List\n * Causes the authenticated user to unpin a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n * @param listId The ID of the List to unpin.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unpinList(id: string, listId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists/{list_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{list_id}', encodeURIComponent(String(listId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Posts\n * Retrieves a list of posts authored by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmarks\n * Retrieves a list of Posts bookmarked by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarks(\n id: string,\n options: GetBookmarksOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Bookmark\n * Adds a post to the authenticated user’s bookmarks.\n\n\n * @param id The ID of the authenticated source User for whom to add bookmarks.\n\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createBookmark(\n id: string,\n body: CreateBookmarkRequest\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Block DMs\n * Blocks direct messages to or from a specific User by their ID for the authenticated user.\n\n\n * @param id The ID of the target User that the authenticated user requesting to block dms for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async blockDms(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/dm/block';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unfollow List\n * Causes the authenticated user to unfollow a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will unfollow the List.\n\n\n\n * @param listId The ID of the List to unfollow.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unfollowList(\n id: string,\n listId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists/{list_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{list_id}', encodeURIComponent(String(listId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get muting\n * Retrieves a list of Users muted by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMuting(\n id: string,\n options: GetMutingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/muting';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Mute User\n * Causes the authenticated user to mute a specific User by their ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to mute the target User.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async muteUser(\n id: string,\n options: MuteUserOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/muting';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get User by ID\n * Retrieves details of a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get my User\n * Retrieves details of the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMe(options: GetMeOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/me';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unrepost Post\n * Causes the authenticated user to unrepost a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to repost the Post.\n\n\n\n * @param sourceTweetId The ID of the Post that the User is requesting to unretweet.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unrepostPost(\n id: string,\n sourceTweetId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/retweets/{source_tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace(\n '{source_tweet_id}',\n encodeURIComponent(String(sourceTweetId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unmute User\n * Causes the authenticated user to unmute a specific user by their ID.\n\n\n * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User.\n\n\n\n * @param targetUserId The ID of the User that the source User is requesting to unmute.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unmuteUser(\n sourceUserId: string,\n targetUserId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{source_user_id}/muting/{target_user_id}';\n\n path = path.replace(\n '{source_user_id}',\n encodeURIComponent(String(sourceUserId))\n );\n\n path = path.replace(\n '{target_user_id}',\n encodeURIComponent(String(targetUserId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Users\n * Retrieves a list of Users matching a search query.\n\n\n\n * @param query TThe the query string by which to query for users.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: any,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n nextToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get pinned Lists\n * Retrieves a list of Lists pinned by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPinnedLists(\n id: string,\n options: GetPinnedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Pin List\n * Causes the authenticated user to pin a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will pin the List.\n\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async pinList(id: string, body: PinListRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get followed Lists\n * Retrieves a list of Lists followed by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowedLists(\n id: string,\n options: GetFollowedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Follow List\n * Causes the authenticated user to follow a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will follow the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async followList(\n id: string,\n options: FollowListOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Like Post\n * Causes the authenticated user to Like a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to like the Post.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async likePost(\n id: string,\n options: LikePostOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/likes';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get liked Posts\n * Retrieves a list of Posts liked by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getLikedPosts(\n id: string,\n options: GetLikedPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/liked_tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Users by usernames\n * Retrieves details of multiple Users by their usernames.\n\n\n\n * @param usernames A list of usernames, comma-separated.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByUsernames(\n usernames: Array,\n options: GetByUsernamesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/by';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (usernames !== undefined && usernames.length > 0) {\n params.append('usernames', usernames.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Repost Post\n * Causes the authenticated user to repost a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to repost the Post.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async repostPost(\n id: string,\n options: RepostPostOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/retweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unfollow User\n * Causes the authenticated user to unfollow a specific user by their ID.\n\n\n * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User.\n\n\n\n * @param targetUserId The ID of the User that the source User is requesting to unfollow.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unfollowUser(\n sourceUserId: string,\n targetUserId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{source_user_id}/following/{target_user_id}';\n\n path = path.replace(\n '{source_user_id}',\n encodeURIComponent(String(sourceUserId))\n );\n\n path = path.replace(\n '{target_user_id}',\n encodeURIComponent(String(targetUserId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get followers\n * Retrieves a list of Users who follow a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowers(\n id: string,\n options: GetFollowersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Users by IDs\n * Retrieves details of multiple Users by their IDs.\n\n\n\n * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmarks by folder ID\n * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarksByFolderId(\n id: string,\n folderId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/folders/{folder_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{folder_id}', encodeURIComponent(String(folderId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmark folders\n * Retrieves a list of Bookmark folders created by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarkFolders(\n id: string,\n options: GetBookmarkFoldersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/folders';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get following\n * Retrieves a list of Users followed by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowing(\n id: string,\n options: GetFollowingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/following';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Follow User\n * Causes the authenticated user to follow a specific user by their ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to follow the target User.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async followUser(\n id: string,\n options: FollowUserOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/following';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Timeline\n * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline.\n\n\n * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getTimeline(\n id: string,\n options: GetTimelineOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/timelines/reverse_chronological';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unblock DMs\n * Unblocks direct messages to or from a specific User by their ID for the authenticated user.\n\n\n * @param id The ID of the target User that the authenticated user requesting to unblock dms for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unblockDms(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/dm/unblock';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get mentions\n * Retrieves a list of Posts that mention a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMentions(\n id: string,\n options: GetMentionsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/mentions';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List memberships\n * Retrieves a list of Lists that a specific User is a member of by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getListMemberships(\n id: string,\n options: GetListMembershipsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/list_memberships';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposts of me\n * Retrieves a list of Posts that repost content from the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getRepostsOfMe(\n options: GetRepostsOfMeOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/reposts_of_me';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['timeline.read', 'tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for users operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for unlikePost\n * \n * @public\n */\nexport type UnlikePostResponse = Schemas.UsersLikesDeleteResponse;\n/**\n * Response for getOwnedLists\n * \n * @public\n */\nexport type GetOwnedListsResponse = Schemas.Get2UsersIdOwnedListsResponse;\n/**\n * Response for getBlocking\n * \n * @public\n */\nexport type GetBlockingResponse = Schemas.Get2UsersIdBlockingResponse;\n/**\n * Response for deleteBookmark\n * \n * @public\n */\nexport type DeleteBookmarkResponse = Schemas.BookmarkMutationResponse;\n/**\n * Response for getByUsername\n * \n * @public\n */\nexport type GetByUsernameResponse = Schemas.Get2UsersByUsernameUsernameResponse;\n/**\n * Response for unpinList\n * \n * @public\n */\nexport type UnpinListResponse = Schemas.ListUnpinResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2UsersIdTweetsResponse;\n/**\n * Response for getBookmarks\n * \n * @public\n */\nexport type GetBookmarksResponse = Schemas.Get2UsersIdBookmarksResponse;\n/**\n * Request for createBookmark\n * \n * @public\n */\nexport type CreateBookmarkRequest = Schemas.BookmarkAddRequest;\n/**\n * Response for createBookmark\n * \n * @public\n */\nexport type CreateBookmarkResponse = Schemas.BookmarkMutationResponse;\n/**\n * Response for blockDms\n * \n * @public\n */\nexport type BlockDmsResponse = Schemas.UsersDMBlockCreateResponse;\n/**\n * Response for unfollowList\n * \n * @public\n */\nexport type UnfollowListResponse = Schemas.ListFollowedResponse;\n/**\n * Response for getMuting\n * \n * @public\n */\nexport type GetMutingResponse = Schemas.Get2UsersIdMutingResponse;\n\n/**\n * Request for muteUser\n * \n * @public\n */\nexport type { MuteUserRequest as MuteUserRequest } from '../schemas.js';\n/**\n * Response for muteUser\n * \n * @public\n */\nexport type MuteUserResponse = Schemas.MuteUserMutationResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2UsersIdResponse;\n/**\n * Response for getMe\n * \n * @public\n */\nexport type GetMeResponse = Schemas.Get2UsersMeResponse;\n/**\n * Response for unrepostPost\n * \n * @public\n */\nexport type UnrepostPostResponse = Schemas.UsersRetweetsDeleteResponse;\n/**\n * Response for unmuteUser\n * \n * @public\n */\nexport type UnmuteUserResponse = Schemas.MuteUserMutationResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2UsersSearchResponse;\n/**\n * Response for getPinnedLists\n * \n * @public\n */\nexport type GetPinnedListsResponse = Schemas.Get2UsersIdPinnedListsResponse;\n/**\n * Request for pinList\n * \n * @public\n */\nexport type PinListRequest = Schemas.ListPinnedRequest;\n/**\n * Response for pinList\n * \n * @public\n */\nexport type PinListResponse = Schemas.ListPinnedResponse;\n/**\n * Response for getFollowedLists\n * \n * @public\n */\nexport type GetFollowedListsResponse = Schemas.Get2UsersIdFollowedListsResponse;\n/**\n * Request for followList\n * \n * @public\n */\nexport type FollowListRequest = Schemas.ListFollowedRequest;\n/**\n * Response for followList\n * \n * @public\n */\nexport type FollowListResponse = Schemas.ListFollowedResponse;\n/**\n * Request for likePost\n * \n * @public\n */\nexport type LikePostRequest = Schemas.UsersLikesCreateRequest;\n/**\n * Response for likePost\n * \n * @public\n */\nexport type LikePostResponse = Schemas.UsersLikesCreateResponse;\n/**\n * Response for getLikedPosts\n * \n * @public\n */\nexport type GetLikedPostsResponse = Schemas.Get2UsersIdLikedTweetsResponse;\n/**\n * Response for getByUsernames\n * \n * @public\n */\nexport type GetByUsernamesResponse = Schemas.Get2UsersByResponse;\n/**\n * Request for repostPost\n * \n * @public\n */\nexport type RepostPostRequest = Schemas.UsersRetweetsCreateRequest;\n/**\n * Response for repostPost\n * \n * @public\n */\nexport type RepostPostResponse = Schemas.UsersRetweetsCreateResponse;\n/**\n * Response for unfollowUser\n * \n * @public\n */\nexport type UnfollowUserResponse = Schemas.UsersFollowingDeleteResponse;\n/**\n * Response for getFollowers\n * \n * @public\n */\nexport type GetFollowersResponse = Schemas.Get2UsersIdFollowersResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2UsersResponse;\n/**\n * Response for getBookmarksByFolderId\n * \n * @public\n */\nexport type GetBookmarksByFolderIdResponse = Schemas.BookmarkFolderPostsResponse;\n/**\n * Response for getBookmarkFolders\n * \n * @public\n */\nexport type GetBookmarkFoldersResponse = Schemas.BookmarkFoldersResponse;\n/**\n * Response for getFollowing\n * \n * @public\n */\nexport type GetFollowingResponse = Schemas.Get2UsersIdFollowingResponse;\n/**\n * Request for followUser\n * \n * @public\n */\nexport type FollowUserRequest = Schemas.UsersFollowingCreateRequest;\n/**\n * Response for followUser\n * \n * @public\n */\nexport type FollowUserResponse = Schemas.UsersFollowingCreateResponse;\n/**\n * Response for getTimeline\n * \n * @public\n */\nexport type GetTimelineResponse = Schemas.Get2UsersIdTimelinesReverseChronologicalResponse;\n/**\n * Response for unblockDms\n * \n * @public\n */\nexport type UnblockDmsResponse = Schemas.UsersDMUnBlockCreateResponse;\n/**\n * Response for getMentions\n * \n * @public\n */\nexport type GetMentionsResponse = Schemas.Get2UsersIdMentionsResponse;\n/**\n * Response for getListMemberships\n * \n * @public\n */\nexport type GetListMembershipsResponse = Schemas.Get2UsersIdListMembershipsResponse;\n/**\n * Response for getRepostsOfMe\n * \n * @public\n */\nexport type GetRepostsOfMeResponse = Schemas.Get2UsersRepostsOfMeResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * direct messages client for the X API.\n *\n * This module provides a client for interacting with the direct messages endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetEventsByParticipantIdResponse,\n CreateByConversationIdRequest,\n CreateByConversationIdResponse,\n CreateByParticipantIdRequest,\n CreateByParticipantIdResponse,\n CreateConversationRequest,\n CreateConversationResponse,\n GetEventsByIdResponse,\n DeleteEventsResponse,\n GetEventsResponse,\n GetEventsByConversationIdResponse,\n} from './models.js';\n\n/**\n * Options for getEventsByParticipantId method\n * \n * @public\n */\nexport interface GetEventsByParticipantIdOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createByConversationId method\n * \n * @public\n */\nexport interface CreateByConversationIdOptions {\n /** Request body */\n body?: CreateByConversationIdRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createByParticipantId method\n * \n * @public\n */\nexport interface CreateByParticipantIdOptions {\n /** Request body */\n body?: CreateByParticipantIdRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createConversation method\n * \n * @public\n */\nexport interface CreateConversationOptions {\n /** Request body */\n body?: CreateConversationRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsById method\n * \n * @public\n */\nexport interface GetEventsByIdOptions {\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEvents method\n * \n * @public\n */\nexport interface GetEventsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsByConversationId method\n * \n * @public\n */\nexport interface GetEventsByConversationIdOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for direct messages operations\n * \n * This client provides methods for interacting with the direct messages endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all direct messages related operations.\n * \n * @category direct messages\n */\nexport class DirectMessagesClient {\n private client: Client;\n\n /**\n * Creates a new direct messages client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get DM events for a DM conversation\n * Retrieves direct message events for a specific conversation.\n\n\n * @param participantId The ID of the participant user for the One to One DM conversation.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsByParticipantId(\n participantId: string,\n options: GetEventsByParticipantIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/with/{participant_id}/dm_events';\n\n path = path.replace(\n '{participant_id}',\n encodeURIComponent(String(participantId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM message by conversation ID\n * Sends a new direct message to a specific conversation by its ID.\n\n\n * @param dmConversationId The DM Conversation ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createByConversationId(\n dmConversationId: string,\n options: CreateByConversationIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/{dm_conversation_id}/messages';\n\n path = path.replace(\n '{dm_conversation_id}',\n encodeURIComponent(String(dmConversationId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM message by participant ID\n * Sends a new direct message to a specific participant by their ID.\n\n\n * @param participantId The ID of the recipient user that will receive the DM.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createByParticipantId(\n participantId: string,\n options: CreateByParticipantIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/with/{participant_id}/messages';\n\n path = path.replace(\n '{participant_id}',\n encodeURIComponent(String(participantId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM conversation\n * Initiates a new direct message conversation with specified participants.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createConversation(\n options: CreateConversationOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM event by ID\n * Retrieves details of a specific direct message event by its ID.\n\n\n * @param eventId dm event id.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsById(\n eventId: string,\n options: GetEventsByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_events/{event_id}';\n\n path = path.replace('{event_id}', encodeURIComponent(String(eventId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete DM event\n * Deletes a specific direct message event by its ID, if owned by the authenticated user.\n\n\n * @param eventId The ID of the direct-message event to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteEvents(eventId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/dm_events/{event_id}';\n\n path = path.replace('{event_id}', encodeURIComponent(String(eventId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events\n * Retrieves a list of recent direct message events across all conversations.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEvents(options: GetEventsOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_events';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events for a DM conversation\n * Retrieves direct message events for a specific conversation.\n\n\n * @param id The DM conversation ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsByConversationId(\n id: string,\n options: GetEventsByConversationIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/{id}/dm_events';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for direct messages operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getEventsByParticipantId\n * \n * @public\n */\nexport type GetEventsByParticipantIdResponse = Schemas.Get2DmConversationsWithParticipantIdDmEventsResponse;\n/**\n * Request for createByConversationId\n * \n * @public\n */\nexport type CreateByConversationIdRequest = Schemas.CreateMessageRequest;\n/**\n * Response for createByConversationId\n * \n * @public\n */\nexport type CreateByConversationIdResponse = Schemas.CreateDmEventResponse;\n/**\n * Request for createByParticipantId\n * \n * @public\n */\nexport type CreateByParticipantIdRequest = Schemas.CreateMessageRequest;\n/**\n * Response for createByParticipantId\n * \n * @public\n */\nexport type CreateByParticipantIdResponse = Schemas.CreateDmEventResponse;\n/**\n * Request for createConversation\n * \n * @public\n */\nexport type CreateConversationRequest = Schemas.CreateDmConversationRequest;\n/**\n * Response for createConversation\n * \n * @public\n */\nexport type CreateConversationResponse = Schemas.CreateDmEventResponse;\n/**\n * Response for getEventsById\n * \n * @public\n */\nexport type GetEventsByIdResponse = Schemas.Get2DmEventsEventIdResponse;\n/**\n * Response for deleteEvents\n * \n * @public\n */\nexport type DeleteEventsResponse = Schemas.DeleteDmResponse;\n/**\n * Response for getEvents\n * \n * @public\n */\nexport type GetEventsResponse = Schemas.Get2DmEventsResponse;\n/**\n * Response for getEventsByConversationId\n * \n * @public\n */\nexport type GetEventsByConversationIdResponse = Schemas.Get2DmConversationsIdDmEventsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * community notes client for the X API.\n *\n * This module provides a client for interacting with the community notes endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n DeleteResponse,\n SearchEligiblePostsResponse,\n EvaluateRequest,\n EvaluateResponse,\n SearchWrittenResponse,\n CreateRequest,\n CreateResponse,\n} from './models.js';\n\n/**\n * Options for searchEligiblePosts method\n * \n * @public\n */\nexport interface SearchEligiblePostsOptions {\n /** Pagination token to get next set of posts eligible for notes. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Max results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. \n * Also accepts: post_selection or proper camelCase (e.g., postSelection) */\n postSelection?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for evaluate method\n * \n * @public\n */\nexport interface EvaluateOptions {\n /** Request body */\n body?: EvaluateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchWritten method\n * \n * @public\n */\nexport interface SearchWrittenOptions {\n /** Pagination token to get next set of posts eligible for notes. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Max results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Note fields to display. \n * Also accepts: note.fields or proper camelCase (e.g., noteFields) */\n noteFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for community notes operations\n * \n * This client provides methods for interacting with the community notes endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all community notes related operations.\n * \n * @category community notes\n */\nexport class CommunityNotesClient {\n private client: Client;\n\n /**\n * Creates a new community notes client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Delete a Community Note\n * Deletes a community note.\n\n\n * @param id The community note id to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/notes/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search for Posts Eligible for Community Notes\n * Returns all the posts that are eligible for community notes.\n\n\n\n * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchEligiblePosts(\n testMode: boolean,\n options: SearchEligiblePostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n post_selection: 'postSelection',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n postSelection = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes/search/posts_eligible_for_notes';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (testMode !== undefined) {\n params.append('test_mode', String(testMode));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (postSelection !== undefined) {\n params.append('post_selection', String(postSelection));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Evaluate a Community Note\n * Endpoint to evaluate a community note.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async evaluate(options: EvaluateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/evaluate_note';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search for Community Notes Written\n * Returns all the community notes written by the user.\n\n\n\n * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchWritten(\n testMode: boolean,\n options: SearchWrittenOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n 'note.fields': 'noteFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n noteFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes/search/notes_written';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (testMode !== undefined) {\n params.append('test_mode', String(testMode));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (noteFields !== undefined && noteFields.length > 0) {\n params.append('note.fields', noteFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create a Community Note\n * Creates a community note endpoint for LLM use case.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for community notes operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.DeleteNoteResponse;\n/**\n * Response for searchEligiblePosts\n * \n * @public\n */\nexport type SearchEligiblePostsResponse = Schemas.Get2NotesSearchPostsEligibleForNotesResponse;\n/**\n * Request for evaluate\n * \n * @public\n */\nexport type EvaluateRequest = Schemas.EvaluateNoteRequest;\n/**\n * Response for evaluate\n * \n * @public\n */\nexport type EvaluateResponse = Schemas.EvaluateNoteResponse;\n/**\n * Response for searchWritten\n * \n * @public\n */\nexport type SearchWrittenResponse = Schemas.Get2NotesSearchNotesWrittenResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.CreateNoteRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.CreateNoteResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * posts client for the X API.\n *\n * This module provides a client for interacting with the posts endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n HideReplyRequest,\n HideReplyResponse,\n GetAnalyticsResponse,\n GetInsightsHistoricalResponse,\n GetCountsRecentResponse,\n GetCountsAllResponse,\n GetRepostsResponse,\n GetByIdResponse,\n DeleteResponse,\n GetRepostedByResponse,\n GetInsights28hrResponse,\n GetByIdsResponse,\n CreateRequest,\n CreateResponse,\n GetLikingUsersResponse,\n SearchAllResponse,\n GetQuotedResponse,\n SearchRecentResponse,\n} from './models.js';\n\n/**\n * Options for hideReply method\n * \n * @public\n */\nexport interface HideReplyOptions {\n /** Request body */\n body?: HideReplyRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getAnalytics method\n * \n * @public\n */\nexport interface GetAnalyticsOptions {\n /** A comma separated list of Analytics fields to display. \n * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */\n analyticsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getInsightsHistorical method\n * \n * @public\n */\nexport interface GetInsightsHistoricalOptions {\n /** A comma separated list of Engagement fields to display. \n * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */\n engagementFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getCountsRecent method\n * \n * @public\n */\nexport interface GetCountsRecentOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The granularity for the search counts results. \n * Also accepts: granularity or proper camelCase (e.g., granularity) */\n granularity?: string;\n\n /** A comma separated list of SearchCount fields to display. \n * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */\n searchCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getCountsAll method\n * \n * @public\n */\nexport interface GetCountsAllOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The granularity for the search counts results. \n * Also accepts: granularity or proper camelCase (e.g., granularity) */\n granularity?: string;\n\n /** A comma separated list of SearchCount fields to display. \n * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */\n searchCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getReposts method\n * \n * @public\n */\nexport interface GetRepostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getRepostedBy method\n * \n * @public\n */\nexport interface GetRepostedByOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getInsights28hr method\n * \n * @public\n */\nexport interface GetInsights28hrOptions {\n /** A comma separated list of Engagement fields to display. \n * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */\n engagementFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getLikingUsers method\n * \n * @public\n */\nexport interface GetLikingUsersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchAll method\n * \n * @public\n */\nexport interface SearchAllOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** This order in which to return results. \n * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */\n sortOrder?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getQuoted method\n * \n * @public\n */\nexport interface GetQuotedOptions {\n /** The maximum number of results to be returned. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchRecent method\n * \n * @public\n */\nexport interface SearchRecentOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** This order in which to return results. \n * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */\n sortOrder?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for posts operations\n * \n * This client provides methods for interacting with the posts endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all posts related operations.\n * \n * @category posts\n */\nexport class PostsClient {\n private client: Client;\n\n /**\n * Creates a new posts client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Hide reply\n * Hides or unhides a reply to a conversation owned by the authenticated user.\n\n\n * @param tweetId The ID of the reply that you want to hide or unhide.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async hideReply(\n tweetId: string,\n options: HideReplyOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{tweet_id}/hidden';\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.moderate.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Post analytics\n * Retrieves analytics data for specified Posts within a defined time range.\n\n\n\n * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity The granularity for the search counts results.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAnalytics(\n ids: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n options: GetAnalyticsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'analytics.fields': 'analyticsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n analyticsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/analytics';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (analyticsFields !== undefined && analyticsFields.length > 0) {\n params.append('analytics.fields', analyticsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get historical Post insights\n * Retrieves historical engagement metrics for specified Posts within a defined time range.\n\n\n\n * @param tweetIds List of PostIds for historical metrics.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity granularity of metrics response.\n\n\n\n * @param requestedMetrics request metrics for historical request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getInsightsHistorical(\n tweetIds: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n requestedMetrics: Array,\n options: GetInsightsHistoricalOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'engagement.fields': 'engagementFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n engagementFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/insights/historical';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetIds !== undefined && tweetIds.length > 0) {\n params.append('tweet_ids', tweetIds.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (requestedMetrics !== undefined && requestedMetrics.length > 0) {\n params.append('requested_metrics', requestedMetrics.join(','));\n }\n\n if (engagementFields !== undefined && engagementFields.length > 0) {\n params.append('engagement.fields', engagementFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get count of recent Posts\n * Retrieves the count of Posts from the last 7 days matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getCountsRecent(\n query: string,\n options: GetCountsRecentOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'search_count.fields': 'searchCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n granularity = undefined,\n\n searchCountFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/counts/recent';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (searchCountFields !== undefined && searchCountFields.length > 0) {\n params.append('search_count.fields', searchCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get count of all Posts\n * Retrieves the count of Posts matching a search query from the full archive.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getCountsAll(\n query: string,\n options: GetCountsAllOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'search_count.fields': 'searchCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n granularity = undefined,\n\n searchCountFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/counts/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (searchCountFields !== undefined && searchCountFields.length > 0) {\n params.append('search_count.fields', searchCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposts\n * Retrieves a list of Posts that repost a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getReposts(\n id: string,\n options: GetRepostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/retweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Post by ID\n * Retrieves details of a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Post\n * Deletes a specific Post by its ID, if owned by the authenticated user.\n\n\n * @param id The ID of the Post to be deleted.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposted by\n * Retrieves a list of Users who reposted a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getRepostedBy(\n id: string,\n options: GetRepostedByOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/retweeted_by';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get 28-hour Post insights\n * Retrieves engagement metrics for specified Posts over the last 28 hours.\n\n\n\n * @param tweetIds List of PostIds for 28hr metrics.\n\n\n\n * @param granularity granularity of metrics response.\n\n\n\n * @param requestedMetrics request metrics for historical request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getInsights28hr(\n tweetIds: Array,\n granularity: string,\n requestedMetrics: Array,\n options: GetInsights28hrOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'engagement.fields': 'engagementFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n engagementFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/insights/28hr';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetIds !== undefined && tweetIds.length > 0) {\n params.append('tweet_ids', tweetIds.join(','));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (requestedMetrics !== undefined && requestedMetrics.length > 0) {\n params.append('requested_metrics', requestedMetrics.join(','));\n }\n\n if (engagementFields !== undefined && engagementFields.length > 0) {\n params.append('engagement.fields', engagementFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Posts by IDs\n * Retrieves details of multiple Posts by their IDs.\n\n\n\n * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create or Edit Post\n * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided.\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(body: CreateRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Liking Users\n * Retrieves a list of Users who liked a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getLikingUsers(\n id: string,\n options: GetLikingUsersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/liking_users';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search all Posts\n * Retrieves Posts from the full archive matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchAll(\n query: string,\n options: SearchAllOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n sort_order: 'sortOrder',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n sortOrder = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (sortOrder !== undefined) {\n params.append('sort_order', String(sortOrder));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Quoted Posts\n * Retrieves a list of Posts that quote a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getQuoted(\n id: string,\n options: GetQuotedOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/quote_tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search recent Posts\n * Retrieves Posts from the last 7 days matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchRecent(\n query: string,\n options: SearchRecentOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n sort_order: 'sortOrder',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n sortOrder = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/recent';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (sortOrder !== undefined) {\n params.append('sort_order', String(sortOrder));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for posts operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Request for hideReply\n * \n * @public\n */\nexport type HideReplyRequest = Schemas.TweetHideRequest;\n/**\n * Response for hideReply\n * \n * @public\n */\nexport type HideReplyResponse = Schemas.TweetHideResponse;\n/**\n * Response for getAnalytics\n * \n * @public\n */\nexport type GetAnalyticsResponse = Schemas.Analytics;\n/**\n * Response for getInsightsHistorical\n * \n * @public\n */\nexport type GetInsightsHistoricalResponse = Schemas.Get2InsightsHistoricalResponse;\n/**\n * Response for getCountsRecent\n * \n * @public\n */\nexport type GetCountsRecentResponse = Schemas.Get2TweetsCountsRecentResponse;\n/**\n * Response for getCountsAll\n * \n * @public\n */\nexport type GetCountsAllResponse = Schemas.Get2TweetsCountsAllResponse;\n/**\n * Response for getReposts\n * \n * @public\n */\nexport type GetRepostsResponse = Schemas.Get2TweetsIdRetweetsResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2TweetsIdResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.TweetDeleteResponse;\n/**\n * Response for getRepostedBy\n * \n * @public\n */\nexport type GetRepostedByResponse = Schemas.Get2TweetsIdRetweetedByResponse;\n/**\n * Response for getInsights28hr\n * \n * @public\n */\nexport type GetInsights28hrResponse = Schemas.Get2Insights28hrResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2TweetsResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.TweetCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.TweetCreateResponse;\n/**\n * Response for getLikingUsers\n * \n * @public\n */\nexport type GetLikingUsersResponse = Schemas.Get2TweetsIdLikingUsersResponse;\n/**\n * Response for searchAll\n * \n * @public\n */\nexport type SearchAllResponse = Schemas.Get2TweetsSearchAllResponse;\n/**\n * Response for getQuoted\n * \n * @public\n */\nexport type GetQuotedResponse = Schemas.Get2TweetsIdQuoteTweetsResponse;\n/**\n * Response for searchRecent\n * \n * @public\n */\nexport type SearchRecentResponse = Schemas.Get2TweetsSearchRecentResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * trends client for the X API.\n *\n * This module provides a client for interacting with the trends endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetAiResponse,\n GetByWoeidResponse,\n GetPersonalizedResponse,\n} from './models.js';\n\n/**\n * Options for getAi method\n * \n * @public\n */\nexport interface GetAiOptions {\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByWoeid method\n * \n * @public\n */\nexport interface GetByWoeidOptions {\n /** The maximum number of results. \n * Also accepts: max_trends or proper camelCase (e.g., maxTrends) */\n maxTrends?: number;\n\n /** A comma separated list of Trend fields to display. \n * Also accepts: trend.fields or proper camelCase (e.g., trendFields) */\n trendFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPersonalized method\n * \n * @public\n */\nexport interface GetPersonalizedOptions {\n /** A comma separated list of PersonalizedTrend fields to display. \n * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */\n personalizedTrendFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for trends operations\n * \n * This client provides methods for interacting with the trends endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all trends related operations.\n * \n * @category trends\n */\nexport class TrendsClient {\n private client: Client;\n\n /**\n * Creates a new trends client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get AI Trends by ID\n * Retrieves an AI trend by its ID.\n\n\n * @param id The ID of the ai trend.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAi(id: string, options: GetAiOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/ai_trends/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Trends by WOEID\n * Retrieves trending topics for a specific location identified by its WOEID.\n\n\n * @param woeid The WOEID of the place to lookup a trend for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByWoeid(\n woeid: number,\n options: GetByWoeidOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_trends: 'maxTrends',\n\n 'trend.fields': 'trendFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxTrends = undefined,\n\n trendFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/trends/by/woeid/{woeid}';\n\n path = path.replace('{woeid}', encodeURIComponent(String(woeid)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxTrends !== undefined) {\n params.append('max_trends', String(maxTrends));\n }\n\n if (trendFields !== undefined && trendFields.length > 0) {\n params.append('trend.fields', trendFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get personalized Trends\n * Retrieves personalized trending topics for the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPersonalized(\n options: GetPersonalizedOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'personalized_trend.fields': 'personalizedTrendFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n personalizedTrendFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/personalized_trends';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (\n personalizedTrendFields !== undefined &&\n personalizedTrendFields.length > 0\n ) {\n params.append(\n 'personalized_trend.fields',\n personalizedTrendFields.join(',')\n );\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for trends operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getAi\n * \n * @public\n */\nexport type GetAiResponse = Schemas.Get2AiTrendsIdResponse;\n/**\n * Response for getByWoeid\n * \n * @public\n */\nexport type GetByWoeidResponse = Schemas.Get2TrendsByWoeidWoeidResponse;\n/**\n * Response for getPersonalized\n * \n * @public\n */\nexport type GetPersonalizedResponse = Schemas.Get2UsersPersonalizedTrendsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * activity client for the X API.\n *\n * This module provides a client for interacting with the activity endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetSubscriptionsResponse,\n CreateSubscriptionRequest,\n CreateSubscriptionResponse,\n UpdateSubscriptionRequest,\n UpdateSubscriptionResponse,\n DeleteSubscriptionResponse,\n StreamResponse,\n} from './models.js';\n\n/**\n * Options for createSubscription method\n * \n * @public\n */\nexport interface CreateSubscriptionOptions {\n /** Request body */\n body?: CreateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for updateSubscription method\n * \n * @public\n */\nexport interface UpdateSubscriptionOptions {\n /** Request body */\n body?: UpdateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for stream method\n * \n * @public\n */\nexport interface StreamOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for activity operations\n * \n * This client provides methods for interacting with the activity endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all activity related operations.\n * \n * @category activity\n */\nexport class ActivityClient {\n private client: Client;\n\n /**\n * Creates a new activity client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get X activity subscriptions\n * Get a list of active subscriptions for XAA\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptions(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create X activity subscription\n * Creates a subscription for an X activity event\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubscription(\n options: CreateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update X activity subscription\n * Updates a subscription for an X activity event\n\n\n * @param subscriptionId The ID of the subscription to update.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async updateSubscription(\n subscriptionId: string,\n options: UpdateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions/{subscription_id}';\n\n path = path.replace(\n '{subscription_id}',\n encodeURIComponent(String(subscriptionId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Deletes X activity subscription\n * Deletes a subscription for an X activity event\n\n\n * @param subscriptionId The ID of the subscription to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubscription(\n subscriptionId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions/{subscription_id}';\n\n path = path.replace(\n '{subscription_id}',\n encodeURIComponent(String(subscriptionId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Activity Stream\n * Stream of X Activities\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async stream(options: StreamOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for activity operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getSubscriptions\n * \n * @public\n */\nexport type GetSubscriptionsResponse = Schemas.ActivitySubscriptionGetResponse;\n/**\n * Request for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionRequest = Schemas.ActivitySubscriptionCreateRequest;\n/**\n * Response for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionResponse = Schemas.ActivitySubscriptionCreateResponse;\n/**\n * Request for updateSubscription\n * \n * @public\n */\nexport type UpdateSubscriptionRequest = Schemas.ActivitySubscriptionUpdateRequest;\n/**\n * Response for updateSubscription\n * \n * @public\n */\nexport type UpdateSubscriptionResponse = Schemas.ActivitySubscriptionUpdateResponse;\n/**\n * Response for deleteSubscription\n * \n * @public\n */\nexport type DeleteSubscriptionResponse = Schemas.ActivitySubscriptionDeleteResponse;\n/**\n * Response for stream\n * \n * @public\n */\nexport type StreamResponse = Schemas.ActivityStreamingResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * usage client for the X API.\n *\n * This module provides a client for interacting with the usage endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetResponse } from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** The number of days for which you need usage for. \n * Also accepts: days or proper camelCase (e.g., days) */\n days?: number;\n\n /** A comma separated list of Usage fields to display. \n * Also accepts: usage.fields or proper camelCase (e.g., usageFields) */\n usageFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for usage operations\n * \n * This client provides methods for interacting with the usage endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all usage related operations.\n * \n * @category usage\n */\nexport class UsageClient {\n private client: Client;\n\n /**\n * Creates a new usage client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get usage\n * Retrieves usage statistics for Posts over a specified number of days.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'usage.fields': 'usageFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n days = undefined,\n\n usageFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/usage/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (days !== undefined) {\n params.append('days', String(days));\n }\n\n if (usageFields !== undefined && usageFields.length > 0) {\n params.append('usage.fields', usageFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for usage operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2UsageTweetsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * spaces client for the X API.\n *\n * This module provides a client for interacting with the spaces endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetPostsResponse,\n SearchResponse,\n GetByIdResponse,\n GetByCreatorIdsResponse,\n GetBuyersResponse,\n GetByIdsResponse,\n} from './models.js';\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The state of Spaces to search for. \n * Also accepts: state or proper camelCase (e.g., state) */\n state?: string;\n\n /** The number of results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByCreatorIds method\n * \n * @public\n */\nexport interface GetByCreatorIdsOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBuyers method\n * \n * @public\n */\nexport interface GetBuyersOptions {\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for spaces operations\n * \n * This client provides methods for interacting with the spaces endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all spaces related operations.\n * \n * @category spaces\n */\nexport class SpacesClient {\n private client: Client;\n\n /**\n * Creates a new spaces client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Space Posts\n * Retrieves a list of Posts shared in a specific Space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Spaces\n * Retrieves a list of Spaces matching the specified search query.\n\n\n\n * @param query The search query.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n state = undefined,\n\n maxResults = undefined,\n\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (state !== undefined) {\n params.append('state', String(state));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get space by ID\n * Retrieves details of a specific space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Spaces by creator IDs\n * Retrieves details of Spaces created by specified User IDs.\n\n\n\n * @param userIds The IDs of Users to search through.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByCreatorIds(\n userIds: Array,\n options: GetByCreatorIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/by/creator_ids';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userIds !== undefined && userIds.length > 0) {\n params.append('user_ids', userIds.join(','));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Space ticket buyers\n * Retrieves a list of Users who purchased tickets to a specific Space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBuyers(\n id: string,\n options: GetBuyersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}/buyers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Spaces by IDs\n * Retrieves details of multiple Spaces by their IDs.\n\n\n\n * @param ids The list of Space IDs to return.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for spaces operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2SpacesIdTweetsResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2SpacesSearchResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2SpacesIdResponse;\n/**\n * Response for getByCreatorIds\n * \n * @public\n */\nexport type GetByCreatorIdsResponse = Schemas.Get2SpacesByCreatorIdsResponse;\n/**\n * Response for getBuyers\n * \n * @public\n */\nexport type GetBuyersResponse = Schemas.Get2SpacesIdBuyersResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2SpacesResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * communities client for the X API.\n *\n * This module provides a client for interacting with the communities endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetByIdResponse, SearchResponse } from './models.js';\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Community fields to display. \n * Also accepts: community.fields or proper camelCase (e.g., communityFields) */\n communityFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Community fields to display. \n * Also accepts: community.fields or proper camelCase (e.g., communityFields) */\n communityFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for communities operations\n * \n * This client provides methods for interacting with the communities endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all communities related operations.\n * \n * @category communities\n */\nexport class CommunitiesClient {\n private client: Client;\n\n /**\n * Creates a new communities client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Community by ID\n * Retrieves details of a specific Community by its ID.\n\n\n * @param id The ID of the Community.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'community.fields': 'communityFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n communityFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/communities/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (communityFields !== undefined && communityFields.length > 0) {\n params.append('community.fields', communityFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Communities\n * Retrieves a list of Communities matching the specified search query.\n\n\n\n * @param query Query to search communities.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'community.fields': 'communityFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n communityFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/communities/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (communityFields !== undefined && communityFields.length > 0) {\n params.append('community.fields', communityFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for communities operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2CommunitiesIdResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2CommunitiesSearchResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * connections client for the X API.\n *\n * This module provides a client for interacting with the connections endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { DeleteAllResponse } from './models.js';\n\n/**\n * Client for connections operations\n * \n * This client provides methods for interacting with the connections endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all connections related operations.\n * \n * @category connections\n */\nexport class ConnectionsClient {\n private client: Client;\n\n /**\n * Creates a new connections client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Terminate all connections\n * Terminates all active streaming connections for the authenticated application.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteAll(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/connections/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for connections operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for deleteAll\n * \n * @public\n */\nexport type DeleteAllResponse = Schemas.KillAllConnectionsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * media client for the X API.\n *\n * This module provides a client for interacting with the media endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetAnalyticsResponse,\n CreateSubtitlesRequest,\n CreateSubtitlesResponse,\n DeleteSubtitlesRequest,\n DeleteSubtitlesResponse,\n InitializeUploadRequest,\n InitializeUploadResponse,\n GetUploadStatusResponse,\n UploadRequest,\n UploadResponse,\n GetByKeyResponse,\n AppendUploadRequest,\n AppendUploadResponse,\n GetByKeysResponse,\n FinalizeUploadResponse,\n CreateMetadataRequest,\n CreateMetadataResponse,\n} from './models.js';\n\n/**\n * Options for getAnalytics method\n * \n * @public\n */\nexport interface GetAnalyticsOptions {\n /** A comma separated list of MediaAnalytics fields to display. \n * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */\n mediaAnalyticsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createSubtitles method\n * \n * @public\n */\nexport interface CreateSubtitlesOptions {\n /** Request body */\n body?: CreateSubtitlesRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for deleteSubtitles method\n * \n * @public\n */\nexport interface DeleteSubtitlesOptions {\n /** Request body */\n body?: DeleteSubtitlesRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for initializeUpload method\n * \n * @public\n */\nexport interface InitializeUploadOptions {\n /** Request body */\n body?: InitializeUploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getUploadStatus method\n * \n * @public\n */\nexport interface GetUploadStatusOptions {\n /** The command for the media upload request. \n * Also accepts: command or proper camelCase (e.g., command) */\n command?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for upload method\n * \n * @public\n */\nexport interface UploadOptions {\n /** Request body */\n body?: UploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByKey method\n * \n * @public\n */\nexport interface GetByKeyOptions {\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for appendUpload method\n * \n * @public\n */\nexport interface AppendUploadOptions {\n /** Request body */\n body?: AppendUploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByKeys method\n * \n * @public\n */\nexport interface GetByKeysOptions {\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createMetadata method\n * \n * @public\n */\nexport interface CreateMetadataOptions {\n /** Request body */\n body?: CreateMetadataRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for media operations\n * \n * This client provides methods for interacting with the media endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all media related operations.\n * \n * @category media\n */\nexport class MediaClient {\n private client: Client;\n\n /**\n * Creates a new media client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Media analytics\n * Retrieves analytics data for media.\n\n\n\n * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity The granularity for the search counts results.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAnalytics(\n mediaKeys: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n options: GetAnalyticsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media_analytics.fields': 'mediaAnalyticsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaAnalyticsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/analytics';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaKeys !== undefined && mediaKeys.length > 0) {\n params.append('media_keys', mediaKeys.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (mediaAnalyticsFields !== undefined && mediaAnalyticsFields.length > 0) {\n params.append('media_analytics.fields', mediaAnalyticsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Media subtitles\n * Creates subtitles for a specific Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubtitles(\n options: CreateSubtitlesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/subtitles';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Media subtitles\n * Deletes subtitles for a specific Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubtitles(\n options: DeleteSubtitlesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/subtitles';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Initialize media upload\n * Initializes a media upload.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async initializeUpload(\n options: InitializeUploadOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload/initialize';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media upload status\n * Retrieves the status of a Media upload by its ID.\n\n\n\n * @param mediaId Media id for the requested media upload status.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getUploadStatus(\n mediaId: any,\n options: GetUploadStatusOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {};\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n command = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaId !== undefined) {\n params.append('media_id', String(mediaId));\n }\n\n if (command !== undefined) {\n params.append('command', String(command));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Upload media\n * Uploads a media file for use in posts or other content.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async upload(options: UploadOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media by media key\n * Retrieves details of a specific Media file by its media key.\n\n\n * @param mediaKey A single Media Key.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByKey(\n mediaKey: string,\n options: GetByKeyOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media.fields': 'mediaFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/{media_key}';\n\n path = path.replace('{media_key}', encodeURIComponent(String(mediaKey)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Append Media upload\n * Appends data to a Media upload request.\n\n\n * @param id The media identifier for the media to perform the append operation.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async appendUpload(\n id: string,\n options: AppendUploadOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload/{id}/append';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media by media keys\n * Retrieves details of Media files by their media keys.\n\n\n\n * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByKeys(\n mediaKeys: Array,\n options: GetByKeysOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media.fields': 'mediaFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaKeys !== undefined && mediaKeys.length > 0) {\n params.append('media_keys', mediaKeys.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Finalize Media upload\n * Finalizes a Media upload request.\n\n\n * @param id The media id of the targeted media to finalize.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async finalizeUpload(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/media/upload/{id}/finalize';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Media metadata\n * Creates metadata for a Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createMetadata(\n options: CreateMetadataOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/metadata';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for media operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getAnalytics\n * \n * @public\n */\nexport type GetAnalyticsResponse = Schemas.MediaAnalytics;\n/**\n * Request for createSubtitles\n * \n * @public\n */\nexport type CreateSubtitlesRequest = Schemas.SubtitlesCreateRequest;\n/**\n * Response for createSubtitles\n * \n * @public\n */\nexport type CreateSubtitlesResponse = Schemas.SubtitlesCreateResponse;\n/**\n * Request for deleteSubtitles\n * \n * @public\n */\nexport type DeleteSubtitlesRequest = Schemas.SubtitlesDeleteRequest;\n/**\n * Response for deleteSubtitles\n * \n * @public\n */\nexport type DeleteSubtitlesResponse = Schemas.SubtitlesDeleteResponse;\n/**\n * Request for initializeUpload\n * \n * @public\n */\nexport type InitializeUploadRequest = Schemas.MediaUploadConfigRequest;\n/**\n * Response for initializeUpload\n * \n * @public\n */\nexport type InitializeUploadResponse = Schemas.MediaUploadResponse;\n/**\n * Response for getUploadStatus\n * \n * @public\n */\nexport type GetUploadStatusResponse = Schemas.MediaUploadResponse;\n/**\n * Request for upload\n * \n * @public\n */\nexport type UploadRequest = Schemas.MediaUploadRequestOneShot;\n/**\n * Response for upload\n * \n * @public\n */\nexport type UploadResponse = Schemas.MediaUploadResponse;\n/**\n * Response for getByKey\n * \n * @public\n */\nexport type GetByKeyResponse = Schemas.Get2MediaMediaKeyResponse;\n/**\n * Request for appendUpload\n * \n * @public\n */\nexport type AppendUploadRequest = Schemas.MediaUploadAppendRequest;\n/**\n * Response for appendUpload\n * \n * @public\n */\nexport type AppendUploadResponse = Schemas.MediaUploadAppendResponse;\n/**\n * Response for getByKeys\n * \n * @public\n */\nexport type GetByKeysResponse = Schemas.Get2MediaResponse;\n/**\n * Response for finalizeUpload\n * \n * @public\n */\nexport type FinalizeUploadResponse = Schemas.MediaUploadResponse;\n/**\n * Request for createMetadata\n * \n * @public\n */\nexport type CreateMetadataRequest = Schemas.MetadataCreateRequest;\n/**\n * Response for createMetadata\n * \n * @public\n */\nexport type CreateMetadataResponse = Schemas.MetadataCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * lists client for the X API.\n *\n * This module provides a client for interacting with the lists endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n RemoveMemberByUserIdResponse,\n GetByIdResponse,\n UpdateRequest,\n UpdateResponse,\n DeleteResponse,\n GetMembersResponse,\n AddMemberRequest,\n AddMemberResponse,\n GetFollowersResponse,\n GetPostsResponse,\n CreateRequest,\n CreateResponse,\n} from './models.js';\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for update method\n * \n * @public\n */\nexport interface UpdateOptions {\n /** Request body */\n body?: UpdateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMembers method\n * \n * @public\n */\nexport interface GetMembersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for addMember method\n * \n * @public\n */\nexport interface AddMemberOptions {\n /** Request body */\n body?: AddMemberRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowers method\n * \n * @public\n */\nexport interface GetFollowersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for lists operations\n * \n * This client provides methods for interacting with the lists endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all lists related operations.\n * \n * @category lists\n */\nexport class ListsClient {\n private client: Client;\n\n /**\n * Creates a new lists client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Remove List member\n * Removes a User from a specific List by its ID and the User’s ID.\n\n\n * @param id The ID of the List to remove a member.\n\n\n\n * @param userId The ID of User that will be removed from the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async removeMemberByUserId(\n id: string,\n userId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members/{user_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{user_id}', encodeURIComponent(String(userId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List by ID\n * Retrieves details of a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update List\n * Updates the details of a specific List owned by the authenticated user by its ID.\n\n\n * @param id The ID of the List to modify.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async update(\n id: string,\n options: UpdateOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete List\n * Deletes a specific List owned by the authenticated user by its ID.\n\n\n * @param id The ID of the List to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List members\n * Retrieves a list of Users who are members of a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMembers(\n id: string,\n options: GetMembersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Add List member\n * Adds a User to a specific List by its ID.\n\n\n * @param id The ID of the List for which to add a member.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async addMember(\n id: string,\n options: AddMemberOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List followers\n * Retrieves a list of Users who follow a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowers(\n id: string,\n options: GetFollowersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/followers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List Posts\n * Retrieves a list of Posts associated with a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create List\n * Creates a new List for the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: [\n 'list.read',\n 'list.write',\n 'tweet.read',\n 'users.read',\n ],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for lists operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for removeMemberByUserId\n * \n * @public\n */\nexport type RemoveMemberByUserIdResponse = Schemas.ListMutateResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2ListsIdResponse;\n/**\n * Request for update\n * \n * @public\n */\nexport type UpdateRequest = Schemas.ListUpdateRequest;\n/**\n * Response for update\n * \n * @public\n */\nexport type UpdateResponse = Schemas.ListUpdateResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.ListDeleteResponse;\n/**\n * Response for getMembers\n * \n * @public\n */\nexport type GetMembersResponse = Schemas.Get2ListsIdMembersResponse;\n/**\n * Request for addMember\n * \n * @public\n */\nexport type AddMemberRequest = Schemas.ListAddUserRequest;\n/**\n * Response for addMember\n * \n * @public\n */\nexport type AddMemberResponse = Schemas.ListMutateResponse;\n/**\n * Response for getFollowers\n * \n * @public\n */\nexport type GetFollowersResponse = Schemas.Get2ListsIdFollowersResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2ListsIdTweetsResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.ListCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.ListCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * compliance client for the X API.\n *\n * This module provides a client for interacting with the compliance endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetJobsByIdResponse,\n GetJobsResponse,\n CreateJobsRequest,\n CreateJobsResponse,\n} from './models.js';\n\n/**\n * Options for getJobsById method\n * \n * @public\n */\nexport interface GetJobsByIdOptions {\n /** A comma separated list of ComplianceJob fields to display. \n * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */\n complianceJobFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getJobs method\n * \n * @public\n */\nexport interface GetJobsOptions {\n /** Status of Compliance Job to list. \n * Also accepts: status or proper camelCase (e.g., status) */\n status?: string;\n\n /** A comma separated list of ComplianceJob fields to display. \n * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */\n complianceJobFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for compliance operations\n * \n * This client provides methods for interacting with the compliance endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all compliance related operations.\n * \n * @category compliance\n */\nexport class ComplianceClient {\n private client: Client;\n\n /**\n * Creates a new compliance client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Compliance Job by ID\n * Retrieves details of a specific Compliance Job by its ID.\n\n\n * @param id The ID of the Compliance Job to retrieve.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getJobsById(\n id: string,\n options: GetJobsByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'compliance_job.fields': 'complianceJobFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n complianceJobFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (complianceJobFields !== undefined && complianceJobFields.length > 0) {\n params.append('compliance_job.fields', complianceJobFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Compliance Jobs\n * Retrieves a list of Compliance Jobs filtered by job type and optional status.\n\n\n\n * @param type Type of Compliance Job to list.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getJobs(\n type: string,\n options: GetJobsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'compliance_job.fields': 'complianceJobFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n status = undefined,\n\n complianceJobFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (type !== undefined) {\n params.append('type', String(type));\n }\n\n if (status !== undefined) {\n params.append('status', String(status));\n }\n\n if (complianceJobFields !== undefined && complianceJobFields.length > 0) {\n params.append('compliance_job.fields', complianceJobFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Compliance Job\n * Creates a new Compliance Job for the specified job type.\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createJobs(body: CreateJobsRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for compliance operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getJobsById\n * \n * @public\n */\nexport type GetJobsByIdResponse = Schemas.Get2ComplianceJobsIdResponse;\n/**\n * Response for getJobs\n * \n * @public\n */\nexport type GetJobsResponse = Schemas.Get2ComplianceJobsResponse;\n/**\n * Request for createJobs\n * \n * @public\n */\nexport type CreateJobsRequest = Schemas.CreateComplianceJobRequest;\n/**\n * Response for createJobs\n * \n * @public\n */\nexport type CreateJobsResponse = Schemas.CreateComplianceJobResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * general client for the X API.\n *\n * This module provides a client for interacting with the general endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetOpenApiSpecResponse } from './models.js';\n\n/**\n * Client for general operations\n * \n * This client provides methods for interacting with the general endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all general related operations.\n * \n * @category general\n */\nexport class GeneralClient {\n private client: Client;\n\n /**\n * Creates a new general client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get OpenAPI Spec.\n * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md)\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getOpenApiSpec(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/openapi.json';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for general operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n\n/**\n * Response for getOpenApiSpec\n * \n * @public\n */\nexport type GetOpenApiSpecResponse = Record;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * account activity client for the X API.\n *\n * This module provides a client for interacting with the account activity endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n ValidateSubscriptionResponse,\n CreateSubscriptionRequest,\n CreateSubscriptionResponse,\n GetSubscriptionCountResponse,\n GetSubscriptionsResponse,\n CreateReplayJobResponse,\n DeleteSubscriptionResponse,\n} from './models.js';\n\n/**\n * Options for createSubscription method\n * \n * @public\n */\nexport interface CreateSubscriptionOptions {\n /** Request body */\n body?: CreateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for account activity operations\n * \n * This client provides methods for interacting with the account activity endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all account activity related operations.\n * \n * @category account activity\n */\nexport class AccountActivityClient {\n private client: Client;\n\n /**\n * Creates a new account activity client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Validate subscription\n * Checks a user’s Account Activity subscription for a given webhook.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async validateSubscription(\n webhookId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create subscription\n * Creates an Account Activity subscription for the user and the given webhook.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubscription(\n webhookId: string,\n options: CreateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get subscription count\n * Retrieves a count of currently active Account Activity subscriptions.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptionCount(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/account_activity/subscriptions/count';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get subscriptions\n * Retrieves a list of all active subscriptions for a given webhook.\n\n\n * @param webhookId The webhook ID to pull subscriptions for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptions(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create replay job\n * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook.\n\n\n * @param webhookId The unique identifier for the webhook configuration.\n\n\n\n\n * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format.\n\n\n\n * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createReplayJob(\n webhookId: string,\n fromDate: string,\n toDate: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (fromDate !== undefined) {\n params.append('from_date', String(fromDate));\n }\n\n if (toDate !== undefined) {\n params.append('to_date', String(toDate));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete subscription\n * Deletes an Account Activity subscription for the given webhook and user ID.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n * @param userId User ID to unsubscribe from.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubscription(\n webhookId: string,\n userId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n path = path.replace('{user_id}', encodeURIComponent(String(userId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for account activity operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for validateSubscription\n * \n * @public\n */\nexport type ValidateSubscriptionResponse = Schemas.SubscriptionsGetResponse;\n/**\n * Request for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionRequest = Schemas.SubscriptionsCreateRequest;\n/**\n * Response for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionResponse = Schemas.SubscriptionsCreateResponse;\n/**\n * Response for getSubscriptionCount\n * \n * @public\n */\nexport type GetSubscriptionCountResponse = Schemas.SubscriptionsCountGetResponse;\n/**\n * Response for getSubscriptions\n * \n * @public\n */\nexport type GetSubscriptionsResponse = Schemas.SubscriptionsListGetResponse;\n/**\n * Response for createReplayJob\n * \n * @public\n */\nexport type CreateReplayJobResponse = Schemas.ReplayJobCreateResponse;\n/**\n * Response for deleteSubscription\n * \n * @public\n */\nexport type DeleteSubscriptionResponse = Schemas.SubscriptionsDeleteResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Event-driven streaming utilities for the X API.\n * \n * This module provides event-driven streaming interfaces that are more user-friendly\n * than manual ReadableStream management.\n */\n\n// Event types for the stream (using string literals for simplicity)\n// Based on actual Twitter API behavior from documentation\nexport const StreamEvent = {\n Data: 'data', // When JSON data arrives\n KeepAlive: 'keepAlive', // 20-second heartbeat (newline character)\n Error: 'error', // HTTP errors, ConnectionException, operational-disconnect\n Close: 'close', // When stream ends\n};\n\n// Event data types\nexport interface StreamDataEvent {\n data: any;\n includes?: any;\n matching_rules?: any[];\n}\n\nexport interface StreamErrorEvent {\n error: Error;\n // Additional error details from the API response\n code?: string;\n status?: number;\n}\n\n/**\n * Event-driven stream class for handling streaming data from the X API.\n * \n * This class provides an event-driven interface for working with streaming endpoints,\n * allowing you to listen to 'data', 'keepAlive', 'error', and 'close' events.\n * \n * @public\n */\nexport class EventDrivenStream {\n private webStream: ReadableStream | null = null;\n private reader: ReadableStreamDefaultReader | null = null;\n private decoder: TextDecoder;\n private isConnected: boolean = false;\n private isClosed: boolean = false;\n private buffer: string = '';\n private eventListeners: Map = new Map();\n private autoReconnect: boolean = false;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = 5;\n private reconnectDelay: number = 1000;\n\n constructor() {\n this.decoder = new TextDecoder();\n this.setupEventListeners();\n }\n\n /**\n * Initialize the stream with a Web ReadableStream\n */\n async connect(webStream: ReadableStream): Promise {\n if (this.isConnected) {\n throw new Error('Stream is already connected');\n }\n\n this.webStream = webStream;\n this.isConnected = true;\n this.isClosed = false;\n this.reconnectAttempts = 0;\n\n this.emit(StreamEvent.Data, { message: 'Stream connected' });\n this.startReading(); // Don't await this - it runs in the background\n }\n\n /**\n * Start reading from the stream\n */\n private async startReading(): Promise {\n if (!this.webStream || !this.isConnected) {\n return;\n }\n\n this.reader = this.webStream.getReader();\n\n try {\n while (this.isConnected && !this.isClosed) {\n const { done, value } = await this.reader.read();\n\n if (done) {\n this.handleConnectionClosed();\n break;\n }\n\n if (value) {\n await this.processChunk(value);\n }\n }\n } catch (error) {\n this.handleConnectionError(error as Error);\n } finally {\n this.cleanup();\n }\n }\n\n /**\n * Process incoming data chunks\n */\n private async processChunk(value: Uint8Array): Promise {\n const chunk = this.decoder.decode(value, { stream: true });\n this.buffer += chunk;\n\n // Process complete lines (ending with newline)\n let boundary;\n while ((boundary = this.buffer.indexOf('\\n')) !== -1) {\n const line = this.buffer.substring(0, boundary);\n this.buffer = this.buffer.substring(boundary + 1);\n\n if (line.trim()) {\n try {\n const data = JSON.parse(line);\n\n // Check if it's a keep-alive signal (20-second heartbeat)\n if (this.isKeepAlive(data)) {\n this.emit(StreamEvent.KeepAlive, { data });\n continue;\n }\n\n // Emit data event for actual content\n this.emit(StreamEvent.Data, data);\n } catch (parseError) {\n // Skip invalid JSON lines - these are usually incomplete chunks\n console.warn('Skipping invalid JSON:', line.substring(0, 100));\n }\n }\n }\n }\n\n /**\n * Check if data is a keep-alive signal (20-second heartbeat)\n * Twitter sends newline characters every 20 seconds to prevent timeouts\n */\n private isKeepAlive(data: any): boolean {\n // Twitter sends empty objects or just newline characters as keep-alive\n return !data.data && !data.includes && !data.matching_rules && !data.errors;\n }\n\n /**\n * Handle connection errors\n */\n private handleConnectionError(error: Error): void {\n this.isConnected = false;\n\n // Emit the error as-is (API returns the actual error details)\n this.emit(StreamEvent.Error, { error });\n\n if (\n this.autoReconnect &&\n this.reconnectAttempts < this.maxReconnectAttempts\n ) {\n this.attemptReconnect();\n }\n }\n\n /**\n * Handle connection closed\n */\n private handleConnectionClosed(): void {\n this.isConnected = false;\n this.emit(StreamEvent.Close, { message: 'Connection closed' });\n }\n\n /**\n * Attempt to reconnect\n */\n private async attemptReconnect(): Promise {\n this.reconnectAttempts++;\n this.emit(StreamEvent.Data, {\n message: `Reconnect attempt ${this.reconnectAttempts}/${this\n .maxReconnectAttempts}`,\n });\n\n // Wait before reconnecting\n await new Promise(resolve =>\n setTimeout(resolve, this.reconnectDelay * this.reconnectAttempts)\n );\n\n try {\n // This would need to be implemented based on how you get a new stream\n // For now, we'll just emit the events\n this.emit(StreamEvent.Error, {\n error: new Error('Reconnect not implemented in this example'),\n });\n } catch (error) {\n this.emit(StreamEvent.Error, { error: error as Error });\n }\n }\n\n /**\n * Clean up resources\n */\n private cleanup(): void {\n if (this.reader) {\n try {\n // Try to release the lock - it will throw if already released\n this.reader.releaseLock();\n } catch (error) {\n // Ignore errors when releasing the lock (already released)\n console.debug('Reader lock already released or error:', error);\n }\n this.reader = null;\n }\n this.buffer = '';\n }\n\n /**\n * Close the stream\n */\n close(): void {\n this.isClosed = true;\n this.isConnected = false;\n this.cleanup();\n this.emit(StreamEvent.Close, { message: 'Stream closed by user' });\n }\n\n /**\n * Add event listener\n */\n on(event: string, listener: Function): this {\n if (!this.eventListeners.has(event)) {\n this.eventListeners.set(event, []);\n }\n this.eventListeners.get(event)!.push(listener);\n return this;\n }\n\n /**\n * Remove event listener\n */\n off(event: string, listener: Function): this {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n const index = listeners.indexOf(listener);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n }\n return this;\n }\n\n /**\n * Emit event to listeners\n */\n private emit(event: string, data: any): void {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n listeners.forEach(listener => {\n try {\n listener(data);\n } catch (error) {\n console.error(`Error in ${event} listener:`, error);\n }\n });\n }\n }\n\n /**\n * Setup default event listeners\n */\n private setupEventListeners(): void {\n // Default error handling\n this.on(StreamEvent.Error, (eventData: StreamErrorEvent) => {\n console.error('Stream error:', eventData.error);\n });\n }\n\n /**\n * Enable/disable auto-reconnect\n */\n set autoReconnectEnabled(enabled: boolean) {\n this.autoReconnect = enabled;\n }\n\n get autoReconnectEnabled(): boolean {\n return this.autoReconnect;\n }\n\n /**\n * Set max reconnect attempts\n */\n set maxReconnectAttemptsCount(count: number) {\n this.maxReconnectAttempts = count;\n }\n\n get maxReconnectAttemptsCount(): number {\n return this.maxReconnectAttempts;\n }\n\n /**\n * Async iterator for tweets\n */\n async *[Symbol.asyncIterator](): AsyncGenerator<\n StreamDataEvent,\n void,\n unknown\n > {\n const dataQueue: StreamDataEvent[] = [];\n let isComplete = false;\n let hasError = false;\n let error: Error | null = null;\n\n // Set up listeners\n const dataListener = (eventData: any) => {\n dataQueue.push(eventData);\n };\n\n const errorListener = (eventData: StreamErrorEvent) => {\n hasError = true;\n error = eventData.error;\n };\n\n const closeListener = () => {\n isComplete = true;\n };\n\n this.on(StreamEvent.Data, dataListener);\n this.on(StreamEvent.Error, errorListener);\n this.on(StreamEvent.Close, closeListener);\n\n try {\n while (!isComplete && !hasError) {\n if (dataQueue.length > 0) {\n yield dataQueue.shift()!;\n } else {\n // Wait a bit for more data\n await new Promise(resolve => setTimeout(resolve, 10));\n }\n }\n\n if (hasError && error) {\n throw error;\n }\n } finally {\n // Clean up listeners\n this.off(StreamEvent.Data, dataListener);\n this.off(StreamEvent.Error, errorListener);\n this.off(StreamEvent.Close, closeListener);\n }\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Stream client for the X API.\n *\n * This module provides a client for interacting with the streaming endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport { EventDrivenStream, StreamEvent } from './event_driven_stream.js';\nimport {\n PostsSampleResponse,\n PostsFirehoseResponse,\n LabelsComplianceResponse,\n LikesComplianceResponse,\n LikesSample10Response,\n PostsFirehosePtResponse,\n PostsFirehoseEnResponse,\n PostsResponse,\n GetRulesResponse,\n UpdateRulesResponse,\n PostsComplianceResponse,\n PostsFirehoseKoResponse,\n LikesFirehoseResponse,\n PostsSample10Response,\n PostsFirehoseJaResponse,\n GetRuleCountsResponse,\n UsersComplianceResponse,\n} from './models.js';\n\n/**\n * Options for postsSample method\n * \n * @public\n */\nexport interface PostsSampleStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehose method\n * \n * @public\n */\nexport interface PostsFirehoseStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for labelsCompliance method\n * \n * @public\n */\nexport interface LabelsComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesCompliance method\n * \n * @public\n */\nexport interface LikesComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesSample10 method\n * \n * @public\n */\nexport interface LikesSample10StreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of LikeWithTweetAuthor fields to display. \n * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */\n likeWithTweetAuthorFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehosePt method\n * \n * @public\n */\nexport interface PostsFirehosePtStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseEn method\n * \n * @public\n */\nexport interface PostsFirehoseEnStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for posts method\n * \n * @public\n */\nexport interface PostsStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for getRules method\n * \n * @public\n */\nexport interface GetRulesStreamingOptions {\n /** A comma-separated list of Rule IDs. \n * Also accepts: ids or proper camelCase (e.g., ids) */\n ids?: Array;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This value is populated by passing the 'next_token' returned in a request to paginate through results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for updateRules method\n * \n * @public\n */\nexport interface UpdateRulesStreamingOptions {\n /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. \n * Also accepts: dry_run or proper camelCase (e.g., dryRun) */\n dryRun?: boolean;\n\n /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. \n * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */\n deleteAll?: boolean;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsCompliance method\n * \n * @public\n */\nexport interface PostsComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseKo method\n * \n * @public\n */\nexport interface PostsFirehoseKoStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesFirehose method\n * \n * @public\n */\nexport interface LikesFirehoseStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of LikeWithTweetAuthor fields to display. \n * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */\n likeWithTweetAuthorFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsSample10 method\n * \n * @public\n */\nexport interface PostsSample10StreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseJa method\n * \n * @public\n */\nexport interface PostsFirehoseJaStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for getRuleCounts method\n * \n * @public\n */\nexport interface GetRuleCountsStreamingOptions {\n /** A comma separated list of RulesCount fields to display. \n * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */\n rulesCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for usersCompliance method\n * \n * @public\n */\nexport interface UsersComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\nexport class StreamClient {\n private client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Stream sampled Posts\n * Streams a 1% sample of public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsSample(\n options: PostsSampleStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsSample');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/sample/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream all Posts\n * Streams all public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehose(\n partition: number,\n options: PostsFirehoseStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehose');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Post labels\n * Streams all labeling events applied to Posts.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async labelsCompliance(\n options: LabelsComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'labelsCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/label/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Likes compliance data\n * Streams all compliance data related to Likes for Users.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesCompliance(\n options: LikesComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream sampled Likes\n * Streams a 10% sample of public Likes in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesSample10(\n partition: number,\n options: LikesSample10StreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesSample10');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n likeWithTweetAuthorFields = [],\n\n expansions = [],\n\n userFields = [],\n\n tweetFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/sample10/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (\n likeWithTweetAuthorFields !== undefined &&\n likeWithTweetAuthorFields.length > 0\n ) {\n params.append(\n 'like_with_tweet_author.fields',\n likeWithTweetAuthorFields.join(',')\n );\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Portuguese Posts\n * Streams all public Portuguese-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehosePt(\n partition: number,\n options: PostsFirehosePtStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehosePt');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/pt';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream English Posts\n * Streams all public English-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseEn(\n partition: number,\n options: PostsFirehoseEnStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseEn');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/en';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream filtered Posts\n * Streams Posts in real-time matching the active rule set.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async posts(options: PostsStreamingOptions = {}): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'posts');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Posts compliance data\n * Streams all compliance data related to Posts.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsCompliance(\n partition: number,\n options: PostsComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Korean Posts\n * Streams all public Korean-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseKo(\n partition: number,\n options: PostsFirehoseKoStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseKo');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/ko';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream all Likes\n * Streams all public Likes in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesFirehose(\n partition: number,\n options: LikesFirehoseStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesFirehose');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n likeWithTweetAuthorFields = [],\n\n expansions = [],\n\n userFields = [],\n\n tweetFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/firehose/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (\n likeWithTweetAuthorFields !== undefined &&\n likeWithTweetAuthorFields.length > 0\n ) {\n params.append(\n 'like_with_tweet_author.fields',\n likeWithTweetAuthorFields.join(',')\n );\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream 10% sampled Posts\n * Streams a 10% sample of public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsSample10(\n partition: number,\n options: PostsSample10StreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsSample10');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/sample10/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Japanese Posts\n * Streams all public Japanese-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseJa(\n partition: number,\n options: PostsFirehoseJaStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseJa');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/ja';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Users compliance data\n * Streams all compliance data related to Users.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async usersCompliance(\n partition: number,\n options: UsersComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'usersCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Get stream rules\n * Retrieves the active rule set or a subset of rules for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async getRules(\n options: GetRulesStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'getRules');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n ids = [],\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update stream rules\n * Adds or deletes rules from the active rule set for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async updateRules(\n body: any,\n options: UpdateRulesStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'updateRules');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n dry_run: 'dryRun',\n\n delete_all: 'deleteAll',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n dryRun = undefined,\n\n deleteAll = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (dryRun !== undefined) {\n params.append('dry_run', String(dryRun));\n }\n\n if (deleteAll !== undefined) {\n params.append('delete_all', String(deleteAll));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n body: JSON.stringify(body),\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get stream rule counts\n * Retrieves the count of rules in the active rule set for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async getRuleCounts(\n options: GetRuleCountsStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'getRuleCounts');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'rules_count.fields': 'rulesCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n rulesCountFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules/counts';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (rulesCountFields !== undefined && rulesCountFields.length > 0) {\n params.append('rules_count.fields', rulesCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * webhooks client for the X API.\n *\n * This module provides a client for interacting with the webhooks endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n CreateStreamLinkResponse,\n DeleteStreamLinkResponse,\n ValidateResponse,\n DeleteResponse,\n GetStreamLinksResponse,\n GetResponse,\n CreateRequest,\n CreateResponse,\n} from './models.js';\n\n/**\n * Options for createStreamLink method\n * \n * @public\n */\nexport interface CreateStreamLinkOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: string;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: string;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: string;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: string;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: string;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** A comma separated list of WebhookConfig fields to display. \n * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */\n webhookConfigFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for webhooks operations\n * \n * This client provides methods for interacting with the webhooks endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all webhooks related operations.\n * \n * @category webhooks\n */\nexport class WebhooksClient {\n private client: Client;\n\n /**\n * Creates a new webhooks client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Create stream link\n * Creates a link to deliver FilteredStream events to the given webhook.\n\n\n * @param webhookId The webhook ID to link to your FilteredStream ruleset.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createStreamLink(\n webhookId: string,\n options: CreateStreamLinkOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = undefined,\n\n expansions = undefined,\n\n mediaFields = undefined,\n\n pollFields = undefined,\n\n userFields = undefined,\n\n placeFields = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetFields !== undefined) {\n params.append('tweet.fields', String(tweetFields));\n }\n\n if (expansions !== undefined) {\n params.append('expansions', String(expansions));\n }\n\n if (mediaFields !== undefined) {\n params.append('media.fields', String(mediaFields));\n }\n\n if (pollFields !== undefined) {\n params.append('poll.fields', String(pollFields));\n }\n\n if (userFields !== undefined) {\n params.append('user.fields', String(userFields));\n }\n\n if (placeFields !== undefined) {\n params.append('place.fields', String(placeFields));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete stream link\n * Deletes a link from FilteredStream events to the given webhook.\n\n\n * @param webhookId The webhook ID to link to your FilteredStream ruleset.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteStreamLink(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Validate webhook\n * Triggers a CRC check for a given webhook.\n\n\n * @param webhookId The ID of the webhook to check.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async validate(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete webhook\n * Deletes an existing webhook configuration.\n\n\n * @param webhookId The ID of the webhook to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get stream links\n * Get a list of webhook links associated with a filtered stream ruleset.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getStreamLinks(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get webhook\n * Get a list of webhook configs associated with a client app.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'webhook_config.fields': 'webhookConfigFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n webhookConfigFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (webhookConfigFields !== undefined && webhookConfigFields.length > 0) {\n params.append('webhook_config.fields', webhookConfigFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create webhook\n * Creates a new webhook configuration.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for webhooks operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for createStreamLink\n * \n * @public\n */\nexport type CreateStreamLinkResponse = Schemas.WebhookLinksCreateResponse;\n/**\n * Response for deleteStreamLink\n * \n * @public\n */\nexport type DeleteStreamLinkResponse = Schemas.WebhookLinksDeleteResponse;\n/**\n * Response for validate\n * \n * @public\n */\nexport type ValidateResponse = Schemas.WebhookConfigPutResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.WebhookConfigDeleteResponse;\n/**\n * Response for getStreamLinks\n * \n * @public\n */\nexport type GetStreamLinksResponse = Schemas.WebhookLinksGetResponse;\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2WebhooksResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.WebhookConfigCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.WebhookConfigCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Main client for the X API.\n *\n * This module provides the main client class for interacting with the X API.\n */\n\nimport { httpClient } from \"./http-client.js\";\nimport { \n Paginator, \n PostPaginator, \n UserPaginator, \n EventPaginator\n} from \"./paginator.js\";\n\n\n\nimport { NewsClient } from \"./news/index.js\";\n\n\n\nimport { UsersClient } from \"./users/index.js\";\n\n\n\nimport { DirectMessagesClient } from \"./direct_messages/index.js\";\n\n\n\nimport { CommunityNotesClient } from \"./community_notes/index.js\";\n\n\n\nimport { PostsClient } from \"./posts/index.js\";\n\n\n\nimport { TrendsClient } from \"./trends/index.js\";\n\n\n\nimport { ActivityClient } from \"./activity/index.js\";\n\n\n\nimport { UsageClient } from \"./usage/index.js\";\n\n\n\nimport { SpacesClient } from \"./spaces/index.js\";\n\n\n\nimport { CommunitiesClient } from \"./communities/index.js\";\n\n\n\nimport { ConnectionsClient } from \"./connections/index.js\";\n\n\n\nimport { MediaClient } from \"./media/index.js\";\n\n\n\nimport { ListsClient } from \"./lists/index.js\";\n\n\n\nimport { ComplianceClient } from \"./compliance/index.js\";\n\n\n\nimport { GeneralClient } from \"./general/index.js\";\n\n\n\nimport { AccountActivityClient } from \"./account_activity/index.js\";\n\n\n\nimport { StreamClient } from \"./stream/client.js\";\n\n\n\nimport { WebhooksClient } from \"./webhooks/index.js\";\n\n\n\n/**\n * Configuration options for the X API client\n */\nexport interface ClientConfig {\n /** Base URL for API requests */\n baseUrl?: string;\n /** Bearer token for authentication */\n bearerToken?: string;\n /** OAuth2 access token */\n accessToken?: string;\n /** OAuth1 instance for authentication */\n oauth1?: any;\n /** Custom headers to include in requests */\n headers?: Record;\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Whether to automatically retry failed requests */\n retry?: boolean;\n /** Maximum number of retry attempts */\n maxRetries?: number;\n}\n\n/**\n * API Error class for handling X API errors\n */\nexport class ApiError extends Error {\n public readonly status: number;\n public readonly statusText: string;\n public readonly headers: Headers;\n public readonly data?: any;\n\n constructor(message: string, status: number, statusText: string, headers: Headers, data?: any) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.statusText = statusText;\n this.headers = headers;\n this.data = data;\n }\n}\n\n/**\n * Request options for API calls\n */\nexport interface RequestOptions {\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Additional headers */\n headers?: Record;\n /** Request signal for cancellation */\n signal?: AbortSignal;\n /** Request body */\n body?: string;\n /** Return raw HTTP wrapper instead of parsed body */\n raw?: boolean;\n /** Security requirements for the endpoint (from OpenAPI spec) - used for smart auth selection */\n security?: Array>;\n}\n\n/**\n * Response wrapper with metadata\n */\nexport interface ApiResponse {\n /** Response body */\n body: T;\n /** Response headers */\n headers: Headers;\n /** HTTP status code */\n status: number;\n /** HTTP status text */\n statusText: string;\n /** Response URL */\n url: string;\n}\n\n/**\n * Pagination metadata\n */\nexport interface PaginationMeta {\n /** Next page token */\n next_token?: string;\n /** Previous page token */\n previous_token?: string;\n /** Total count */\n total_count?: number;\n /** Result count */\n result_count?: number;\n}\n\n\n/**\n * Main client class for the X API\n * \n * This is the primary entry point for interacting with the X API. It provides\n * access to all API endpoints through specialized client modules and handles\n * authentication, request configuration, and error handling.\n * \n * @example\n * ```typescript\n * import { Client } from 'x-api-sdk';\n * \n * const client = new Client({\n * bearerToken: 'your-bearer-token'\n * });\n * \n * // Get user information\n * const user = await client.users.getUser('783214');\n * \n * // Get followers with pagination\n * const followers = await client.users.getFollowers('783214', {\n * maxResults: 10,\n * userFields: ['id', 'name', 'username']\n * });\n * \n * // Iterate through followers\n * for await (const follower of followers) {\n * console.log(follower.username);\n * }\n * ```\n * \n * @category Client\n */\nexport class Client {\n /** Base URL for API requests */\n readonly baseUrl: string;\n /** Bearer token for authentication */\n readonly bearerToken?: string;\n /** OAuth2 access token */\n readonly accessToken?: string;\n /** OAuth1 instance for authentication */\n readonly oauth1?: any;\n /** Headers for requests */\n readonly headers: Headers;\n /** Request timeout in milliseconds */\n readonly timeout: number;\n /** Whether to automatically retry failed requests */\n readonly retry: boolean;\n /** Maximum number of retry attempts */\n readonly maxRetries: number;\n\n /** HTTP client for making requests */\n readonly httpClient = httpClient;\n\n\n /** news client */\n readonly news: NewsClient;\n\n /** users client */\n readonly users: UsersClient;\n\n /** direct messages client */\n readonly directMessages: DirectMessagesClient;\n\n /** community notes client */\n readonly communityNotes: CommunityNotesClient;\n\n /** posts client */\n readonly posts: PostsClient;\n\n /** trends client */\n readonly trends: TrendsClient;\n\n /** activity client */\n readonly activity: ActivityClient;\n\n /** usage client */\n readonly usage: UsageClient;\n\n /** spaces client */\n readonly spaces: SpacesClient;\n\n /** communities client */\n readonly communities: CommunitiesClient;\n\n /** connections client */\n readonly connections: ConnectionsClient;\n\n /** media client */\n readonly media: MediaClient;\n\n /** lists client */\n readonly lists: ListsClient;\n\n /** compliance client */\n readonly compliance: ComplianceClient;\n\n /** general client */\n readonly general: GeneralClient;\n\n /** account activity client */\n readonly accountActivity: AccountActivityClient;\n\n /** stream client */\n readonly stream: StreamClient;\n\n /** webhooks client */\n readonly webhooks: WebhooksClient;\n\n\n /**\n * Creates a new X API client instance\n * \n * @param config - Configuration options for the client\n * \n * @example\n * ```typescript\n * // Bearer token authentication\n * const client = new Client({\n * bearerToken: 'your-bearer-token'\n * });\n * \n * // OAuth2 authentication\n * const client = new Client({\n * accessToken: 'your-access-token'\n * });\n * \n * // OAuth1 authentication\n * const client = new Client({\n * oauth1: oauth1Instance\n * });\n * ```\n */\n constructor(config: ClientConfig | any) {\n // Handle OAuth1 instance passed directly\n if (config && typeof config === 'object' && config.accessToken && config.accessToken.accessToken && config.accessToken.accessTokenSecret) {\n // This is an OAuth1 instance\n this.oauth1 = config;\n this.baseUrl = \"https://api.x.com\";\n } else {\n // This is a regular config object\n const clientConfig = config as ClientConfig;\n this.baseUrl = clientConfig.baseUrl || \"https://api.x.com\";\n this.bearerToken = clientConfig.bearerToken;\n this.accessToken = clientConfig.accessToken;\n this.oauth1 = clientConfig.oauth1;\n }\n \n this.timeout = (config as ClientConfig).timeout || 30000;\n this.retry = (config as ClientConfig).retry ?? true;\n this.maxRetries = (config as ClientConfig).maxRetries || 3;\n \n // Initialize headers\n const defaultHeaders: Record = {\n 'User-Agent': 'xdk-typescript/0.2.1-beta',\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n ...((config as ClientConfig).headers || {}),\n };\n \n this.headers = httpClient.createHeaders(defaultHeaders);\n\n\n this.news = new NewsClient(this);\n\n this.users = new UsersClient(this);\n\n this.directMessages = new DirectMessagesClient(this);\n\n this.communityNotes = new CommunityNotesClient(this);\n\n this.posts = new PostsClient(this);\n\n this.trends = new TrendsClient(this);\n\n this.activity = new ActivityClient(this);\n\n this.usage = new UsageClient(this);\n\n this.spaces = new SpacesClient(this);\n\n this.communities = new CommunitiesClient(this);\n\n this.connections = new ConnectionsClient(this);\n\n this.media = new MediaClient(this);\n\n this.lists = new ListsClient(this);\n\n this.compliance = new ComplianceClient(this);\n\n this.general = new GeneralClient(this);\n\n this.accountActivity = new AccountActivityClient(this);\n\n this.stream = new StreamClient(this);\n\n this.webhooks = new WebhooksClient(this);\n\n }\n\n /**\n * Make an authenticated request to the X API\n * \n * This method handles authentication, request formatting, and error handling\n * for all API requests. It automatically adds the appropriate authentication\n * headers based on the client configuration.\n * \n * @param method - HTTP method (GET, POST, PUT, DELETE, etc.)\n * @param path - API endpoint path (e.g., '/2/users/by/username/username')\n * @param options - Request options including timeout, headers, and body\n * @returns Promise that resolves to the parsed response data\n * \n * @example\n * ```typescript\n * // GET request\n * const user = await client.request('GET', '/2/users/by/username/username', {\n * timeout: 5000\n * });\n * \n * // POST request with body\n * const result = await client.request('POST', '/2/tweets', {\n * body: JSON.stringify({ text: 'Hello World!' })\n * });\n * ```\n * \n * @throws {ApiError} When the API returns an error response\n */\n async request(\n method: string,\n path: string,\n options: RequestOptions = {}\n ): Promise {\n const url = `${this.baseUrl}${path}`;\n const headers = new Headers(this.headers);\n \n // Select the best authentication method based on endpoint requirements\n const selectedAuth = this.selectAuthMethod(method, options.security);\n \n // Add authentication headers based on selected method\n if (selectedAuth === 'bearer_token' && this.bearerToken) {\n headers.set('Authorization', `Bearer ${this.bearerToken}`);\n } else if (selectedAuth === 'oauth2_user_context' && this.accessToken) {\n headers.set('Authorization', `Bearer ${this.accessToken}`);\n } else if (selectedAuth === 'oauth1' && this.oauth1 && this.oauth1.accessToken) {\n // OAuth1 authentication - build proper OAuth1 header\n try {\n const oauthHeader = await this.oauth1.buildRequestHeader(method, url, options.body || '');\n headers.set('Authorization', oauthHeader);\n \n // Keep Content-Type header for JSON requests - X API requires it\n // Only remove Content-Type for form-encoded OAuth1 requests\n // JSON bodies are not included in OAuth1 signature (per OAuth1 spec)\n } catch (error) {\n throw new Error(`Failed to build OAuth1 header: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n } else if (!selectedAuth) {\n // No suitable auth method found - validate authentication\n const requiredSchemes = options.security \n ? options.security.flatMap(req => Object.keys(req))\n : [];\n if (requiredSchemes.length > 0) {\n this.validateAuthentication(requiredSchemes, path);\n }\n }\n \n // Add custom headers\n if (options.headers) {\n Object.entries(options.headers).forEach(([key, value]) => {\n headers.set(key, value);\n });\n }\n\n try {\n const response = await this.httpClient.request(url, {\n method,\n headers,\n signal: options.signal,\n body: options.body,\n timeout: options.timeout !== undefined ? options.timeout : this.timeout,\n });\n\n if (!response.ok) {\n let errorData: any;\n try {\n errorData = await response.json();\n } catch {\n errorData = await response.text();\n }\n \n throw new ApiError(\n errorData && errorData.message ? errorData.message : `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n response.headers,\n errorData\n );\n }\n\n // For streaming requests, return the raw Response object\n if (options.raw) {\n return response as any; // Return the actual Response object for streaming\n }\n\n let data: T;\n const contentType = response.headers.get('content-type');\n if (contentType && contentType.includes('application/json')) {\n data = await response.json();\n } else {\n data = await response.text() as T;\n }\n\n // Return parsed body for non-streaming requests\n return data;\n } catch (error) {\n if (error instanceof ApiError) {\n throw error;\n }\n throw new ApiError(\n error instanceof Error ? error.message : 'Request failed',\n 0,\n 'NETWORK_ERROR',\n new Headers(),\n error\n );\n }\n }\n\n /**\n * Check if the OAuth2 token is expired\n */\n isTokenExpired(): boolean {\n // TODO: Implement token expiration check\n return false;\n }\n\n /**\n * Refresh the OAuth2 token\n */\n async refreshToken(): Promise {\n // TODO: Implement token refresh\n }\n\n /**\n * Get the current authentication status\n */\n isAuthenticated(): boolean {\n return !!(this.bearerToken || this.accessToken || (this.oauth1 && this.oauth1.accessToken));\n }\n\n /**\n * Map OpenAPI security scheme names to internal authentication types\n * @param securitySchemeName The security scheme name from OpenAPI\n * @returns Array of internal authentication types\n */\n public mapSecuritySchemeToAuthTypes(securitySchemeName: string): string[] {\n // Mappings for X/Twitter API security schemes\n const schemeMapping: Record = {\n 'BearerToken': ['bearer_token'], // App-only OAuth2.0\n 'OAuth2UserToken': ['oauth2_user_context'], // OAuth2.0 User Context\n 'UserToken': ['oauth1'], // OAuth1.0a User Context\n // Fallback mappings for common variations\n 'OAuth2': ['bearer_token', 'oauth2_user_context'],\n 'OAuth1': ['oauth1'],\n 'Bearer': ['bearer_token'],\n 'OAuth2User': ['oauth2_user_context'],\n 'OAuth1User': ['oauth1'],\n };\n\n return schemeMapping[securitySchemeName] || [securitySchemeName.toLowerCase()];\n }\n\n /**\n * Select the best authentication method based on endpoint requirements and available credentials\n * \n * Priority strategy:\n * 1. If endpoint only accepts one method, use that (if available)\n * 2. If endpoint accepts multiple methods:\n * - For write operations (POST/PUT/DELETE): Prefer OAuth1 > OAuth2 User Token > Bearer Token\n * - For read operations (GET): Prefer Bearer Token > OAuth2 User Token > OAuth1\n * - This allows Bearer Token for read-only operations while using user context for writes\n * \n * @param method HTTP method (GET, POST, etc.)\n * @param securityRequirements Security requirements from OpenAPI spec (array of security requirement objects)\n * @returns Selected auth method: 'bearer_token', 'oauth2_user_context', 'oauth1', or null if none available\n */\n private selectAuthMethod(method: string, securityRequirements?: Array>): 'bearer_token' | 'oauth2_user_context' | 'oauth1' | null {\n // If no security requirements, use default priority\n if (!securityRequirements || securityRequirements.length === 0) {\n if (this.bearerToken) return 'bearer_token';\n if (this.accessToken) return 'oauth2_user_context';\n if (this.oauth1 && this.oauth1.accessToken) return 'oauth1';\n return null;\n }\n\n // Extract all acceptable security schemes from requirements\n // Security requirements are OR'd together (any one can be used)\n const acceptableSchemes = new Set();\n for (const requirement of securityRequirements) {\n for (const schemeName of Object.keys(requirement)) {\n acceptableSchemes.add(schemeName);\n }\n }\n\n // Check what auth methods we have available\n const availableAuth: Record = {\n 'BearerToken': !!this.bearerToken,\n 'OAuth2UserToken': !!this.accessToken,\n 'UserToken': !!(this.oauth1 && this.oauth1.accessToken),\n };\n\n // If only one scheme is acceptable, use it if available\n if (acceptableSchemes.size === 1) {\n const scheme = Array.from(acceptableSchemes)[0];\n if (availableAuth[scheme]) {\n return this.mapSecuritySchemeToAuthTypes(scheme)[0] as 'bearer_token' | 'oauth2_user_context' | 'oauth1';\n }\n return null;\n }\n\n // Multiple schemes acceptable - use priority based on operation type\n const isWriteOperation = ['POST', 'PUT', 'DELETE', 'PATCH'].includes(method.toUpperCase());\n \n // Priority order for write operations: OAuth1 > OAuth2 User Token > Bearer Token\n // (User context is required for most write operations)\n if (isWriteOperation) {\n if (acceptableSchemes.has('UserToken') && availableAuth['UserToken']) {\n return 'oauth1';\n }\n if (acceptableSchemes.has('OAuth2UserToken') && availableAuth['OAuth2UserToken']) {\n return 'oauth2_user_context';\n }\n if (acceptableSchemes.has('BearerToken') && availableAuth['BearerToken']) {\n return 'bearer_token';\n }\n } else {\n // Priority order for read operations: Bearer Token > OAuth2 User Token > OAuth1\n // (Bearer Token is simpler for read-only operations)\n if (acceptableSchemes.has('BearerToken') && availableAuth['BearerToken']) {\n return 'bearer_token';\n }\n if (acceptableSchemes.has('OAuth2UserToken') && availableAuth['OAuth2UserToken']) {\n return 'oauth2_user_context';\n }\n if (acceptableSchemes.has('UserToken') && availableAuth['UserToken']) {\n return 'oauth1';\n }\n }\n\n return null;\n }\n\n /**\n * Validate that the required authentication method is available\n * @param requiredAuthTypes Array of required authentication types (OpenAPI security scheme names)\n * @param operationName Name of the operation for error messages\n */\n public validateAuthentication(requiredAuthTypes: string[], operationName: string): void {\n if (requiredAuthTypes.length === 0) {\n return; // No authentication required\n }\n\n const availableAuthTypes: string[] = [];\n \n if (this.bearerToken) {\n availableAuthTypes.push('bearer_token');\n }\n if (this.accessToken) {\n availableAuthTypes.push('oauth2_user_context');\n }\n if (this.oauth1 && this.oauth1.accessToken) {\n availableAuthTypes.push('oauth1');\n }\n\n // Map OpenAPI security schemes to internal auth types\n const mappedRequiredTypes = requiredAuthTypes.flatMap(scheme => \n this.mapSecuritySchemeToAuthTypes(scheme)\n );\n\n // Check if any of the required auth types are available\n const hasRequiredAuth = mappedRequiredTypes.some(required => \n availableAuthTypes.includes(required)\n );\n\n if (!hasRequiredAuth) {\n const availableStr = availableAuthTypes.length > 0 ? availableAuthTypes.join(', ') : 'none';\n const requiredStr = requiredAuthTypes.join(', ');\n throw new Error(\n `Authentication required for ${operationName}. ` +\n `Required: ${requiredStr}. ` +\n `Available: ${availableStr}. ` +\n `Please configure the appropriate authentication method.`\n );\n }\n }\n\n /**\n * Get available authentication types\n */\n getAvailableAuthTypes(): string[] {\n const authTypes: string[] = [];\n if (this.bearerToken) authTypes.push('bearer_token');\n if (this.accessToken) authTypes.push('oauth2_user_context');\n if (this.oauth1 && this.oauth1.accessToken) authTypes.push('oauth1');\n return authTypes;\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Environment-agnostic cryptographic utilities for the X API SDK.\n * Provides HMAC-SHA1 implementation that works in both Node.js and browser environments.\n */\n\n/**\n * HMAC-SHA1 implementation that works in both Node.js and browser environments\n */\nexport class CryptoUtils {\n /**\n * Generate HMAC-SHA1 signature\n * @param key Signing key\n * @param message Message to sign\n * @returns Base64 encoded signature\n */\n static async hmacSha1(key: string, message: string): Promise {\n // Try to use native Node.js crypto first\n if (\n typeof process !== 'undefined' &&\n process.versions &&\n process.versions.node\n ) {\n try {\n return await this._nodeHmacSha1(key, message);\n } catch (error) {\n // Fall back to Web Crypto API or polyfill\n console.warn('Node.js crypto failed, falling back:', error);\n }\n }\n\n // Try Web Crypto API (modern browsers)\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n try {\n return await this._webCryptoHmacSha1(key, message);\n } catch (error) {\n // Fall back to polyfill\n console.warn('Web Crypto API failed, falling back:', error);\n }\n }\n\n // Fall back to polyfill implementation\n return this._polyfillHmacSha1(key, message);\n }\n\n /**\n * Node.js native HMAC-SHA1 implementation\n */\n private static async _nodeHmacSha1(\n key: string,\n message: string\n ): Promise {\n // Dynamic import for Node.js crypto module (ES module compatible)\n const crypto = await import('crypto');\n const hmac = crypto.createHmac('sha1', key);\n hmac.update(message);\n return hmac.digest('base64');\n }\n\n /**\n * Web Crypto API HMAC-SHA1 implementation\n */\n private static async _webCryptoHmacSha1(\n key: string,\n message: string\n ): Promise {\n // Convert string key to ArrayBuffer\n const keyBuffer = this._stringToArrayBuffer(key);\n const messageBuffer = this._stringToArrayBuffer(message);\n\n // Import the key\n const cryptoKey = await crypto.subtle.importKey(\n 'raw',\n keyBuffer,\n { name: 'HMAC', hash: 'SHA-1' },\n false,\n ['sign']\n );\n\n // Sign the message\n const signature = await crypto.subtle.sign(\n 'HMAC',\n cryptoKey,\n messageBuffer\n );\n\n // Convert to base64\n return this._arrayBufferToBase64(signature);\n }\n\n /**\n * Polyfill HMAC-SHA1 implementation using pure JavaScript\n * This is a fallback that works everywhere but is slower\n */\n private static _polyfillHmacSha1(key: string, message: string): string {\n // For now, throw an error to indicate that proper crypto is needed\n // This will help identify when the fallback is being used\n throw new Error(\n 'HMAC-SHA1 polyfill not implemented. Please ensure Node.js crypto or Web Crypto API is available.'\n );\n\n // In a real implementation, you would use a library like crypto-js:\n // import CryptoJS from 'crypto-js';\n // return CryptoJS.HmacSHA1(message, key).toString(CryptoJS.enc.Base64);\n }\n\n /**\n * Convert string to ArrayBuffer\n */\n private static _stringToArrayBuffer(str: string): ArrayBuffer {\n const buffer = new ArrayBuffer(str.length);\n const view = new Uint8Array(buffer);\n for (let i = 0; i < str.length; i++) {\n view[i] = str.charCodeAt(i);\n }\n return buffer;\n }\n\n /**\n * Convert ArrayBuffer to base64 string\n */\n private static _arrayBufferToBase64(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n /**\n * Generate a random nonce for OAuth\n * @param length Length of the nonce\n * @returns Random nonce string\n */\n static generateNonce(length: number = 32): string {\n if (typeof crypto !== 'undefined' && crypto.getRandomValues) {\n // Use crypto.getRandomValues if available\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join(\n ''\n );\n } else {\n // Fallback to Math.random (less secure but functional)\n let result = '';\n const characters =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n for (let i = 0; i < length; i++) {\n result += characters.charAt(\n Math.floor(Math.random() * characters.length)\n );\n }\n return result;\n }\n }\n\n /**\n * Generate timestamp for OAuth\n * @returns Unix timestamp as string\n */\n static generateTimestamp(): string {\n return Math.floor(Date.now() / 1000).toString();\n }\n\n /**\n * Generate a cryptographically secure random string for PKCE code verifier\n * @param length Length of the code verifier (43-128 characters recommended)\n * @returns Random code verifier string\n */\n static generateCodeVerifier(length: number = 128): string {\n if (typeof crypto !== 'undefined' && crypto.getRandomValues) {\n // Use crypto.getRandomValues if available\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n // Convert to base64url encoding (RFC 7636)\n return this._base64UrlEncode(array);\n } else {\n // Fallback to Math.random (less secure but functional)\n const characters =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';\n let result = '';\n for (let i = 0; i < length; i++) {\n result += characters.charAt(\n Math.floor(Math.random() * characters.length)\n );\n }\n return result;\n }\n }\n\n /**\n * Generate PKCE code challenge from code verifier\n * @param codeVerifier The code verifier string\n * @returns Base64url encoded SHA256 hash of the code verifier\n */\n static async generateCodeChallenge(codeVerifier: string): Promise {\n // Try to use native Node.js crypto first\n if (\n typeof process !== 'undefined' &&\n process.versions &&\n process.versions.node\n ) {\n try {\n return await this._nodeSha256(codeVerifier);\n } catch (error) {\n console.warn('Node.js crypto failed for SHA256, falling back:', error);\n }\n }\n\n // Try Web Crypto API (modern browsers)\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n try {\n return await this._webCryptoSha256(codeVerifier);\n } catch (error) {\n console.warn('Web Crypto API failed for SHA256, falling back:', error);\n }\n }\n\n // Fall back to polyfill implementation\n return this._polyfillSha256(codeVerifier);\n }\n\n /**\n * Node.js native SHA256 implementation for PKCE\n */\n private static async _nodeSha256(message: string): Promise {\n const crypto = await import('crypto');\n const hash = crypto.createHash('sha256');\n hash.update(message);\n const digest = hash.digest();\n return this._base64UrlEncode(digest);\n }\n\n /**\n * Web Crypto API SHA256 implementation for PKCE\n */\n private static async _webCryptoSha256(message: string): Promise {\n const messageBuffer = this._stringToArrayBuffer(message);\n const hashBuffer = await crypto.subtle.digest('SHA-256', messageBuffer);\n return this._base64UrlEncode(hashBuffer);\n }\n\n /**\n * Polyfill SHA256 implementation for PKCE\n * This is a fallback that works everywhere but is slower\n */\n private static _polyfillSha256(message: string): string {\n // For now, throw an error to indicate that proper crypto is needed\n throw new Error(\n 'SHA256 polyfill not implemented. Please ensure Node.js crypto or Web Crypto API is available.'\n );\n\n // In a real implementation, you would use a library like crypto-js:\n // import CryptoJS from 'crypto-js';\n // return CryptoJS.SHA256(message).toString(CryptoJS.enc.Base64url);\n }\n\n /**\n * Convert ArrayBuffer or Uint8Array to base64url encoding (RFC 7636)\n */\n private static _base64UrlEncode(buffer: ArrayBuffer | Uint8Array): string {\n const bytes =\n buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n // Convert to base64url: replace + with -, / with _, and remove padding =\n return btoa(binary)\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '');\n }\n}\n\n/**\n * Convenience function for HMAC-SHA1\n * @param key Signing key\n * @param message Message to sign\n * @returns Promise that resolves to base64 encoded signature\n */\nexport async function hmacSha1(key: string, message: string): Promise {\n return CryptoUtils.hmacSha1(key, message);\n}\n\n/**\n * Convenience function for generating nonce\n * @param length Length of the nonce\n * @returns Random nonce string\n */\nexport function generateNonce(length: number = 32): string {\n return CryptoUtils.generateNonce(length);\n}\n\n/**\n * Convenience function for generating timestamp\n * @returns Unix timestamp as string\n */\nexport function generateTimestamp(): string {\n return CryptoUtils.generateTimestamp();\n}\n\n/**\n * Convenience function for generating PKCE code verifier\n * @param length Length of the code verifier\n * @returns Random code verifier string\n */\nexport function generateCodeVerifier(length: number = 128): string {\n return CryptoUtils.generateCodeVerifier(length);\n}\n\n/**\n * Convenience function for generating PKCE code challenge\n * @param codeVerifier The code verifier string\n * @returns Promise that resolves to base64url encoded SHA256 hash\n */\nexport async function generateCodeChallenge(\n codeVerifier: string\n): Promise {\n return CryptoUtils.generateCodeChallenge(codeVerifier);\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OAuth2 authentication utilities for the X API.\n */\n\nimport { CryptoUtils, generateCodeVerifier, generateCodeChallenge } from './crypto_utils.js';\n\n/**\n * OAuth2 configuration options\n */\nexport interface OAuth2Config {\n /** Client ID */\n clientId: string;\n /** Client secret (optional for public clients) */\n clientSecret?: string;\n /** Redirect URI */\n redirectUri: string;\n /** Scopes to request */\n scope?: string[];\n}\n\n/**\n * OAuth2 token response\n */\nexport interface OAuth2Token {\n /** Access token */\n access_token: string;\n /** Token type */\n token_type: string;\n /** Expiration time in seconds */\n expires_in: number;\n /** Refresh token */\n refresh_token?: string;\n /** Scopes granted */\n scope?: string;\n}\n\n/**\n * OAuth2 authentication handler\n */\nexport class OAuth2 {\n private config: OAuth2Config;\n private token?: OAuth2Token;\n private codeVerifier?: string;\n private codeChallenge?: string;\n\n constructor(config: OAuth2Config) {\n this.config = {\n scope: ['tweet.read', 'users.read'],\n ...config\n };\n }\n\n /**\n * Get the authorization URL\n * @param state Optional state parameter for security\n * @returns Authorization URL\n */\n async getAuthorizationUrl(state?: string): Promise {\n const params = new URLSearchParams({\n response_type: 'code',\n client_id: this.config.clientId,\n redirect_uri: this.config.redirectUri,\n scope: this.config.scope?.join(' ') || '',\n state: state || ''\n });\n\n // PKCE parameters are handled separately - not generated automatically\n\n return `https://x.com/i/oauth2/authorize?${params.toString()}`;\n }\n\n /**\n * Exchange authorization code for tokens\n * @param code Authorization code from callback\n * @param codeVerifier Optional code verifier for PKCE\n * @returns Promise with OAuth2 token\n */\n async exchangeCode(code: string, codeVerifier?: string): Promise {\n const params = new URLSearchParams({\n grant_type: 'authorization_code',\n code,\n redirect_uri: this.config.redirectUri\n });\n\n // Add PKCE code verifier if provided\n if (codeVerifier) {\n params.append('code_verifier', codeVerifier);\n }\n\n // Prepare headers\n const headers: Record = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n };\n\n // Add Basic Auth header if client secret is provided (optional but recommended)\n if (this.config.clientSecret) {\n const credentials = this._base64Encode(`${this.config.clientId}:${this.config.clientSecret}`);\n headers['Authorization'] = `Basic ${credentials}`;\n } else {\n // Only add client_id to body if no client_secret (public client)\n params.append('client_id', this.config.clientId);\n }\n \n const response = await fetch('https://api.x.com/2/oauth2/token', {\n method: 'POST',\n headers,\n body: params.toString()\n });\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => response.text());\n throw new Error(`HTTP error! status: ${response.status}, body: ${JSON.stringify(errorData)}`);\n }\n\n const data = await response.json();\n this.token = {\n access_token: data.access_token,\n token_type: data.token_type,\n expires_in: data.expires_in,\n refresh_token: data.refresh_token,\n scope: data.scope\n };\n\n return this.token;\n }\n\n /**\n * Get the current token\n * @returns Current OAuth2 token if available\n */\n getToken(): OAuth2Token | undefined {\n return this.token;\n }\n\n /**\n * Get the current code verifier (for PKCE)\n * @returns Current code verifier if available\n */\n getCodeVerifier(): string | undefined {\n return this.codeVerifier;\n }\n\n\n /**\n * Manually set PKCE parameters\n * @param codeVerifier The code verifier to use\n * @param codeChallenge Optional code challenge (will be generated if not provided)\n */\n async setPkceParameters(codeVerifier: string, codeChallenge?: string): Promise {\n this.codeVerifier = codeVerifier;\n if (codeChallenge) {\n this.codeChallenge = codeChallenge;\n } else {\n this.codeChallenge = await generateCodeChallenge(codeVerifier);\n }\n }\n\n /**\n * Get the current code challenge (for PKCE)\n * @returns Current code challenge if available\n */\n getCodeChallenge(): string | undefined {\n return this.codeChallenge;\n }\n\n /**\n * Base64 encode a string (with fallback for environments without btoa)\n * @param str String to encode\n * @returns Base64 encoded string\n */\n private _base64Encode(str: string): string {\n if (typeof btoa !== 'undefined') {\n return btoa(str);\n } else if (typeof Buffer !== 'undefined') {\n // Node.js fallback\n return Buffer.from(str, 'utf8').toString('base64');\n } else {\n // Manual base64 encoding fallback\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n let result = '';\n let i = 0;\n while (i < str.length) {\n const a = str.charCodeAt(i++);\n const b = i < str.length ? str.charCodeAt(i++) : 0;\n const c = i < str.length ? str.charCodeAt(i++) : 0;\n const bitmap = (a << 16) | (b << 8) | c;\n result += chars.charAt((bitmap >> 18) & 63);\n result += chars.charAt((bitmap >> 12) & 63);\n result += i - 2 < str.length ? chars.charAt((bitmap >> 6) & 63) : '=';\n result += i - 1 < str.length ? chars.charAt(bitmap & 63) : '=';\n }\n return result;\n }\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OAuth1 authentication utilities for the X API.\n */\n\nimport { CryptoUtils, generateNonce, generateTimestamp } from './crypto_utils.js';\n\n/**\n * OAuth1 configuration options\n */\nexport interface OAuth1Config {\n /** API Key (Consumer Key) */\n apiKey: string;\n /** API Secret (Consumer Secret) */\n apiSecret: string;\n /** Callback URL for OAuth flow */\n callback: string;\n /** Access Token (if already obtained) */\n accessToken?: string;\n /** Access Token Secret (if already obtained) */\n accessTokenSecret?: string;\n}\n\n/**\n * OAuth1 request token response\n */\nexport interface OAuth1RequestToken {\n /** OAuth token */\n oauthToken: string;\n /** OAuth token secret */\n oauthTokenSecret: string;\n}\n\n/**\n * OAuth1 access token response\n */\nexport interface OAuth1AccessToken {\n /** Access token */\n accessToken: string;\n /** Access token secret */\n accessTokenSecret: string;\n}\n\n/**\n * OAuth1 authentication handler\n */\nexport class OAuth1 {\n private config: OAuth1Config;\n public requestToken?: OAuth1RequestToken;\n public accessToken?: OAuth1AccessToken;\n\n constructor(config: OAuth1Config) {\n this.config = config;\n \n // If access token is provided, set it\n if (config.accessToken && config.accessTokenSecret) {\n this.accessToken = {\n accessToken: config.accessToken,\n accessTokenSecret: config.accessTokenSecret\n };\n }\n }\n\n /**\n * Get the authorization URL for OAuth1 flow\n * @param loginWithX Whether to use \"Log in with X\" flow\n * @returns Authorization URL\n */\n getAuthorizationUrl(loginWithX: boolean = false): string {\n if (!this.requestToken) {\n throw new Error('Request token not obtained. Call getRequestToken() first.');\n }\n\n const baseUrl = loginWithX \n ? 'https://x.com/i/oauth/authenticate'\n : 'https://x.com/oauth/authorize';\n\n const params = new URLSearchParams({\n oauth_token: this.requestToken.oauthToken\n });\n\n return `${baseUrl}?${params.toString()}`;\n }\n\n /**\n * Get request token to start OAuth1 flow\n * @returns Promise with request token\n */\n async getRequestToken(): Promise {\n const url = 'https://api.x.com/oauth/request_token';\n \n const params = new URLSearchParams({\n oauth_callback: this.config.callback\n });\n\n const response = await fetch(`${url}?${params.toString()}`, {\n method: 'POST',\n headers: {\n 'Authorization': await this._buildOAuthHeader('POST', url, params.toString())\n }\n });\n\n if (!response.ok) {\n throw new Error(`Failed to get request token: ${response.status} ${response.statusText}`);\n }\n\n const responseText = await response.text();\n const responseParams = new URLSearchParams(responseText);\n \n this.requestToken = {\n oauthToken: responseParams.get('oauth_token')!,\n oauthTokenSecret: responseParams.get('oauth_token_secret')!\n };\n\n return this.requestToken;\n }\n\n /**\n * Exchange verifier for access token\n * @param verifier OAuth verifier from callback or PIN\n * @returns Promise with access token\n */\n async getAccessToken(verifier: string): Promise {\n if (!this.requestToken) {\n throw new Error('Request token not obtained. Call getRequestToken() first.');\n }\n\n const url = 'https://api.x.com/oauth/access_token';\n \n const params = new URLSearchParams({\n oauth_token: this.requestToken.oauthToken,\n oauth_verifier: verifier\n });\n\n const response = await fetch(`${url}?${params.toString()}`, {\n method: 'POST',\n headers: {\n 'Authorization': await this._buildOAuthHeader('POST', url, params.toString())\n }\n });\n\n if (!response.ok) {\n throw new Error(`Failed to get access token: ${response.status} ${response.statusText}`);\n }\n\n const responseText = await response.text();\n const responseParams = new URLSearchParams(responseText);\n \n this.accessToken = {\n accessToken: responseParams.get('oauth_token')!,\n accessTokenSecret: responseParams.get('oauth_token_secret')!\n };\n\n return this.accessToken;\n }\n\n /**\n * Build OAuth1 authorization header\n * @param method HTTP method\n * @param url Request URL\n * @param body Request body\n * @returns Promise that resolves to OAuth1 authorization header string\n */\n private async _buildOAuthHeader(method: string, url: string, body: string): Promise {\n const timestamp = generateTimestamp();\n const nonce = generateNonce();\n \n const oauthParams: Record = {\n oauth_consumer_key: this.config.apiKey,\n oauth_nonce: nonce,\n oauth_signature_method: 'HMAC-SHA1',\n oauth_timestamp: timestamp,\n oauth_version: '1.0'\n };\n\n // Add request token if available\n if (this.requestToken) {\n oauthParams['oauth_token'] = this.requestToken.oauthToken;\n }\n\n // Add access token if available\n if (this.accessToken) {\n oauthParams['oauth_token'] = this.accessToken.accessToken;\n }\n\n // Build signature base string\n const paramString = this._buildParamString(oauthParams, body);\n const signatureBase = `${method.toUpperCase()}&${this._encode(url)}&${this._encode(paramString)}`;\n \n // Generate signature\n const signingKey = `${this._encode(this.config.apiSecret)}&${this._encode(\n this.requestToken?.oauthTokenSecret || this.accessToken?.accessTokenSecret || ''\n )}`;\n \n const signature = await CryptoUtils.hmacSha1(signingKey, signatureBase);\n oauthParams['oauth_signature'] = signature;\n\n // Build authorization header\n const headerParams = Object.entries(oauthParams)\n .map(([key, value]) => `${key}=\"${this._encode(value)}\"`)\n .join(', ');\n\n return `OAuth ${headerParams}`;\n }\n\n /**\n * Build parameter string for OAuth signature\n * @param oauthParams OAuth parameters\n * @param body Request body\n * @returns Parameter string\n */\n private _buildParamString(oauthParams: Record, body: string): string {\n const allParams = { ...oauthParams };\n \n // Parse body parameters if present and it's form-encoded (not JSON)\n // According to OAuth1 spec, JSON bodies should NOT be included in the signature\n if (body) {\n // Check if body is JSON by attempting to parse it\n let isJson = false;\n try {\n JSON.parse(body);\n isJson = true;\n } catch {\n // Not valid JSON, treat as form-encoded\n isJson = false;\n }\n \n if (!isJson) {\n // Only parse form-encoded bodies\n try {\n const bodyParams = new URLSearchParams(body);\n bodyParams.forEach((value, key) => {\n allParams[key] = value;\n });\n } catch (error) {\n // If body parsing fails, ignore it\n console.warn('Failed to parse body parameters:', error);\n }\n }\n // If body is JSON, we don't include it in the signature (per OAuth1 spec)\n }\n\n // Sort parameters alphabetically\n const sortedParams = Object.entries(allParams).sort(([a], [b]) => a.localeCompare(b));\n \n return sortedParams\n .map(([key, value]) => `${this._encode(key)}=${this._encode(value)}`)\n .join('&');\n }\n\n /**\n * URL encode string according to OAuth1 specification\n * @param str String to encode\n * @returns Encoded string\n */\n private _encode(str: string): string {\n return encodeURIComponent(str)\n .replace(/!/g, '%21')\n .replace(/\\*/g, '%2A')\n .replace(/'/g, '%27')\n .replace(/\\(/g, '%28')\n .replace(/\\)/g, '%29')\n .replace(/%7E/g, '~');\n }\n\n /**\n * Convenience method to start the OAuth1 flow\n * @param loginWithX Whether to use \"Log in with X\" flow\n * @returns Promise that resolves to the authorization URL\n */\n async startOAuthFlow(loginWithX: boolean = false): Promise {\n await this.getRequestToken();\n return this.getAuthorizationUrl(loginWithX);\n }\n\n /**\n * Build OAuth1 authorization header for API requests\n * @param method HTTP method\n * @param url Request URL\n * @param body Request body\n * @returns Promise that resolves to OAuth1 authorization header string\n */\n async buildRequestHeader(method: string, url: string, body: string = ''): Promise {\n if (!this.accessToken) {\n throw new Error('Access token not available. Complete OAuth1 flow first.');\n }\n\n // Extract query parameters from URL if present\n let urlWithoutQuery = url;\n let queryParams = '';\n \n try {\n const urlObj = new URL(url);\n if (urlObj.search) {\n queryParams = urlObj.search.substring(1); // Remove the '?' prefix\n urlWithoutQuery = urlObj.origin + urlObj.pathname;\n }\n } catch (error) {\n // If URL parsing fails, use the original URL\n console.warn('Failed to parse URL for OAuth1:', error);\n }\n\n // Combine query parameters with body parameters\n let allParams = '';\n if (queryParams && body) {\n allParams = `${queryParams}&${body}`;\n } else if (queryParams) {\n allParams = queryParams;\n } else if (body) {\n allParams = body;\n }\n\n return this._buildOAuthHeader(method, urlWithoutQuery, allParams);\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OpenAPI Schema Types\n * Auto-generated from OpenAPI components/schemas\n *\n * @internal\n */\n\n/**\nThe unique identifier of an Activity event.\n *\n * @public\n */\nexport type ActivityEventId = string; /**\nAn activity event or error that can be returned by the x activity streaming API.\n *\n * @public\n */\nexport interface ActivityStreamingResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for ActivityStreamingResponsePayload\n *\n * @public\n */\nexport type ActivityStreamingResponsePayload = any; /**\nAn XActivity subscription.\n *\n * @public\n */\nexport interface ActivitySubscription {\n /** none */ createdAt: string;\n /** none */ eventType: string;\n filter: ActivitySubscriptionFilter;\n subscriptionId: ActivitySubscriptionId;\n /** none */ tag?: string;\n /** none */ updatedAt: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionCreateRequest\n *\n * @public\n */\nexport interface ActivitySubscriptionCreateRequest {\n /** none */ eventType:\n | 'ProfileBioUpdate'\n | 'ProfilePictureUpdate'\n | 'ProfileBannerPictureUpdate'\n | 'ProfileScreennameUpdate'\n | 'ProfileGeoUpdate'\n | 'ProfileUrlUpdate'\n | 'ProfileVerifiedBadgeUpdate'\n | 'TrendsNew';\n filter: ActivitySubscriptionFilter;\n /** none */ tag?: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionCreateResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for ActivitySubscriptionDeleteResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nAn XAA subscription.\n *\n * @public\n */\nexport interface ActivitySubscriptionFilter {\n keyword?: Keyword;\n userId?: UserId;\n} /**\nSchema type for ActivitySubscriptionGetResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionGetResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nThe unique identifier of this subscription.\n *\n * @public\n */\nexport type ActivitySubscriptionId = string; /**\nSchema type for ActivitySubscriptionUpdateRequest\n *\n * @public\n */\nexport interface ActivitySubscriptionUpdateRequest {\n /** none */ tag?: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionUpdateResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionUpdateResponse {\n /** none */ data?: Record;\n}\n/**\nSchema type for AddOrDeleteRulesRequest\n *\n * @public\n */\nexport type AddOrDeleteRulesRequest = any; /**\nA response from modifying user-specified stream filtering rules.\n *\n * @public\n */\nexport interface AddOrDeleteRulesResponse {\n /** All user-specified stream filtering rules that were created. */ data?: Array<\n Rule\n >;\n /** none */ errors?: Array;\n meta: RulesResponseMetadata;\n} /**\nA request to add a user-specified stream filtering rule.\n *\n * @public\n */\nexport interface AddRulesRequest {\n /** none */ add: Array;\n} /**\nThe sum of results returned in this response.\n *\n * @public\n */\nexport type Aggregate = number; /**\nUnique identifier of ai trend.\n *\n * @public\n */\nexport type AiTrendId = string; /**\nSchema type for AllowDownloadStatus\n *\n * @public\n */\nexport interface AllowDownloadStatus {\n /** none */ allowDownload?: boolean;\n} /**\nClient App Rule Counts for all applications in the project\n *\n * @public\n */\nexport type AllProjectClientApps = Array<\n AppRulesCount\n>; /**\nSchema type for AltText\n *\n * @public\n */\nexport interface AltText {\n /** Description of media ( <= 1000 characters ) */ text: string;\n} /**\nSchema type for Analytics\n *\n * @public\n */\nexport interface Analytics {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n}\n/**\nSchema type for AnimatedGif\n *\n * @public\n */\nexport type AnimatedGif = any; /**\nA count of user-provided stream filtering rules at the client application level.\n *\n * @public\n */\nexport interface AppRulesCount {\n clientAppId?: ClientAppId;\n /** Number of rules for client application */ ruleCount?: number;\n} /**\nSchema type for AudiencePolicy\n *\n * @public\n */\nexport interface AudiencePolicy {\n /** none */ creatorSubscriptions?: Array<'Any'>;\n /** none */ xSubscriptions?: Array<'Any'>;\n} /**\nSchema type for BookmarkAddRequest\n *\n * @public\n */\nexport interface BookmarkAddRequest {\n tweetId: TweetId;\n} /**\nThe unique identifier of this Bookmark folder.\n *\n * @public\n */\nexport type BookmarkFolderId = string; /**\nSchema type for BookmarkFolderPostsResponse\n *\n * @public\n */\nexport interface BookmarkFolderPostsResponse {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for BookmarkFoldersResponse\n *\n * @public\n */\nexport interface BookmarkFoldersResponse {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for BookmarkMutationResponse\n *\n * @public\n */\nexport interface BookmarkMutationResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for CashtagEntity\n *\n * @public\n */\nexport type CashtagEntity = any; /**\nRepresent the portion of text recognized as a Cashtag, and its start and end position within the text.\n *\n * @public\n */\nexport interface CashtagFields {\n /** none */ tag: string;\n} /**\nThe ID of the client application\n *\n * @public\n */\nexport type ClientAppId = string; /**\nUsage per client app\n *\n * @public\n */\nexport interface ClientAppUsage {\n /** The unique identifier for this project */ clientAppId?: string;\n /** The usage value */ usage?: Array;\n /** The number of results returned */ usageResultCount?: number;\n}\n/**\nYour client has gone away.\n *\n * @public\n */\nexport type ClientDisconnectedProblem = any;\n/**\nA problem that indicates your client is forbidden from making this request.\n *\n * @public\n */\nexport type ClientForbiddenProblem = any; /**\nA X Community is a curated group of Posts.\n *\n * @public\n */\nexport interface Community {\n /** none */ createdAt?: string;\n id: CommunityId;\n /** The name of this Community. */ name: string;\n} /**\nThe unique identifier of this Community.\n *\n * @public\n */\nexport type CommunityId = string; /**\nSchema type for ComplianceJob\n *\n * @public\n */\nexport interface ComplianceJob {\n createdAt: CreatedAt;\n downloadExpiresAt: DownloadExpiration;\n downloadUrl: DownloadUrl;\n id: JobId;\n name?: ComplianceJobName;\n status: ComplianceJobStatus;\n type: ComplianceJobType;\n uploadExpiresAt: UploadExpiration;\n uploadUrl: UploadUrl;\n} /**\nUser-provided name for a compliance job.\n *\n * @public\n */\nexport type ComplianceJobName = string; /**\nStatus of a compliance job.\n *\n * @public\n */\nexport type ComplianceJobStatus =\n | 'created'\n | 'in_progress'\n | 'failed'\n | 'complete'\n | 'expired'; /**\nType of compliance job to list.\n *\n * @public\n */\nexport type ComplianceJobType = 'tweets' | 'users';\n/**\nYou cannot create a new job if one is already in progress.\n *\n * @public\n */\nexport type ConflictProblem = any;\n/**\nA problem that indicates something is wrong with the connection.\n *\n * @public\n */\nexport type ConnectionExceptionProblem = any; /**\nSchema type for ContentExpiration\n *\n * @public\n */\nexport interface ContentExpiration {\n /** Expiration time for content as a Unix timestamp in seconds */ timestampSec: number;\n} /**\nAnnotation inferred from the Tweet text.\n *\n * @public\n */\nexport interface ContextAnnotation {\n domain: ContextAnnotationDomainFields;\n entity: ContextAnnotationEntityFields;\n} /**\nRepresents the data for the context annotation domain.\n *\n * @public\n */\nexport interface ContextAnnotationDomainFields {\n /** Description of the context annotation domain. */ description?: string;\n /** The unique id for a context annotation domain. */ id: string;\n /** Name of the context annotation domain. */ name?: string;\n} /**\nRepresents the data for the context annotation entity.\n *\n * @public\n */\nexport interface ContextAnnotationEntityFields {\n /** Description of the context annotation entity. */ description?: string;\n /** The unique id for a context annotation entity. */ id: string;\n /** Name of the context annotation entity. */ name?: string;\n} /**\nA two-letter ISO 3166-1 alpha-2 country code.\n *\n * @public\n */\nexport type CountryCode = string; /**\nSchema type for CreateAttachmentsMessageRequest\n *\n * @public\n */\nexport interface CreateAttachmentsMessageRequest {\n attachments: DmAttachments;\n /** Text of the message. */ text?: string;\n} /**\nA request to create a new batch compliance job.\n *\n * @public\n */\nexport interface CreateComplianceJobRequest {\n name?: ComplianceJobName;\n /** If true, this endpoint will return a pre-signed URL with resumable uploads enabled. */ resumable?: boolean;\n /** Type of compliance job to list. */ type: 'tweets' | 'users';\n} /**\nSchema type for CreateComplianceJobResponse\n *\n * @public\n */\nexport interface CreateComplianceJobResponse {\n data?: ComplianceJob;\n /** none */ errors?: Array;\n} /**\nCreation time of the compliance job.\n *\n * @public\n */\nexport type CreatedAt = string; /**\nSchema type for CreateDmConversationRequest\n *\n * @public\n */\nexport interface CreateDmConversationRequest {\n /** The conversation type that is being created. */ conversationType: 'Group';\n message: CreateMessageRequest;\n participantIds: DmParticipants;\n} /**\nSchema type for CreateDmEventResponse\n *\n * @public\n */\nexport interface CreateDmEventResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for CreateMessageRequest\n *\n * @public\n */\nexport type CreateMessageRequest = any; /**\nSchema type for CreateNoteRequest\n *\n * @public\n */\nexport interface CreateNoteRequest {\n info: NoteInfo;\n postId: TweetId;\n /** If true, the note being submitted is only for testing the capability of the bot, and won't be publicly visible. If false, the note being submitted will be a new proposed note on the product. */ testMode: boolean;\n} /**\nSchema type for CreateNoteResponse\n *\n * @public\n */\nexport interface CreateNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for CreateTextMessageRequest\n *\n * @public\n */\nexport interface CreateTextMessageRequest {\n attachments?: DmAttachments;\n /** Text of the message. */ text: string;\n} /**\nSchema type for DeleteDmResponse\n *\n * @public\n */\nexport interface DeleteDmResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for DeleteNoteResponse\n *\n * @public\n */\nexport interface DeleteNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nA response from deleting user-specified stream filtering rules.\n *\n * @public\n */\nexport interface DeleteRulesRequest {\n /** IDs and values of all deleted user-specified stream filtering rules. */ delete: Record<\n string,\n any\n >;\n}\n/**\nA problem that indicates that the resource requested violates the precepts of this API.\n *\n * @public\n */\nexport type DisallowedResourceProblem = any; /**\nRepresent a boundary range (start and end zero-based indices) for the portion of text that is displayed for a post. `start` must be smaller than `end`. The start index is inclusive, the end index is exclusive.\n *\n * @public\n */\nexport type DisplayTextRange = Array<\n number\n>; /**\nAttachments to a DM Event.\n *\n * @public\n */\nexport type DmAttachments = Array<\n DmMediaAttachment\n>; /**\nUnique identifier of a DM conversation. This can either be a numeric string, or a pair of numeric strings separated by a '-' character in the case of one-on-one DM Conversations.\n *\n * @public\n */\nexport type DmConversationId = string; /**\nSchema type for DmEvent\n *\n * @public\n */\nexport interface DmEvent {\n /** Specifies the type of attachments (if any) present in this DM. */ attachments?: Record<\n string,\n any\n >;\n /** none */ cashtags?: Array;\n /** none */ createdAt?: string;\n dmConversationId?: DmConversationId;\n /** none */ eventType: string;\n /** none */ hashtags?: Array;\n id: DmEventId;\n /** none */ mentions?: Array;\n /** A list of participants for a ParticipantsJoin or ParticipantsLeave event_type. */ participantIds?: Array<\n UserId\n >;\n /** A list of Posts this DM refers to. */ referencedTweets?: Array<\n Record\n >;\n senderId?: UserId;\n /** none */ text?: string;\n /** none */ urls?: Array;\n} /**\nUnique identifier of a DM Event.\n *\n * @public\n */\nexport type DmEventId = string; /**\nSchema type for DmMediaAttachment\n *\n * @public\n */\nexport interface DmMediaAttachment {\n mediaId: MediaId;\n} /**\nParticipants for the DM Conversation.\n *\n * @public\n */\nexport type DmParticipants = Array<\n UserId\n>; /**\nSchema type for DomainRestrictions\n *\n * @public\n */\nexport interface DomainRestrictions {\n /** List of whitelisted domains */ whitelist: Array;\n} /**\nExpiration time of the download URL.\n *\n * @public\n */\nexport type DownloadExpiration = string; /**\nURL from which the user will retrieve their compliance results.\n *\n * @public\n */\nexport type DownloadUrl = string;\n/**\nThe rule you have submitted is a duplicate.\n *\n * @public\n */\nexport type DuplicateRuleProblem = any; /**\nThe end time of the bucket.\n *\n * @public\n */\nexport type End = string; /**\nAn Engagement Api Response.\n *\n * @public\n */\nexport interface Engagement {\n /** none */ errors?: Array>;\n /** none */ measurement?: Record;\n} /**\nRepresent a boundary range (start and end index) for a recognized entity (for example a hashtag or a mention). `start` must be smaller than `end`. The start index is inclusive, the end index is exclusive.\n *\n * @public\n */\nexport interface EntityIndicesInclusiveExclusive {\n /** Index (zero-based) at which position this entity ends. The index is exclusive. */ end: number;\n /** Index (zero-based) at which position this entity starts. The index is inclusive. */ start: number;\n} /**\nRepresent a boundary range (start and end index) for a recognized entity (for example a hashtag or a mention). `start` must be smaller than `end`. The start index is inclusive, the end index is inclusive.\n *\n * @public\n */\nexport interface EntityIndicesInclusiveInclusive {\n /** Index (zero-based) at which position this entity ends. The index is inclusive. */ end: number;\n /** Index (zero-based) at which position this entity starts. The index is inclusive. */ start: number;\n} /**\nSchema type for Error\n *\n * @public\n */\nexport interface Error {\n /** none */ code: number;\n /** none */ message: string;\n} /**\nSchema type for EvaluateNoteRequest\n *\n * @public\n */\nexport interface EvaluateNoteRequest {\n /** Text for the community note. */ noteText: string;\n postId: TweetId;\n} /**\nSchema type for EvaluateNoteResponse\n *\n * @public\n */\nexport interface EvaluateNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for Expansions\n *\n * @public\n */\nexport interface Expansions {\n /** none */ media?: Array;\n /** none */ places?: Array;\n /** none */ polls?: Array;\n /** none */ topics?: Array;\n /** none */ tweets?: Array;\n /** none */ users?: Array;\n}\n/**\nA problem that indicates that you are not allowed to see a particular field on a Tweet, User, etc.\n *\n * @public\n */\nexport type FieldUnauthorizedProblem = any; /**\nA Tweet or error that can be returned by the streaming Tweet API. The values returned with a successful streamed Tweet includes the user provided rules that the Tweet matched.\n *\n * @public\n */\nexport interface FilteredStreamingTweetResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** The list of rules which matched the Tweet */ matchingRules?: Array<\n Record\n >;\n} /**\nSchema type for FoundMediaOrigin\n *\n * @public\n */\nexport interface FoundMediaOrigin {\n /** Unique Identifier of media within provider ( <= 24 characters )) */ id: string;\n /** The media provider (e.g., 'giphy') that sourced the media ( <= 8 Characters ) */ provider: string;\n} /**\nSchema type for FullTextEntities\n *\n * @public\n */\nexport interface FullTextEntities {\n /** none */ annotations?: Array;\n /** none */ cashtags?: Array;\n /** none */ hashtags?: Array;\n /** none */ mentions?: Array;\n /** none */ urls?: Array;\n}\n/**\nA generic problem with no additional information beyond that provided by the HTTP status code.\n *\n * @public\n */\nexport type GenericProblem = any; /**\nSchema type for Geo\n *\n * @public\n */\nexport interface Geo {\n /** none */ bbox: Array;\n geometry?: Point;\n /** none */ properties: Record;\n /** none */ type: 'Feature';\n}\n/**\nSchema type for GeoRestrictions\n *\n * @public\n */\nexport type GeoRestrictions = any; /**\nSchema type for Get2AiTrendsIdResponse\n *\n * @public\n */\nexport interface Get2AiTrendsIdResponse {\n data?: News;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2CommunitiesIdResponse\n *\n * @public\n */\nexport interface Get2CommunitiesIdResponse {\n data?: Community;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2CommunitiesSearchResponse\n *\n * @public\n */\nexport interface Get2CommunitiesSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ComplianceJobsIdResponse\n *\n * @public\n */\nexport interface Get2ComplianceJobsIdResponse {\n data?: ComplianceJob;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2ComplianceJobsResponse\n *\n * @public\n */\nexport interface Get2ComplianceJobsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmConversationsIdDmEventsResponse\n *\n * @public\n */\nexport interface Get2DmConversationsIdDmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmConversationsWithParticipantIdDmEventsResponse\n *\n * @public\n */\nexport interface Get2DmConversationsWithParticipantIdDmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmEventsEventIdResponse\n *\n * @public\n */\nexport interface Get2DmEventsEventIdResponse {\n data?: DmEvent;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2DmEventsResponse\n *\n * @public\n */\nexport interface Get2DmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2FdxAccountsAccountidContactResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidContactResponse {\n data?: PlaidAccountContact;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidPayment-networksResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidPayment_networksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidResponse {\n data?: PlaidAccount;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidTransactionsResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidTransactionsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxCustomersCurrentResponse\n *\n * @public\n */\nexport interface Get2FdxCustomersCurrentResponse {\n data?: PlaidCustomer;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2Insights28hrResponse\n *\n * @public\n */\nexport interface Get2Insights28hrResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2InsightsHistoricalResponse\n *\n * @public\n */\nexport interface Get2InsightsHistoricalResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2LikesFirehoseStreamResponse\n *\n * @public\n */\nexport interface Get2LikesFirehoseStreamResponse {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2LikesSample10StreamResponse\n *\n * @public\n */\nexport interface Get2LikesSample10StreamResponse {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2ListsIdFollowersResponse\n *\n * @public\n */\nexport interface Get2ListsIdFollowersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ListsIdMembersResponse\n *\n * @public\n */\nexport interface Get2ListsIdMembersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ListsIdResponse\n *\n * @public\n */\nexport interface Get2ListsIdResponse {\n data?: List;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2ListsIdTweetsResponse\n *\n * @public\n */\nexport interface Get2ListsIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2MediaAnalyticsResponse\n *\n * @public\n */\nexport interface Get2MediaAnalyticsResponse {\n data?: MediaAnalytics;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2MediaMediaKeyResponse\n *\n * @public\n */\nexport interface Get2MediaMediaKeyResponse {\n data?: Media;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2MediaResponse\n *\n * @public\n */\nexport interface Get2MediaResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2NewsIdResponse\n *\n * @public\n */\nexport interface Get2NewsIdResponse {\n data?: News;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2NotesSearchNotesWrittenResponse\n *\n * @public\n */\nexport interface Get2NotesSearchNotesWrittenResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2NotesSearchPostsEligibleForNotesResponse\n *\n * @public\n */\nexport interface Get2NotesSearchPostsEligibleForNotesResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesByCreatorIdsResponse\n *\n * @public\n */\nexport interface Get2SpacesByCreatorIdsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesIdBuyersResponse\n *\n * @public\n */\nexport interface Get2SpacesIdBuyersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesIdResponse\n *\n * @public\n */\nexport interface Get2SpacesIdResponse {\n data?: Space;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2SpacesIdTweetsResponse\n *\n * @public\n */\nexport interface Get2SpacesIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesResponse\n *\n * @public\n */\nexport interface Get2SpacesResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2SpacesSearchResponse\n *\n * @public\n */\nexport interface Get2SpacesSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TrendsByWoeidWoeidResponse\n *\n * @public\n */\nexport interface Get2TrendsByWoeidWoeidResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2TweetsAnalyticsResponse\n *\n * @public\n */\nexport interface Get2TweetsAnalyticsResponse {\n data?: Analytics;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2TweetsCountsAllResponse\n *\n * @public\n */\nexport interface Get2TweetsCountsAllResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsCountsRecentResponse\n *\n * @public\n */\nexport interface Get2TweetsCountsRecentResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangEnResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangEnResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangJaResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangJaResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangKoResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangKoResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangPtResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangPtResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsIdLikingUsersResponse\n *\n * @public\n */\nexport interface Get2TweetsIdLikingUsersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdQuoteTweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsIdQuoteTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdResponse\n *\n * @public\n */\nexport interface Get2TweetsIdResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsIdRetweetedByResponse\n *\n * @public\n */\nexport interface Get2TweetsIdRetweetedByResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdRetweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsIdRetweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSample10StreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSample10StreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSampleStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSampleStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSearchAllResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchAllResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsSearchRecentResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchRecentResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsSearchStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSearchStreamRulesCountsResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchStreamRulesCountsResponse {\n data?: RulesCount;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsageTweetsResponse\n *\n * @public\n */\nexport interface Get2UsageTweetsResponse {\n data?: Usage;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsersByResponse\n *\n * @public\n */\nexport interface Get2UsersByResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersByUsernameUsernameResponse\n *\n * @public\n */\nexport interface Get2UsersByUsernameUsernameResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersIdBlockingResponse\n *\n * @public\n */\nexport interface Get2UsersIdBlockingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdBookmarksResponse\n *\n * @public\n */\nexport interface Get2UsersIdBookmarksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowersResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowingResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdLikedTweetsResponse\n *\n * @public\n */\nexport interface Get2UsersIdLikedTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdListMembershipsResponse\n *\n * @public\n */\nexport interface Get2UsersIdListMembershipsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdMentionsResponse\n *\n * @public\n */\nexport interface Get2UsersIdMentionsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdMutingResponse\n *\n * @public\n */\nexport interface Get2UsersIdMutingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdOwnedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdOwnedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdPinnedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdPinnedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdResponse\n *\n * @public\n */\nexport interface Get2UsersIdResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersIdTimelinesReverseChronologicalResponse\n *\n * @public\n */\nexport interface Get2UsersIdTimelinesReverseChronologicalResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdTweetsResponse\n *\n * @public\n */\nexport interface Get2UsersIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersMeResponse\n *\n * @public\n */\nexport interface Get2UsersMeResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersPersonalizedTrendsResponse\n *\n * @public\n */\nexport interface Get2UsersPersonalizedTrendsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsersRepostsOfMeResponse\n *\n * @public\n */\nexport interface Get2UsersRepostsOfMeResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersResponse\n *\n * @public\n */\nexport interface Get2UsersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersSearchResponse\n *\n * @public\n */\nexport interface Get2UsersSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2WebhooksResponse\n *\n * @public\n */\nexport interface Get2WebhooksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n}\n/**\nSchema type for HashtagEntity\n *\n * @public\n */\nexport type HashtagEntity = any; /**\nRepresent the portion of text recognized as a Hashtag, and its start and end position within the text.\n *\n * @public\n */\nexport interface HashtagFields {\n /** The text of the Hashtag. */ tag: string;\n} /**\nHTTP Status Code.\n *\n * @public\n */\nexport type HttpStatusCode = number;\n/**\nA problem that indicates this request is invalid.\n *\n * @public\n */\nexport type InvalidRequestProblem = any;\n/**\nThe rule you have submitted is invalid.\n *\n * @public\n */\nexport type InvalidRuleProblem = any; /**\nCompliance Job ID.\n *\n * @public\n */\nexport type JobId = string; /**\nA keyword to filter on.\n *\n * @public\n */\nexport type Keyword = string; /**\nSchema type for KillAllConnectionsResponse\n *\n * @public\n */\nexport interface KillAllConnectionsResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for LikeComplianceSchema\n *\n * @public\n */\nexport interface LikeComplianceSchema {\n delete: UnlikeComplianceSchema;\n} /**\nThe unique identifier of this Like.\n *\n * @public\n */\nexport type LikeId = string;\n/**\nLikes compliance stream events.\n *\n * @public\n */\nexport type LikesComplianceStreamResponse = any; /**\nA Like event, with the tweet author user and the tweet being liked\n *\n * @public\n */\nexport interface LikeWithTweetAuthor {\n /** Creation time of the Tweet. */ createdAt?: string;\n id?: LikeId;\n likedTweetId?: TweetId;\n /** Timestamp in milliseconds of creation. */ timestampMs?: number;\n tweetAuthorId?: UserId;\n} /**\nA X List is a curated group of accounts.\n *\n * @public\n */\nexport interface List {\n /** none */ createdAt?: string;\n /** none */ description?: string;\n /** none */ followerCount?: number;\n id: ListId;\n /** none */ memberCount?: number;\n /** The name of this List. */ name: string;\n ownerId?: UserId;\n /** none */ private?: boolean;\n} /**\nSchema type for ListAddUserRequest\n *\n * @public\n */\nexport interface ListAddUserRequest {\n userId: UserId;\n} /**\nSchema type for ListCreateRequest\n *\n * @public\n */\nexport interface ListCreateRequest {\n /** none */ description?: string;\n /** none */ name: string;\n /** none */ private?: boolean;\n} /**\nSchema type for ListCreateResponse\n *\n * @public\n */\nexport interface ListCreateResponse {\n /** A X List is a curated group of accounts. */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListDeleteResponse\n *\n * @public\n */\nexport interface ListDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListFollowedRequest\n *\n * @public\n */\nexport interface ListFollowedRequest {\n listId: ListId;\n} /**\nSchema type for ListFollowedResponse\n *\n * @public\n */\nexport interface ListFollowedResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe unique identifier of this List.\n *\n * @public\n */\nexport type ListId = string; /**\nSchema type for ListMutateResponse\n *\n * @public\n */\nexport interface ListMutateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListPinnedRequest\n *\n * @public\n */\nexport interface ListPinnedRequest {\n listId: ListId;\n} /**\nSchema type for ListPinnedResponse\n *\n * @public\n */\nexport interface ListPinnedResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListUnpinResponse\n *\n * @public\n */\nexport interface ListUnpinResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListUpdateRequest\n *\n * @public\n */\nexport interface ListUpdateRequest {\n /** none */ description?: string;\n /** none */ name?: string;\n /** none */ private?: boolean;\n} /**\nSchema type for ListUpdateResponse\n *\n * @public\n */\nexport interface ListUpdateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ManagementInfo\n *\n * @public\n */\nexport interface ManagementInfo {\n /** Indicates if the media is managed by Media Studio */ managed: boolean;\n} /**\nSchema type for Media\n *\n * @public\n */\nexport interface Media {\n height?: MediaHeight;\n mediaKey?: MediaKey;\n /** none */ type: string;\n width?: MediaWidth;\n} /**\nSchema type for MediaAnalytics\n *\n * @public\n */\nexport interface MediaAnalytics {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n} /**\nA string enum value which identifies a media use-case. This identifier is used to enforce use-case specific constraints (e.g. file size, video duration) and enable advanced features.\n *\n * @public\n */\nexport type MediaCategory =\n | 'amplify_video'\n | 'tweet_gif'\n | 'tweet_image'\n | 'tweet_video'\n | 'dm_gif'\n | 'dm_image'\n | 'dm_video'\n | 'subtitles'; /**\nA string enum value which identifies a media use-case. This identifier is used to enforce use-case specific constraints (e.g. file size) and enable advanced features.\n *\n * @public\n */\nexport type MediaCategoryOneShot =\n | 'tweet_image'\n | 'dm_image'\n | 'subtitles'; /**\nThe media category of uploaded media to which subtitles should be added/deleted\n *\n * @public\n */\nexport type MediaCategorySubtitles =\n | 'AmplifyVideo'\n | 'TweetVideo'; /**\nThe height of the media in pixels.\n *\n * @public\n */\nexport type MediaHeight = number; /**\nThe unique identifier of this Media.\n *\n * @public\n */\nexport type MediaId = string; /**\nThe Media Key identifier for this attachment.\n *\n * @public\n */\nexport type MediaKey = string; /**\nSchema type for MediaMetrics\n *\n * @public\n */\nexport interface MediaMetrics {\n /** Tracks the number of clicks on a call-to-action URL */ ctaUrlClicks?: number;\n /** Tracks the number of clicks to watch a video or media content */ ctaWatchClicks?: number;\n /** Tracks the number of times a video or media is played from a user tap */ playFromTap?: number;\n /** Tracks the number of times a video reaches 25% of its duration */ playback25?: number;\n /** Tracks the number of times a video reaches 50% of its duration */ playback50?: number;\n /** Tracks the number of times a video reaches 75% of its duration */ playback75?: number;\n /** Tracks the number of times a video is played to completion */ playbackComplete?: number;\n /** Tracks the number of times a video playback is initiated */ playbackStart?: number;\n /** Tracks the number of times a video is viewed */ videoViews?: number;\n /** Tracks the total time spent watching a video, measured in milliseconds */ watchTimeMs?: number;\n} /**\nThe file to upload.\n *\n * @public\n */\nexport type MediaPayloadBinary = string; /**\nThe file to upload.\n *\n * @public\n */\nexport type MediaPayloadByte = string;\n/**\nSchema type for MediaSegments\n *\n * @public\n */\nexport type MediaSegments = any; /**\nSchema type for MediaTimestampedMetrics\n *\n * @public\n */\nexport interface MediaTimestampedMetrics {\n metrics?: MediaMetrics;\n /** ISO8601 Time */ timestamp?: string;\n}\n/**\nSchema type for MediaUploadAppendRequest\n *\n * @public\n */\nexport type MediaUploadAppendRequest = any; /**\nA response from getting a media upload request status.\n *\n * @public\n */\nexport interface MediaUploadAppendResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for MediaUploadConfigRequest\n *\n * @public\n */\nexport interface MediaUploadConfigRequest {\n /** none */ additionalOwners?: Array;\n mediaCategory?: MediaCategory;\n /** The type of media. */ mediaType?:\n | 'video/mp4'\n | 'video/webm'\n | 'video/mp2t'\n | 'video/quicktime'\n | 'text/srt'\n | 'text/vtt'\n | 'image/jpeg'\n | 'image/gif'\n | 'image/bmp'\n | 'image/png'\n | 'image/webp'\n | 'image/pjpeg'\n | 'image/tiff'\n | 'model/gltf-binary'\n | 'model/vnd.usdz+zip';\n /** Whether this media is shared or not. */ shared?: boolean;\n /** The total size of the media upload in bytes. */ totalBytes?: number;\n} /**\nSchema type for MediaUploadRequestOneShot\n *\n * @public\n */\nexport interface MediaUploadRequestOneShot {\n /** none */ additionalOwners?: Array;\n /** none */ media: any;\n mediaCategory: MediaCategoryOneShot;\n /** The type of image or subtitle. */ mediaType?:\n | 'text/srt'\n | 'text/vtt'\n | 'image/jpeg'\n | 'image/bmp'\n | 'image/png'\n | 'image/webp'\n | 'image/pjpeg'\n | 'image/tiff';\n /** Whether this media is shared or not. */ shared?: boolean;\n} /**\nA response from getting a media upload request status.\n *\n * @public\n */\nexport interface MediaUploadResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe width of the media in pixels.\n *\n * @public\n */\nexport type MediaWidth = number;\n/**\nSchema type for MentionEntity\n *\n * @public\n */\nexport type MentionEntity = any; /**\nRepresent the portion of text recognized as a User mention, and its start and end position within the text.\n *\n * @public\n */\nexport interface MentionFields {\n id?: UserId;\n username: UserName;\n} /**\nSchema type for MetadataCreateRequest\n *\n * @public\n */\nexport interface MetadataCreateRequest {\n id: MediaId;\n /** none */ metadata?: Record;\n} /**\nSchema type for MetadataCreateResponse\n *\n * @public\n */\nexport interface MetadataCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for Metrics\n *\n * @public\n */\nexport interface Metrics {\n /** Tracks number of App Install Attempts */ appInstallAttempts?: number;\n /** Tracks number of App opens */ appOpens?: number;\n /** Tracks number of Detail expands */ detailExpands?: number;\n /** Tracks number of Email Tweet actions */ emailTweet?: number;\n /** Tracks total Engagements */ engagements?: number;\n /** Tracks number of Follows */ follows?: number;\n /** Tracks number of Hashtag clicks */ hashtagClicks?: number;\n /** Tracks number of Impressions */ impressions?: number;\n /** Tracks number of Likes */ likes?: number;\n /** Tracks number of Link clicks */ linkClicks?: number;\n /** Tracks number of Media engagements */ mediaEngagements?: number;\n /** Tracks number of Media views */ mediaViews?: number;\n /** Tracks number of Permalink clicks */ permalinkClicks?: number;\n /** Tracks number of Profile visits */ profileVisits?: number;\n /** Tracks number of Quote Tweets */ quoteTweets?: number;\n /** Tracks number of Replies */ replies?: number;\n /** Tracks number of Retweets */ retweets?: number;\n /** Tracks number of URL clicks */ urlClicks?: number;\n /** Tracks number of User Profile clicks */ userProfileClicks?: number;\n} /**\nCommunity Note misleading tags type.\n *\n * @public\n */\nexport type MisleadingTags =\n | 'disputed_claim_as_fact'\n | 'factual_error'\n | 'manipulated_media'\n | 'misinterpreted_satire'\n | 'missing_important_context'\n | 'other'\n | 'outdated_information'; /**\nSchema type for MuteUserMutationResponse\n *\n * @public\n */\nexport interface MuteUserMutationResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for MuteUserRequest\n *\n * @public\n */\nexport interface MuteUserRequest {\n targetUserId: UserId;\n} /**\nThe newest id in this response.\n *\n * @public\n */\nexport type NewestId = string; /**\nAn AI generated news story.\n *\n * @public\n */\nexport interface News {\n /** The news category. */ category?: string;\n /** none */ clusterPostsResults?: Array>;\n /** none */ contexts?: Record;\n /** none */ disclaimer?: string;\n /** The news hook. */ hook?: string;\n /** none */ keywords?: Array;\n /** none */ lastUpdatedAtMs?: string;\n /** The headline. */ name?: string;\n restId: NewsId;\n /** The news summary. */ summary?: string;\n} /**\nUnique identifier of news story.\n *\n * @public\n */\nexport type NewsId = string; /**\nThe next token.\n *\n * @public\n */\nexport type NextToken = string;\n/**\nA problem that indicates the user's rule set is not compliant.\n *\n * @public\n */\nexport type NonCompliantRulesProblem = any; /**\nA X Community Note is a note on a Post.\n *\n * @public\n */\nexport interface Note {\n id: NoteId;\n info?: NoteInfo;\n postId: TweetId;\n status?: NoteRatingStatus;\n testResult?: NoteTestResult;\n} /**\nCommunity Note classification type.\n *\n * @public\n */\nexport type NoteClassification =\n | 'misinformed_or_potentially_misleading'\n | 'not_misleading'; /**\nThe unique identifier of this Community Note.\n *\n * @public\n */\nexport type NoteId = string; /**\nA X Community Note is a note on a Post.\n *\n * @public\n */\nexport interface NoteInfo {\n classification: NoteClassification;\n /** none */ misleadingTags: Array;\n /** The text summary in the Community Note. */ text: string;\n /** Whether the note provided trustworthy links. */ trustworthySources: boolean;\n} /**\nCommunity Note rating status\n *\n * @public\n */\nexport type NoteRatingStatus =\n | 'currently_rated_helpful'\n | 'currently_rated_not_helpful'\n | 'firm_reject'\n | 'insufficient_consensus'\n | 'minimum_ratings_not_met'\n | 'needs_more_ratings'\n | 'needs_your_help'; /**\nThe evaluation result of a community note.\n *\n * @public\n */\nexport interface NoteTestResult {\n /** Score bucket from the evaluator result. */ evaluatorScoreBucket?: string;\n /** The type of the evaluator. */ evaluatorType?: string;\n} /**\nThe note content of the Tweet.\n *\n * @public\n */\nexport type NoteTweetText = string;\n/**\nA problem that indicates your client application does not have the required OAuth1 permissions for the requested endpoint.\n *\n * @public\n */\nexport type Oauth1PermissionsProblem = any; /**\nThe oldest id in this response.\n *\n * @public\n */\nexport type OldestId = string;\n/**\nYou have been disconnected for operational reasons.\n *\n * @public\n */\nexport type OperationalDisconnectProblem = any; /**\nA base32 pagination token.\n *\n * @public\n */\nexport type PaginationToken32 = string; /**\nA base36 pagination token.\n *\n * @public\n */\nexport type PaginationToken36 = string; /**\nA 'long' pagination token.\n *\n * @public\n */\nexport type PaginationTokenLong = string; /**\nA trend.\n *\n * @public\n */\nexport interface PersonalizedTrend {\n /** Category of this trend. */ category?: string;\n /** Number of posts pertaining to this trend. */ postCount?: number;\n /** Name of the trend. */ trendName?: string;\n /** Time since this is trending. */ trendingSince?: string;\n}\n/**\nSchema type for Photo\n *\n * @public\n */\nexport type Photo = any; /**\nSchema type for Place\n *\n * @public\n */\nexport interface Place {\n /** none */ containedWithin?: Array;\n /** The full name of the county in which this place exists. */ country?: string;\n countryCode?: CountryCode;\n /** The full name of this place. */ fullName: string;\n geo?: Geo;\n id: PlaceId;\n /** The human readable name of this place. */ name?: string;\n placeType?: PlaceType;\n} /**\nThe identifier for this place.\n *\n * @public\n */\nexport type PlaceId = string; /**\nSchema type for PlaceType\n *\n * @public\n */\nexport type PlaceType =\n | 'poi'\n | 'neighborhood'\n | 'city'\n | 'admin'\n | 'country'\n | 'unknown'; /**\nDescriptor for a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccount {\n /** The category of the account (e.g., personal, business). */ accountCategory: string;\n /** The Plaid account ID. */ accountId: string;\n /** The last 2-4 digits of the account number. */ accountNumberDisplay: string;\n /** The type of the account (e.g., checking, savings). */ accountType: string;\n /** The available balance of the account. */ availableBalance?: number;\n currency: PlaidCurrency;\n /** The current balance of the account. */ currentBalance?: number;\n /** The nickname of the account. */ nickname?: string;\n /** The name of the product associated with the account. */ productName: string;\n /** The status of the account. */ status: string;\n} /**\nContact information associated with a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccountContact {\n /** List of addresses associated with the account holder. */ addresses: Array<\n PlaidAddress\n >;\n /** List of email addresses associated with the account holder. */ emails: Array<\n string\n >;\n name: PlaidName;\n /** Relationship of the contact to the account. */ relationship?: string;\n /** List of telephone numbers associated with the account holder. */ telephones: Array<\n PlaidTelephone\n >;\n} /**\nPayment network details associated with the account.\n *\n * @public\n */\nexport interface PlaidAccountPaymentNetwork {\n /** The bank ID associated with the account. */ bankId: string;\n /** The payment network identifier. */ identifier: string;\n /** Indicates if transfers into the account are supported. */ transferIn: boolean;\n /** Indicates if transfers out of the account are supported. */ transferOut: boolean;\n /** The type of payment network (e.g., ACH, SEPA). */ type: string;\n} /**\nDescriptor for a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccountTransaction {\n /** The category of the account (e.g., personal, business). */ accountCategory: string;\n /** The amount transacted. */ amount: number;\n /** Memo for transaction (e.g. CREDIT) */ debitCreditMemo: string;\n /** The transaction description */ description: string;\n /** The timestamp when the transaction was posted. */ postedTimestamp?: string;\n /** The status of the transaction. */ status: string;\n /** The identifier for the transaction. */ transactionId: string;\n /** The timestamp when the transaction occurred. */ transactionTimestamp: string;\n} /**\nAddress information for the account holder.\n *\n * @public\n */\nexport interface PlaidAddress {\n /** The city of the address. */ city: string;\n /** The country of the address (ISO 3166-1 alpha-2 code). */ country: string;\n /** The first line of the address. */ line1: string;\n /** The second line of the address. */ line2?: string;\n /** The postal code of the address. */ postalCode?: string;\n /** The region or state of the address. */ region?: string;\n} /**\nCurrency information.\n *\n * @public\n */\nexport interface PlaidCurrency {\n /** The ISO 4217 currency code. */ currencyCode: string;\n} /**\nA user id for the plaid customer\n *\n * @public\n */\nexport interface PlaidCustomer {\n customerId?: UserId;\n} /**\nName information for the account holder.\n *\n * @public\n */\nexport interface PlaidName {\n /** The first name of the account holder. */ first: string;\n /** The last name of the account holder. */ last: string;\n} /**\nTelephone information for the account holder.\n *\n * @public\n */\nexport interface PlaidTelephone {\n /** The country code for the phone number (e.g., '+1'). */ country: string;\n /** The phone number. */ number: string;\n /** The type of phone number (e.g., 'mobile'). */ type: string;\n} /**\nA [GeoJson Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) geometry object.\n *\n * @public\n */\nexport interface Point {\n coordinates: Position;\n /** none */ type: 'Point';\n} /**\nRepresent a Poll attached to a Tweet.\n *\n * @public\n */\nexport interface Poll {\n /** none */ durationMinutes?: number;\n /** none */ endDatetime?: string;\n id: PollId;\n /** none */ options: Array;\n /** none */ votingStatus?: 'open' | 'closed';\n} /**\nUnique identifier of this poll.\n *\n * @public\n */\nexport type PollId = string; /**\nDescribes a choice in a Poll object.\n *\n * @public\n */\nexport interface PollOption {\n label: PollOptionLabel;\n /** Position of this choice in the poll. */ position: number;\n /** Number of users who voted for this choice. */ votes: number;\n} /**\nThe text of a poll choice.\n *\n * @public\n */\nexport type PollOptionLabel = string; /**\nA [GeoJson Position](https://tools.ietf.org/html/rfc7946#section-3.1.1) in the format `[longitude,latitude]`.\n *\n * @public\n */\nexport type Position = Array<\n number\n>; /**\nSchema type for PreviewImage\n *\n * @public\n */\nexport interface PreviewImage {\n /** none */ mediaKey: Record;\n} /**\nThe previous token.\n *\n * @public\n */\nexport type PreviousToken = string; /**\nAn HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807).\n *\n * @public\n */\nexport interface Problem {\n /** none */ detail?: string;\n /** none */ status?: number;\n /** none */ title: string;\n /** none */ type: string;\n} /**\nSchema type for ProcessingInfo\n *\n * @public\n */\nexport interface ProcessingInfo {\n /** Number of seconds to check again for status */ checkAfterSecs?: number;\n /** Percent of upload progress */ progressPercent?: number;\n /** State of upload */ state?:\n | 'succeeded'\n | 'in_progress'\n | 'pending'\n | 'failed';\n} /**\nSchema type for ProfileUpdateActivityResponsePayload\n *\n * @public\n */\nexport interface ProfileUpdateActivityResponsePayload {\n /** none */ after?: string;\n /** none */ before?: string;\n} /**\nConfirmation that the replay job request was accepted.\n *\n * @public\n */\nexport interface ReplayJobCreateResponse {\n /** The UTC timestamp indicating when the replay job was created. */ createdAt: string;\n /** The unique identifier for the initiated replay job. */ jobId: string;\n} /**\nShows who can reply a Tweet. Fields returned are everyone, mentioned_users, and following.\n *\n * @public\n */\nexport type ReplySettings =\n | 'everyone'\n | 'mentionedUsers'\n | 'following'\n | 'other'; /**\nShows who can reply a Tweet. Fields returned are everyone, mentioned_users, subscribers, verified and following.\n *\n * @public\n */\nexport type ReplySettingsWithVerifiedUsers =\n | 'everyone'\n | 'mentionedUsers'\n | 'following'\n | 'other'\n | 'subscribers'\n | 'verified';\n/**\nA problem that indicates that a given Tweet, User, etc. does not exist.\n *\n * @public\n */\nexport type ResourceNotFoundProblem = any;\n/**\nA problem that indicates you are not allowed to see a particular Tweet, User, etc.\n *\n * @public\n */\nexport type ResourceUnauthorizedProblem = any;\n/**\nA problem that indicates a particular Tweet, User, etc. is not available to you.\n *\n * @public\n */\nexport type ResourceUnavailableProblem = any; /**\nThe number of results returned in this response.\n *\n * @public\n */\nexport type ResultCount = number; /**\nA user-provided stream filtering rule.\n *\n * @public\n */\nexport interface Rule {\n id?: RuleId;\n tag?: RuleTag;\n value: RuleValue;\n} /**\nUnique identifier of this rule.\n *\n * @public\n */\nexport type RuleId = string; /**\nA user-provided stream filtering rule.\n *\n * @public\n */\nexport interface RuleNoId {\n tag?: RuleTag;\n value: RuleValue;\n}\n/**\nYou have exceeded the maximum number of rules.\n *\n * @public\n */\nexport type RulesCapProblem = any; /**\nA count of user-provided stream filtering rules at the application and project levels.\n *\n * @public\n */\nexport interface RulesCount {\n allProjectClientApps?: AllProjectClientApps;\n /** Cap of number of rules allowed per client application */ capPerClientApp?: number;\n /** Cap of number of rules allowed per project */ capPerProject?: number;\n clientAppRulesCount?: AppRulesCount;\n /** Number of rules for project */ projectRulesCount?: number;\n} /**\nSchema type for RulesLookupResponse\n *\n * @public\n */\nexport interface RulesLookupResponse {\n /** none */ data?: Array;\n meta: RulesResponseMetadata;\n}\n/**\nSchema type for RulesRequestSummary\n *\n * @public\n */\nexport type RulesRequestSummary = any; /**\nSchema type for RulesResponseMetadata\n *\n * @public\n */\nexport interface RulesResponseMetadata {\n nextToken?: NextToken;\n /** Number of Rules in result set. */ resultCount?: number;\n /** none */ sent: string;\n summary?: RulesRequestSummary;\n} /**\nA tag meant for the labeling of user provided rules.\n *\n * @public\n */\nexport type RuleTag = string; /**\nThe filterlang value of the rule.\n *\n * @public\n */\nexport type RuleValue = string; /**\nRepresent a Search Count Result.\n *\n * @public\n */\nexport interface SearchCount {\n end: End;\n start: Start;\n tweetCount: TweetCount;\n} /**\nSchema type for SensitiveMediaWarning\n *\n * @public\n */\nexport interface SensitiveMediaWarning {\n /** Indicates if the content contains adult material */ adultContent?: boolean;\n /** Indicates if the content depicts graphic violence */ graphicViolence?: boolean;\n /** Indicates if the content has other sensitive characteristics */ other?: boolean;\n} /**\nSchema type for SharedInfo\n *\n * @public\n */\nexport interface SharedInfo {\n /** Indicates if the media is shared in direct messages */ shared: boolean;\n} /**\nSchema type for Space\n *\n * @public\n */\nexport interface Space {\n /** Creation time of the Space. */ createdAt?: string;\n creatorId?: UserId;\n /** End time of the Space. */ endedAt?: string;\n /** The user ids for the hosts of the Space. */ hostIds?: Array;\n id: SpaceId;\n /** An array of user ids for people who were invited to a Space. */ invitedUserIds?: Array<\n UserId\n >;\n /** Denotes if the Space is a ticketed Space. */ isTicketed?: boolean;\n /** The language of the Space. */ lang?: string;\n /** The number of participants in a Space. */ participantCount?: number;\n /** A date time stamp for when a Space is scheduled to begin. */ scheduledStart?: string;\n /** An array of user ids for people who were speakers in a Space. */ speakerIds?: Array<\n UserId\n >;\n /** When the Space was started as a date string. */ startedAt?: string;\n /** The current state of the Space. */ state: 'live' | 'scheduled' | 'ended';\n /** The number of people who have either purchased a ticket or set a reminder for this Space. */ subscriberCount?: number;\n /** The title of the Space. */ title?: string;\n /** The topics of a Space, as selected by its creator. */ topics?: Array<\n Record\n >;\n /** When the Space was last updated. */ updatedAt?: string;\n} /**\nThe unique identifier of this Space.\n *\n * @public\n */\nexport type SpaceId = string; /**\nThe start time of the bucket.\n *\n * @public\n */\nexport type Start = string; /**\nSchema type for Sticker\n *\n * @public\n */\nexport interface Sticker {\n /** width-to-height ratio of the media */ aspectRatio?: number;\n /** A unique identifier for the group of annotations associated with the media */ groupAnnotationId?: number;\n /** Unique identifier for sticker */ id?: string;\n /** A unique identifier for the sticker set associated with the media */ stickerSetAnnotationId?: number;\n /** Scale or rotate the media on the x-axis */ transformA?: number;\n /** Skew the media on the x-axis */ transformB?: number;\n /** Skew the media on the y-axis */ transformC?: number;\n /** Scale or rotate the media on the y-axis */ transformD?: number;\n /** Scale or rotate the media on the x-axis */ transformTx?: number;\n /** The vertical translation (shift) value for the media */ transformTy?: number;\n} /**\nSchema type for StickerInfo\n *\n * @public\n */\nexport interface StickerInfo {\n /** Stickers list must not be empty and should not exceed 25 */ stickers: Array<\n Sticker\n >;\n} /**\nSchema type for StreamingLikeResponseV2\n *\n * @public\n */\nexport interface StreamingLikeResponseV2 {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for StreamingTweetResponse\n *\n * @public\n */\nexport interface StreamingTweetResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for SubscriptionsCountGetResponse\n *\n * @public\n */\nexport interface SubscriptionsCountGetResponse {\n /** The count of active subscriptions across all webhooks */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsCreateRequest\n *\n * @public\n */\nexport type SubscriptionsCreateRequest = Record<\n string,\n any\n>; /**\nSchema type for SubscriptionsCreateResponse\n *\n * @public\n */\nexport interface SubscriptionsCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsDeleteResponse\n *\n * @public\n */\nexport interface SubscriptionsDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsGetResponse\n *\n * @public\n */\nexport interface SubscriptionsGetResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsListGetResponse\n *\n * @public\n */\nexport interface SubscriptionsListGetResponse {\n /** The list of active subscriptions for a specified webhook */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n} /**\nThe language code should be a BCP47 code (e.g. 'EN\", \"SP\")\n *\n * @public\n */\nexport type SubtitleLanguageCode = string; /**\nSchema type for Subtitles\n *\n * @public\n */\nexport interface Subtitles {\n /** Language name in a human readable form */ displayName?: string;\n id?: MediaId;\n languageCode?: SubtitleLanguageCode;\n} /**\nSchema type for SubtitlesCreateRequest\n *\n * @public\n */\nexport interface SubtitlesCreateRequest {\n id?: MediaId;\n mediaCategory?: MediaCategorySubtitles;\n subtitles?: Subtitles;\n} /**\nSchema type for SubtitlesCreateResponse\n *\n * @public\n */\nexport interface SubtitlesCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubtitlesDeleteRequest\n *\n * @public\n */\nexport interface SubtitlesDeleteRequest {\n id?: MediaId;\n languageCode?: SubtitleLanguageCode;\n mediaCategory?: MediaCategorySubtitles;\n} /**\nSchema type for SubtitlesDeleteResponse\n *\n * @public\n */\nexport interface SubtitlesDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TimestampedMetrics\n *\n * @public\n */\nexport interface TimestampedMetrics {\n metrics?: Metrics;\n /** ISO8601 Time */ timestamp?: string;\n} /**\nThe topic of a Space, as selected by its creator.\n *\n * @public\n */\nexport interface Topic {\n /** The description of the given topic. */ description?: string;\n id: TopicId;\n /** The name of the given topic. */ name: string;\n} /**\nUnique identifier of this Topic.\n *\n * @public\n */\nexport type TopicId = string; /**\nA trend.\n *\n * @public\n */\nexport interface Trend {\n /** Name of the trend. */ trendName?: string;\n /** Number of Posts in this trend. */ tweetCount?: number;\n} /**\nSchema type for TrendActivityResponsePayload\n *\n * @public\n */\nexport interface TrendActivityResponsePayload {\n /** none */ category?: string;\n /** none */ headline?: string;\n /** none */ hook?: string;\n /** none */ summary?: string;\n} /**\nSchema type for Tweet\n *\n * @public\n */\nexport interface Tweet {\n /** Specifies the type of attachments (if any) present in this Tweet. */ attachments?: Record<\n string,\n any\n >;\n authorId?: UserId;\n communityId?: CommunityId;\n /** none */ contextAnnotations?: Array;\n conversationId?: TweetId;\n /** Creation time of the Tweet. */ createdAt?: string;\n displayTextRange?: DisplayTextRange;\n /** none */ editControls?: Record;\n /** A list of Tweet Ids in this Tweet chain. */ editHistoryTweetIds?: Array<\n TweetId\n >;\n entities?: FullTextEntities;\n /** The location tagged on the Tweet, if the user provided one. */ geo?: Record<\n string,\n any\n >;\n id?: TweetId;\n inReplyToUserId?: UserId;\n /** Language of the Tweet, if detected by X. Returned as a BCP47 language tag. */ lang?: string;\n /** Nonpublic engagement metrics for the Tweet at the time of the request. */ nonPublicMetrics?: Record<\n string,\n any\n >;\n /** The full-content of the Tweet, including text beyond 280 characters. */ noteTweet?: Record<\n string,\n any\n >;\n /** Organic nonpublic engagement metrics for the Tweet at the time of the request. */ organicMetrics?: Record<\n string,\n any\n >;\n /** Indicates if this Tweet contains URLs marked as sensitive, for example content suitable for mature audiences. */ possiblySensitive?: boolean;\n /** Promoted nonpublic engagement metrics for the Tweet at the time of the request. */ promotedMetrics?: Record<\n string,\n any\n >;\n /** Engagement metrics for the Tweet at the time of the request. */ publicMetrics?: Record<\n string,\n any\n >;\n /** A list of Posts this Tweet refers to. For example, if the parent Tweet is a Retweet, a Quoted Tweet or a Reply, it will include the related Tweet referenced to by its parent. */ referencedTweets?: Array<\n Record\n >;\n replySettings?: ReplySettingsWithVerifiedUsers;\n /** The scopes for this tweet */ scopes?: Record;\n /** This is deprecated. */ source?: string;\n /** none */ suggestedSourceLinks?: Array;\n text?: TweetText;\n username?: UserName;\n withheld?: TweetWithheld;\n}\n/**\nTweet compliance data.\n *\n * @public\n */\nexport type TweetComplianceData = any; /**\nSchema type for TweetComplianceSchema\n *\n * @public\n */\nexport interface TweetComplianceSchema {\n /** Event time. */ eventAt: string;\n quoteTweetId?: TweetId;\n /** none */ tweet: Record;\n}\n/**\nTweet compliance stream events.\n *\n * @public\n */\nexport type TweetComplianceStreamResponse = any; /**\nThe count for the bucket.\n *\n * @public\n */\nexport type TweetCount = number; /**\nSchema type for TweetCreateRequest\n *\n * @public\n */\nexport interface TweetCreateRequest {\n /** Card Uri Parameter. This is mutually exclusive from Quote Tweet Id, Poll, Media, and Direct Message Deep Link. */ cardUri?: string;\n communityId?: CommunityId;\n /** Link to take the conversation from the public timeline to a private Direct Message. */ directMessageDeepLink?: string;\n /** Options for editing an existing Post. When provided, this request will edit the specified Post instead of creating a new one. */ editOptions?: Record<\n string,\n any\n >;\n /** Exclusive Tweet for super followers. */ forSuperFollowersOnly?: boolean;\n /** Place ID being attached to the Tweet for geo location. */ geo?: Record<\n string,\n any\n >;\n /** Media information being attached to created Tweet. This is mutually exclusive from Quote Tweet Id, Poll, and Card URI. */ media?: Record<\n string,\n any\n >;\n /** Nullcasted (promoted-only) Posts do not appear in the public timeline and are not served to followers. */ nullcast?: boolean;\n /** Poll options for a Tweet with a poll. This is mutually exclusive from Media, Quote Tweet Id, and Card URI. */ poll?: Record<\n string,\n any\n >;\n quoteTweetId?: TweetId;\n /** Tweet information of the Tweet being replied to. */ reply?: Record<\n string,\n any\n >;\n /** Settings to indicate who can reply to the Tweet. */ replySettings?:\n | 'following'\n | 'mentionedUsers'\n | 'subscribers'\n | 'verified';\n /** Share community post with followers too. */ shareWithFollowers?: boolean;\n text?: TweetText;\n} /**\nSchema type for TweetCreateResponse\n *\n * @public\n */\nexport interface TweetCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TweetDeleteComplianceSchema\n *\n * @public\n */\nexport interface TweetDeleteComplianceSchema {\n delete: TweetComplianceSchema;\n} /**\nSchema type for TweetDeleteResponse\n *\n * @public\n */\nexport interface TweetDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TweetDropComplianceSchema\n *\n * @public\n */\nexport interface TweetDropComplianceSchema {\n drop: TweetComplianceSchema;\n} /**\nSchema type for TweetEditComplianceObjectSchema\n *\n * @public\n */\nexport interface TweetEditComplianceObjectSchema {\n /** none */ editTweetIds: Array;\n /** Event time. */ eventAt: string;\n initialTweetId: TweetId;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetEditComplianceSchema\n *\n * @public\n */\nexport interface TweetEditComplianceSchema {\n tweetEdit: TweetEditComplianceObjectSchema;\n} /**\nSchema type for TweetHideRequest\n *\n * @public\n */\nexport interface TweetHideRequest {\n /** none */ hidden: boolean;\n} /**\nSchema type for TweetHideResponse\n *\n * @public\n */\nexport interface TweetHideResponse {\n /** none */ data?: Record;\n} /**\nUnique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.\n *\n * @public\n */\nexport type TweetId = string;\n/**\nTweet label data.\n *\n * @public\n */\nexport type TweetLabelData = any;\n/**\nTweet label stream events.\n *\n * @public\n */\nexport type TweetLabelStreamResponse = any; /**\nSchema type for TweetNotice\n *\n * @public\n */\nexport interface TweetNotice {\n /** If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. */ application: string;\n /** Information shown on the Tweet label */ details?: string;\n /** Event time. */ eventAt: string;\n /** The type of label on the Tweet */ eventType: string;\n /** Link to more information about this kind of label */ extendedDetailsUrl?: string;\n /** Title/header of the Tweet label */ labelTitle?: string;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetNoticeSchema\n *\n * @public\n */\nexport interface TweetNoticeSchema {\n publicTweetNotice: TweetNotice;\n} /**\nSchema type for TweetTakedownComplianceSchema\n *\n * @public\n */\nexport interface TweetTakedownComplianceSchema {\n /** Event time. */ eventAt: string;\n quoteTweetId?: TweetId;\n /** none */ tweet: Record;\n /** none */ withheldInCountries: Array;\n} /**\nThe content of the Tweet.\n *\n * @public\n */\nexport type TweetText = string; /**\nSchema type for TweetUndropComplianceSchema\n *\n * @public\n */\nexport interface TweetUndropComplianceSchema {\n undrop: TweetComplianceSchema;\n} /**\nSchema type for TweetUnviewable\n *\n * @public\n */\nexport interface TweetUnviewable {\n /** If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. */ application: string;\n /** Event time. */ eventAt: string;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetUnviewableSchema\n *\n * @public\n */\nexport interface TweetUnviewableSchema {\n publicTweetUnviewable: TweetUnviewable;\n} /**\nIndicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).\n *\n * @public\n */\nexport interface TweetWithheld {\n /** Indicates if the content is being withheld for on the basis of copyright infringement. */ copyright: boolean;\n /** Provides a list of countries where this content is not available. */ countryCodes: Array<\n CountryCode\n >;\n /** Indicates whether the content being withheld is the `tweet` or a `user`. */ scope?:\n | 'tweet'\n | 'user';\n} /**\nSchema type for TweetWithheldComplianceSchema\n *\n * @public\n */\nexport interface TweetWithheldComplianceSchema {\n withheld: TweetTakedownComplianceSchema;\n} /**\nSchema type for UnlikeComplianceSchema\n *\n * @public\n */\nexport interface UnlikeComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ favorite: Record;\n}\n/**\nA problem that indicates that the authentication used is not supported.\n *\n * @public\n */\nexport type UnsupportedAuthenticationProblem = any; /**\nExpiration time of the upload URL.\n *\n * @public\n */\nexport type UploadExpiration = string; /**\nSchema type for UploadSource\n *\n * @public\n */\nexport interface UploadSource {\n /** Records the source (e.g., app, device) from which the media was uploaded */ uploadSource: string;\n} /**\nURL to which the user will upload their Tweet or user IDs.\n *\n * @public\n */\nexport type UploadUrl = string; /**\nA validly formatted URL.\n *\n * @public\n */\nexport type Url = string;\n/**\nRepresent the portion of text recognized as a URL, and its start and end position within the text.\n *\n * @public\n */\nexport type UrlEntity = any;\n/**\nRepresent the portion of text recognized as a URL, and its start and end position within the text.\n *\n * @public\n */\nexport type UrlEntityDm = any; /**\nRepresent the portion of text recognized as a URL.\n *\n * @public\n */\nexport interface UrlFields {\n /** Description of the URL landing page. */ description?: string;\n /** The URL as displayed in the X client. */ displayUrl?: string;\n expandedUrl?: Url;\n /** none */ images?: Array;\n mediaKey?: MediaKey;\n status?: HttpStatusCode;\n /** Title of the page the URL points to. */ title?: string;\n /** Fully resolved url. */ unwoundUrl?: string;\n url: Url;\n} /**\nRepresent the information for the URL image.\n *\n * @public\n */\nexport interface UrlImage {\n height?: MediaHeight;\n url?: Url;\n width?: MediaWidth;\n} /**\nUsage per client app\n *\n * @public\n */\nexport interface Usage {\n /** Number of days left for the Tweet cap to reset */ capResetDay?: number;\n /** The daily usage breakdown for each Client Application a project */ dailyClientAppUsage?: Array<\n ClientAppUsage\n >;\n /** The daily usage breakdown for a project */ dailyProjectUsage?: Record<\n string,\n any\n >;\n /** Total number of Posts that can be read in this project per month */ projectCap?: number;\n /** The unique identifier for this project */ projectId?: string;\n /** The number of Posts read in this project */ projectUsage?: number;\n}\n/**\nA problem that indicates that a usage cap has been exceeded.\n *\n * @public\n */\nexport type UsageCapExceededProblem = any; /**\nRepresents the data for Usage\n *\n * @public\n */\nexport interface UsageFields {\n /** The time period for the usage */ date?: string;\n /** The usage value */ usage?: number;\n} /**\nThe X User object.\n *\n * @public\n */\nexport interface User {\n /** Metadata about a user's affiliation. */ affiliation?: Record;\n /** Returns detailed information about the relationship between two users. */ connectionStatus?: Array<\n | 'follow_request_received'\n | 'follow_request_sent'\n | 'blocking'\n | 'followed_by'\n | 'following'\n | 'muting'\n >;\n /** Creation time of this User. */ createdAt?: string;\n /** The text of this User's profile description (also known as bio), if the User provided one. */ description?: string;\n /** A list of metadata found in the User's profile description. */ entities?: Record<\n string,\n any\n >;\n id: UserId;\n /** The location specified in the User's profile, if the User provided one. As this is a freeform value, it may not indicate a valid location, but it may be fuzzily evaluated when performing searches with location queries. */ location?: string;\n mostRecentTweetId?: TweetId;\n /** The friendly name of this User, as shown on their profile. */ name: string;\n pinnedTweetId?: TweetId;\n /** The URL to the profile banner for this User. */ profileBannerUrl?: string;\n /** The URL to the profile image for this User. */ profileImageUrl?: string;\n /** Indicates if this User has chosen to protect their Posts (in other words, if this User's Posts are private). */ protected?: boolean;\n /** A list of metrics for this User. */ publicMetrics?: Record;\n /** Indicates if you can send a DM to this User */ receivesYourDm?: boolean;\n /** The X Blue subscription type of the user, eg: Basic, Premium, PremiumPlus or None. */ subscriptionType?:\n | 'Basic'\n | 'Premium'\n | 'PremiumPlus'\n | 'None';\n /** The URL specified in the User's profile. */ url?: string;\n username: UserName;\n /** Indicate if this User is a verified X User. */ verified?: boolean;\n /** The X Blue verified type of the user, eg: blue, government, business or none. */ verifiedType?:\n | 'blue'\n | 'government'\n | 'business'\n | 'none';\n withheld?: UserWithheld;\n}\n/**\nUser compliance data.\n *\n * @public\n */\nexport type UserComplianceData = any; /**\nSchema type for UserComplianceSchema\n *\n * @public\n */\nexport interface UserComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ user: Record;\n}\n/**\nUser compliance stream events.\n *\n * @public\n */\nexport type UserComplianceStreamResponse = any; /**\nSchema type for UserDeleteComplianceSchema\n *\n * @public\n */\nexport interface UserDeleteComplianceSchema {\n userDelete: UserComplianceSchema;\n} /**\nUnique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.\n *\n * @public\n */\nexport type UserId = string; /**\nUnique identifier of this User. The value must be the same as the authenticated user.\n *\n * @public\n */\nexport type UserIdMatchesAuthenticatedUser = string; /**\nThe X handle (screen name) of this user.\n *\n * @public\n */\nexport type UserName = string; /**\nSchema type for UserProfileModificationComplianceSchema\n *\n * @public\n */\nexport interface UserProfileModificationComplianceSchema {\n userProfileModification: UserProfileModificationObjectSchema;\n} /**\nSchema type for UserProfileModificationObjectSchema\n *\n * @public\n */\nexport interface UserProfileModificationObjectSchema {\n /** Event time. */ eventAt: string;\n /** none */ newValue: string;\n /** none */ profileField: string;\n /** none */ user: Record;\n} /**\nSchema type for UserProtectComplianceSchema\n *\n * @public\n */\nexport interface UserProtectComplianceSchema {\n userProtect: UserComplianceSchema;\n} /**\nSchema type for UserScrubGeoObjectSchema\n *\n * @public\n */\nexport interface UserScrubGeoObjectSchema {\n /** Event time. */ eventAt: string;\n upToTweetId: TweetId;\n /** none */ user: Record;\n} /**\nSchema type for UserScrubGeoSchema\n *\n * @public\n */\nexport interface UserScrubGeoSchema {\n scrubGeo: UserScrubGeoObjectSchema;\n} /**\nSchema type for UsersDMBlockCreateResponse\n *\n * @public\n */\nexport interface UsersDMBlockCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersDMUnBlockCreateResponse\n *\n * @public\n */\nexport interface UsersDMUnBlockCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe the search string by which to query for users.\n *\n * @public\n */\nexport type UserSearchQueryVnext = string; /**\nSchema type for UsersFollowingCreateRequest\n *\n * @public\n */\nexport interface UsersFollowingCreateRequest {\n targetUserId: UserId;\n} /**\nSchema type for UsersFollowingCreateResponse\n *\n * @public\n */\nexport interface UsersFollowingCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersFollowingDeleteResponse\n *\n * @public\n */\nexport interface UsersFollowingDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersLikesCreateRequest\n *\n * @public\n */\nexport interface UsersLikesCreateRequest {\n tweetId: TweetId;\n} /**\nSchema type for UsersLikesCreateResponse\n *\n * @public\n */\nexport interface UsersLikesCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersLikesDeleteResponse\n *\n * @public\n */\nexport interface UsersLikesDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersRetweetsCreateRequest\n *\n * @public\n */\nexport interface UsersRetweetsCreateRequest {\n tweetId: TweetId;\n} /**\nSchema type for UsersRetweetsCreateResponse\n *\n * @public\n */\nexport interface UsersRetweetsCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersRetweetsDeleteResponse\n *\n * @public\n */\nexport interface UsersRetweetsDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UserSuspendComplianceSchema\n *\n * @public\n */\nexport interface UserSuspendComplianceSchema {\n userSuspend: UserComplianceSchema;\n} /**\nSchema type for UserTakedownComplianceSchema\n *\n * @public\n */\nexport interface UserTakedownComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ user: Record;\n /** none */ withheldInCountries: Array;\n} /**\nSchema type for UserUndeleteComplianceSchema\n *\n * @public\n */\nexport interface UserUndeleteComplianceSchema {\n userUndelete: UserComplianceSchema;\n} /**\nSchema type for UserUnprotectComplianceSchema\n *\n * @public\n */\nexport interface UserUnprotectComplianceSchema {\n userUnprotect: UserComplianceSchema;\n} /**\nSchema type for UserUnsuspendComplianceSchema\n *\n * @public\n */\nexport interface UserUnsuspendComplianceSchema {\n userUnsuspend: UserComplianceSchema;\n} /**\nIndicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).\n *\n * @public\n */\nexport interface UserWithheld {\n /** Provides a list of countries where this content is not available. */ countryCodes: Array<\n CountryCode\n >;\n /** Indicates that the content being withheld is a `user`. */ scope?: 'user';\n} /**\nSchema type for UserWithheldComplianceSchema\n *\n * @public\n */\nexport interface UserWithheldComplianceSchema {\n userWithheld: UserTakedownComplianceSchema;\n} /**\nSchema type for Variant\n *\n * @public\n */\nexport interface Variant {\n /** The bit rate of the media. */ bitRate?: number;\n /** The content type of the media. */ contentType?: string;\n /** The url to the media. */ url?: string;\n} /**\nAn array of all available variants of the media.\n *\n * @public\n */\nexport type Variants = Array;\n/**\nSchema type for Video\n *\n * @public\n */\nexport type Video = any; /**\nA Webhook Configuration\n *\n * @public\n */\nexport interface WebhookConfig {\n /** none */ createdAt: string;\n id: WebhookConfigId;\n /** The callback URL of the webhook. */ url: string;\n /** none */ valid: boolean;\n} /**\nSchema type for WebhookConfigCreateRequest\n *\n * @public\n */\nexport interface WebhookConfigCreateRequest {\n /** none */ url: string;\n} /**\nA Webhook Configuration\n *\n * @public\n */\nexport interface WebhookConfigCreateResponse {\n /** none */ createdAt: string;\n id: WebhookConfigId;\n /** The callback URL of the webhook. */ url: string;\n /** none */ valid: boolean;\n} /**\nSchema type for WebhookConfigDeleteResponse\n *\n * @public\n */\nexport interface WebhookConfigDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe unique identifier of this webhook config.\n *\n * @public\n */\nexport type WebhookConfigId = string; /**\nSchema type for WebhookConfigPutResponse\n *\n * @public\n */\nexport interface WebhookConfigPutResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksCreateResponse\n *\n * @public\n */\nexport interface WebhookLinksCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksDeleteResponse\n *\n * @public\n */\nexport interface WebhookLinksDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksGetResponse\n *\n * @public\n */\nexport interface WebhookLinksGetResponse {\n /** The list of active webhook links for a given stream */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for stream operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for postsSample\n * \n * @public\n */\nexport type PostsSampleResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsFirehose\n * \n * @public\n */\nexport type PostsFirehoseResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for labelsCompliance\n * \n * @public\n */\nexport type LabelsComplianceResponse = Schemas.TweetLabelStreamResponse;\n/**\n * Response for likesCompliance\n * \n * @public\n */\nexport type LikesComplianceResponse = Schemas.LikesComplianceStreamResponse;\n/**\n * Response for likesSample10\n * \n * @public\n */\nexport type LikesSample10Response = Schemas.StreamingLikeResponseV2;\n/**\n * Response for postsFirehosePt\n * \n * @public\n */\nexport type PostsFirehosePtResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsFirehoseEn\n * \n * @public\n */\nexport type PostsFirehoseEnResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for posts\n * \n * @public\n */\nexport type PostsResponse = Schemas.FilteredStreamingTweetResponse;\n/**\n * Response for getRules\n * \n * @public\n */\nexport type GetRulesResponse = Schemas.RulesLookupResponse;\n/**\n * Request for updateRules\n * \n * @public\n */\nexport type UpdateRulesRequest = Schemas.AddOrDeleteRulesRequest;\n/**\n * Response for updateRules\n * \n * @public\n */\nexport type UpdateRulesResponse = Schemas.AddOrDeleteRulesResponse;\n/**\n * Response for postsCompliance\n * \n * @public\n */\nexport type PostsComplianceResponse = Schemas.TweetComplianceStreamResponse;\n/**\n * Response for postsFirehoseKo\n * \n * @public\n */\nexport type PostsFirehoseKoResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for likesFirehose\n * \n * @public\n */\nexport type LikesFirehoseResponse = Schemas.StreamingLikeResponseV2;\n/**\n * Response for postsSample10\n * \n * @public\n */\nexport type PostsSample10Response = Schemas.Get2TweetsSample10StreamResponse;\n/**\n * Response for postsFirehoseJa\n * \n * @public\n */\nexport type PostsFirehoseJaResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for getRuleCounts\n * \n * @public\n */\nexport type GetRuleCountsResponse = Schemas.Get2TweetsSearchStreamRulesCountsResponse;\n/**\n * Response for usersCompliance\n * \n * @public\n */\nexport type UsersComplianceResponse = Schemas.UserComplianceStreamResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Pagination utilities for the X API.\n * \n * This module provides comprehensive pagination support for the X API, including\n * automatic iteration, manual page control, and metadata access.\n * \n * @category Pagination\n */\n\n/**\n * Paginated response interface\n * \n * Represents the structure of a paginated API response from the X API.\n * \n * @template T - The type of items in the response\n */\nexport interface PaginatedResponse {\n /** Array of items in the current page */\n data: T[];\n /** Pagination metadata */\n meta?: {\n /** Number of results in the current page */\n result_count?: number;\n /** Token for fetching the next page */\n next_token?: string;\n /** Token for fetching the previous page */\n previous_token?: string;\n };\n /** Additional included objects (users, tweets, etc.) */\n includes?: Record;\n /** Any errors in the response */\n errors?: Array;\n}\n\n\n/**\n * X API paginator with rich functionality\n * \n * This class provides comprehensive pagination support for the X API, including:\n * - Automatic iteration with `for await...of` loops\n * - Manual page control with `fetchNext()` and `fetchPrevious()`\n * - Metadata access for pagination tokens and counts\n * - Error handling and rate limit detection\n * - Support for both forward and backward pagination\n * \n * @template T - The type of items being paginated\n * \n * @example\n * ```typescript\n * // Automatic iteration\n * const followers = await client.users.getFollowers('783214');\n * for await (const follower of followers) {\n * console.log(follower.username);\n * }\n * \n * // Manual control\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext();\n * console.log(followers.items.length); // Number of followers\n * console.log(followers.meta.next_token); // Next page token\n * \n * // Check status\n * if (!followers.done) {\n * await followers.fetchNext();\n * }\n * ```\n * \n * @category Pagination\n */\nexport class Paginator implements AsyncIterable {\n private fetchPage: (token?: string) => Promise>;\n private currentToken?: string;\n private previousToken?: string;\n private hasMore: boolean = true;\n private isDone: boolean = false;\n private allItems: T[] = [];\n private currentMeta?: any;\n private currentIncludes?: Record;\n private currentErrors?: Array;\n private rateLimitHit: boolean = false;\n\n /**\n * Creates a new paginator instance\n * \n * @param fetchPage - Function that fetches a page of data given a pagination token\n */\n constructor(fetchPage: (token?: string) => Promise>) {\n this.fetchPage = fetchPage;\n }\n\n /**\n * Get all fetched items\n */\n get items(): T[] {\n return [...this.allItems];\n }\n\n /**\n * Get current pagination metadata\n */\n get meta(): any {\n return this.currentMeta;\n }\n\n /**\n * Get current includes data\n */\n get includes(): Record | undefined {\n return this.currentIncludes;\n }\n\n /**\n * Get current errors\n */\n get errors(): Array | undefined {\n return this.currentErrors;\n }\n\n /**\n * Check if pagination is done\n */\n get done(): boolean {\n return this.isDone || this.rateLimitHit;\n }\n\n /**\n * Check if rate limit was hit\n */\n get rateLimited(): boolean {\n return this.rateLimitHit;\n }\n\n /**\n * Fetch the next page and add items to current instance\n * \n * This method fetches the next page of data and appends the items to the\n * current paginator instance. It updates the pagination state and metadata.\n * \n * @example\n * ```typescript\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext(); // Fetch first page\n * console.log(followers.items.length); // Number of followers\n * \n * if (!followers.done) {\n * await followers.fetchNext(); // Fetch second page\n * console.log(followers.items.length); // Total followers across pages\n * }\n * ```\n * \n * @throws {Error} When the API request fails\n */\n async fetchNext(): Promise {\n if (this.done) {\n return;\n }\n\n try {\n const response = await this.fetchPage(this.currentToken);\n \n // Update tokens\n this.previousToken = this.currentToken;\n this.currentToken = response.meta?.next_token;\n \n // Update state\n this.hasMore = !!this.currentToken;\n this.isDone = !this.hasMore;\n \n // Add new items to collection\n if (response.data) {\n this.allItems.push(...response.data);\n }\n \n // Update metadata\n this.currentMeta = response.meta;\n this.currentIncludes = response.includes;\n this.currentErrors = response.errors;\n \n } catch (error: any) {\n // Check if it's a rate limit error\n if (error.status === 429 || error.message?.includes('rate limit')) {\n this.rateLimitHit = true;\n }\n throw error;\n }\n }\n\n /**\n * Get next page as a new instance\n * \n * This method creates a new paginator instance that starts from the next page,\n * without affecting the current paginator's state.\n * \n * @example\n * ```typescript\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext(); // Fetch first page\n * \n * if (!followers.done) {\n * const nextPage = await followers.next(); // Get next page as new instance\n * console.log(followers.items.length); // Still first page\n * console.log(nextPage.items.length); // Second page\n * }\n * ```\n * \n * @returns New paginator instance for the next page\n */\n async next(): Promise> {\n if (this.done) {\n return new Paginator(this.fetchPage);\n }\n\n const nextPaginator = new Paginator(this.fetchPage);\n nextPaginator.currentToken = this.currentToken;\n await nextPaginator.fetchNext();\n return nextPaginator;\n }\n\n /**\n * Fetch previous page (if supported)\n */\n async fetchPrevious(): Promise {\n if (!this.previousToken) {\n return;\n }\n\n try {\n const response = await this.fetchPage(this.previousToken);\n \n // Update tokens\n this.currentToken = this.previousToken;\n this.previousToken = response.meta?.previous_token;\n \n // Update state\n this.hasMore = !!this.currentToken;\n this.isDone = !this.hasMore;\n \n // Replace items with previous page items\n this.allItems = response.data || [];\n \n // Update metadata\n this.currentMeta = response.meta;\n this.currentIncludes = response.includes;\n this.currentErrors = response.errors;\n \n } catch (error: any) {\n if (error.status === 429 || error.message?.includes('rate limit')) {\n this.rateLimitHit = true;\n }\n throw error;\n }\n }\n\n /**\n * Get previous page as a new instance\n */\n async previous(): Promise> {\n if (!this.previousToken) {\n return new Paginator(this.fetchPage);\n }\n\n const prevPaginator = new Paginator(this.fetchPage);\n prevPaginator.currentToken = this.previousToken;\n await prevPaginator.fetchNext();\n return prevPaginator;\n }\n\n /**\n * Fetch up to a specified number of additional items\n */\n async fetchLast(count: number): Promise {\n let fetched = 0;\n \n while (!this.done && fetched < count) {\n const beforeCount = this.allItems.length;\n await this.fetchNext();\n const afterCount = this.allItems.length;\n fetched += (afterCount - beforeCount);\n }\n }\n\n /**\n * Reset paginator to initial state\n */\n reset(): void {\n this.currentToken = undefined;\n this.previousToken = undefined;\n this.hasMore = true;\n this.isDone = false;\n this.allItems = [];\n this.currentMeta = undefined;\n this.currentIncludes = undefined;\n this.currentErrors = undefined;\n this.rateLimitHit = false;\n }\n\n /**\n * Iterator for all fetched items\n */\n *[Symbol.iterator](): Iterator {\n for (const item of this.allItems) {\n yield item;\n }\n }\n\n /**\n * Async iterator that fetches pages automatically\n */\n async *[Symbol.asyncIterator](): AsyncIterator {\n let lastYieldedIndex = 0;\n \n // First, yield all currently fetched items\n for (let i = lastYieldedIndex; i < this.allItems.length; i++) {\n yield this.allItems[i];\n }\n lastYieldedIndex = this.allItems.length;\n\n // Then continue fetching and yielding new items\n while (!this.done) {\n await this.fetchNext();\n \n // Yield only new items since last iteration\n for (let i = lastYieldedIndex; i < this.allItems.length; i++) {\n yield this.allItems[i];\n }\n lastYieldedIndex = this.allItems.length;\n }\n }\n}\n\n/**\n * Specialized paginators for different data types\n */\n\n/**\n * Paginator for posts\n */\nexport class PostPaginator extends Paginator {\n get posts(): any[] {\n return this.items;\n }\n}\n\n/**\n * Paginator for users\n */\nexport class UserPaginator extends Paginator {\n get users(): any[] {\n return this.items;\n }\n}\n\n\n\n/**\n * Paginator for events (like DM events)\n */\nexport class EventPaginator extends Paginator {\n get events(): any[] {\n return this.items;\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * X API SDK\n *\n * A modern TypeScript/JavaScript SDK for interacting with the X API.\n * Built with full TypeScript support, React hooks, and Next.js integration.\n */\n\n// Automatic polyfill setup for Node.js environments\nif (typeof process !== 'undefined' && process.versions && process.versions.node) {\n // Node.js environment - set up polyfills if needed\n if (typeof globalThis.fetch === 'undefined' || typeof globalThis.Headers === 'undefined') {\n try {\n // Try to use native Node.js fetch (Node 18+)\n if (typeof globalThis.fetch === 'function' && typeof globalThis.Headers === 'function') {\n // Native APIs are available, no polyfills needed\n } else {\n // Need to set up polyfills for older Node.js versions\n const nodeFetch = require('node-fetch');\n const { Headers: NodeHeaders } = nodeFetch;\n \n if (typeof globalThis.fetch === 'undefined') {\n (globalThis as any).fetch = nodeFetch.default || nodeFetch;\n }\n if (typeof globalThis.Headers === 'undefined') {\n (globalThis as any).Headers = NodeHeaders;\n }\n }\n } catch (error) {\n // If node-fetch is not available, provide a helpful error\n console.warn(\n 'X API SDK: node-fetch not found. For Node.js environments, please install node-fetch:\\n' +\n 'npm install node-fetch\\n' +\n 'Or upgrade to Node.js 18+ for native fetch support.'\n );\n }\n }\n}\n\n// Main client\nexport { Client } from './client.js';\nexport type { ClientConfig } from './client.js';\n\n// Error handling\nexport { ApiError } from './client.js';\nexport type { RequestOptions, ApiResponse, PaginationMeta } from './client.js';\n\n// HTTP client\nexport { httpClient, HttpClient } from './http-client.js';\nexport type { RequestOptions as HttpClientRequestOptions, HttpResponse } from './http-client.js';\n\n// Authentication\nexport { OAuth2 } from './oauth2_auth.js';\nexport type { OAuth2Config, OAuth2Token } from './oauth2_auth.js';\nexport { OAuth1 } from './oauth1_auth.js';\nexport type { OAuth1Config, OAuth1RequestToken, OAuth1AccessToken } from './oauth1_auth.js';\n\n// Crypto utilities\nexport { CryptoUtils, hmacSha1, generateNonce, generateTimestamp, generateCodeVerifier, generateCodeChallenge } from './crypto_utils.js';\n\n// Streaming\nexport type { StreamListener, TweetStreamListener } from './stream_listener.js';\n\n// Schema types (export all OpenAPI schema types)\nexport * as Schemas from './schemas.js';\n\n// Client modules (export client classes and types)\n\nexport { NewsClient } from './news/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as News from './news/models.js';\n\nexport { UsersClient } from './users/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Users from './users/models.js';\n\nexport { DirectMessagesClient } from './direct_messages/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as DirectMessages from './direct_messages/models.js';\n\nexport { CommunityNotesClient } from './community_notes/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as CommunityNotes from './community_notes/models.js';\n\nexport { PostsClient } from './posts/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Posts from './posts/models.js';\n\nexport { TrendsClient } from './trends/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Trends from './trends/models.js';\n\nexport { ActivityClient } from './activity/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Activity from './activity/models.js';\n\nexport { UsageClient } from './usage/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Usage from './usage/models.js';\n\nexport { SpacesClient } from './spaces/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Spaces from './spaces/models.js';\n\nexport { CommunitiesClient } from './communities/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Communities from './communities/models.js';\n\nexport { ConnectionsClient } from './connections/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Connections from './connections/models.js';\n\nexport { MediaClient } from './media/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Media from './media/models.js';\n\nexport { ListsClient } from './lists/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Lists from './lists/models.js';\n\nexport { ComplianceClient } from './compliance/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Compliance from './compliance/models.js';\n\nexport { GeneralClient } from './general/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as General from './general/models.js';\n\nexport { AccountActivityClient } from './account_activity/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as AccountActivity from './account_activity/models.js';\n\nexport { StreamClient } from './stream/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Stream from './stream/models.js';\n\nexport { WebhooksClient } from './webhooks/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Webhooks from './webhooks/models.js';\n\n\n// Utilities\nexport * from './paginator.js'; "]} \ No newline at end of file +{"version":3,"sources":["../node_modules/data-uri-to-buffer/src/index.ts","../node_modules/web-streams-polyfill/src/utils.ts","../node_modules/web-streams-polyfill/src/lib/helpers/miscellaneous.ts","../node_modules/web-streams-polyfill/src/lib/helpers/webidl.ts","../node_modules/web-streams-polyfill/src/lib/simple-queue.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/internal-methods.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/generic-reader.ts","../node_modules/web-streams-polyfill/src/stub/number-isfinite.ts","../node_modules/web-streams-polyfill/src/stub/math-trunc.ts","../node_modules/web-streams-polyfill/src/lib/validators/basic.ts","../node_modules/web-streams-polyfill/src/lib/validators/readable-stream.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/default-reader.ts","../node_modules/web-streams-polyfill/src/target/es2018/stub/async-iterator-prototype.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/async-iterator.ts","../node_modules/web-streams-polyfill/src/stub/number-isnan.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/ecmascript.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/miscellaneous.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/queue-with-sizes.ts","../node_modules/web-streams-polyfill/src/lib/helpers/array-buffer-view.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/byte-stream-controller.ts","../node_modules/web-streams-polyfill/src/lib/validators/reader-options.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/byob-reader.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/underlying-sink.ts","../node_modules/web-streams-polyfill/src/lib/validators/writable-stream.ts","../node_modules/web-streams-polyfill/src/lib/abort-signal.ts","../node_modules/web-streams-polyfill/src/lib/writable-stream.ts","../node_modules/web-streams-polyfill/src/globals.ts","../node_modules/web-streams-polyfill/src/stub/dom-exception.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/pipe.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/default-controller.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/tee.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/readable-stream-like.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/from.ts","../node_modules/web-streams-polyfill/src/lib/validators/underlying-source.ts","../node_modules/web-streams-polyfill/src/lib/validators/iterator-options.ts","../node_modules/web-streams-polyfill/src/lib/validators/pipe-options.ts","../node_modules/web-streams-polyfill/src/lib/validators/readable-writable-pair.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream.ts","../node_modules/web-streams-polyfill/src/lib/validators/queuing-strategy-init.ts","../node_modules/web-streams-polyfill/src/lib/byte-length-queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/count-queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/transformer.ts","../node_modules/web-streams-polyfill/src/lib/transform-stream.ts","../node_modules/fetch-blob/streams.cjs","../node_modules/fetch-blob/index.js","../node_modules/fetch-blob/file.js","../node_modules/formdata-polyfill/esm.min.js","../node_modules/node-fetch/src/errors/base.js","../node_modules/node-fetch/src/errors/fetch-error.js","../node_modules/node-fetch/src/utils/is.js","../node_modules/node-domexception/index.js","../node_modules/fetch-blob/from.js","../node_modules/node-fetch/src/utils/multipart-parser.js","../node_modules/node-fetch/src/body.js","../node_modules/node-fetch/src/headers.js","../node_modules/node-fetch/src/utils/is-redirect.js","../node_modules/node-fetch/src/response.js","../node_modules/node-fetch/src/utils/get-search.js","../node_modules/node-fetch/src/utils/referrer.js","../node_modules/node-fetch/src/request.js","../node_modules/node-fetch/src/errors/abort-error.js","../node_modules/node-fetch/src/index.js","../src/http-client.ts","../src/activity/client.ts","../src/activity/models.ts","../src/news/client.ts","../src/news/models.ts","../src/connections/client.ts","../src/connections/models.ts","../src/account_activity/client.ts","../src/account_activity/models.ts","../src/spaces/client.ts","../src/spaces/models.ts","../src/trends/client.ts","../src/trends/models.ts","../src/media/client.ts","../src/media/models.ts","../src/direct_messages/client.ts","../src/direct_messages/models.ts","../src/posts/client.ts","../src/posts/models.ts","../src/lists/client.ts","../src/lists/models.ts","../src/community_notes/client.ts","../src/community_notes/models.ts","../src/general/client.ts","../src/general/models.ts","../src/webhooks/client.ts","../src/webhooks/models.ts","../src/users/client.ts","../src/users/models.ts","../src/communities/client.ts","../src/communities/models.ts","../src/stream/event_driven_stream.ts","../src/stream/stream_client.ts","../src/compliance/client.ts","../src/compliance/models.ts","../src/usage/client.ts","../src/usage/models.ts","../src/client.ts","../src/crypto_utils.ts","../src/oauth2_auth.ts","../src/oauth1_auth.ts","../src/schemas.ts","../src/stream/models.ts","../src/paginator.ts","../src/index.ts"],"names":["i","noop","x","_a","F","e","queueMicrotask","r","isAbortSignal","streamBrandCheckException","defaultControllerBrandCheckException","DOMException","ReadableStream","POOL_SIZE","process","Blob","clone","size","File","f","FormData","m","stat","Body","clear","Buffer","toFormData","types","Headers","INTERNALS","deprecate","fetch","http","Stream","PassThrough","response","s","models_exports","crypto"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaM,SAAU,gBAAgB,KAAW;AAC1C,MAAI,CAAC,UAAU,KAAK,GAAG,GAAG;AACzB,UAAM,IAAI,UACT,kEAAkE;;AAKpE,QAAM,IAAI,QAAQ,UAAU,EAAE;AAG9B,QAAM,aAAa,IAAI,QAAQ,GAAG;AAClC,MAAI,eAAe,MAAM,cAAc,GAAG;AACzC,UAAM,IAAI,UAAU,qBAAqB;;AAI1C,QAAM,OAAO,IAAI,UAAU,GAAG,UAAU,EAAE,MAAM,GAAG;AAEnD,MAAI,UAAU;AACd,MAAI,SAAS;AACb,QAAM,OAAO,KAAK,CAAC,KAAK;AACxB,MAAI,WAAW;AACf,WAASA,KAAI,GAAGA,KAAI,KAAK,QAAQA,MAAK;AACrC,QAAI,KAAKA,EAAC,MAAM,UAAU;AACzB,eAAS;eACA,KAAKA,EAAC,GAAG;AAClB,kBAAY,IAAM,KAAKA,EAAC,CAAC;AACzB,UAAI,KAAKA,EAAC,EAAE,QAAQ,UAAU,MAAM,GAAG;AACtC,kBAAU,KAAKA,EAAC,EAAE,UAAU,CAAC;;;;AAKhC,MAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,QAAQ;AAChC,gBAAY;AACZ,cAAU;;AAIX,QAAM,WAAW,SAAS,WAAW;AACrC,QAAM,OAAO,SAAS,IAAI,UAAU,aAAa,CAAC,CAAC;AACnD,QAAM,SAAS,OAAO,KAAK,MAAM,QAAQ;AAGzC,SAAO,OAAO;AACd,SAAO,WAAW;AAGlB,SAAO,UAAU;AAEjB,SAAO;AACR;AA3DA,IA6DA;AA7DA;;;AA6DA,IAAA,eAAe;;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C;AAAA,EACJ;AACJ;AASO,IAAM,gBAAN,cAA4B,UAAe;AAAA,EAC9C,IAAI,QAAe;AACf,WAAO,KAAK;AAAA,EAChB;AACJ;AAKO,IAAM,gBAAN,cAA4B,UAAe;AAAA,EAC9C,IAAI,QAAe;AACf,WAAO,KAAK;AAAA,EAChB;AACJ;AAOO,IAAM,iBAAN,cAA6B,UAAe;AAAA,EAC/C,IAAI,SAAgB;AAChB,WAAO,KAAK;AAAA,EAChB;AACJ;;;ACjWA,IAAI,OAAO,YAAY,eAAe,QAAQ,YAAY,QAAQ,SAAS,MAAM;AAE/E,MAAI,OAAO,WAAW,UAAU,eAAe,OAAO,WAAW,YAAY,aAAa;AACxF,QAAI;AAEF,UAAI,OAAO,WAAW,UAAU,cAAc,OAAO,WAAW,YAAY,YAAY;AAAA,MAExF,OAAO;AAEL,cAAM,YAAY;AAClB,cAAM,EAAE,SAAS,YAAY,IAAI;AAEjC,YAAI,OAAO,WAAW,UAAU,aAAa;AAC3C,UAAC,WAAmB,QAAQ,UAAU,WAAW;AAAA,QACnD;AACA,YAAI,OAAO,WAAW,YAAY,aAAa;AAC7C,UAAC,WAAmB,UAAU;AAAA,QAChC;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AAEd,cAAQ;AAAA,QACN;AAAA,MAGF;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["export interface MimeBuffer extends Buffer {\n\ttype: string;\n\ttypeFull: string;\n\tcharset: string;\n}\n\n/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @param {String} uri Data URI to turn into a Buffer instance\n * @returns {Buffer} Buffer instance from Data URI\n * @api public\n */\nexport function dataUriToBuffer(uri: string): MimeBuffer {\n\tif (!/^data:/i.test(uri)) {\n\t\tthrow new TypeError(\n\t\t\t'`uri` does not appear to be a Data URI (must begin with \"data:\")'\n\t\t);\n\t}\n\n\t// strip newlines\n\turi = uri.replace(/\\r?\\n/g, '');\n\n\t// split the URI up into the \"metadata\" and the \"data\" portions\n\tconst firstComma = uri.indexOf(',');\n\tif (firstComma === -1 || firstComma <= 4) {\n\t\tthrow new TypeError('malformed data: URI');\n\t}\n\n\t// remove the \"data:\" scheme and parse the metadata\n\tconst meta = uri.substring(5, firstComma).split(';');\n\n\tlet charset = '';\n\tlet base64 = false;\n\tconst type = meta[0] || 'text/plain';\n\tlet typeFull = type;\n\tfor (let i = 1; i < meta.length; i++) {\n\t\tif (meta[i] === 'base64') {\n\t\t\tbase64 = true;\n\t\t} else if(meta[i]) {\n\t\t\ttypeFull += `;${ meta[i]}`;\n\t\t\tif (meta[i].indexOf('charset=') === 0) {\n\t\t\t\tcharset = meta[i].substring(8);\n\t\t\t}\n\t\t}\n\t}\n\t// defaults to US-ASCII only if type is not provided\n\tif (!meta[0] && !charset.length) {\n\t\ttypeFull += ';charset=US-ASCII';\n\t\tcharset = 'US-ASCII';\n\t}\n\n\t// get the encoded data portion and decode URI-encoded chars\n\tconst encoding = base64 ? 'base64' : 'ascii';\n\tconst data = unescape(uri.substring(firstComma + 1));\n\tconst buffer = Buffer.from(data, encoding) as MimeBuffer;\n\n\t// set `.type` and `.typeFull` properties to MIME type\n\tbuffer.type = type;\n\tbuffer.typeFull = typeFull;\n\n\t// set the `.charset` property\n\tbuffer.charset = charset;\n\n\treturn buffer;\n}\n\nexport default dataUriToBuffer;\n","export function noop(): undefined {\n return undefined;\n}\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n\nexport function setFunctionName(fn: Function, name: string): void {\n try {\n Object.defineProperty(fn, 'name', {\n value: name,\n configurable: true\n });\n } catch {\n // This property is non-configurable in older browsers, so ignore if this throws.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility\n }\n}\n","import { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\n// https://webidl.spec.whatwg.org/#a-new-promise\nexport function newPromise(executor: (\n resolve: (value: T | PromiseLike) => void,\n reject: (reason?: any) => void\n) => void): Promise {\n return new originalPromise(executor);\n}\n\n// https://webidl.spec.whatwg.org/#a-promise-resolved-with\nexport function promiseResolvedWith(value: T | PromiseLike): Promise {\n return newPromise(resolve => resolve(value));\n}\n\n// https://webidl.spec.whatwg.org/#a-promise-rejected-with\nexport function promiseRejectedWith(reason: any): Promise {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen(\n promise: Promise,\n onFulfilled?: (value: T) => TResult1 | PromiseLike,\n onRejected?: (reason: any) => TResult2 | PromiseLike): Promise {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise;\n}\n\n// Bluebird logs a warning when a promise is created within a fulfillment handler, but then isn't returned\n// from that handler. To prevent this, return null instead of void from all handlers.\n// http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-created-in-a-handler-but-was-not-returned-from-it\nexport function uponPromise(\n promise: Promise,\n onFulfilled?: (value: T) => null | PromiseLike,\n onRejected?: (reason: any) => null | PromiseLike): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment(promise: Promise, onFulfilled: (value: T) => null | PromiseLike): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise, onRejected: (reason: any) => null | PromiseLike): void {\n uponPromise(promise, undefined, onRejected);\n}\n\nexport function transformPromiseWith(\n promise: Promise,\n fulfillmentHandler?: (value: T) => TResult1 | PromiseLike,\n rejectionHandler?: (reason: any) => TResult2 | PromiseLike): Promise {\n return PerformPromiseThen(promise, fulfillmentHandler, rejectionHandler);\n}\n\nexport function setPromiseIsHandledToTrue(promise: Promise): void {\n PerformPromiseThen(promise, undefined, rethrowAssertionErrorRejection);\n}\n\nlet _queueMicrotask: (callback: () => void) => void = callback => {\n if (typeof queueMicrotask === 'function') {\n _queueMicrotask = queueMicrotask;\n } else {\n const resolvedPromise = promiseResolvedWith(undefined);\n _queueMicrotask = cb => PerformPromiseThen(resolvedPromise, cb);\n }\n return _queueMicrotask(callback);\n};\n\nexport { _queueMicrotask as queueMicrotask };\n\nexport function reflectCall(F: (this: T, ...fnArgs: A) => R, V: T, args: A): R {\n if (typeof F !== 'function') {\n throw new TypeError('Argument is not a function');\n }\n return Function.prototype.apply.call(F, V, args);\n}\n\nexport function promiseCall(F: (this: T, ...fnArgs: A) => R | PromiseLike,\n V: T,\n args: A): Promise {\n assert(typeof F === 'function');\n assert(V !== undefined);\n assert(Array.isArray(args));\n try {\n return promiseResolvedWith(reflectCall(F, V, args));\n } catch (value) {\n return promiseRejectedWith(value);\n }\n}\n","import assert from '../stub/assert';\n\n// Original from Chromium\n// https://chromium.googlesource.com/chromium/src/+/0aee4434a4dba42a42abaea9bfbc0cd196a63bc1/third_party/blink/renderer/core/streams/SimpleQueue.js\n\nconst QUEUE_MAX_ARRAY_SIZE = 16384;\n\ninterface Node {\n _elements: T[];\n _next: Node | undefined;\n}\n\n/**\n * Simple queue structure.\n *\n * Avoids scalability issues with using a packed array directly by using\n * multiple arrays in a linked list and keeping the array size bounded.\n */\nexport class SimpleQueue {\n private _front: Node;\n private _back: Node;\n private _cursor = 0;\n private _size = 0;\n\n constructor() {\n // _front and _back are always defined.\n this._front = {\n _elements: [],\n _next: undefined\n };\n this._back = this._front;\n // The cursor is used to avoid calling Array.shift().\n // It contains the index of the front element of the array inside the\n // front-most node. It is always in the range [0, QUEUE_MAX_ARRAY_SIZE).\n this._cursor = 0;\n // When there is only one node, size === elements.length - cursor.\n this._size = 0;\n }\n\n get length(): number {\n return this._size;\n }\n\n // For exception safety, this method is structured in order:\n // 1. Read state\n // 2. Calculate required state mutations\n // 3. Perform state mutations\n push(element: T): void {\n const oldBack = this._back;\n let newBack = oldBack;\n assert(oldBack._next === undefined);\n if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) {\n newBack = {\n _elements: [],\n _next: undefined\n };\n }\n\n // push() is the mutation most likely to throw an exception, so it\n // goes first.\n oldBack._elements.push(element);\n if (newBack !== oldBack) {\n this._back = newBack;\n oldBack._next = newBack;\n }\n ++this._size;\n }\n\n // Like push(), shift() follows the read -> calculate -> mutate pattern for\n // exception safety.\n shift(): T {\n assert(this._size > 0); // must not be called on an empty queue\n\n const oldFront = this._front;\n let newFront = oldFront;\n const oldCursor = this._cursor;\n let newCursor = oldCursor + 1;\n\n const elements = oldFront._elements;\n const element = elements[oldCursor];\n\n if (newCursor === QUEUE_MAX_ARRAY_SIZE) {\n assert(elements.length === QUEUE_MAX_ARRAY_SIZE);\n assert(oldFront._next !== undefined);\n newFront = oldFront._next!;\n newCursor = 0;\n }\n\n // No mutations before this point.\n --this._size;\n this._cursor = newCursor;\n if (oldFront !== newFront) {\n this._front = newFront;\n }\n\n // Permit shifted element to be garbage collected.\n elements[oldCursor] = undefined!;\n\n return element;\n }\n\n // The tricky thing about forEach() is that it can be called\n // re-entrantly. The queue may be mutated inside the callback. It is easy to\n // see that push() within the callback has no negative effects since the end\n // of the queue is checked for on every iteration. If shift() is called\n // repeatedly within the callback then the next iteration may return an\n // element that has been removed. In this case the callback will be called\n // with undefined values until we either \"catch up\" with elements that still\n // exist or reach the back of the queue.\n forEach(callback: (element: T) => void): void {\n let i = this._cursor;\n let node = this._front;\n let elements = node._elements;\n while (i !== elements.length || node._next !== undefined) {\n if (i === elements.length) {\n assert(node._next !== undefined);\n assert(i === QUEUE_MAX_ARRAY_SIZE);\n node = node._next!;\n elements = node._elements;\n i = 0;\n if (elements.length === 0) {\n break;\n }\n }\n callback(elements[i]);\n ++i;\n }\n }\n\n // Return the element that would be returned if shift() was called now,\n // without modifying the queue.\n peek(): T {\n assert(this._size > 0); // must not be called on an empty queue\n\n const front = this._front;\n const cursor = this._cursor;\n return front._elements[cursor];\n }\n}\n","export const AbortSteps = Symbol('[[AbortSteps]]');\nexport const ErrorSteps = Symbol('[[ErrorSteps]]');\nexport const CancelSteps = Symbol('[[CancelSteps]]');\nexport const PullSteps = Symbol('[[PullSteps]]');\nexport const ReleaseSteps = Symbol('[[ReleaseSteps]]');\n","import assert from '../../stub/assert';\nimport { ReadableStream, ReadableStreamCancel, type ReadableStreamReader } from '../readable-stream';\nimport { newPromise, setPromiseIsHandledToTrue } from '../helpers/webidl';\nimport { ReleaseSteps } from '../abstract-ops/internal-methods';\n\nexport function ReadableStreamReaderGenericInitialize(reader: ReadableStreamReader, stream: ReadableStream) {\n reader._ownerReadableStream = stream;\n stream._reader = reader;\n\n if (stream._state === 'readable') {\n defaultReaderClosedPromiseInitialize(reader);\n } else if (stream._state === 'closed') {\n defaultReaderClosedPromiseInitializeAsResolved(reader);\n } else {\n assert(stream._state === 'errored');\n\n defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);\n }\n}\n\n// A client of ReadableStreamDefaultReader and ReadableStreamBYOBReader may use these functions directly to bypass state\n// check.\n\nexport function ReadableStreamReaderGenericCancel(reader: ReadableStreamReader, reason: any): Promise {\n const stream = reader._ownerReadableStream;\n assert(stream !== undefined);\n return ReadableStreamCancel(stream, reason);\n}\n\nexport function ReadableStreamReaderGenericRelease(reader: ReadableStreamReader) {\n const stream = reader._ownerReadableStream;\n assert(stream !== undefined);\n assert(stream._reader === reader);\n\n if (stream._state === 'readable') {\n defaultReaderClosedPromiseReject(\n reader,\n new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));\n } else {\n defaultReaderClosedPromiseResetToRejected(\n reader,\n new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));\n }\n\n stream._readableStreamController[ReleaseSteps]();\n\n stream._reader = undefined;\n reader._ownerReadableStream = undefined!;\n}\n\n// Helper functions for the readers.\n\nexport function readerLockException(name: string): TypeError {\n return new TypeError('Cannot ' + name + ' a stream using a released reader');\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nexport function defaultReaderClosedPromiseInitialize(reader: ReadableStreamReader) {\n reader._closedPromise = newPromise((resolve, reject) => {\n reader._closedPromise_resolve = resolve;\n reader._closedPromise_reject = reject;\n });\n}\n\nexport function defaultReaderClosedPromiseInitializeAsRejected(reader: ReadableStreamReader, reason: any) {\n defaultReaderClosedPromiseInitialize(reader);\n defaultReaderClosedPromiseReject(reader, reason);\n}\n\nexport function defaultReaderClosedPromiseInitializeAsResolved(reader: ReadableStreamReader) {\n defaultReaderClosedPromiseInitialize(reader);\n defaultReaderClosedPromiseResolve(reader);\n}\n\nexport function defaultReaderClosedPromiseReject(reader: ReadableStreamReader, reason: any) {\n if (reader._closedPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(reader._closedPromise);\n reader._closedPromise_reject(reason);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n\nexport function defaultReaderClosedPromiseResetToRejected(reader: ReadableStreamReader, reason: any) {\n assert(reader._closedPromise_resolve === undefined);\n assert(reader._closedPromise_reject === undefined);\n\n defaultReaderClosedPromiseInitializeAsRejected(reader, reason);\n}\n\nexport function defaultReaderClosedPromiseResolve(reader: ReadableStreamReader) {\n if (reader._closedPromise_resolve === undefined) {\n return;\n }\n\n reader._closedPromise_resolve(undefined);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite#Polyfill\nconst NumberIsFinite: typeof Number.isFinite = Number.isFinite || function (x) {\n return typeof x === 'number' && isFinite(x);\n};\n\nexport default NumberIsFinite;\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc#Polyfill\nconst MathTrunc: typeof Math.trunc = Math.trunc || function (v) {\n return v < 0 ? Math.ceil(v) : Math.floor(v);\n};\n\nexport default MathTrunc;\n","import NumberIsFinite from '../../stub/number-isfinite';\nimport MathTrunc from '../../stub/math-trunc';\n\n// https://heycam.github.io/webidl/#idl-dictionaries\nexport function isDictionary(x: any): x is object | null {\n return typeof x === 'object' || typeof x === 'function';\n}\n\nexport function assertDictionary(obj: unknown,\n context: string): asserts obj is object | null | undefined {\n if (obj !== undefined && !isDictionary(obj)) {\n throw new TypeError(`${context} is not an object.`);\n }\n}\n\nexport type AnyFunction = (...args: any[]) => any;\n\n// https://heycam.github.io/webidl/#idl-callback-functions\nexport function assertFunction(x: unknown, context: string): asserts x is AnyFunction {\n if (typeof x !== 'function') {\n throw new TypeError(`${context} is not a function.`);\n }\n}\n\n// https://heycam.github.io/webidl/#idl-object\nexport function isObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport function assertObject(x: unknown,\n context: string): asserts x is object {\n if (!isObject(x)) {\n throw new TypeError(`${context} is not an object.`);\n }\n}\n\nexport function assertRequiredArgument(x: T | undefined,\n position: number,\n context: string): asserts x is T {\n if (x === undefined) {\n throw new TypeError(`Parameter ${position} is required in '${context}'.`);\n }\n}\n\nexport function assertRequiredField(x: T | undefined,\n field: string,\n context: string): asserts x is T {\n if (x === undefined) {\n throw new TypeError(`${field} is required in '${context}'.`);\n }\n}\n\n// https://heycam.github.io/webidl/#idl-unrestricted-double\nexport function convertUnrestrictedDouble(value: unknown): number {\n return Number(value);\n}\n\nfunction censorNegativeZero(x: number): number {\n return x === 0 ? 0 : x;\n}\n\nfunction integerPart(x: number): number {\n return censorNegativeZero(MathTrunc(x));\n}\n\n// https://heycam.github.io/webidl/#idl-unsigned-long-long\nexport function convertUnsignedLongLongWithEnforceRange(value: unknown, context: string): number {\n const lowerBound = 0;\n const upperBound = Number.MAX_SAFE_INTEGER;\n\n let x = Number(value);\n x = censorNegativeZero(x);\n\n if (!NumberIsFinite(x)) {\n throw new TypeError(`${context} is not a finite number`);\n }\n\n x = integerPart(x);\n\n if (x < lowerBound || x > upperBound) {\n throw new TypeError(`${context} is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`);\n }\n\n if (!NumberIsFinite(x) || x === 0) {\n return 0;\n }\n\n // TODO Use BigInt if supported?\n // let xBigInt = BigInt(integerPart(x));\n // xBigInt = BigInt.asUintN(64, xBigInt);\n // return Number(xBigInt);\n\n return x;\n}\n","import { IsReadableStream, ReadableStream } from '../readable-stream';\n\nexport function assertReadableStream(x: unknown, context: string): asserts x is ReadableStream {\n if (!IsReadableStream(x)) {\n throw new TypeError(`${context} is not a ReadableStream.`);\n }\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport {\n ReadableStreamReaderGenericCancel,\n ReadableStreamReaderGenericInitialize,\n ReadableStreamReaderGenericRelease,\n readerLockException\n} from './generic-reader';\nimport { IsReadableStreamLocked, ReadableStream } from '../readable-stream';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { PullSteps } from '../abstract-ops/internal-methods';\nimport { newPromise, promiseRejectedWith } from '../helpers/webidl';\nimport { assertRequiredArgument } from '../validators/basic';\nimport { assertReadableStream } from '../validators/readable-stream';\n\n/**\n * A result returned by {@link ReadableStreamDefaultReader.read}.\n *\n * @public\n */\nexport type ReadableStreamDefaultReadResult = {\n done: false;\n value: T;\n} | {\n done: true;\n value?: undefined;\n}\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamDefaultReader(stream: ReadableStream): ReadableStreamDefaultReader {\n return new ReadableStreamDefaultReader(stream);\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamAddReadRequest(stream: ReadableStream,\n readRequest: ReadRequest): void {\n assert(IsReadableStreamDefaultReader(stream._reader));\n assert(stream._state === 'readable');\n\n (stream._reader! as ReadableStreamDefaultReader)._readRequests.push(readRequest);\n}\n\nexport function ReadableStreamFulfillReadRequest(stream: ReadableStream, chunk: R | undefined, done: boolean) {\n const reader = stream._reader as ReadableStreamDefaultReader;\n\n assert(reader._readRequests.length > 0);\n\n const readRequest = reader._readRequests.shift()!;\n if (done) {\n readRequest._closeSteps();\n } else {\n readRequest._chunkSteps(chunk!);\n }\n}\n\nexport function ReadableStreamGetNumReadRequests(stream: ReadableStream): number {\n return (stream._reader as ReadableStreamDefaultReader)._readRequests.length;\n}\n\nexport function ReadableStreamHasDefaultReader(stream: ReadableStream): boolean {\n const reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (!IsReadableStreamDefaultReader(reader)) {\n return false;\n }\n\n return true;\n}\n\n// Readers\n\nexport interface ReadRequest {\n _chunkSteps(chunk: R): void;\n\n _closeSteps(): void;\n\n _errorSteps(e: any): void;\n}\n\n/**\n * A default reader vended by a {@link ReadableStream}.\n *\n * @public\n */\nexport class ReadableStreamDefaultReader {\n /** @internal */\n _ownerReadableStream!: ReadableStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _readRequests: SimpleQueue>;\n\n constructor(stream: ReadableStream) {\n assertRequiredArgument(stream, 1, 'ReadableStreamDefaultReader');\n assertReadableStream(stream, 'First parameter');\n\n if (IsReadableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readRequests = new SimpleQueue();\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed,\n * or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n\n /**\n * Returns a promise that allows access to the next chunk from the stream's internal queue, if available.\n *\n * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.\n */\n read(): Promise> {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('read'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('read from'));\n }\n\n let resolvePromise!: (result: ReadableStreamDefaultReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => resolvePromise({ value: chunk, done: false }),\n _closeSteps: () => resolvePromise({ value: undefined, done: true }),\n _errorSteps: e => rejectPromise(e)\n };\n ReadableStreamDefaultReaderRead(this, readRequest);\n return promise;\n }\n\n /**\n * Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.\n * If the associated stream is errored when the lock is released, the reader will appear errored in the same way\n * from now on; otherwise, the reader will appear closed.\n *\n * A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by\n * the reader's {@link ReadableStreamDefaultReader.read | read()} method has not yet been settled. Attempting to\n * do so will throw a `TypeError` and leave the reader locked to the stream.\n */\n releaseLock(): void {\n if (!IsReadableStreamDefaultReader(this)) {\n throw defaultReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n ReadableStreamDefaultReaderRelease(this);\n }\n}\n\nObject.defineProperties(ReadableStreamDefaultReader.prototype, {\n cancel: { enumerable: true },\n read: { enumerable: true },\n releaseLock: { enumerable: true },\n closed: { enumerable: true }\n});\nsetFunctionName(ReadableStreamDefaultReader.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStreamDefaultReader.prototype.read, 'read');\nsetFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, 'releaseLock');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamDefaultReader.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamDefaultReader',\n configurable: true\n });\n}\n\n// Abstract operations for the readers.\n\nexport function IsReadableStreamDefaultReader(x: any): x is ReadableStreamDefaultReader {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {\n return false;\n }\n\n return x instanceof ReadableStreamDefaultReader;\n}\n\nexport function ReadableStreamDefaultReaderRead(reader: ReadableStreamDefaultReader,\n readRequest: ReadRequest): void {\n const stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n readRequest._closeSteps();\n } else if (stream._state === 'errored') {\n readRequest._errorSteps(stream._storedError);\n } else {\n assert(stream._state === 'readable');\n stream._readableStreamController[PullSteps](readRequest as ReadRequest);\n }\n}\n\nexport function ReadableStreamDefaultReaderRelease(reader: ReadableStreamDefaultReader) {\n ReadableStreamReaderGenericRelease(reader);\n const e = new TypeError('Reader was released');\n ReadableStreamDefaultReaderErrorReadRequests(reader, e);\n}\n\nexport function ReadableStreamDefaultReaderErrorReadRequests(reader: ReadableStreamDefaultReader, e: any) {\n const readRequests = reader._readRequests;\n reader._readRequests = new SimpleQueue();\n readRequests.forEach(readRequest => {\n readRequest._errorSteps(e);\n });\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nfunction defaultReaderBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamDefaultReader.prototype.${name} can only be used on a ReadableStreamDefaultReader`);\n}\n","/// \n\n/* eslint-disable @typescript-eslint/no-empty-function */\nexport const AsyncIteratorPrototype: AsyncIterable =\n Object.getPrototypeOf(Object.getPrototypeOf(async function* (): AsyncIterableIterator {}).prototype);\n","/// \n\nimport { ReadableStream } from '../readable-stream';\nimport {\n AcquireReadableStreamDefaultReader,\n ReadableStreamDefaultReader,\n ReadableStreamDefaultReaderRead,\n type ReadableStreamDefaultReadResult,\n type ReadRequest\n} from './default-reader';\nimport { ReadableStreamReaderGenericCancel, ReadableStreamReaderGenericRelease } from './generic-reader';\nimport assert from '../../stub/assert';\nimport { AsyncIteratorPrototype } from '@@target/stub/async-iterator-prototype';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n queueMicrotask,\n transformPromiseWith\n} from '../helpers/webidl';\n\n/**\n * An async iterator returned by {@link ReadableStream.values}.\n *\n * @public\n */\nexport interface ReadableStreamAsyncIterator extends AsyncIterableIterator {\n next(): Promise>;\n\n return(value?: any): Promise>;\n}\n\nexport class ReadableStreamAsyncIteratorImpl {\n private readonly _reader: ReadableStreamDefaultReader;\n private readonly _preventCancel: boolean;\n private _ongoingPromise: Promise> | undefined = undefined;\n private _isFinished = false;\n\n constructor(reader: ReadableStreamDefaultReader, preventCancel: boolean) {\n this._reader = reader;\n this._preventCancel = preventCancel;\n }\n\n next(): Promise> {\n const nextSteps = () => this._nextSteps();\n this._ongoingPromise = this._ongoingPromise ?\n transformPromiseWith(this._ongoingPromise, nextSteps, nextSteps) :\n nextSteps();\n return this._ongoingPromise;\n }\n\n return(value: any): Promise> {\n const returnSteps = () => this._returnSteps(value);\n return this._ongoingPromise ?\n transformPromiseWith(this._ongoingPromise, returnSteps, returnSteps) :\n returnSteps();\n }\n\n private _nextSteps(): Promise> {\n if (this._isFinished) {\n return Promise.resolve({ value: undefined, done: true });\n }\n\n const reader = this._reader;\n assert(reader._ownerReadableStream !== undefined);\n\n let resolvePromise!: (result: ReadableStreamDefaultReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => {\n this._ongoingPromise = undefined;\n // This needs to be delayed by one microtask, otherwise we stop pulling too early which breaks a test.\n // FIXME Is this a bug in the specification, or in the test?\n queueMicrotask(() => resolvePromise({ value: chunk, done: false }));\n },\n _closeSteps: () => {\n this._ongoingPromise = undefined;\n this._isFinished = true;\n ReadableStreamReaderGenericRelease(reader);\n resolvePromise({ value: undefined, done: true });\n },\n _errorSteps: reason => {\n this._ongoingPromise = undefined;\n this._isFinished = true;\n ReadableStreamReaderGenericRelease(reader);\n rejectPromise(reason);\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n return promise;\n }\n\n private _returnSteps(value: any): Promise> {\n if (this._isFinished) {\n return Promise.resolve({ value, done: true });\n }\n this._isFinished = true;\n\n const reader = this._reader;\n assert(reader._ownerReadableStream !== undefined);\n assert(reader._readRequests.length === 0);\n\n if (!this._preventCancel) {\n const result = ReadableStreamReaderGenericCancel(reader, value);\n ReadableStreamReaderGenericRelease(reader);\n return transformPromiseWith(result, () => ({ value, done: true }));\n }\n\n ReadableStreamReaderGenericRelease(reader);\n return promiseResolvedWith({ value, done: true });\n }\n}\n\ninterface ReadableStreamAsyncIteratorInstance extends ReadableStreamAsyncIterator {\n /** @interal */\n _asyncIteratorImpl: ReadableStreamAsyncIteratorImpl;\n\n next(): Promise>;\n\n return(value?: any): Promise>;\n}\n\nconst ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIteratorInstance = {\n next(this: ReadableStreamAsyncIteratorInstance): Promise> {\n if (!IsReadableStreamAsyncIterator(this)) {\n return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next'));\n }\n return this._asyncIteratorImpl.next();\n },\n\n return(this: ReadableStreamAsyncIteratorInstance, value: any): Promise> {\n if (!IsReadableStreamAsyncIterator(this)) {\n return promiseRejectedWith(streamAsyncIteratorBrandCheckException('return'));\n }\n return this._asyncIteratorImpl.return(value);\n }\n} as any;\nObject.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamAsyncIterator(stream: ReadableStream,\n preventCancel: boolean): ReadableStreamAsyncIterator {\n const reader = AcquireReadableStreamDefaultReader(stream);\n const impl = new ReadableStreamAsyncIteratorImpl(reader, preventCancel);\n const iterator: ReadableStreamAsyncIteratorInstance = Object.create(ReadableStreamAsyncIteratorPrototype);\n iterator._asyncIteratorImpl = impl;\n return iterator;\n}\n\nfunction IsReadableStreamAsyncIterator(x: any): x is ReadableStreamAsyncIterator {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_asyncIteratorImpl')) {\n return false;\n }\n\n try {\n // noinspection SuspiciousTypeOfGuard\n return (x as ReadableStreamAsyncIteratorInstance)._asyncIteratorImpl instanceof\n ReadableStreamAsyncIteratorImpl;\n } catch {\n return false;\n }\n}\n\n// Helper functions for the ReadableStream.\n\nfunction streamAsyncIteratorBrandCheckException(name: string): TypeError {\n return new TypeError(`ReadableStreamAsyncIterator.${name} can only be used on a ReadableSteamAsyncIterator`);\n}\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#Polyfill\nconst NumberIsNaN: typeof Number.isNaN = Number.isNaN || function (x) {\n // eslint-disable-next-line no-self-compare\n return x !== x;\n};\n\nexport default NumberIsNaN;\n","import { reflectCall } from 'lib/helpers/webidl';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport assert from '../../stub/assert';\n\ndeclare global {\n interface ArrayBuffer {\n readonly detached: boolean;\n\n transfer(): ArrayBuffer;\n }\n\n function structuredClone(value: T, options: { transfer: ArrayBuffer[] }): T;\n}\n\nexport function CreateArrayFromList(elements: T): T {\n // We use arrays to represent lists, so this is basically a no-op.\n // Do a slice though just in case we happen to depend on the unique-ness.\n return elements.slice() as T;\n}\n\nexport function CopyDataBlockBytes(dest: ArrayBuffer,\n destOffset: number,\n src: ArrayBuffer,\n srcOffset: number,\n n: number) {\n new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);\n}\n\nexport let TransferArrayBuffer = (O: ArrayBuffer): ArrayBuffer => {\n if (typeof O.transfer === 'function') {\n TransferArrayBuffer = buffer => buffer.transfer();\n } else if (typeof structuredClone === 'function') {\n TransferArrayBuffer = buffer => structuredClone(buffer, { transfer: [buffer] });\n } else {\n // Not implemented correctly\n TransferArrayBuffer = buffer => buffer;\n }\n return TransferArrayBuffer(O);\n};\n\nexport function CanTransferArrayBuffer(O: ArrayBuffer): boolean {\n return !IsDetachedBuffer(O);\n}\n\nexport let IsDetachedBuffer = (O: ArrayBuffer): boolean => {\n if (typeof O.detached === 'boolean') {\n IsDetachedBuffer = buffer => buffer.detached;\n } else {\n // Not implemented correctly\n IsDetachedBuffer = buffer => buffer.byteLength === 0;\n }\n return IsDetachedBuffer(O);\n};\n\nexport function ArrayBufferSlice(buffer: ArrayBuffer, begin: number, end: number): ArrayBuffer {\n // ArrayBuffer.prototype.slice is not available on IE10\n // https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice\n if (buffer.slice) {\n return buffer.slice(begin, end);\n }\n const length = end - begin;\n const slice = new ArrayBuffer(length);\n CopyDataBlockBytes(slice, 0, buffer, begin, length);\n return slice;\n}\n\nexport type MethodName = {\n [P in keyof T]: T[P] extends Function | undefined ? P : never;\n}[keyof T];\n\nexport function GetMethod>(receiver: T, prop: K): T[K] | undefined {\n const func = receiver[prop];\n if (func === undefined || func === null) {\n return undefined;\n }\n if (typeof func !== 'function') {\n throw new TypeError(`${String(prop)} is not a function`);\n }\n return func;\n}\n\nexport interface SyncIteratorRecord {\n iterator: Iterator,\n nextMethod: Iterator['next'],\n done: boolean;\n}\n\nexport interface AsyncIteratorRecord {\n iterator: AsyncIterator,\n nextMethod: AsyncIterator['next'],\n done: boolean;\n}\n\nexport type SyncOrAsyncIteratorRecord = SyncIteratorRecord | AsyncIteratorRecord;\n\nexport function CreateAsyncFromSyncIterator(syncIteratorRecord: SyncIteratorRecord): AsyncIteratorRecord {\n // Instead of re-implementing CreateAsyncFromSyncIterator and %AsyncFromSyncIteratorPrototype%,\n // we use yield* inside an async generator function to achieve the same result.\n\n // Wrap the sync iterator inside a sync iterable, so we can use it with yield*.\n const syncIterable = {\n [Symbol.iterator]: () => syncIteratorRecord.iterator\n };\n // Create an async generator function and immediately invoke it.\n const asyncIterator = (async function* () {\n return yield* syncIterable;\n }());\n // Return as an async iterator record.\n const nextMethod = asyncIterator.next;\n return { iterator: asyncIterator, nextMethod, done: false };\n}\n\n// Aligns with core-js/modules/es.symbol.async-iterator.js\nexport const SymbolAsyncIterator: (typeof Symbol)['asyncIterator'] =\n Symbol.asyncIterator ??\n Symbol.for?.('Symbol.asyncIterator') ??\n '@@asyncIterator';\n\nexport type SyncOrAsyncIterable = Iterable | AsyncIterable;\nexport type SyncOrAsyncIteratorMethod = () => (Iterator | AsyncIterator);\n\nfunction GetIterator(\n obj: SyncOrAsyncIterable,\n hint: 'async',\n method?: SyncOrAsyncIteratorMethod\n): AsyncIteratorRecord;\nfunction GetIterator(\n obj: Iterable,\n hint: 'sync',\n method?: SyncOrAsyncIteratorMethod\n): SyncIteratorRecord;\nfunction GetIterator(\n obj: SyncOrAsyncIterable,\n hint = 'sync',\n method?: SyncOrAsyncIteratorMethod\n): SyncOrAsyncIteratorRecord {\n assert(hint === 'sync' || hint === 'async');\n if (method === undefined) {\n if (hint === 'async') {\n method = GetMethod(obj as AsyncIterable, SymbolAsyncIterator);\n if (method === undefined) {\n const syncMethod = GetMethod(obj as Iterable, Symbol.iterator);\n const syncIteratorRecord = GetIterator(obj as Iterable, 'sync', syncMethod);\n return CreateAsyncFromSyncIterator(syncIteratorRecord);\n }\n } else {\n method = GetMethod(obj as Iterable, Symbol.iterator);\n }\n }\n if (method === undefined) {\n throw new TypeError('The object is not iterable');\n }\n const iterator = reflectCall(method, obj, []);\n if (!typeIsObject(iterator)) {\n throw new TypeError('The iterator method must return an object');\n }\n const nextMethod = iterator.next;\n return { iterator, nextMethod, done: false } as SyncOrAsyncIteratorRecord;\n}\n\nexport { GetIterator };\n\nexport function IteratorNext(iteratorRecord: AsyncIteratorRecord): Promise> {\n const result = reflectCall(iteratorRecord.nextMethod, iteratorRecord.iterator, []);\n if (!typeIsObject(result)) {\n throw new TypeError('The iterator.next() method must return an object');\n }\n return result;\n}\n\nexport function IteratorComplete(\n iterResult: IteratorResult\n): iterResult is IteratorReturnResult {\n assert(typeIsObject(iterResult));\n return Boolean(iterResult.done);\n}\n\nexport function IteratorValue(iterResult: IteratorYieldResult): T {\n assert(typeIsObject(iterResult));\n return iterResult.value;\n}\n","import NumberIsNaN from '../../stub/number-isnan';\nimport { ArrayBufferSlice } from './ecmascript';\nimport type { NonShared } from '../helpers/array-buffer-view';\n\nexport function IsNonNegativeNumber(v: number): boolean {\n if (typeof v !== 'number') {\n return false;\n }\n\n if (NumberIsNaN(v)) {\n return false;\n }\n\n if (v < 0) {\n return false;\n }\n\n return true;\n}\n\nexport function CloneAsUint8Array(O: NonShared): NonShared {\n const buffer = ArrayBufferSlice(O.buffer, O.byteOffset, O.byteOffset + O.byteLength);\n return new Uint8Array(buffer) as NonShared;\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport { IsNonNegativeNumber } from './miscellaneous';\n\nexport interface QueueContainer {\n _queue: SimpleQueue;\n _queueTotalSize: number;\n}\n\nexport interface QueuePair {\n value: T;\n size: number;\n}\n\nexport function DequeueValue(container: QueueContainer>): T {\n assert('_queue' in container && '_queueTotalSize' in container);\n assert(container._queue.length > 0);\n\n const pair = container._queue.shift()!;\n container._queueTotalSize -= pair.size;\n if (container._queueTotalSize < 0) {\n container._queueTotalSize = 0;\n }\n\n return pair.value;\n}\n\nexport function EnqueueValueWithSize(container: QueueContainer>, value: T, size: number) {\n assert('_queue' in container && '_queueTotalSize' in container);\n\n if (!IsNonNegativeNumber(size) || size === Infinity) {\n throw new RangeError('Size must be a finite, non-NaN, non-negative number.');\n }\n\n container._queue.push({ value, size });\n container._queueTotalSize += size;\n}\n\nexport function PeekQueueValue(container: QueueContainer>): T {\n assert('_queue' in container && '_queueTotalSize' in container);\n assert(container._queue.length > 0);\n\n const pair = container._queue.peek();\n return pair.value;\n}\n\nexport function ResetQueue(container: QueueContainer) {\n assert('_queue' in container && '_queueTotalSize' in container);\n\n container._queue = new SimpleQueue();\n container._queueTotalSize = 0;\n}\n","export type TypedArray =\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Float32Array\n | Float64Array;\n\nexport type NonShared = T & {\n buffer: ArrayBuffer;\n}\n\nexport interface ArrayBufferViewConstructor {\n new(buffer: ArrayBuffer, byteOffset: number, length?: number): T;\n\n readonly prototype: T;\n}\n\nexport interface TypedArrayConstructor extends ArrayBufferViewConstructor {\n readonly BYTES_PER_ELEMENT: number;\n}\n\nexport type DataViewConstructor = ArrayBufferViewConstructor;\n\nfunction isDataViewConstructor(ctor: Function): ctor is DataViewConstructor {\n return ctor === DataView;\n}\n\nexport function isDataView(view: ArrayBufferView): view is DataView {\n return isDataViewConstructor(view.constructor);\n}\n\nexport function arrayBufferViewElementSize(ctor: ArrayBufferViewConstructor): number {\n if (isDataViewConstructor(ctor)) {\n return 1;\n }\n return (ctor as unknown as TypedArrayConstructor).BYTES_PER_ELEMENT;\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport { ResetQueue } from '../abstract-ops/queue-with-sizes';\nimport {\n IsReadableStreamDefaultReader,\n ReadableStreamAddReadRequest,\n ReadableStreamFulfillReadRequest,\n ReadableStreamGetNumReadRequests,\n ReadableStreamHasDefaultReader,\n type ReadRequest\n} from './default-reader';\nimport {\n ReadableStreamAddReadIntoRequest,\n ReadableStreamFulfillReadIntoRequest,\n ReadableStreamGetNumReadIntoRequests,\n ReadableStreamHasBYOBReader,\n type ReadIntoRequest\n} from './byob-reader';\nimport NumberIsInteger from '../../stub/number-isinteger';\nimport {\n IsReadableStreamLocked,\n type ReadableByteStream,\n ReadableStreamClose,\n ReadableStreamError\n} from '../readable-stream';\nimport type { ValidatedUnderlyingByteSource } from './underlying-source';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport {\n ArrayBufferSlice,\n CanTransferArrayBuffer,\n CopyDataBlockBytes,\n IsDetachedBuffer,\n TransferArrayBuffer\n} from '../abstract-ops/ecmascript';\nimport { CancelSteps, PullSteps, ReleaseSteps } from '../abstract-ops/internal-methods';\nimport { promiseResolvedWith, uponPromise } from '../helpers/webidl';\nimport { assertRequiredArgument, convertUnsignedLongLongWithEnforceRange } from '../validators/basic';\nimport {\n type ArrayBufferViewConstructor,\n arrayBufferViewElementSize,\n type NonShared,\n type TypedArrayConstructor\n} from '../helpers/array-buffer-view';\n\n/**\n * A pull-into request in a {@link ReadableByteStreamController}.\n *\n * @public\n */\nexport class ReadableStreamBYOBRequest {\n /** @internal */\n _associatedReadableByteStreamController!: ReadableByteStreamController;\n /** @internal */\n _view!: NonShared | null;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the view for writing in to, or `null` if the BYOB request has already been responded to.\n */\n get view(): ArrayBufferView | null {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('view');\n }\n\n return this._view;\n }\n\n /**\n * Indicates to the associated readable byte stream that `bytesWritten` bytes were written into\n * {@link ReadableStreamBYOBRequest.view | view}, causing the result be surfaced to the consumer.\n *\n * After this method is called, {@link ReadableStreamBYOBRequest.view | view} will be transferred and no longer\n * modifiable.\n */\n respond(bytesWritten: number): void;\n respond(bytesWritten: number | undefined): void {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('respond');\n }\n assertRequiredArgument(bytesWritten, 1, 'respond');\n bytesWritten = convertUnsignedLongLongWithEnforceRange(bytesWritten, 'First parameter');\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n if (IsDetachedBuffer(this._view!.buffer)) {\n throw new TypeError(`The BYOB request's buffer has been detached and so cannot be used as a response`);\n }\n\n assert(this._view!.byteLength > 0);\n assert(this._view!.buffer.byteLength > 0);\n\n ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);\n }\n\n /**\n * Indicates to the associated readable byte stream that instead of writing into\n * {@link ReadableStreamBYOBRequest.view | view}, the underlying byte source is providing a new `ArrayBufferView`,\n * which will be given to the consumer of the readable byte stream.\n *\n * After this method is called, `view` will be transferred and no longer modifiable.\n */\n respondWithNewView(view: ArrayBufferView): void;\n respondWithNewView(view: NonShared): void {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('respondWithNewView');\n }\n assertRequiredArgument(view, 1, 'respondWithNewView');\n\n if (!ArrayBuffer.isView(view)) {\n throw new TypeError('You can only respond with array buffer views');\n }\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n if (IsDetachedBuffer(view.buffer)) {\n throw new TypeError('The given view\\'s buffer has been detached and so cannot be used as a response');\n }\n\n ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);\n }\n}\n\nObject.defineProperties(ReadableStreamBYOBRequest.prototype, {\n respond: { enumerable: true },\n respondWithNewView: { enumerable: true },\n view: { enumerable: true }\n});\nsetFunctionName(ReadableStreamBYOBRequest.prototype.respond, 'respond');\nsetFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, 'respondWithNewView');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamBYOBRequest.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamBYOBRequest',\n configurable: true\n });\n}\n\ninterface ByteQueueElement {\n buffer: ArrayBuffer;\n byteOffset: number;\n byteLength: number;\n}\n\ntype PullIntoDescriptor = NonShared> =\n DefaultPullIntoDescriptor\n | BYOBPullIntoDescriptor;\n\ninterface DefaultPullIntoDescriptor {\n buffer: ArrayBuffer;\n bufferByteLength: number;\n byteOffset: number;\n byteLength: number;\n bytesFilled: number;\n minimumFill: number;\n elementSize: number;\n viewConstructor: TypedArrayConstructor;\n readerType: 'default' | 'none';\n}\n\ninterface BYOBPullIntoDescriptor = NonShared> {\n buffer: ArrayBuffer;\n bufferByteLength: number;\n byteOffset: number;\n byteLength: number;\n bytesFilled: number;\n minimumFill: number;\n elementSize: number;\n viewConstructor: ArrayBufferViewConstructor;\n readerType: 'byob' | 'none';\n}\n\n/**\n * Allows control of a {@link ReadableStream | readable byte stream}'s state and internal queue.\n *\n * @public\n */\nexport class ReadableByteStreamController {\n /** @internal */\n _controlledReadableByteStream!: ReadableByteStream;\n /** @internal */\n _queue!: SimpleQueue;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _closeRequested!: boolean;\n /** @internal */\n _pullAgain!: boolean;\n /** @internal */\n _pulling !: boolean;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _pullAlgorithm!: () => Promise;\n /** @internal */\n _cancelAlgorithm!: (reason: any) => Promise;\n /** @internal */\n _autoAllocateChunkSize: number | undefined;\n /** @internal */\n _byobRequest: ReadableStreamBYOBRequest | null;\n /** @internal */\n _pendingPullIntos!: SimpleQueue;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the current BYOB pull request, or `null` if there isn't one.\n */\n get byobRequest(): ReadableStreamBYOBRequest | null {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('byobRequest');\n }\n\n return ReadableByteStreamControllerGetBYOBRequest(this);\n }\n\n /**\n * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is\n * over-full. An underlying byte source ought to use this information to determine when and how to apply backpressure.\n */\n get desiredSize(): number | null {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('desiredSize');\n }\n\n return ReadableByteStreamControllerGetDesiredSize(this);\n }\n\n /**\n * Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from\n * the stream, but once those are read, the stream will become closed.\n */\n close(): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('close');\n }\n\n if (this._closeRequested) {\n throw new TypeError('The stream has already been closed; do not close it again!');\n }\n\n const state = this._controlledReadableByteStream._state;\n if (state !== 'readable') {\n throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be closed`);\n }\n\n ReadableByteStreamControllerClose(this);\n }\n\n /**\n * Enqueues the given chunk chunk in the controlled readable stream.\n * The chunk has to be an `ArrayBufferView` instance, or else a `TypeError` will be thrown.\n */\n enqueue(chunk: ArrayBufferView): void;\n enqueue(chunk: NonShared): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('enqueue');\n }\n\n assertRequiredArgument(chunk, 1, 'enqueue');\n if (!ArrayBuffer.isView(chunk)) {\n throw new TypeError('chunk must be an array buffer view');\n }\n if (chunk.byteLength === 0) {\n throw new TypeError('chunk must have non-zero byteLength');\n }\n if (chunk.buffer.byteLength === 0) {\n throw new TypeError(`chunk's buffer must have non-zero byteLength`);\n }\n\n if (this._closeRequested) {\n throw new TypeError('stream is closed or draining');\n }\n\n const state = this._controlledReadableByteStream._state;\n if (state !== 'readable') {\n throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be enqueued to`);\n }\n\n ReadableByteStreamControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.\n */\n error(e: any = undefined): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('error');\n }\n\n ReadableByteStreamControllerError(this, e);\n }\n\n /** @internal */\n [CancelSteps](reason: any): Promise {\n ReadableByteStreamControllerClearPendingPullIntos(this);\n\n ResetQueue(this);\n\n const result = this._cancelAlgorithm(reason);\n ReadableByteStreamControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [PullSteps](readRequest: ReadRequest>): void {\n const stream = this._controlledReadableByteStream;\n assert(ReadableStreamHasDefaultReader(stream));\n\n if (this._queueTotalSize > 0) {\n assert(ReadableStreamGetNumReadRequests(stream) === 0);\n\n ReadableByteStreamControllerFillReadRequestFromQueue(this, readRequest);\n return;\n }\n\n const autoAllocateChunkSize = this._autoAllocateChunkSize;\n if (autoAllocateChunkSize !== undefined) {\n let buffer: ArrayBuffer;\n try {\n buffer = new ArrayBuffer(autoAllocateChunkSize);\n } catch (bufferE) {\n readRequest._errorSteps(bufferE);\n return;\n }\n\n const pullIntoDescriptor: DefaultPullIntoDescriptor = {\n buffer,\n bufferByteLength: autoAllocateChunkSize,\n byteOffset: 0,\n byteLength: autoAllocateChunkSize,\n bytesFilled: 0,\n minimumFill: 1,\n elementSize: 1,\n viewConstructor: Uint8Array,\n readerType: 'default'\n };\n\n this._pendingPullIntos.push(pullIntoDescriptor);\n }\n\n ReadableStreamAddReadRequest(stream, readRequest);\n ReadableByteStreamControllerCallPullIfNeeded(this);\n }\n\n /** @internal */\n [ReleaseSteps](): void {\n if (this._pendingPullIntos.length > 0) {\n const firstPullInto = this._pendingPullIntos.peek();\n firstPullInto.readerType = 'none';\n\n this._pendingPullIntos = new SimpleQueue();\n this._pendingPullIntos.push(firstPullInto);\n }\n }\n}\n\nObject.defineProperties(ReadableByteStreamController.prototype, {\n close: { enumerable: true },\n enqueue: { enumerable: true },\n error: { enumerable: true },\n byobRequest: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(ReadableByteStreamController.prototype.close, 'close');\nsetFunctionName(ReadableByteStreamController.prototype.enqueue, 'enqueue');\nsetFunctionName(ReadableByteStreamController.prototype.error, 'error');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableByteStreamController.prototype, Symbol.toStringTag, {\n value: 'ReadableByteStreamController',\n configurable: true\n });\n}\n\n// Abstract operations for the ReadableByteStreamController.\n\nexport function IsReadableByteStreamController(x: any): x is ReadableByteStreamController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableByteStream')) {\n return false;\n }\n\n return x instanceof ReadableByteStreamController;\n}\n\nfunction IsReadableStreamBYOBRequest(x: any): x is ReadableStreamBYOBRequest {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {\n return false;\n }\n\n return x instanceof ReadableStreamBYOBRequest;\n}\n\nfunction ReadableByteStreamControllerCallPullIfNeeded(controller: ReadableByteStreamController): void {\n const shouldPull = ReadableByteStreamControllerShouldCallPull(controller);\n if (!shouldPull) {\n return;\n }\n\n if (controller._pulling) {\n controller._pullAgain = true;\n return;\n }\n\n assert(!controller._pullAgain);\n\n controller._pulling = true;\n\n // TODO: Test controller argument\n const pullPromise = controller._pullAlgorithm();\n uponPromise(\n pullPromise,\n () => {\n controller._pulling = false;\n\n if (controller._pullAgain) {\n controller._pullAgain = false;\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n\n return null;\n },\n e => {\n ReadableByteStreamControllerError(controller, e);\n return null;\n }\n );\n}\n\nfunction ReadableByteStreamControllerClearPendingPullIntos(controller: ReadableByteStreamController) {\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n controller._pendingPullIntos = new SimpleQueue();\n}\n\nfunction ReadableByteStreamControllerCommitPullIntoDescriptor>(\n stream: ReadableByteStream,\n pullIntoDescriptor: PullIntoDescriptor\n) {\n assert(stream._state !== 'errored');\n assert(pullIntoDescriptor.readerType !== 'none');\n\n let done = false;\n if (stream._state === 'closed') {\n assert(pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize === 0);\n done = true;\n }\n\n const filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n if (pullIntoDescriptor.readerType === 'default') {\n ReadableStreamFulfillReadRequest(stream, filledView as unknown as NonShared, done);\n } else {\n assert(pullIntoDescriptor.readerType === 'byob');\n ReadableStreamFulfillReadIntoRequest(stream, filledView, done);\n }\n}\n\nfunction ReadableByteStreamControllerConvertPullIntoDescriptor>(\n pullIntoDescriptor: PullIntoDescriptor\n): T {\n const bytesFilled = pullIntoDescriptor.bytesFilled;\n const elementSize = pullIntoDescriptor.elementSize;\n\n assert(bytesFilled <= pullIntoDescriptor.byteLength);\n assert(bytesFilled % elementSize === 0);\n\n return new pullIntoDescriptor.viewConstructor(\n pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize) as T;\n}\n\nfunction ReadableByteStreamControllerEnqueueChunkToQueue(controller: ReadableByteStreamController,\n buffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number) {\n controller._queue.push({ buffer, byteOffset, byteLength });\n controller._queueTotalSize += byteLength;\n}\n\nfunction ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller: ReadableByteStreamController,\n buffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number) {\n let clonedChunk;\n try {\n clonedChunk = ArrayBufferSlice(buffer, byteOffset, byteOffset + byteLength);\n } catch (cloneE) {\n ReadableByteStreamControllerError(controller, cloneE);\n throw cloneE;\n }\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, clonedChunk, 0, byteLength);\n}\n\nfunction ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller: ReadableByteStreamController,\n firstDescriptor: PullIntoDescriptor) {\n assert(firstDescriptor.readerType === 'none');\n if (firstDescriptor.bytesFilled > 0) {\n ReadableByteStreamControllerEnqueueClonedChunkToQueue(\n controller,\n firstDescriptor.buffer,\n firstDescriptor.byteOffset,\n firstDescriptor.bytesFilled\n );\n }\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n}\n\nfunction ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller: ReadableByteStreamController,\n pullIntoDescriptor: PullIntoDescriptor) {\n const maxBytesToCopy = Math.min(controller._queueTotalSize,\n pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);\n const maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;\n\n let totalBytesToCopyRemaining = maxBytesToCopy;\n let ready = false;\n assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill);\n const remainderBytes = maxBytesFilled % pullIntoDescriptor.elementSize;\n const maxAlignedBytes = maxBytesFilled - remainderBytes;\n // A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head\n // of the queue, so the underlying source can keep filling it.\n if (maxAlignedBytes >= pullIntoDescriptor.minimumFill) {\n totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;\n ready = true;\n }\n\n const queue = controller._queue;\n\n while (totalBytesToCopyRemaining > 0) {\n const headOfQueue = queue.peek();\n\n const bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);\n\n const destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n CopyDataBlockBytes(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);\n\n if (headOfQueue.byteLength === bytesToCopy) {\n queue.shift();\n } else {\n headOfQueue.byteOffset += bytesToCopy;\n headOfQueue.byteLength -= bytesToCopy;\n }\n controller._queueTotalSize -= bytesToCopy;\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);\n\n totalBytesToCopyRemaining -= bytesToCopy;\n }\n\n if (!ready) {\n assert(controller._queueTotalSize === 0);\n assert(pullIntoDescriptor.bytesFilled > 0);\n assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill);\n }\n\n return ready;\n}\n\nfunction ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller: ReadableByteStreamController,\n size: number,\n pullIntoDescriptor: PullIntoDescriptor) {\n assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos.peek() === pullIntoDescriptor);\n assert(controller._byobRequest === null);\n pullIntoDescriptor.bytesFilled += size;\n}\n\nfunction ReadableByteStreamControllerHandleQueueDrain(controller: ReadableByteStreamController) {\n assert(controller._controlledReadableByteStream._state === 'readable');\n\n if (controller._queueTotalSize === 0 && controller._closeRequested) {\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamClose(controller._controlledReadableByteStream);\n } else {\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n}\n\nfunction ReadableByteStreamControllerInvalidateBYOBRequest(controller: ReadableByteStreamController) {\n if (controller._byobRequest === null) {\n return;\n }\n\n controller._byobRequest._associatedReadableByteStreamController = undefined!;\n controller._byobRequest._view = null!;\n controller._byobRequest = null;\n}\n\nfunction ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller: ReadableByteStreamController) {\n assert(!controller._closeRequested);\n\n while (controller._pendingPullIntos.length > 0) {\n if (controller._queueTotalSize === 0) {\n return;\n }\n\n const pullIntoDescriptor = controller._pendingPullIntos.peek();\n assert(pullIntoDescriptor.readerType !== 'none');\n\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor)) {\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n ReadableByteStreamControllerCommitPullIntoDescriptor(\n controller._controlledReadableByteStream,\n pullIntoDescriptor\n );\n }\n }\n}\n\nfunction ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller: ReadableByteStreamController) {\n const reader = controller._controlledReadableByteStream._reader;\n assert(IsReadableStreamDefaultReader(reader));\n while (reader._readRequests.length > 0) {\n if (controller._queueTotalSize === 0) {\n return;\n }\n const readRequest = reader._readRequests.shift();\n ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest);\n }\n}\n\nexport function ReadableByteStreamControllerPullInto>(\n controller: ReadableByteStreamController,\n view: T,\n min: number,\n readIntoRequest: ReadIntoRequest\n): void {\n const stream = controller._controlledReadableByteStream;\n\n const ctor = view.constructor as ArrayBufferViewConstructor;\n const elementSize = arrayBufferViewElementSize(ctor);\n\n const { byteOffset, byteLength } = view;\n\n const minimumFill = min * elementSize;\n assert(minimumFill >= elementSize && minimumFill <= byteLength);\n assert(minimumFill % elementSize === 0);\n\n let buffer: ArrayBuffer;\n try {\n buffer = TransferArrayBuffer(view.buffer);\n } catch (e) {\n readIntoRequest._errorSteps(e);\n return;\n }\n\n const pullIntoDescriptor: BYOBPullIntoDescriptor = {\n buffer,\n bufferByteLength: buffer.byteLength,\n byteOffset,\n byteLength,\n bytesFilled: 0,\n minimumFill,\n elementSize,\n viewConstructor: ctor,\n readerType: 'byob'\n };\n\n if (controller._pendingPullIntos.length > 0) {\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n // No ReadableByteStreamControllerCallPullIfNeeded() call since:\n // - No change happens on desiredSize\n // - The source has already been notified of that there's at least 1 pending read(view)\n\n ReadableStreamAddReadIntoRequest(stream, readIntoRequest);\n return;\n }\n\n if (stream._state === 'closed') {\n const emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);\n readIntoRequest._closeSteps(emptyView);\n return;\n }\n\n if (controller._queueTotalSize > 0) {\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor)) {\n const filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n\n ReadableByteStreamControllerHandleQueueDrain(controller);\n\n readIntoRequest._chunkSteps(filledView);\n return;\n }\n\n if (controller._closeRequested) {\n const e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n readIntoRequest._errorSteps(e);\n return;\n }\n }\n\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n ReadableStreamAddReadIntoRequest(stream, readIntoRequest);\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nfunction ReadableByteStreamControllerRespondInClosedState(controller: ReadableByteStreamController,\n firstDescriptor: PullIntoDescriptor) {\n assert(firstDescriptor.bytesFilled % firstDescriptor.elementSize === 0);\n\n if (firstDescriptor.readerType === 'none') {\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n }\n\n const stream = controller._controlledReadableByteStream;\n if (ReadableStreamHasBYOBReader(stream)) {\n while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n const pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);\n ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);\n }\n }\n}\n\nfunction ReadableByteStreamControllerRespondInReadableState(controller: ReadableByteStreamController,\n bytesWritten: number,\n pullIntoDescriptor: PullIntoDescriptor) {\n assert(pullIntoDescriptor.bytesFilled + bytesWritten <= pullIntoDescriptor.byteLength);\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);\n\n if (pullIntoDescriptor.readerType === 'none') {\n ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, pullIntoDescriptor);\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n return;\n }\n\n if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill) {\n // A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head\n // of the queue, so the underlying source can keep filling it.\n return;\n }\n\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;\n if (remainderSize > 0) {\n const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n ReadableByteStreamControllerEnqueueClonedChunkToQueue(\n controller,\n pullIntoDescriptor.buffer,\n end - remainderSize,\n remainderSize\n );\n }\n\n pullIntoDescriptor.bytesFilled -= remainderSize;\n ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);\n\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n}\n\nfunction ReadableByteStreamControllerRespondInternal(controller: ReadableByteStreamController, bytesWritten: number) {\n const firstDescriptor = controller._pendingPullIntos.peek();\n assert(CanTransferArrayBuffer(firstDescriptor.buffer));\n\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n\n const state = controller._controlledReadableByteStream._state;\n if (state === 'closed') {\n assert(bytesWritten === 0);\n ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);\n } else {\n assert(state === 'readable');\n assert(bytesWritten > 0);\n ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);\n }\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nfunction ReadableByteStreamControllerShiftPendingPullInto(\n controller: ReadableByteStreamController\n): PullIntoDescriptor {\n assert(controller._byobRequest === null);\n const descriptor = controller._pendingPullIntos.shift()!;\n return descriptor;\n}\n\nfunction ReadableByteStreamControllerShouldCallPull(controller: ReadableByteStreamController): boolean {\n const stream = controller._controlledReadableByteStream;\n\n if (stream._state !== 'readable') {\n return false;\n }\n\n if (controller._closeRequested) {\n return false;\n }\n\n if (!controller._started) {\n return false;\n }\n\n if (ReadableStreamHasDefaultReader(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n if (ReadableStreamHasBYOBReader(stream) && ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n return true;\n }\n\n const desiredSize = ReadableByteStreamControllerGetDesiredSize(controller);\n assert(desiredSize !== null);\n if (desiredSize! > 0) {\n return true;\n }\n\n return false;\n}\n\nfunction ReadableByteStreamControllerClearAlgorithms(controller: ReadableByteStreamController) {\n controller._pullAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n}\n\n// A client of ReadableByteStreamController may use these functions directly to bypass state check.\n\nexport function ReadableByteStreamControllerClose(controller: ReadableByteStreamController) {\n const stream = controller._controlledReadableByteStream;\n\n if (controller._closeRequested || stream._state !== 'readable') {\n return;\n }\n\n if (controller._queueTotalSize > 0) {\n controller._closeRequested = true;\n\n return;\n }\n\n if (controller._pendingPullIntos.length > 0) {\n const firstPendingPullInto = controller._pendingPullIntos.peek();\n if (firstPendingPullInto.bytesFilled % firstPendingPullInto.elementSize !== 0) {\n const e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n throw e;\n }\n }\n\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamClose(stream);\n}\n\nexport function ReadableByteStreamControllerEnqueue(\n controller: ReadableByteStreamController,\n chunk: NonShared\n) {\n const stream = controller._controlledReadableByteStream;\n\n if (controller._closeRequested || stream._state !== 'readable') {\n return;\n }\n\n const { buffer, byteOffset, byteLength } = chunk;\n if (IsDetachedBuffer(buffer)) {\n throw new TypeError('chunk\\'s buffer is detached and so cannot be enqueued');\n }\n const transferredBuffer = TransferArrayBuffer(buffer);\n\n if (controller._pendingPullIntos.length > 0) {\n const firstPendingPullInto = controller._pendingPullIntos.peek();\n if (IsDetachedBuffer(firstPendingPullInto.buffer)) {\n throw new TypeError(\n 'The BYOB request\\'s buffer has been detached and so cannot be filled with an enqueued chunk'\n );\n }\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);\n if (firstPendingPullInto.readerType === 'none') {\n ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto);\n }\n }\n\n if (ReadableStreamHasDefaultReader(stream)) {\n ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller);\n if (ReadableStreamGetNumReadRequests(stream) === 0) {\n assert(controller._pendingPullIntos.length === 0);\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n } else {\n assert(controller._queue.length === 0);\n if (controller._pendingPullIntos.length > 0) {\n assert(controller._pendingPullIntos.peek().readerType === 'default');\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n }\n const transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);\n ReadableStreamFulfillReadRequest(stream, transferredView as NonShared, false);\n }\n } else if (ReadableStreamHasBYOBReader(stream)) {\n // TODO: Ideally in this branch detaching should happen only if the buffer is not consumed fully.\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n } else {\n assert(!IsReadableStreamLocked(stream));\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n }\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nexport function ReadableByteStreamControllerError(controller: ReadableByteStreamController, e: any) {\n const stream = controller._controlledReadableByteStream;\n\n if (stream._state !== 'readable') {\n return;\n }\n\n ReadableByteStreamControllerClearPendingPullIntos(controller);\n\n ResetQueue(controller);\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamError(stream, e);\n}\n\nexport function ReadableByteStreamControllerFillReadRequestFromQueue(\n controller: ReadableByteStreamController,\n readRequest: ReadRequest>\n) {\n assert(controller._queueTotalSize > 0);\n\n const entry = controller._queue.shift();\n controller._queueTotalSize -= entry.byteLength;\n\n ReadableByteStreamControllerHandleQueueDrain(controller);\n\n const view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);\n readRequest._chunkSteps(view as NonShared);\n}\n\nexport function ReadableByteStreamControllerGetBYOBRequest(\n controller: ReadableByteStreamController\n): ReadableStreamBYOBRequest | null {\n if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {\n const firstDescriptor = controller._pendingPullIntos.peek();\n const view = new Uint8Array(firstDescriptor.buffer,\n firstDescriptor.byteOffset + firstDescriptor.bytesFilled,\n firstDescriptor.byteLength - firstDescriptor.bytesFilled);\n\n const byobRequest: ReadableStreamBYOBRequest = Object.create(ReadableStreamBYOBRequest.prototype);\n SetUpReadableStreamBYOBRequest(byobRequest, controller, view as NonShared);\n controller._byobRequest = byobRequest;\n }\n return controller._byobRequest;\n}\n\nfunction ReadableByteStreamControllerGetDesiredSize(controller: ReadableByteStreamController): number | null {\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nexport function ReadableByteStreamControllerRespond(controller: ReadableByteStreamController, bytesWritten: number) {\n assert(controller._pendingPullIntos.length > 0);\n\n const firstDescriptor = controller._pendingPullIntos.peek();\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'closed') {\n if (bytesWritten !== 0) {\n throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');\n }\n } else {\n assert(state === 'readable');\n if (bytesWritten === 0) {\n throw new TypeError('bytesWritten must be greater than 0 when calling respond() on a readable stream');\n }\n if (firstDescriptor.bytesFilled + bytesWritten > firstDescriptor.byteLength) {\n throw new RangeError('bytesWritten out of range');\n }\n }\n\n firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);\n\n ReadableByteStreamControllerRespondInternal(controller, bytesWritten);\n}\n\nexport function ReadableByteStreamControllerRespondWithNewView(controller: ReadableByteStreamController,\n view: NonShared) {\n assert(controller._pendingPullIntos.length > 0);\n assert(!IsDetachedBuffer(view.buffer));\n\n const firstDescriptor = controller._pendingPullIntos.peek();\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'closed') {\n if (view.byteLength !== 0) {\n throw new TypeError('The view\\'s length must be 0 when calling respondWithNewView() on a closed stream');\n }\n } else {\n assert(state === 'readable');\n if (view.byteLength === 0) {\n throw new TypeError(\n 'The view\\'s length must be greater than 0 when calling respondWithNewView() on a readable stream'\n );\n }\n }\n\n if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {\n throw new RangeError('The region specified by view does not match byobRequest');\n }\n if (firstDescriptor.bufferByteLength !== view.buffer.byteLength) {\n throw new RangeError('The buffer of view has different capacity than byobRequest');\n }\n if (firstDescriptor.bytesFilled + view.byteLength > firstDescriptor.byteLength) {\n throw new RangeError('The region specified by view is larger than byobRequest');\n }\n\n const viewByteLength = view.byteLength;\n firstDescriptor.buffer = TransferArrayBuffer(view.buffer);\n ReadableByteStreamControllerRespondInternal(controller, viewByteLength);\n}\n\nexport function SetUpReadableByteStreamController(stream: ReadableByteStream,\n controller: ReadableByteStreamController,\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n autoAllocateChunkSize: number | undefined) {\n assert(stream._readableStreamController === undefined);\n if (autoAllocateChunkSize !== undefined) {\n assert(NumberIsInteger(autoAllocateChunkSize));\n assert(autoAllocateChunkSize > 0);\n }\n\n controller._controlledReadableByteStream = stream;\n\n controller._pullAgain = false;\n controller._pulling = false;\n\n controller._byobRequest = null;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n controller._queue = controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._closeRequested = false;\n controller._started = false;\n\n controller._strategyHWM = highWaterMark;\n\n controller._pullAlgorithm = pullAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n controller._autoAllocateChunkSize = autoAllocateChunkSize;\n\n controller._pendingPullIntos = new SimpleQueue();\n\n stream._readableStreamController = controller;\n\n const startResult = startAlgorithm();\n uponPromise(\n promiseResolvedWith(startResult),\n () => {\n controller._started = true;\n\n assert(!controller._pulling);\n assert(!controller._pullAgain);\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n return null;\n },\n r => {\n ReadableByteStreamControllerError(controller, r);\n return null;\n }\n );\n}\n\nexport function SetUpReadableByteStreamControllerFromUnderlyingSource(\n stream: ReadableByteStream,\n underlyingByteSource: ValidatedUnderlyingByteSource,\n highWaterMark: number\n) {\n const controller: ReadableByteStreamController = Object.create(ReadableByteStreamController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let pullAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (underlyingByteSource.start !== undefined) {\n startAlgorithm = () => underlyingByteSource.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingByteSource.pull !== undefined) {\n pullAlgorithm = () => underlyingByteSource.pull!(controller);\n } else {\n pullAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingByteSource.cancel !== undefined) {\n cancelAlgorithm = reason => underlyingByteSource.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n const autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;\n if (autoAllocateChunkSize === 0) {\n throw new TypeError('autoAllocateChunkSize must be greater than 0');\n }\n\n SetUpReadableByteStreamController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize\n );\n}\n\nfunction SetUpReadableStreamBYOBRequest(request: ReadableStreamBYOBRequest,\n controller: ReadableByteStreamController,\n view: NonShared) {\n assert(IsReadableByteStreamController(controller));\n assert(typeof view === 'object');\n assert(ArrayBuffer.isView(view));\n assert(!IsDetachedBuffer(view.buffer));\n request._associatedReadableByteStreamController = controller;\n request._view = view;\n}\n\n// Helper functions for the ReadableStreamBYOBRequest.\n\nfunction byobRequestBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamBYOBRequest.prototype.${name} can only be used on a ReadableStreamBYOBRequest`);\n}\n\n// Helper functions for the ReadableByteStreamController.\n\nfunction byteStreamControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableByteStreamController.prototype.${name} can only be used on a ReadableByteStreamController`);\n}\n","import { assertDictionary, convertUnsignedLongLongWithEnforceRange } from './basic';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ReadableStreamGetReaderOptions,\n ValidatedReadableStreamBYOBReaderReadOptions\n} from '../readable-stream/reader-options';\n\nexport function convertReaderOptions(options: ReadableStreamGetReaderOptions | null | undefined,\n context: string): ReadableStreamGetReaderOptions {\n assertDictionary(options, context);\n const mode = options?.mode;\n return {\n mode: mode === undefined ? undefined : convertReadableStreamReaderMode(mode, `${context} has member 'mode' that`)\n };\n}\n\nfunction convertReadableStreamReaderMode(mode: string, context: string): 'byob' {\n mode = `${mode}`;\n if (mode !== 'byob') {\n throw new TypeError(`${context} '${mode}' is not a valid enumeration value for ReadableStreamReaderMode`);\n }\n return mode;\n}\n\nexport function convertByobReadOptions(\n options: ReadableStreamBYOBReaderReadOptions | null | undefined,\n context: string\n): ValidatedReadableStreamBYOBReaderReadOptions {\n assertDictionary(options, context);\n const min = options?.min ?? 1;\n return {\n min: convertUnsignedLongLongWithEnforceRange(\n min,\n `${context} has member 'min' that`\n )\n };\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport {\n ReadableStreamReaderGenericCancel,\n ReadableStreamReaderGenericInitialize,\n ReadableStreamReaderGenericRelease,\n readerLockException\n} from './generic-reader';\nimport { IsReadableStreamLocked, type ReadableByteStream, type ReadableStream } from '../readable-stream';\nimport {\n IsReadableByteStreamController,\n ReadableByteStreamController,\n ReadableByteStreamControllerPullInto\n} from './byte-stream-controller';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { newPromise, promiseRejectedWith } from '../helpers/webidl';\nimport { assertRequiredArgument } from '../validators/basic';\nimport { assertReadableStream } from '../validators/readable-stream';\nimport { IsDetachedBuffer } from '../abstract-ops/ecmascript';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ValidatedReadableStreamBYOBReaderReadOptions\n} from './reader-options';\nimport { convertByobReadOptions } from '../validators/reader-options';\nimport { isDataView, type NonShared, type TypedArray } from '../helpers/array-buffer-view';\n\n/**\n * A result returned by {@link ReadableStreamBYOBReader.read}.\n *\n * @public\n */\nexport type ReadableStreamBYOBReadResult = {\n done: false;\n value: T;\n} | {\n done: true;\n value: T | undefined;\n};\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamBYOBReader(stream: ReadableByteStream): ReadableStreamBYOBReader {\n return new ReadableStreamBYOBReader(stream as ReadableStream);\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamAddReadIntoRequest>(\n stream: ReadableByteStream,\n readIntoRequest: ReadIntoRequest\n): void {\n assert(IsReadableStreamBYOBReader(stream._reader));\n assert(stream._state === 'readable' || stream._state === 'closed');\n\n (stream._reader! as ReadableStreamBYOBReader)._readIntoRequests.push(readIntoRequest);\n}\n\nexport function ReadableStreamFulfillReadIntoRequest(stream: ReadableByteStream,\n chunk: ArrayBufferView,\n done: boolean) {\n const reader = stream._reader as ReadableStreamBYOBReader;\n\n assert(reader._readIntoRequests.length > 0);\n\n const readIntoRequest = reader._readIntoRequests.shift()!;\n if (done) {\n readIntoRequest._closeSteps(chunk);\n } else {\n readIntoRequest._chunkSteps(chunk);\n }\n}\n\nexport function ReadableStreamGetNumReadIntoRequests(stream: ReadableByteStream): number {\n return (stream._reader as ReadableStreamBYOBReader)._readIntoRequests.length;\n}\n\nexport function ReadableStreamHasBYOBReader(stream: ReadableByteStream): boolean {\n const reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (!IsReadableStreamBYOBReader(reader)) {\n return false;\n }\n\n return true;\n}\n\n// Readers\n\nexport interface ReadIntoRequest> {\n _chunkSteps(chunk: T): void;\n\n _closeSteps(chunk: T | undefined): void;\n\n _errorSteps(e: any): void;\n}\n\n/**\n * A BYOB reader vended by a {@link ReadableStream}.\n *\n * @public\n */\nexport class ReadableStreamBYOBReader {\n /** @internal */\n _ownerReadableStream!: ReadableByteStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _readIntoRequests: SimpleQueue>;\n\n constructor(stream: ReadableStream) {\n assertRequiredArgument(stream, 1, 'ReadableStreamBYOBReader');\n assertReadableStream(stream, 'First parameter');\n\n if (IsReadableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n if (!IsReadableByteStreamController(stream._readableStreamController)) {\n throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' +\n 'source');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readIntoRequests = new SimpleQueue();\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or\n * the reader's lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n\n /**\n * Attempts to reads bytes into view, and returns a promise resolved with the result.\n *\n * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.\n */\n read(\n view: T,\n options?: ReadableStreamBYOBReaderReadOptions\n ): Promise>;\n read>(\n view: T,\n rawOptions: ReadableStreamBYOBReaderReadOptions | null | undefined = {}\n ): Promise> {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('read'));\n }\n\n if (!ArrayBuffer.isView(view)) {\n return promiseRejectedWith(new TypeError('view must be an array buffer view'));\n }\n if (view.byteLength === 0) {\n return promiseRejectedWith(new TypeError('view must have non-zero byteLength'));\n }\n if (view.buffer.byteLength === 0) {\n return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`));\n }\n if (IsDetachedBuffer(view.buffer)) {\n return promiseRejectedWith(new TypeError('view\\'s buffer has been detached'));\n }\n\n let options: ValidatedReadableStreamBYOBReaderReadOptions;\n try {\n options = convertByobReadOptions(rawOptions, 'options');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const min = options.min;\n if (min === 0) {\n return promiseRejectedWith(new TypeError('options.min must be greater than 0'));\n }\n if (!isDataView(view)) {\n if (min > (view as unknown as TypedArray).length) {\n return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\\'s length'));\n }\n } else if (min > view.byteLength) {\n return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\\'s byteLength'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('read from'));\n }\n\n let resolvePromise!: (result: ReadableStreamBYOBReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readIntoRequest: ReadIntoRequest = {\n _chunkSteps: chunk => resolvePromise({ value: chunk, done: false }),\n _closeSteps: chunk => resolvePromise({ value: chunk, done: true }),\n _errorSteps: e => rejectPromise(e)\n };\n ReadableStreamBYOBReaderRead(this, view, min, readIntoRequest);\n return promise;\n }\n\n /**\n * Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.\n * If the associated stream is errored when the lock is released, the reader will appear errored in the same way\n * from now on; otherwise, the reader will appear closed.\n *\n * A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by\n * the reader's {@link ReadableStreamBYOBReader.read | read()} method has not yet been settled. Attempting to\n * do so will throw a `TypeError` and leave the reader locked to the stream.\n */\n releaseLock(): void {\n if (!IsReadableStreamBYOBReader(this)) {\n throw byobReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n ReadableStreamBYOBReaderRelease(this);\n }\n}\n\nObject.defineProperties(ReadableStreamBYOBReader.prototype, {\n cancel: { enumerable: true },\n read: { enumerable: true },\n releaseLock: { enumerable: true },\n closed: { enumerable: true }\n});\nsetFunctionName(ReadableStreamBYOBReader.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStreamBYOBReader.prototype.read, 'read');\nsetFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, 'releaseLock');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamBYOBReader.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamBYOBReader',\n configurable: true\n });\n}\n\n// Abstract operations for the readers.\n\nexport function IsReadableStreamBYOBReader(x: any): x is ReadableStreamBYOBReader {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {\n return false;\n }\n\n return x instanceof ReadableStreamBYOBReader;\n}\n\nexport function ReadableStreamBYOBReaderRead>(\n reader: ReadableStreamBYOBReader,\n view: T,\n min: number,\n readIntoRequest: ReadIntoRequest\n): void {\n const stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'errored') {\n readIntoRequest._errorSteps(stream._storedError);\n } else {\n ReadableByteStreamControllerPullInto(\n stream._readableStreamController as ReadableByteStreamController,\n view,\n min,\n readIntoRequest\n );\n }\n}\n\nexport function ReadableStreamBYOBReaderRelease(reader: ReadableStreamBYOBReader) {\n ReadableStreamReaderGenericRelease(reader);\n const e = new TypeError('Reader was released');\n ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);\n}\n\nexport function ReadableStreamBYOBReaderErrorReadIntoRequests(reader: ReadableStreamBYOBReader, e: any) {\n const readIntoRequests = reader._readIntoRequests;\n reader._readIntoRequests = new SimpleQueue();\n readIntoRequests.forEach(readIntoRequest => {\n readIntoRequest._errorSteps(e);\n });\n}\n\n// Helper functions for the ReadableStreamBYOBReader.\n\nfunction byobReaderBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamBYOBReader.prototype.${name} can only be used on a ReadableStreamBYOBReader`);\n}\n","import type { QueuingStrategy, QueuingStrategySizeCallback } from '../queuing-strategy';\nimport NumberIsNaN from '../../stub/number-isnan';\n\nexport function ExtractHighWaterMark(strategy: QueuingStrategy, defaultHWM: number): number {\n const { highWaterMark } = strategy;\n\n if (highWaterMark === undefined) {\n return defaultHWM;\n }\n\n if (NumberIsNaN(highWaterMark) || highWaterMark < 0) {\n throw new RangeError('Invalid highWaterMark');\n }\n\n return highWaterMark;\n}\n\nexport function ExtractSizeAlgorithm(strategy: QueuingStrategy): QueuingStrategySizeCallback {\n const { size } = strategy;\n\n if (!size) {\n return () => 1;\n }\n\n return size;\n}\n","import type { QueuingStrategy, QueuingStrategySizeCallback } from '../queuing-strategy';\nimport { assertDictionary, assertFunction, convertUnrestrictedDouble } from './basic';\n\nexport function convertQueuingStrategy(init: QueuingStrategy | null | undefined,\n context: string): QueuingStrategy {\n assertDictionary(init, context);\n const highWaterMark = init?.highWaterMark;\n const size = init?.size;\n return {\n highWaterMark: highWaterMark === undefined ? undefined : convertUnrestrictedDouble(highWaterMark),\n size: size === undefined ? undefined : convertQueuingStrategySize(size, `${context} has member 'size' that`)\n };\n}\n\nfunction convertQueuingStrategySize(fn: QueuingStrategySizeCallback,\n context: string): QueuingStrategySizeCallback {\n assertFunction(fn, context);\n return chunk => convertUnrestrictedDouble(fn(chunk));\n}\n","import { assertDictionary, assertFunction } from './basic';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\nimport type {\n UnderlyingSink,\n UnderlyingSinkAbortCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n ValidatedUnderlyingSink\n} from '../writable-stream/underlying-sink';\nimport { WritableStreamDefaultController } from '../writable-stream';\n\nexport function convertUnderlyingSink(original: UnderlyingSink | null,\n context: string): ValidatedUnderlyingSink {\n assertDictionary(original, context);\n const abort = original?.abort;\n const close = original?.close;\n const start = original?.start;\n const type = original?.type;\n const write = original?.write;\n return {\n abort: abort === undefined ?\n undefined :\n convertUnderlyingSinkAbortCallback(abort, original!, `${context} has member 'abort' that`),\n close: close === undefined ?\n undefined :\n convertUnderlyingSinkCloseCallback(close, original!, `${context} has member 'close' that`),\n start: start === undefined ?\n undefined :\n convertUnderlyingSinkStartCallback(start, original!, `${context} has member 'start' that`),\n write: write === undefined ?\n undefined :\n convertUnderlyingSinkWriteCallback(write, original!, `${context} has member 'write' that`),\n type\n };\n}\n\nfunction convertUnderlyingSinkAbortCallback(\n fn: UnderlyingSinkAbortCallback,\n original: UnderlyingSink,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n\nfunction convertUnderlyingSinkCloseCallback(\n fn: UnderlyingSinkCloseCallback,\n original: UnderlyingSink,\n context: string\n): () => Promise {\n assertFunction(fn, context);\n return () => promiseCall(fn, original, []);\n}\n\nfunction convertUnderlyingSinkStartCallback(\n fn: UnderlyingSinkStartCallback,\n original: UnderlyingSink,\n context: string\n): UnderlyingSinkStartCallback {\n assertFunction(fn, context);\n return (controller: WritableStreamDefaultController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertUnderlyingSinkWriteCallback(\n fn: UnderlyingSinkWriteCallback,\n original: UnderlyingSink,\n context: string\n): (chunk: W, controller: WritableStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (chunk: W, controller: WritableStreamDefaultController) => promiseCall(fn, original, [chunk, controller]);\n}\n","import { IsWritableStream, WritableStream } from '../writable-stream';\n\nexport function assertWritableStream(x: unknown, context: string): asserts x is WritableStream {\n if (!IsWritableStream(x)) {\n throw new TypeError(`${context} is not a WritableStream.`);\n }\n}\n","/**\n * A signal object that allows you to communicate with a request and abort it if required\n * via its associated `AbortController` object.\n *\n * @remarks\n * This interface is compatible with the `AbortSignal` interface defined in TypeScript's DOM types.\n * It is redefined here, so it can be polyfilled without a DOM, for example with\n * {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.\n *\n * @public\n */\nexport interface AbortSignal {\n /**\n * Whether the request is aborted.\n */\n readonly aborted: boolean;\n\n /**\n * If aborted, returns the reason for aborting.\n */\n readonly reason?: any;\n\n /**\n * Add an event listener to be triggered when this signal becomes aborted.\n */\n addEventListener(type: 'abort', listener: () => void): void;\n\n /**\n * Remove an event listener that was previously added with {@link AbortSignal.addEventListener}.\n */\n removeEventListener(type: 'abort', listener: () => void): void;\n}\n\nexport function isAbortSignal(value: unknown): value is AbortSignal {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n try {\n return typeof (value as AbortSignal).aborted === 'boolean';\n } catch {\n // AbortSignal.prototype.aborted throws if its brand check fails\n return false;\n }\n}\n\n/**\n * A controller object that allows you to abort an `AbortSignal` when desired.\n *\n * @remarks\n * This interface is compatible with the `AbortController` interface defined in TypeScript's DOM types.\n * It is redefined here, so it can be polyfilled without a DOM, for example with\n * {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.\n *\n * @internal\n */\nexport interface AbortController {\n readonly signal: AbortSignal;\n\n abort(reason?: any): void;\n}\n\ninterface AbortControllerConstructor {\n new(): AbortController;\n}\n\nconst supportsAbortController = typeof (AbortController as any) === 'function';\n\n/**\n * Construct a new AbortController, if supported by the platform.\n *\n * @internal\n */\nexport function createAbortController(): AbortController | undefined {\n if (supportsAbortController) {\n return new (AbortController as AbortControllerConstructor)();\n }\n return undefined;\n}\n","import assert from '../stub/assert';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n uponPromise\n} from './helpers/webidl';\nimport {\n DequeueValue,\n EnqueueValueWithSize,\n PeekQueueValue,\n type QueuePair,\n ResetQueue\n} from './abstract-ops/queue-with-sizes';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { SimpleQueue } from './simple-queue';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { AbortSteps, ErrorSteps } from './abstract-ops/internal-methods';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport type {\n UnderlyingSink,\n UnderlyingSinkAbortCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n ValidatedUnderlyingSink\n} from './writable-stream/underlying-sink';\nimport { assertObject, assertRequiredArgument } from './validators/basic';\nimport { convertUnderlyingSink } from './validators/underlying-sink';\nimport { assertWritableStream } from './validators/writable-stream';\nimport { type AbortController, type AbortSignal, createAbortController } from './abort-signal';\n\ntype WritableStreamState = 'writable' | 'closed' | 'erroring' | 'errored';\n\ninterface WriteOrCloseRequest {\n _resolve: (value?: undefined) => void;\n _reject: (reason: any) => void;\n}\n\ntype WriteRequest = WriteOrCloseRequest;\ntype CloseRequest = WriteOrCloseRequest;\n\ninterface PendingAbortRequest {\n _promise: Promise;\n _resolve: (value?: undefined) => void;\n _reject: (reason: any) => void;\n _reason: any;\n _wasAlreadyErroring: boolean;\n}\n\n/**\n * A writable stream represents a destination for data, into which you can write.\n *\n * @public\n */\nclass WritableStream {\n /** @internal */\n _state!: WritableStreamState;\n /** @internal */\n _storedError: any;\n /** @internal */\n _writer: WritableStreamDefaultWriter | undefined;\n /** @internal */\n _writableStreamController!: WritableStreamDefaultController;\n /** @internal */\n _writeRequests!: SimpleQueue;\n /** @internal */\n _inFlightWriteRequest: WriteRequest | undefined;\n /** @internal */\n _closeRequest: CloseRequest | undefined;\n /** @internal */\n _inFlightCloseRequest: CloseRequest | undefined;\n /** @internal */\n _pendingAbortRequest: PendingAbortRequest | undefined;\n /** @internal */\n _backpressure!: boolean;\n\n constructor(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy);\n constructor(rawUnderlyingSink: UnderlyingSink | null | undefined = {},\n rawStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawUnderlyingSink === undefined) {\n rawUnderlyingSink = null;\n } else {\n assertObject(rawUnderlyingSink, 'First parameter');\n }\n\n const strategy = convertQueuingStrategy(rawStrategy, 'Second parameter');\n const underlyingSink = convertUnderlyingSink(rawUnderlyingSink, 'First parameter');\n\n InitializeWritableStream(this);\n\n const type = underlyingSink.type;\n if (type !== undefined) {\n throw new RangeError('Invalid type is specified');\n }\n\n const sizeAlgorithm = ExtractSizeAlgorithm(strategy);\n const highWaterMark = ExtractHighWaterMark(strategy, 1);\n\n SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, highWaterMark, sizeAlgorithm);\n }\n\n /**\n * Returns whether or not the writable stream is locked to a writer.\n */\n get locked(): boolean {\n if (!IsWritableStream(this)) {\n throw streamBrandCheckException('locked');\n }\n\n return IsWritableStreamLocked(this);\n }\n\n /**\n * Aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be\n * immediately moved to an errored state, with any queued-up writes discarded. This will also execute any abort\n * mechanism of the underlying sink.\n *\n * The returned promise will fulfill if the stream shuts down successfully, or reject if the underlying sink signaled\n * that there was an error doing so. Additionally, it will reject with a `TypeError` (without attempting to cancel\n * the stream) if the stream is currently locked.\n */\n abort(reason: any = undefined): Promise {\n if (!IsWritableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('abort'));\n }\n\n if (IsWritableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));\n }\n\n return WritableStreamAbort(this, reason);\n }\n\n /**\n * Closes the stream. The underlying sink will finish processing any previously-written chunks, before invoking its\n * close behavior. During this time any further attempts to write will fail (without erroring the stream).\n *\n * The method returns a promise that will fulfill if all remaining chunks are successfully written and the stream\n * successfully closes, or rejects if an error is encountered during this process. Additionally, it will reject with\n * a `TypeError` (without attempting to cancel the stream) if the stream is currently locked.\n */\n close() {\n if (!IsWritableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('close'));\n }\n\n if (IsWritableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));\n }\n\n if (WritableStreamCloseQueuedOrInFlight(this)) {\n return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));\n }\n\n return WritableStreamClose(this);\n }\n\n /**\n * Creates a {@link WritableStreamDefaultWriter | writer} and locks the stream to the new writer. While the stream\n * is locked, no other writer can be acquired until this one is released.\n *\n * This functionality is especially useful for creating abstractions that desire the ability to write to a stream\n * without interruption or interleaving. By getting a writer for the stream, you can ensure nobody else can write at\n * the same time, which would cause the resulting written data to be unpredictable and probably useless.\n */\n getWriter(): WritableStreamDefaultWriter {\n if (!IsWritableStream(this)) {\n throw streamBrandCheckException('getWriter');\n }\n\n return AcquireWritableStreamDefaultWriter(this);\n }\n}\n\nObject.defineProperties(WritableStream.prototype, {\n abort: { enumerable: true },\n close: { enumerable: true },\n getWriter: { enumerable: true },\n locked: { enumerable: true }\n});\nsetFunctionName(WritableStream.prototype.abort, 'abort');\nsetFunctionName(WritableStream.prototype.close, 'close');\nsetFunctionName(WritableStream.prototype.getWriter, 'getWriter');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStream.prototype, Symbol.toStringTag, {\n value: 'WritableStream',\n configurable: true\n });\n}\n\nexport {\n AcquireWritableStreamDefaultWriter,\n CreateWritableStream,\n IsWritableStream,\n IsWritableStreamLocked,\n WritableStream,\n WritableStreamAbort,\n WritableStreamDefaultControllerErrorIfNeeded,\n WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite,\n WritableStreamCloseQueuedOrInFlight\n};\n\nexport type {\n UnderlyingSink,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkAbortCallback\n};\n\n// Abstract operations for the WritableStream.\n\nfunction AcquireWritableStreamDefaultWriter(stream: WritableStream): WritableStreamDefaultWriter {\n return new WritableStreamDefaultWriter(stream);\n}\n\n// Throws if and only if startAlgorithm throws.\nfunction CreateWritableStream(startAlgorithm: () => void | PromiseLike,\n writeAlgorithm: (chunk: W) => Promise,\n closeAlgorithm: () => Promise,\n abortAlgorithm: (reason: any) => Promise,\n highWaterMark = 1,\n sizeAlgorithm: QueuingStrategySizeCallback = () => 1) {\n assert(IsNonNegativeNumber(highWaterMark));\n\n const stream: WritableStream = Object.create(WritableStream.prototype);\n InitializeWritableStream(stream);\n\n const controller: WritableStreamDefaultController = Object.create(WritableStreamDefaultController.prototype);\n\n SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm,\n abortAlgorithm, highWaterMark, sizeAlgorithm);\n return stream;\n}\n\nfunction InitializeWritableStream(stream: WritableStream) {\n stream._state = 'writable';\n\n // The error that will be reported by new method calls once the state becomes errored. Only set when [[state]] is\n // 'erroring' or 'errored'. May be set to an undefined value.\n stream._storedError = undefined;\n\n stream._writer = undefined;\n\n // Initialize to undefined first because the constructor of the controller checks this\n // variable to validate the caller.\n stream._writableStreamController = undefined!;\n\n // This queue is placed here instead of the writer class in order to allow for passing a writer to the next data\n // producer without waiting for the queued writes to finish.\n stream._writeRequests = new SimpleQueue();\n\n // Write requests are removed from _writeRequests when write() is called on the underlying sink. This prevents\n // them from being erroneously rejected on error. If a write() call is in-flight, the request is stored here.\n stream._inFlightWriteRequest = undefined;\n\n // The promise that was returned from writer.close(). Stored here because it may be fulfilled after the writer\n // has been detached.\n stream._closeRequest = undefined;\n\n // Close request is removed from _closeRequest when close() is called on the underlying sink. This prevents it\n // from being erroneously rejected on error. If a close() call is in-flight, the request is stored here.\n stream._inFlightCloseRequest = undefined;\n\n // The promise that was returned from writer.abort(). This may also be fulfilled after the writer has detached.\n stream._pendingAbortRequest = undefined;\n\n // The backpressure signal set by the controller.\n stream._backpressure = false;\n}\n\nfunction IsWritableStream(x: unknown): x is WritableStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {\n return false;\n }\n\n return x instanceof WritableStream;\n}\n\nfunction IsWritableStreamLocked(stream: WritableStream): boolean {\n assert(IsWritableStream(stream));\n\n if (stream._writer === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamAbort(stream: WritableStream, reason: any): Promise {\n if (stream._state === 'closed' || stream._state === 'errored') {\n return promiseResolvedWith(undefined);\n }\n stream._writableStreamController._abortReason = reason;\n stream._writableStreamController._abortController?.abort(reason);\n\n // TypeScript narrows the type of `stream._state` down to 'writable' | 'erroring',\n // but it doesn't know that signaling abort runs author code that might have changed the state.\n // Widen the type again by casting to WritableStreamState.\n const state = stream._state as WritableStreamState;\n\n if (state === 'closed' || state === 'errored') {\n return promiseResolvedWith(undefined);\n }\n if (stream._pendingAbortRequest !== undefined) {\n return stream._pendingAbortRequest._promise;\n }\n\n assert(state === 'writable' || state === 'erroring');\n\n let wasAlreadyErroring = false;\n if (state === 'erroring') {\n wasAlreadyErroring = true;\n // reason will not be used, so don't keep a reference to it.\n reason = undefined;\n }\n\n const promise = newPromise((resolve, reject) => {\n stream._pendingAbortRequest = {\n _promise: undefined!,\n _resolve: resolve,\n _reject: reject,\n _reason: reason,\n _wasAlreadyErroring: wasAlreadyErroring\n };\n });\n stream._pendingAbortRequest!._promise = promise;\n\n if (!wasAlreadyErroring) {\n WritableStreamStartErroring(stream, reason);\n }\n\n return promise;\n}\n\nfunction WritableStreamClose(stream: WritableStream): Promise {\n const state = stream._state;\n if (state === 'closed' || state === 'errored') {\n return promiseRejectedWith(new TypeError(\n `The stream (in ${state} state) is not in the writable state and cannot be closed`));\n }\n\n assert(state === 'writable' || state === 'erroring');\n assert(!WritableStreamCloseQueuedOrInFlight(stream));\n\n const promise = newPromise((resolve, reject) => {\n const closeRequest: CloseRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._closeRequest = closeRequest;\n });\n\n const writer = stream._writer;\n if (writer !== undefined && stream._backpressure && state === 'writable') {\n defaultWriterReadyPromiseResolve(writer);\n }\n\n WritableStreamDefaultControllerClose(stream._writableStreamController);\n\n return promise;\n}\n\n// WritableStream API exposed for controllers.\n\nfunction WritableStreamAddWriteRequest(stream: WritableStream): Promise {\n assert(IsWritableStreamLocked(stream));\n assert(stream._state === 'writable');\n\n const promise = newPromise((resolve, reject) => {\n const writeRequest: WriteRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._writeRequests.push(writeRequest);\n });\n\n return promise;\n}\n\nfunction WritableStreamDealWithRejection(stream: WritableStream, error: any) {\n const state = stream._state;\n\n if (state === 'writable') {\n WritableStreamStartErroring(stream, error);\n return;\n }\n\n assert(state === 'erroring');\n WritableStreamFinishErroring(stream);\n}\n\nfunction WritableStreamStartErroring(stream: WritableStream, reason: any) {\n assert(stream._storedError === undefined);\n assert(stream._state === 'writable');\n\n const controller = stream._writableStreamController;\n assert(controller !== undefined);\n\n stream._state = 'erroring';\n stream._storedError = reason;\n const writer = stream._writer;\n if (writer !== undefined) {\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);\n }\n\n if (!WritableStreamHasOperationMarkedInFlight(stream) && controller._started) {\n WritableStreamFinishErroring(stream);\n }\n}\n\nfunction WritableStreamFinishErroring(stream: WritableStream) {\n assert(stream._state === 'erroring');\n assert(!WritableStreamHasOperationMarkedInFlight(stream));\n stream._state = 'errored';\n stream._writableStreamController[ErrorSteps]();\n\n const storedError = stream._storedError;\n stream._writeRequests.forEach(writeRequest => {\n writeRequest._reject(storedError);\n });\n stream._writeRequests = new SimpleQueue();\n\n if (stream._pendingAbortRequest === undefined) {\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n const abortRequest = stream._pendingAbortRequest;\n stream._pendingAbortRequest = undefined;\n\n if (abortRequest._wasAlreadyErroring) {\n abortRequest._reject(storedError);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n const promise = stream._writableStreamController[AbortSteps](abortRequest._reason);\n uponPromise(\n promise,\n () => {\n abortRequest._resolve();\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return null;\n },\n (reason: any) => {\n abortRequest._reject(reason);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return null;\n });\n}\n\nfunction WritableStreamFinishInFlightWrite(stream: WritableStream) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest!._resolve(undefined);\n stream._inFlightWriteRequest = undefined;\n}\n\nfunction WritableStreamFinishInFlightWriteWithError(stream: WritableStream, error: any) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest!._reject(error);\n stream._inFlightWriteRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n WritableStreamDealWithRejection(stream, error);\n}\n\nfunction WritableStreamFinishInFlightClose(stream: WritableStream) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest!._resolve(undefined);\n stream._inFlightCloseRequest = undefined;\n\n const state = stream._state;\n\n assert(state === 'writable' || state === 'erroring');\n\n if (state === 'erroring') {\n // The error was too late to do anything, so it is ignored.\n stream._storedError = undefined;\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._resolve();\n stream._pendingAbortRequest = undefined;\n }\n }\n\n stream._state = 'closed';\n\n const writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseResolve(writer);\n }\n\n assert(stream._pendingAbortRequest === undefined);\n assert(stream._storedError === undefined);\n}\n\nfunction WritableStreamFinishInFlightCloseWithError(stream: WritableStream, error: any) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest!._reject(error);\n stream._inFlightCloseRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n // Never execute sink abort() after sink close().\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._reject(error);\n stream._pendingAbortRequest = undefined;\n }\n WritableStreamDealWithRejection(stream, error);\n}\n\n// TODO(ricea): Fix alphabetical order.\nfunction WritableStreamCloseQueuedOrInFlight(stream: WritableStream): boolean {\n if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamHasOperationMarkedInFlight(stream: WritableStream): boolean {\n if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamMarkCloseRequestInFlight(stream: WritableStream) {\n assert(stream._inFlightCloseRequest === undefined);\n assert(stream._closeRequest !== undefined);\n stream._inFlightCloseRequest = stream._closeRequest;\n stream._closeRequest = undefined;\n}\n\nfunction WritableStreamMarkFirstWriteRequestInFlight(stream: WritableStream) {\n assert(stream._inFlightWriteRequest === undefined);\n assert(stream._writeRequests.length !== 0);\n stream._inFlightWriteRequest = stream._writeRequests.shift();\n}\n\nfunction WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream: WritableStream) {\n assert(stream._state === 'errored');\n if (stream._closeRequest !== undefined) {\n assert(stream._inFlightCloseRequest === undefined);\n\n stream._closeRequest._reject(stream._storedError);\n stream._closeRequest = undefined;\n }\n const writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseReject(writer, stream._storedError);\n }\n}\n\nfunction WritableStreamUpdateBackpressure(stream: WritableStream, backpressure: boolean) {\n assert(stream._state === 'writable');\n assert(!WritableStreamCloseQueuedOrInFlight(stream));\n\n const writer = stream._writer;\n if (writer !== undefined && backpressure !== stream._backpressure) {\n if (backpressure) {\n defaultWriterReadyPromiseReset(writer);\n } else {\n assert(!backpressure);\n\n defaultWriterReadyPromiseResolve(writer);\n }\n }\n\n stream._backpressure = backpressure;\n}\n\n/**\n * A default writer vended by a {@link WritableStream}.\n *\n * @public\n */\nexport class WritableStreamDefaultWriter {\n /** @internal */\n _ownerWritableStream: WritableStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _closedPromiseState!: 'pending' | 'resolved' | 'rejected';\n /** @internal */\n _readyPromise!: Promise;\n /** @internal */\n _readyPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _readyPromise_reject?: (reason: any) => void;\n /** @internal */\n _readyPromiseState!: 'pending' | 'fulfilled' | 'rejected';\n\n constructor(stream: WritableStream) {\n assertRequiredArgument(stream, 1, 'WritableStreamDefaultWriter');\n assertWritableStream(stream, 'First parameter');\n\n if (IsWritableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive writing by another writer');\n }\n\n this._ownerWritableStream = stream;\n stream._writer = this;\n\n const state = stream._state;\n\n if (state === 'writable') {\n if (!WritableStreamCloseQueuedOrInFlight(stream) && stream._backpressure) {\n defaultWriterReadyPromiseInitialize(this);\n } else {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n }\n\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'erroring') {\n defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'closed') {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n defaultWriterClosedPromiseInitializeAsResolved(this);\n } else {\n assert(state === 'errored');\n\n const storedError = stream._storedError;\n defaultWriterReadyPromiseInitializeAsRejected(this, storedError);\n defaultWriterClosedPromiseInitializeAsRejected(this, storedError);\n }\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or\n * the writer’s lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * Returns the desired size to fill the stream’s internal queue. It can be negative, if the queue is over-full.\n * A producer can use this information to determine the right amount of data to write.\n *\n * It will be `null` if the stream cannot be successfully written to (due to either being errored, or having an abort\n * queued up). It will return zero if the stream is closed. And the getter will throw an exception if invoked when\n * the writer’s lock is released.\n */\n get desiredSize(): number | null {\n if (!IsWritableStreamDefaultWriter(this)) {\n throw defaultWriterBrandCheckException('desiredSize');\n }\n\n if (this._ownerWritableStream === undefined) {\n throw defaultWriterLockException('desiredSize');\n }\n\n return WritableStreamDefaultWriterGetDesiredSize(this);\n }\n\n /**\n * Returns a promise that will be fulfilled when the desired size to fill the stream’s internal queue transitions\n * from non-positive to positive, signaling that it is no longer applying backpressure. Once the desired size dips\n * back to zero or below, the getter will return a new promise that stays pending until the next transition.\n *\n * If the stream becomes errored or aborted, or the writer’s lock is released, the returned promise will become\n * rejected.\n */\n get ready(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('ready'));\n }\n\n return this._readyPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link WritableStream.abort | stream.abort(reason)}.\n */\n abort(reason: any = undefined): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('abort'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('abort'));\n }\n\n return WritableStreamDefaultWriterAbort(this, reason);\n }\n\n /**\n * If the reader is active, behaves the same as {@link WritableStream.close | stream.close()}.\n */\n close(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('close'));\n }\n\n const stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('close'));\n }\n\n if (WritableStreamCloseQueuedOrInFlight(stream)) {\n return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));\n }\n\n return WritableStreamDefaultWriterClose(this);\n }\n\n /**\n * Releases the writer’s lock on the corresponding stream. After the lock is released, the writer is no longer active.\n * If the associated stream is errored when the lock is released, the writer will appear errored in the same way from\n * now on; otherwise, the writer will appear closed.\n *\n * Note that the lock can still be released even if some ongoing writes have not yet finished (i.e. even if the\n * promises returned from previous calls to {@link WritableStreamDefaultWriter.write | write()} have not yet settled).\n * It’s not necessary to hold the lock on the writer for the duration of the write; the lock instead simply prevents\n * other producers from writing in an interleaved manner.\n */\n releaseLock(): void {\n if (!IsWritableStreamDefaultWriter(this)) {\n throw defaultWriterBrandCheckException('releaseLock');\n }\n\n const stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return;\n }\n\n assert(stream._writer !== undefined);\n\n WritableStreamDefaultWriterRelease(this);\n }\n\n /**\n * Writes the given chunk to the writable stream, by waiting until any previous writes have finished successfully,\n * and then sending the chunk to the underlying sink's {@link UnderlyingSink.write | write()} method. It will return\n * a promise that fulfills with undefined upon a successful write, or rejects if the write fails or stream becomes\n * errored before the writing process is initiated.\n *\n * Note that what \"success\" means is up to the underlying sink; it might indicate simply that the chunk has been\n * accepted, and not necessarily that it is safely saved to its ultimate destination.\n */\n write(chunk: W): Promise;\n write(chunk: W = undefined!): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('write'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('write to'));\n }\n\n return WritableStreamDefaultWriterWrite(this, chunk);\n }\n}\n\nObject.defineProperties(WritableStreamDefaultWriter.prototype, {\n abort: { enumerable: true },\n close: { enumerable: true },\n releaseLock: { enumerable: true },\n write: { enumerable: true },\n closed: { enumerable: true },\n desiredSize: { enumerable: true },\n ready: { enumerable: true }\n});\nsetFunctionName(WritableStreamDefaultWriter.prototype.abort, 'abort');\nsetFunctionName(WritableStreamDefaultWriter.prototype.close, 'close');\nsetFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, 'releaseLock');\nsetFunctionName(WritableStreamDefaultWriter.prototype.write, 'write');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStreamDefaultWriter.prototype, Symbol.toStringTag, {\n value: 'WritableStreamDefaultWriter',\n configurable: true\n });\n}\n\n// Abstract operations for the WritableStreamDefaultWriter.\n\nfunction IsWritableStreamDefaultWriter(x: any): x is WritableStreamDefaultWriter {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {\n return false;\n }\n\n return x instanceof WritableStreamDefaultWriter;\n}\n\n// A client of WritableStreamDefaultWriter may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultWriterAbort(writer: WritableStreamDefaultWriter, reason: any) {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n return WritableStreamAbort(stream, reason);\n}\n\nfunction WritableStreamDefaultWriterClose(writer: WritableStreamDefaultWriter): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n return WritableStreamClose(stream);\n}\n\nfunction WritableStreamDefaultWriterCloseWithErrorPropagation(writer: WritableStreamDefaultWriter): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n const state = stream._state;\n if (WritableStreamCloseQueuedOrInFlight(stream) || state === 'closed') {\n return promiseResolvedWith(undefined);\n }\n\n if (state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n\n assert(state === 'writable' || state === 'erroring');\n\n return WritableStreamDefaultWriterClose(writer);\n}\n\nfunction WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer: WritableStreamDefaultWriter, error: any) {\n if (writer._closedPromiseState === 'pending') {\n defaultWriterClosedPromiseReject(writer, error);\n } else {\n defaultWriterClosedPromiseResetToRejected(writer, error);\n }\n}\n\nfunction WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer: WritableStreamDefaultWriter, error: any) {\n if (writer._readyPromiseState === 'pending') {\n defaultWriterReadyPromiseReject(writer, error);\n } else {\n defaultWriterReadyPromiseResetToRejected(writer, error);\n }\n}\n\nfunction WritableStreamDefaultWriterGetDesiredSize(writer: WritableStreamDefaultWriter): number | null {\n const stream = writer._ownerWritableStream;\n const state = stream._state;\n\n if (state === 'errored' || state === 'erroring') {\n return null;\n }\n\n if (state === 'closed') {\n return 0;\n }\n\n return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);\n}\n\nfunction WritableStreamDefaultWriterRelease(writer: WritableStreamDefaultWriter) {\n const stream = writer._ownerWritableStream;\n assert(stream !== undefined);\n assert(stream._writer === writer);\n\n const releasedError = new TypeError(\n `Writer was released and can no longer be used to monitor the stream's closedness`);\n\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);\n\n // The state transitions to \"errored\" before the sink abort() method runs, but the writer.closed promise is not\n // rejected until afterwards. This means that simply testing state will not work.\n WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);\n\n stream._writer = undefined;\n writer._ownerWritableStream = undefined!;\n}\n\nfunction WritableStreamDefaultWriterWrite(writer: WritableStreamDefaultWriter, chunk: W): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n const controller = stream._writableStreamController;\n\n const chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);\n\n if (stream !== writer._ownerWritableStream) {\n return promiseRejectedWith(defaultWriterLockException('write to'));\n }\n\n const state = stream._state;\n if (state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n if (WritableStreamCloseQueuedOrInFlight(stream) || state === 'closed') {\n return promiseRejectedWith(new TypeError('The stream is closing or closed and cannot be written to'));\n }\n if (state === 'erroring') {\n return promiseRejectedWith(stream._storedError);\n }\n\n assert(state === 'writable');\n\n const promise = WritableStreamAddWriteRequest(stream);\n\n WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);\n\n return promise;\n}\n\nconst closeSentinel: unique symbol = {} as any;\n\ntype QueueRecord = W | typeof closeSentinel;\n\n/**\n * Allows control of a {@link WritableStream | writable stream}'s state and internal queue.\n *\n * @public\n */\nexport class WritableStreamDefaultController {\n /** @internal */\n _controlledWritableStream!: WritableStream;\n /** @internal */\n _queue!: SimpleQueue>>;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _abortReason: any;\n /** @internal */\n _abortController: AbortController | undefined;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _strategySizeAlgorithm!: QueuingStrategySizeCallback;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _writeAlgorithm!: (chunk: W) => Promise;\n /** @internal */\n _closeAlgorithm!: () => Promise;\n /** @internal */\n _abortAlgorithm!: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.\n *\n * @deprecated\n * This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.\n * Use {@link WritableStreamDefaultController.signal}'s `reason` instead.\n */\n get abortReason(): any {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('abortReason');\n }\n return this._abortReason;\n }\n\n /**\n * An `AbortSignal` that can be used to abort the pending write or close operation when the stream is aborted.\n */\n get signal(): AbortSignal {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('signal');\n }\n if (this._abortController === undefined) {\n // Older browsers or older Node versions may not support `AbortController` or `AbortSignal`.\n // We don't want to bundle and ship an `AbortController` polyfill together with our polyfill,\n // so instead we only implement support for `signal` if we find a global `AbortController` constructor.\n throw new TypeError('WritableStreamDefaultController.prototype.signal is not supported');\n }\n return this._abortController.signal;\n }\n\n /**\n * Closes the controlled writable stream, making all future interactions with it fail with the given error `e`.\n *\n * This method is rarely used, since usually it suffices to return a rejected promise from one of the underlying\n * sink's methods. However, it can be useful for suddenly shutting down a stream in response to an event outside the\n * normal lifecycle of interactions with the underlying sink.\n */\n error(e: any = undefined): void {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n const state = this._controlledWritableStream._state;\n if (state !== 'writable') {\n // The stream is closed, errored or will be soon. The sink can't do anything useful if it gets an error here, so\n // just treat it as a no-op.\n return;\n }\n\n WritableStreamDefaultControllerError(this, e);\n }\n\n /** @internal */\n [AbortSteps](reason: any): Promise {\n const result = this._abortAlgorithm(reason);\n WritableStreamDefaultControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [ErrorSteps]() {\n ResetQueue(this);\n }\n}\n\nObject.defineProperties(WritableStreamDefaultController.prototype, {\n abortReason: { enumerable: true },\n signal: { enumerable: true },\n error: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'WritableStreamDefaultController',\n configurable: true\n });\n}\n\n// Abstract operations implementing interface required by the WritableStream.\n\nfunction IsWritableStreamDefaultController(x: any): x is WritableStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledWritableStream')) {\n return false;\n }\n\n return x instanceof WritableStreamDefaultController;\n}\n\nfunction SetUpWritableStreamDefaultController(stream: WritableStream,\n controller: WritableStreamDefaultController,\n startAlgorithm: () => void | PromiseLike,\n writeAlgorithm: (chunk: W) => Promise,\n closeAlgorithm: () => Promise,\n abortAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n assert(IsWritableStream(stream));\n assert(stream._writableStreamController === undefined);\n\n controller._controlledWritableStream = stream;\n stream._writableStreamController = controller;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n controller._queue = undefined!;\n controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._abortReason = undefined;\n controller._abortController = createAbortController();\n controller._started = false;\n\n controller._strategySizeAlgorithm = sizeAlgorithm;\n controller._strategyHWM = highWaterMark;\n\n controller._writeAlgorithm = writeAlgorithm;\n controller._closeAlgorithm = closeAlgorithm;\n controller._abortAlgorithm = abortAlgorithm;\n\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n\n const startResult = startAlgorithm();\n const startPromise = promiseResolvedWith(startResult);\n uponPromise(\n startPromise,\n () => {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n controller._started = true;\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n return null;\n },\n r => {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n controller._started = true;\n WritableStreamDealWithRejection(stream, r);\n return null;\n }\n );\n}\n\nfunction SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream: WritableStream,\n underlyingSink: ValidatedUnderlyingSink,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n const controller = Object.create(WritableStreamDefaultController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let writeAlgorithm: (chunk: W) => Promise;\n let closeAlgorithm: () => Promise;\n let abortAlgorithm: (reason: any) => Promise;\n\n if (underlyingSink.start !== undefined) {\n startAlgorithm = () => underlyingSink.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingSink.write !== undefined) {\n writeAlgorithm = chunk => underlyingSink.write!(chunk, controller);\n } else {\n writeAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSink.close !== undefined) {\n closeAlgorithm = () => underlyingSink.close!();\n } else {\n closeAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSink.abort !== undefined) {\n abortAlgorithm = reason => underlyingSink.abort!(reason);\n } else {\n abortAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpWritableStreamDefaultController(\n stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm\n );\n}\n\n// ClearAlgorithms may be called twice. Erroring the same stream in multiple ways will often result in redundant calls.\nfunction WritableStreamDefaultControllerClearAlgorithms(controller: WritableStreamDefaultController) {\n controller._writeAlgorithm = undefined!;\n controller._closeAlgorithm = undefined!;\n controller._abortAlgorithm = undefined!;\n controller._strategySizeAlgorithm = undefined!;\n}\n\nfunction WritableStreamDefaultControllerClose(controller: WritableStreamDefaultController) {\n EnqueueValueWithSize(controller, closeSentinel, 0);\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\nfunction WritableStreamDefaultControllerGetChunkSize(controller: WritableStreamDefaultController,\n chunk: W): number {\n try {\n return controller._strategySizeAlgorithm(chunk);\n } catch (chunkSizeE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);\n return 1;\n }\n}\n\nfunction WritableStreamDefaultControllerGetDesiredSize(controller: WritableStreamDefaultController): number {\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nfunction WritableStreamDefaultControllerWrite(controller: WritableStreamDefaultController,\n chunk: W,\n chunkSize: number) {\n try {\n EnqueueValueWithSize(controller, chunk, chunkSize);\n } catch (enqueueE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);\n return;\n }\n\n const stream = controller._controlledWritableStream;\n if (!WritableStreamCloseQueuedOrInFlight(stream) && stream._state === 'writable') {\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\n// Abstract operations for the WritableStreamDefaultController.\n\nfunction WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller: WritableStreamDefaultController) {\n const stream = controller._controlledWritableStream;\n\n if (!controller._started) {\n return;\n }\n\n if (stream._inFlightWriteRequest !== undefined) {\n return;\n }\n\n const state = stream._state;\n assert(state !== 'closed' && state !== 'errored');\n if (state === 'erroring') {\n WritableStreamFinishErroring(stream);\n return;\n }\n\n if (controller._queue.length === 0) {\n return;\n }\n\n const value = PeekQueueValue(controller);\n if (value === closeSentinel) {\n WritableStreamDefaultControllerProcessClose(controller);\n } else {\n WritableStreamDefaultControllerProcessWrite(controller, value);\n }\n}\n\nfunction WritableStreamDefaultControllerErrorIfNeeded(controller: WritableStreamDefaultController, error: any) {\n if (controller._controlledWritableStream._state === 'writable') {\n WritableStreamDefaultControllerError(controller, error);\n }\n}\n\nfunction WritableStreamDefaultControllerProcessClose(controller: WritableStreamDefaultController) {\n const stream = controller._controlledWritableStream;\n\n WritableStreamMarkCloseRequestInFlight(stream);\n\n DequeueValue(controller);\n assert(controller._queue.length === 0);\n\n const sinkClosePromise = controller._closeAlgorithm();\n WritableStreamDefaultControllerClearAlgorithms(controller);\n uponPromise(\n sinkClosePromise,\n () => {\n WritableStreamFinishInFlightClose(stream);\n return null;\n },\n reason => {\n WritableStreamFinishInFlightCloseWithError(stream, reason);\n return null;\n }\n );\n}\n\nfunction WritableStreamDefaultControllerProcessWrite(controller: WritableStreamDefaultController, chunk: W) {\n const stream = controller._controlledWritableStream;\n\n WritableStreamMarkFirstWriteRequestInFlight(stream);\n\n const sinkWritePromise = controller._writeAlgorithm(chunk);\n uponPromise(\n sinkWritePromise,\n () => {\n WritableStreamFinishInFlightWrite(stream);\n\n const state = stream._state;\n assert(state === 'writable' || state === 'erroring');\n\n DequeueValue(controller);\n\n if (!WritableStreamCloseQueuedOrInFlight(stream) && state === 'writable') {\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n return null;\n },\n reason => {\n if (stream._state === 'writable') {\n WritableStreamDefaultControllerClearAlgorithms(controller);\n }\n WritableStreamFinishInFlightWriteWithError(stream, reason);\n return null;\n }\n );\n}\n\nfunction WritableStreamDefaultControllerGetBackpressure(controller: WritableStreamDefaultController): boolean {\n const desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);\n return desiredSize <= 0;\n}\n\n// A client of WritableStreamDefaultController may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultControllerError(controller: WritableStreamDefaultController, error: any) {\n const stream = controller._controlledWritableStream;\n\n assert(stream._state === 'writable');\n\n WritableStreamDefaultControllerClearAlgorithms(controller);\n WritableStreamStartErroring(stream, error);\n}\n\n// Helper functions for the WritableStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`);\n}\n\n// Helper functions for the WritableStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `WritableStreamDefaultController.prototype.${name} can only be used on a WritableStreamDefaultController`);\n}\n\n\n// Helper functions for the WritableStreamDefaultWriter.\n\nfunction defaultWriterBrandCheckException(name: string): TypeError {\n return new TypeError(\n `WritableStreamDefaultWriter.prototype.${name} can only be used on a WritableStreamDefaultWriter`);\n}\n\nfunction defaultWriterLockException(name: string): TypeError {\n return new TypeError('Cannot ' + name + ' a stream using a released writer');\n}\n\nfunction defaultWriterClosedPromiseInitialize(writer: WritableStreamDefaultWriter) {\n writer._closedPromise = newPromise((resolve, reject) => {\n writer._closedPromise_resolve = resolve;\n writer._closedPromise_reject = reject;\n writer._closedPromiseState = 'pending';\n });\n}\n\nfunction defaultWriterClosedPromiseInitializeAsRejected(writer: WritableStreamDefaultWriter, reason: any) {\n defaultWriterClosedPromiseInitialize(writer);\n defaultWriterClosedPromiseReject(writer, reason);\n}\n\nfunction defaultWriterClosedPromiseInitializeAsResolved(writer: WritableStreamDefaultWriter) {\n defaultWriterClosedPromiseInitialize(writer);\n defaultWriterClosedPromiseResolve(writer);\n}\n\nfunction defaultWriterClosedPromiseReject(writer: WritableStreamDefaultWriter, reason: any) {\n if (writer._closedPromise_reject === undefined) {\n return;\n }\n assert(writer._closedPromiseState === 'pending');\n\n setPromiseIsHandledToTrue(writer._closedPromise);\n writer._closedPromise_reject(reason);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'rejected';\n}\n\nfunction defaultWriterClosedPromiseResetToRejected(writer: WritableStreamDefaultWriter, reason: any) {\n assert(writer._closedPromise_resolve === undefined);\n assert(writer._closedPromise_reject === undefined);\n assert(writer._closedPromiseState !== 'pending');\n\n defaultWriterClosedPromiseInitializeAsRejected(writer, reason);\n}\n\nfunction defaultWriterClosedPromiseResolve(writer: WritableStreamDefaultWriter) {\n if (writer._closedPromise_resolve === undefined) {\n return;\n }\n assert(writer._closedPromiseState === 'pending');\n\n writer._closedPromise_resolve(undefined);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'resolved';\n}\n\nfunction defaultWriterReadyPromiseInitialize(writer: WritableStreamDefaultWriter) {\n writer._readyPromise = newPromise((resolve, reject) => {\n writer._readyPromise_resolve = resolve;\n writer._readyPromise_reject = reject;\n });\n writer._readyPromiseState = 'pending';\n}\n\nfunction defaultWriterReadyPromiseInitializeAsRejected(writer: WritableStreamDefaultWriter, reason: any) {\n defaultWriterReadyPromiseInitialize(writer);\n defaultWriterReadyPromiseReject(writer, reason);\n}\n\nfunction defaultWriterReadyPromiseInitializeAsResolved(writer: WritableStreamDefaultWriter) {\n defaultWriterReadyPromiseInitialize(writer);\n defaultWriterReadyPromiseResolve(writer);\n}\n\nfunction defaultWriterReadyPromiseReject(writer: WritableStreamDefaultWriter, reason: any) {\n if (writer._readyPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(writer._readyPromise);\n writer._readyPromise_reject(reason);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'rejected';\n}\n\nfunction defaultWriterReadyPromiseReset(writer: WritableStreamDefaultWriter) {\n assert(writer._readyPromise_resolve === undefined);\n assert(writer._readyPromise_reject === undefined);\n\n defaultWriterReadyPromiseInitialize(writer);\n}\n\nfunction defaultWriterReadyPromiseResetToRejected(writer: WritableStreamDefaultWriter, reason: any) {\n assert(writer._readyPromise_resolve === undefined);\n assert(writer._readyPromise_reject === undefined);\n\n defaultWriterReadyPromiseInitializeAsRejected(writer, reason);\n}\n\nfunction defaultWriterReadyPromiseResolve(writer: WritableStreamDefaultWriter) {\n if (writer._readyPromise_resolve === undefined) {\n return;\n }\n\n writer._readyPromise_resolve(undefined);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'fulfilled';\n}\n","/// \n\nfunction getGlobals(): typeof globalThis | undefined {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n } else if (typeof self !== 'undefined') {\n return self;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","/// \nimport { globals } from '../globals';\nimport { setFunctionName } from '../lib/helpers/miscellaneous';\n\ninterface DOMException extends Error {\n name: string;\n message: string;\n}\n\ntype DOMExceptionConstructor = new (message?: string, name?: string) => DOMException;\n\nfunction isDOMExceptionConstructor(ctor: unknown): ctor is DOMExceptionConstructor {\n if (!(typeof ctor === 'function' || typeof ctor === 'object')) {\n return false;\n }\n if ((ctor as DOMExceptionConstructor).name !== 'DOMException') {\n return false;\n }\n try {\n new (ctor as DOMExceptionConstructor)();\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Support:\n * - Web browsers\n * - Node 18 and higher (https://github.com/nodejs/node/commit/e4b1fb5e6422c1ff151234bb9de792d45dd88d87)\n */\nfunction getFromGlobal(): DOMExceptionConstructor | undefined {\n const ctor = globals?.DOMException;\n return isDOMExceptionConstructor(ctor) ? ctor : undefined;\n}\n\n/**\n * Support:\n * - All platforms\n */\nfunction createPolyfill(): DOMExceptionConstructor {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const ctor = function DOMException(this: DOMException, message?: string, name?: string) {\n this.message = message || '';\n this.name = name || 'Error';\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n } as any;\n setFunctionName(ctor, 'DOMException');\n ctor.prototype = Object.create(Error.prototype);\n Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });\n return ctor;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nconst DOMException: DOMExceptionConstructor = getFromGlobal() || createPolyfill();\n\nexport { DOMException };\n","import { IsReadableStream, IsReadableStreamLocked, ReadableStream, ReadableStreamCancel } from '../readable-stream';\nimport { AcquireReadableStreamDefaultReader, ReadableStreamDefaultReaderRead } from './default-reader';\nimport { ReadableStreamReaderGenericRelease } from './generic-reader';\nimport {\n AcquireWritableStreamDefaultWriter,\n IsWritableStream,\n IsWritableStreamLocked,\n WritableStream,\n WritableStreamAbort,\n WritableStreamCloseQueuedOrInFlight,\n WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite\n} from '../writable-stream';\nimport assert from '../../stub/assert';\nimport {\n newPromise,\n PerformPromiseThen,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n uponFulfillment,\n uponPromise,\n uponRejection\n} from '../helpers/webidl';\nimport { noop } from '../../utils';\nimport { type AbortSignal, isAbortSignal } from '../abort-signal';\nimport { DOMException } from '../../stub/dom-exception';\n\nexport function ReadableStreamPipeTo(source: ReadableStream,\n dest: WritableStream,\n preventClose: boolean,\n preventAbort: boolean,\n preventCancel: boolean,\n signal: AbortSignal | undefined): Promise {\n assert(IsReadableStream(source));\n assert(IsWritableStream(dest));\n assert(typeof preventClose === 'boolean');\n assert(typeof preventAbort === 'boolean');\n assert(typeof preventCancel === 'boolean');\n assert(signal === undefined || isAbortSignal(signal));\n assert(!IsReadableStreamLocked(source));\n assert(!IsWritableStreamLocked(dest));\n\n const reader = AcquireReadableStreamDefaultReader(source);\n const writer = AcquireWritableStreamDefaultWriter(dest);\n\n source._disturbed = true;\n\n let shuttingDown = false;\n\n // This is used to keep track of the spec's requirement that we wait for ongoing writes during shutdown.\n let currentWrite = promiseResolvedWith(undefined);\n\n return newPromise((resolve, reject) => {\n let abortAlgorithm: () => void;\n if (signal !== undefined) {\n abortAlgorithm = () => {\n const error = signal.reason !== undefined ? signal.reason : new DOMException('Aborted', 'AbortError');\n const actions: Array<() => Promise> = [];\n if (!preventAbort) {\n actions.push(() => {\n if (dest._state === 'writable') {\n return WritableStreamAbort(dest, error);\n }\n return promiseResolvedWith(undefined);\n });\n }\n if (!preventCancel) {\n actions.push(() => {\n if (source._state === 'readable') {\n return ReadableStreamCancel(source, error);\n }\n return promiseResolvedWith(undefined);\n });\n }\n shutdownWithAction(() => Promise.all(actions.map(action => action())), true, error);\n };\n\n if (signal.aborted) {\n abortAlgorithm();\n return;\n }\n\n signal.addEventListener('abort', abortAlgorithm);\n }\n\n // Using reader and writer, read all chunks from this and write them to dest\n // - Backpressure must be enforced\n // - Shutdown must stop all activity\n function pipeLoop() {\n return newPromise((resolveLoop, rejectLoop) => {\n function next(done: boolean) {\n if (done) {\n resolveLoop();\n } else {\n // Use `PerformPromiseThen` instead of `uponPromise` to avoid\n // adding unnecessary `.catch(rethrowAssertionErrorRejection)` handlers\n PerformPromiseThen(pipeStep(), next, rejectLoop);\n }\n }\n\n next(false);\n });\n }\n\n function pipeStep(): Promise {\n if (shuttingDown) {\n return promiseResolvedWith(true);\n }\n\n return PerformPromiseThen(writer._readyPromise, () => {\n return newPromise((resolveRead, rejectRead) => {\n ReadableStreamDefaultReaderRead(\n reader,\n {\n _chunkSteps: chunk => {\n currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, chunk), undefined, noop);\n resolveRead(false);\n },\n _closeSteps: () => resolveRead(true),\n _errorSteps: rejectRead\n }\n );\n });\n });\n }\n\n // Errors must be propagated forward\n isOrBecomesErrored(source, reader._closedPromise, storedError => {\n if (!preventAbort) {\n shutdownWithAction(() => WritableStreamAbort(dest, storedError), true, storedError);\n } else {\n shutdown(true, storedError);\n }\n return null;\n });\n\n // Errors must be propagated backward\n isOrBecomesErrored(dest, writer._closedPromise, storedError => {\n if (!preventCancel) {\n shutdownWithAction(() => ReadableStreamCancel(source, storedError), true, storedError);\n } else {\n shutdown(true, storedError);\n }\n return null;\n });\n\n // Closing must be propagated forward\n isOrBecomesClosed(source, reader._closedPromise, () => {\n if (!preventClose) {\n shutdownWithAction(() => WritableStreamDefaultWriterCloseWithErrorPropagation(writer));\n } else {\n shutdown();\n }\n return null;\n });\n\n // Closing must be propagated backward\n if (WritableStreamCloseQueuedOrInFlight(dest) || dest._state === 'closed') {\n const destClosed = new TypeError('the destination writable stream closed before all data could be piped to it');\n\n if (!preventCancel) {\n shutdownWithAction(() => ReadableStreamCancel(source, destClosed), true, destClosed);\n } else {\n shutdown(true, destClosed);\n }\n }\n\n setPromiseIsHandledToTrue(pipeLoop());\n\n function waitForWritesToFinish(): Promise {\n // Another write may have started while we were waiting on this currentWrite, so we have to be sure to wait\n // for that too.\n const oldCurrentWrite = currentWrite;\n return PerformPromiseThen(\n currentWrite,\n () => oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined\n );\n }\n\n function isOrBecomesErrored(stream: ReadableStream | WritableStream,\n promise: Promise,\n action: (reason: any) => null) {\n if (stream._state === 'errored') {\n action(stream._storedError);\n } else {\n uponRejection(promise, action);\n }\n }\n\n function isOrBecomesClosed(stream: ReadableStream | WritableStream, promise: Promise, action: () => null) {\n if (stream._state === 'closed') {\n action();\n } else {\n uponFulfillment(promise, action);\n }\n }\n\n function shutdownWithAction(action: () => Promise, originalIsError?: boolean, originalError?: any) {\n if (shuttingDown) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && !WritableStreamCloseQueuedOrInFlight(dest)) {\n uponFulfillment(waitForWritesToFinish(), doTheRest);\n } else {\n doTheRest();\n }\n\n function doTheRest(): null {\n uponPromise(\n action(),\n () => finalize(originalIsError, originalError),\n newError => finalize(true, newError)\n );\n return null;\n }\n }\n\n function shutdown(isError?: boolean, error?: any) {\n if (shuttingDown) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && !WritableStreamCloseQueuedOrInFlight(dest)) {\n uponFulfillment(waitForWritesToFinish(), () => finalize(isError, error));\n } else {\n finalize(isError, error);\n }\n }\n\n function finalize(isError?: boolean, error?: any): null {\n WritableStreamDefaultWriterRelease(writer);\n ReadableStreamReaderGenericRelease(reader);\n\n if (signal !== undefined) {\n signal.removeEventListener('abort', abortAlgorithm);\n }\n if (isError) {\n reject(error);\n } else {\n resolve(undefined);\n }\n\n return null;\n }\n });\n}\n","import type { QueuingStrategySizeCallback } from '../queuing-strategy';\nimport assert from '../../stub/assert';\nimport { DequeueValue, EnqueueValueWithSize, type QueuePair, ResetQueue } from '../abstract-ops/queue-with-sizes';\nimport {\n ReadableStreamAddReadRequest,\n ReadableStreamFulfillReadRequest,\n ReadableStreamGetNumReadRequests,\n type ReadRequest\n} from './default-reader';\nimport { SimpleQueue } from '../simple-queue';\nimport { IsReadableStreamLocked, ReadableStream, ReadableStreamClose, ReadableStreamError } from '../readable-stream';\nimport type { ValidatedUnderlyingSource } from './underlying-source';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { CancelSteps, PullSteps, ReleaseSteps } from '../abstract-ops/internal-methods';\nimport { promiseResolvedWith, uponPromise } from '../helpers/webidl';\n\n/**\n * Allows control of a {@link ReadableStream | readable stream}'s state and internal queue.\n *\n * @public\n */\nexport class ReadableStreamDefaultController {\n /** @internal */\n _controlledReadableStream!: ReadableStream;\n /** @internal */\n _queue!: SimpleQueue>;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _closeRequested!: boolean;\n /** @internal */\n _pullAgain!: boolean;\n /** @internal */\n _pulling !: boolean;\n /** @internal */\n _strategySizeAlgorithm!: QueuingStrategySizeCallback;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _pullAlgorithm!: () => Promise;\n /** @internal */\n _cancelAlgorithm!: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is\n * over-full. An underlying source ought to use this information to determine when and how to apply backpressure.\n */\n get desiredSize(): number | null {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n return ReadableStreamDefaultControllerGetDesiredSize(this);\n }\n\n /**\n * Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from\n * the stream, but once those are read, the stream will become closed.\n */\n close(): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('close');\n }\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {\n throw new TypeError('The stream is not in a state that permits close');\n }\n\n ReadableStreamDefaultControllerClose(this);\n }\n\n /**\n * Enqueues the given chunk `chunk` in the controlled readable stream.\n */\n enqueue(chunk: R): void;\n enqueue(chunk: R = undefined!): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {\n throw new TypeError('The stream is not in a state that permits enqueue');\n }\n\n return ReadableStreamDefaultControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.\n */\n error(e: any = undefined): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n\n ReadableStreamDefaultControllerError(this, e);\n }\n\n /** @internal */\n [CancelSteps](reason: any): Promise {\n ResetQueue(this);\n const result = this._cancelAlgorithm(reason);\n ReadableStreamDefaultControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [PullSteps](readRequest: ReadRequest): void {\n const stream = this._controlledReadableStream;\n\n if (this._queue.length > 0) {\n const chunk = DequeueValue(this);\n\n if (this._closeRequested && this._queue.length === 0) {\n ReadableStreamDefaultControllerClearAlgorithms(this);\n ReadableStreamClose(stream);\n } else {\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n }\n\n readRequest._chunkSteps(chunk);\n } else {\n ReadableStreamAddReadRequest(stream, readRequest);\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n }\n }\n\n /** @internal */\n [ReleaseSteps](): void {\n // Do nothing.\n }\n}\n\nObject.defineProperties(ReadableStreamDefaultController.prototype, {\n close: { enumerable: true },\n enqueue: { enumerable: true },\n error: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(ReadableStreamDefaultController.prototype.close, 'close');\nsetFunctionName(ReadableStreamDefaultController.prototype.enqueue, 'enqueue');\nsetFunctionName(ReadableStreamDefaultController.prototype.error, 'error');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamDefaultController',\n configurable: true\n });\n}\n\n// Abstract operations for the ReadableStreamDefaultController.\n\nfunction IsReadableStreamDefaultController(x: any): x is ReadableStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableStream')) {\n return false;\n }\n\n return x instanceof ReadableStreamDefaultController;\n}\n\nfunction ReadableStreamDefaultControllerCallPullIfNeeded(controller: ReadableStreamDefaultController): void {\n const shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);\n if (!shouldPull) {\n return;\n }\n\n if (controller._pulling) {\n controller._pullAgain = true;\n return;\n }\n\n assert(!controller._pullAgain);\n\n controller._pulling = true;\n\n const pullPromise = controller._pullAlgorithm();\n uponPromise(\n pullPromise,\n () => {\n controller._pulling = false;\n\n if (controller._pullAgain) {\n controller._pullAgain = false;\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n }\n\n return null;\n },\n e => {\n ReadableStreamDefaultControllerError(controller, e);\n return null;\n }\n );\n}\n\nfunction ReadableStreamDefaultControllerShouldCallPull(controller: ReadableStreamDefaultController): boolean {\n const stream = controller._controlledReadableStream;\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return false;\n }\n\n if (!controller._started) {\n return false;\n }\n\n if (IsReadableStreamLocked(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n const desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);\n assert(desiredSize !== null);\n if (desiredSize! > 0) {\n return true;\n }\n\n return false;\n}\n\nfunction ReadableStreamDefaultControllerClearAlgorithms(controller: ReadableStreamDefaultController) {\n controller._pullAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n controller._strategySizeAlgorithm = undefined!;\n}\n\n// A client of ReadableStreamDefaultController may use these functions directly to bypass state check.\n\nexport function ReadableStreamDefaultControllerClose(controller: ReadableStreamDefaultController) {\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return;\n }\n\n const stream = controller._controlledReadableStream;\n\n controller._closeRequested = true;\n\n if (controller._queue.length === 0) {\n ReadableStreamDefaultControllerClearAlgorithms(controller);\n ReadableStreamClose(stream);\n }\n}\n\nexport function ReadableStreamDefaultControllerEnqueue(\n controller: ReadableStreamDefaultController,\n chunk: R\n): void {\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return;\n }\n\n const stream = controller._controlledReadableStream;\n\n if (IsReadableStreamLocked(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n ReadableStreamFulfillReadRequest(stream, chunk, false);\n } else {\n let chunkSize;\n try {\n chunkSize = controller._strategySizeAlgorithm(chunk);\n } catch (chunkSizeE) {\n ReadableStreamDefaultControllerError(controller, chunkSizeE);\n throw chunkSizeE;\n }\n\n try {\n EnqueueValueWithSize(controller, chunk, chunkSize);\n } catch (enqueueE) {\n ReadableStreamDefaultControllerError(controller, enqueueE);\n throw enqueueE;\n }\n }\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n}\n\nexport function ReadableStreamDefaultControllerError(controller: ReadableStreamDefaultController, e: any) {\n const stream = controller._controlledReadableStream;\n\n if (stream._state !== 'readable') {\n return;\n }\n\n ResetQueue(controller);\n\n ReadableStreamDefaultControllerClearAlgorithms(controller);\n ReadableStreamError(stream, e);\n}\n\nexport function ReadableStreamDefaultControllerGetDesiredSize(\n controller: ReadableStreamDefaultController\n): number | null {\n const state = controller._controlledReadableStream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\n// This is used in the implementation of TransformStream.\nexport function ReadableStreamDefaultControllerHasBackpressure(\n controller: ReadableStreamDefaultController\n): boolean {\n if (ReadableStreamDefaultControllerShouldCallPull(controller)) {\n return false;\n }\n\n return true;\n}\n\nexport function ReadableStreamDefaultControllerCanCloseOrEnqueue(\n controller: ReadableStreamDefaultController\n): boolean {\n const state = controller._controlledReadableStream._state;\n\n if (!controller._closeRequested && state === 'readable') {\n return true;\n }\n\n return false;\n}\n\nexport function SetUpReadableStreamDefaultController(stream: ReadableStream,\n controller: ReadableStreamDefaultController,\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n assert(stream._readableStreamController === undefined);\n\n controller._controlledReadableStream = stream;\n\n controller._queue = undefined!;\n controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._started = false;\n controller._closeRequested = false;\n controller._pullAgain = false;\n controller._pulling = false;\n\n controller._strategySizeAlgorithm = sizeAlgorithm;\n controller._strategyHWM = highWaterMark;\n\n controller._pullAlgorithm = pullAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n stream._readableStreamController = controller;\n\n const startResult = startAlgorithm();\n uponPromise(\n promiseResolvedWith(startResult),\n () => {\n controller._started = true;\n\n assert(!controller._pulling);\n assert(!controller._pullAgain);\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n return null;\n },\n r => {\n ReadableStreamDefaultControllerError(controller, r);\n return null;\n }\n );\n}\n\nexport function SetUpReadableStreamDefaultControllerFromUnderlyingSource(\n stream: ReadableStream,\n underlyingSource: ValidatedUnderlyingSource,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback\n) {\n const controller: ReadableStreamDefaultController = Object.create(ReadableStreamDefaultController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let pullAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (underlyingSource.start !== undefined) {\n startAlgorithm = () => underlyingSource.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingSource.pull !== undefined) {\n pullAlgorithm = () => underlyingSource.pull!(controller);\n } else {\n pullAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSource.cancel !== undefined) {\n cancelAlgorithm = reason => underlyingSource.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpReadableStreamDefaultController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm\n );\n}\n\n// Helper functions for the ReadableStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamDefaultController.prototype.${name} can only be used on a ReadableStreamDefaultController`);\n}\n","import {\n CreateReadableByteStream,\n CreateReadableStream,\n type DefaultReadableStream,\n IsReadableStream,\n type ReadableByteStream,\n ReadableStream,\n ReadableStreamCancel,\n type ReadableStreamReader\n} from '../readable-stream';\nimport { ReadableStreamReaderGenericRelease } from './generic-reader';\nimport {\n AcquireReadableStreamDefaultReader,\n IsReadableStreamDefaultReader,\n ReadableStreamDefaultReaderRead,\n type ReadRequest\n} from './default-reader';\nimport {\n AcquireReadableStreamBYOBReader,\n IsReadableStreamBYOBReader,\n ReadableStreamBYOBReaderRead,\n type ReadIntoRequest\n} from './byob-reader';\nimport assert from '../../stub/assert';\nimport { newPromise, promiseResolvedWith, queueMicrotask, uponRejection } from '../helpers/webidl';\nimport {\n ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError\n} from './default-controller';\nimport {\n IsReadableByteStreamController,\n ReadableByteStreamControllerClose,\n ReadableByteStreamControllerEnqueue,\n ReadableByteStreamControllerError,\n ReadableByteStreamControllerGetBYOBRequest,\n ReadableByteStreamControllerRespond,\n ReadableByteStreamControllerRespondWithNewView\n} from './byte-stream-controller';\nimport { CreateArrayFromList } from '../abstract-ops/ecmascript';\nimport { CloneAsUint8Array } from '../abstract-ops/miscellaneous';\nimport type { NonShared } from '../helpers/array-buffer-view';\n\nexport function ReadableStreamTee(stream: ReadableStream,\n cloneForBranch2: boolean): [ReadableStream, ReadableStream] {\n assert(IsReadableStream(stream));\n assert(typeof cloneForBranch2 === 'boolean');\n if (IsReadableByteStreamController(stream._readableStreamController)) {\n return ReadableByteStreamTee(stream as unknown as ReadableByteStream) as\n unknown as [ReadableStream, ReadableStream];\n }\n return ReadableStreamDefaultTee(stream, cloneForBranch2);\n}\n\nexport function ReadableStreamDefaultTee(\n stream: ReadableStream,\n cloneForBranch2: boolean\n): [DefaultReadableStream, DefaultReadableStream] {\n assert(IsReadableStream(stream));\n assert(typeof cloneForBranch2 === 'boolean');\n\n const reader = AcquireReadableStreamDefaultReader(stream);\n\n let reading = false;\n let readAgain = false;\n let canceled1 = false;\n let canceled2 = false;\n let reason1: any;\n let reason2: any;\n let branch1: DefaultReadableStream;\n let branch2: DefaultReadableStream;\n\n let resolveCancelPromise: (value: undefined | Promise) => void;\n const cancelPromise = newPromise(resolve => {\n resolveCancelPromise = resolve;\n });\n\n function pullAlgorithm(): Promise {\n if (reading) {\n readAgain = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgain = false;\n const chunk1 = chunk;\n const chunk2 = chunk;\n\n // There is no way to access the cloning code right now in the reference implementation.\n // If we add one then we'll need an implementation for serializable objects.\n // if (!canceled2 && cloneForBranch2) {\n // chunk2 = StructuredDeserialize(StructuredSerialize(chunk2));\n // }\n\n if (!canceled1) {\n ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, chunk1);\n }\n if (!canceled2) {\n ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, chunk2);\n }\n\n reading = false;\n if (readAgain) {\n pullAlgorithm();\n }\n });\n },\n _closeSteps: () => {\n reading = false;\n if (!canceled1) {\n ReadableStreamDefaultControllerClose(branch1._readableStreamController);\n }\n if (!canceled2) {\n ReadableStreamDefaultControllerClose(branch2._readableStreamController);\n }\n\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n\n return promiseResolvedWith(undefined);\n }\n\n function cancel1Algorithm(reason: any): Promise {\n canceled1 = true;\n reason1 = reason;\n if (canceled2) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function cancel2Algorithm(reason: any): Promise {\n canceled2 = true;\n reason2 = reason;\n if (canceled1) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function startAlgorithm() {\n // do nothing\n }\n\n branch1 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel1Algorithm);\n branch2 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel2Algorithm);\n\n uponRejection(reader._closedPromise, (r: any) => {\n ReadableStreamDefaultControllerError(branch1._readableStreamController, r);\n ReadableStreamDefaultControllerError(branch2._readableStreamController, r);\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n return null;\n });\n\n return [branch1, branch2];\n}\n\nexport function ReadableByteStreamTee(stream: ReadableByteStream): [ReadableByteStream, ReadableByteStream] {\n assert(IsReadableStream(stream));\n assert(IsReadableByteStreamController(stream._readableStreamController));\n\n let reader: ReadableStreamReader> = AcquireReadableStreamDefaultReader(stream);\n let reading = false;\n let readAgainForBranch1 = false;\n let readAgainForBranch2 = false;\n let canceled1 = false;\n let canceled2 = false;\n let reason1: any;\n let reason2: any;\n let branch1: ReadableByteStream;\n let branch2: ReadableByteStream;\n\n let resolveCancelPromise: (value: undefined | Promise) => void;\n const cancelPromise = newPromise(resolve => {\n resolveCancelPromise = resolve;\n });\n\n function forwardReaderError(thisReader: ReadableStreamReader>) {\n uponRejection(thisReader._closedPromise, r => {\n if (thisReader !== reader) {\n return null;\n }\n ReadableByteStreamControllerError(branch1._readableStreamController, r);\n ReadableByteStreamControllerError(branch2._readableStreamController, r);\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n return null;\n });\n }\n\n function pullWithDefaultReader() {\n if (IsReadableStreamBYOBReader(reader)) {\n assert(reader._readIntoRequests.length === 0);\n ReadableStreamReaderGenericRelease(reader);\n\n reader = AcquireReadableStreamDefaultReader(stream);\n forwardReaderError(reader);\n }\n\n const readRequest: ReadRequest> = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgainForBranch1 = false;\n readAgainForBranch2 = false;\n\n const chunk1 = chunk;\n let chunk2 = chunk;\n if (!canceled1 && !canceled2) {\n try {\n chunk2 = CloneAsUint8Array(chunk);\n } catch (cloneE) {\n ReadableByteStreamControllerError(branch1._readableStreamController, cloneE);\n ReadableByteStreamControllerError(branch2._readableStreamController, cloneE);\n resolveCancelPromise(ReadableStreamCancel(stream, cloneE));\n return;\n }\n }\n\n if (!canceled1) {\n ReadableByteStreamControllerEnqueue(branch1._readableStreamController, chunk1);\n }\n if (!canceled2) {\n ReadableByteStreamControllerEnqueue(branch2._readableStreamController, chunk2);\n }\n\n reading = false;\n if (readAgainForBranch1) {\n pull1Algorithm();\n } else if (readAgainForBranch2) {\n pull2Algorithm();\n }\n });\n },\n _closeSteps: () => {\n reading = false;\n if (!canceled1) {\n ReadableByteStreamControllerClose(branch1._readableStreamController);\n }\n if (!canceled2) {\n ReadableByteStreamControllerClose(branch2._readableStreamController);\n }\n if (branch1._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(branch1._readableStreamController, 0);\n }\n if (branch2._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(branch2._readableStreamController, 0);\n }\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n }\n\n function pullWithBYOBReader(view: NonShared, forBranch2: boolean) {\n if (IsReadableStreamDefaultReader>(reader)) {\n assert(reader._readRequests.length === 0);\n ReadableStreamReaderGenericRelease(reader);\n\n reader = AcquireReadableStreamBYOBReader(stream);\n forwardReaderError(reader);\n }\n\n const byobBranch = forBranch2 ? branch2 : branch1;\n const otherBranch = forBranch2 ? branch1 : branch2;\n\n const readIntoRequest: ReadIntoRequest> = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgainForBranch1 = false;\n readAgainForBranch2 = false;\n\n const byobCanceled = forBranch2 ? canceled2 : canceled1;\n const otherCanceled = forBranch2 ? canceled1 : canceled2;\n\n if (!otherCanceled) {\n let clonedChunk;\n try {\n clonedChunk = CloneAsUint8Array(chunk);\n } catch (cloneE) {\n ReadableByteStreamControllerError(byobBranch._readableStreamController, cloneE);\n ReadableByteStreamControllerError(otherBranch._readableStreamController, cloneE);\n resolveCancelPromise(ReadableStreamCancel(stream, cloneE));\n return;\n }\n if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n ReadableByteStreamControllerEnqueue(otherBranch._readableStreamController, clonedChunk);\n } else if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n\n reading = false;\n if (readAgainForBranch1) {\n pull1Algorithm();\n } else if (readAgainForBranch2) {\n pull2Algorithm();\n }\n });\n },\n _closeSteps: chunk => {\n reading = false;\n\n const byobCanceled = forBranch2 ? canceled2 : canceled1;\n const otherCanceled = forBranch2 ? canceled1 : canceled2;\n\n if (!byobCanceled) {\n ReadableByteStreamControllerClose(byobBranch._readableStreamController);\n }\n if (!otherCanceled) {\n ReadableByteStreamControllerClose(otherBranch._readableStreamController);\n }\n\n if (chunk !== undefined) {\n assert(chunk.byteLength === 0);\n\n if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n if (!otherCanceled && otherBranch._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(otherBranch._readableStreamController, 0);\n }\n }\n\n if (!byobCanceled || !otherCanceled) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamBYOBReaderRead(reader, view, 1, readIntoRequest);\n }\n\n function pull1Algorithm(): Promise {\n if (reading) {\n readAgainForBranch1 = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch1._readableStreamController);\n if (byobRequest === null) {\n pullWithDefaultReader();\n } else {\n pullWithBYOBReader(byobRequest._view!, false);\n }\n\n return promiseResolvedWith(undefined);\n }\n\n function pull2Algorithm(): Promise {\n if (reading) {\n readAgainForBranch2 = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch2._readableStreamController);\n if (byobRequest === null) {\n pullWithDefaultReader();\n } else {\n pullWithBYOBReader(byobRequest._view!, true);\n }\n\n return promiseResolvedWith(undefined);\n }\n\n function cancel1Algorithm(reason: any): Promise {\n canceled1 = true;\n reason1 = reason;\n if (canceled2) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function cancel2Algorithm(reason: any): Promise {\n canceled2 = true;\n reason2 = reason;\n if (canceled1) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function startAlgorithm(): void {\n return;\n }\n\n branch1 = CreateReadableByteStream(startAlgorithm, pull1Algorithm, cancel1Algorithm);\n branch2 = CreateReadableByteStream(startAlgorithm, pull2Algorithm, cancel2Algorithm);\n\n forwardReaderError(reader);\n\n return [branch1, branch2];\n}\n","import { typeIsObject } from '../helpers/miscellaneous';\nimport type { ReadableStreamDefaultReadResult } from './default-reader';\n\n/**\n * A common interface for a `ReadadableStream` implementation.\n *\n * @public\n */\nexport interface ReadableStreamLike {\n readonly locked: boolean;\n\n getReader(): ReadableStreamDefaultReaderLike;\n}\n\n/**\n * A common interface for a `ReadableStreamDefaultReader` implementation.\n *\n * @public\n */\nexport interface ReadableStreamDefaultReaderLike {\n readonly closed: Promise;\n\n cancel(reason?: any): Promise;\n\n read(): Promise>;\n\n releaseLock(): void;\n}\n\nexport function isReadableStreamLike(stream: unknown): stream is ReadableStreamLike {\n return typeIsObject(stream) && typeof (stream as ReadableStreamLike).getReader !== 'undefined';\n}\n","import { CreateReadableStream, type DefaultReadableStream } from '../readable-stream';\nimport {\n isReadableStreamLike,\n type ReadableStreamDefaultReaderLike,\n type ReadableStreamLike\n} from './readable-stream-like';\nimport { ReadableStreamDefaultControllerClose, ReadableStreamDefaultControllerEnqueue } from './default-controller';\nimport { GetIterator, GetMethod, IteratorComplete, IteratorNext, IteratorValue } from '../abstract-ops/ecmascript';\nimport { promiseRejectedWith, promiseResolvedWith, reflectCall, transformPromiseWith } from '../helpers/webidl';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport { noop } from '../../utils';\n\nexport function ReadableStreamFrom(\n source: Iterable | AsyncIterable | ReadableStreamLike\n): DefaultReadableStream {\n if (isReadableStreamLike(source)) {\n return ReadableStreamFromDefaultReader(source.getReader());\n }\n return ReadableStreamFromIterable(source);\n}\n\nexport function ReadableStreamFromIterable(asyncIterable: Iterable | AsyncIterable): DefaultReadableStream {\n let stream: DefaultReadableStream;\n const iteratorRecord = GetIterator(asyncIterable, 'async');\n\n const startAlgorithm = noop;\n\n function pullAlgorithm(): Promise {\n let nextResult;\n try {\n nextResult = IteratorNext(iteratorRecord);\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const nextPromise = promiseResolvedWith(nextResult);\n return transformPromiseWith(nextPromise, iterResult => {\n if (!typeIsObject(iterResult)) {\n throw new TypeError('The promise returned by the iterator.next() method must fulfill with an object');\n }\n const done = IteratorComplete(iterResult);\n if (done) {\n ReadableStreamDefaultControllerClose(stream._readableStreamController);\n } else {\n const value = IteratorValue(iterResult);\n ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);\n }\n });\n }\n\n function cancelAlgorithm(reason: any): Promise {\n const iterator = iteratorRecord.iterator;\n let returnMethod: (typeof iterator)['return'] | undefined;\n try {\n returnMethod = GetMethod(iterator, 'return');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n if (returnMethod === undefined) {\n return promiseResolvedWith(undefined);\n }\n let returnResult: IteratorResult | Promise>;\n try {\n returnResult = reflectCall(returnMethod, iterator, [reason]);\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const returnPromise = promiseResolvedWith(returnResult);\n return transformPromiseWith(returnPromise, iterResult => {\n if (!typeIsObject(iterResult)) {\n throw new TypeError('The promise returned by the iterator.return() method must fulfill with an object');\n }\n return undefined;\n });\n }\n\n stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);\n return stream;\n}\n\nexport function ReadableStreamFromDefaultReader(\n reader: ReadableStreamDefaultReaderLike\n): DefaultReadableStream {\n let stream: DefaultReadableStream;\n\n const startAlgorithm = noop;\n\n function pullAlgorithm(): Promise {\n let readPromise;\n try {\n readPromise = reader.read();\n } catch (e) {\n return promiseRejectedWith(e);\n }\n return transformPromiseWith(readPromise, readResult => {\n if (!typeIsObject(readResult)) {\n throw new TypeError('The promise returned by the reader.read() method must fulfill with an object');\n }\n if (readResult.done) {\n ReadableStreamDefaultControllerClose(stream._readableStreamController);\n } else {\n const value = readResult.value;\n ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);\n }\n });\n }\n\n function cancelAlgorithm(reason: any): Promise {\n try {\n return promiseResolvedWith(reader.cancel(reason));\n } catch (e) {\n return promiseRejectedWith(e);\n }\n }\n\n stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);\n return stream;\n}\n","import { assertDictionary, assertFunction, convertUnsignedLongLongWithEnforceRange } from './basic';\nimport type {\n ReadableStreamController,\n UnderlyingByteSource,\n UnderlyingDefaultOrByteSource,\n UnderlyingDefaultOrByteSourcePullCallback,\n UnderlyingDefaultOrByteSourceStartCallback,\n UnderlyingSource,\n UnderlyingSourceCancelCallback,\n ValidatedUnderlyingDefaultOrByteSource\n} from '../readable-stream/underlying-source';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\n\nexport function convertUnderlyingDefaultOrByteSource(\n source: UnderlyingSource | UnderlyingByteSource | null,\n context: string\n): ValidatedUnderlyingDefaultOrByteSource {\n assertDictionary(source, context);\n const original = source as (UnderlyingDefaultOrByteSource | null);\n const autoAllocateChunkSize = original?.autoAllocateChunkSize;\n const cancel = original?.cancel;\n const pull = original?.pull;\n const start = original?.start;\n const type = original?.type;\n return {\n autoAllocateChunkSize: autoAllocateChunkSize === undefined ?\n undefined :\n convertUnsignedLongLongWithEnforceRange(\n autoAllocateChunkSize,\n `${context} has member 'autoAllocateChunkSize' that`\n ),\n cancel: cancel === undefined ?\n undefined :\n convertUnderlyingSourceCancelCallback(cancel, original!, `${context} has member 'cancel' that`),\n pull: pull === undefined ?\n undefined :\n convertUnderlyingSourcePullCallback(pull, original!, `${context} has member 'pull' that`),\n start: start === undefined ?\n undefined :\n convertUnderlyingSourceStartCallback(start, original!, `${context} has member 'start' that`),\n type: type === undefined ? undefined : convertReadableStreamType(type, `${context} has member 'type' that`)\n };\n}\n\nfunction convertUnderlyingSourceCancelCallback(\n fn: UnderlyingSourceCancelCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n\nfunction convertUnderlyingSourcePullCallback(\n fn: UnderlyingDefaultOrByteSourcePullCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): (controller: ReadableStreamController) => Promise {\n assertFunction(fn, context);\n return (controller: ReadableStreamController) => promiseCall(fn, original, [controller]);\n}\n\nfunction convertUnderlyingSourceStartCallback(\n fn: UnderlyingDefaultOrByteSourceStartCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): UnderlyingDefaultOrByteSourceStartCallback {\n assertFunction(fn, context);\n return (controller: ReadableStreamController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertReadableStreamType(type: string, context: string): 'bytes' {\n type = `${type}`;\n if (type !== 'bytes') {\n throw new TypeError(`${context} '${type}' is not a valid enumeration value for ReadableStreamType`);\n }\n return type;\n}\n","import { assertDictionary } from './basic';\nimport type {\n ReadableStreamIteratorOptions,\n ValidatedReadableStreamIteratorOptions\n} from '../readable-stream/iterator-options';\n\nexport function convertIteratorOptions(options: ReadableStreamIteratorOptions | null | undefined,\n context: string): ValidatedReadableStreamIteratorOptions {\n assertDictionary(options, context);\n const preventCancel = options?.preventCancel;\n return { preventCancel: Boolean(preventCancel) };\n}\n","import { assertDictionary } from './basic';\nimport type { StreamPipeOptions, ValidatedStreamPipeOptions } from '../readable-stream/pipe-options';\nimport { type AbortSignal, isAbortSignal } from '../abort-signal';\n\nexport function convertPipeOptions(options: StreamPipeOptions | null | undefined,\n context: string): ValidatedStreamPipeOptions {\n assertDictionary(options, context);\n const preventAbort = options?.preventAbort;\n const preventCancel = options?.preventCancel;\n const preventClose = options?.preventClose;\n const signal = options?.signal;\n if (signal !== undefined) {\n assertAbortSignal(signal, `${context} has member 'signal' that`);\n }\n return {\n preventAbort: Boolean(preventAbort),\n preventCancel: Boolean(preventCancel),\n preventClose: Boolean(preventClose),\n signal\n };\n}\n\nfunction assertAbortSignal(signal: unknown, context: string): asserts signal is AbortSignal {\n if (!isAbortSignal(signal)) {\n throw new TypeError(`${context} is not an AbortSignal.`);\n }\n}\n","import { assertDictionary, assertRequiredField } from './basic';\nimport { ReadableStream } from '../readable-stream';\nimport { WritableStream } from '../writable-stream';\nimport { assertReadableStream } from './readable-stream';\nimport { assertWritableStream } from './writable-stream';\n\nexport function convertReadableWritablePair(\n pair: { readable: RS; writable: WS } | null | undefined,\n context: string\n): { readable: RS; writable: WS } {\n assertDictionary(pair, context);\n\n const readable = pair?.readable;\n assertRequiredField(readable, 'readable', 'ReadableWritablePair');\n assertReadableStream(readable, `${context} has member 'readable' that`);\n\n const writable = pair?.writable;\n assertRequiredField(writable, 'writable', 'ReadableWritablePair');\n assertWritableStream(writable, `${context} has member 'writable' that`);\n\n return { readable, writable };\n}\n","import assert from '../stub/assert';\nimport {\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n transformPromiseWith\n} from './helpers/webidl';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { AcquireReadableStreamAsyncIterator, type ReadableStreamAsyncIterator } from './readable-stream/async-iterator';\nimport { defaultReaderClosedPromiseReject, defaultReaderClosedPromiseResolve } from './readable-stream/generic-reader';\nimport {\n AcquireReadableStreamDefaultReader,\n IsReadableStreamDefaultReader,\n ReadableStreamDefaultReader,\n ReadableStreamDefaultReaderErrorReadRequests,\n type ReadableStreamDefaultReadResult\n} from './readable-stream/default-reader';\nimport {\n AcquireReadableStreamBYOBReader,\n IsReadableStreamBYOBReader,\n ReadableStreamBYOBReader,\n ReadableStreamBYOBReaderErrorReadIntoRequests,\n type ReadableStreamBYOBReadResult\n} from './readable-stream/byob-reader';\nimport { ReadableStreamPipeTo } from './readable-stream/pipe';\nimport { ReadableStreamTee } from './readable-stream/tee';\nimport { ReadableStreamFrom } from './readable-stream/from';\nimport { IsWritableStream, IsWritableStreamLocked, WritableStream } from './writable-stream';\nimport { SimpleQueue } from './simple-queue';\nimport {\n ReadableByteStreamController,\n ReadableStreamBYOBRequest,\n SetUpReadableByteStreamController,\n SetUpReadableByteStreamControllerFromUnderlyingSource\n} from './readable-stream/byte-stream-controller';\nimport {\n ReadableStreamDefaultController,\n SetUpReadableStreamDefaultController,\n SetUpReadableStreamDefaultControllerFromUnderlyingSource\n} from './readable-stream/default-controller';\nimport type {\n UnderlyingByteSource,\n UnderlyingByteSourcePullCallback,\n UnderlyingByteSourceStartCallback,\n UnderlyingSource,\n UnderlyingSourceCancelCallback,\n UnderlyingSourcePullCallback,\n UnderlyingSourceStartCallback\n} from './readable-stream/underlying-source';\nimport { noop } from '../utils';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { CreateArrayFromList, SymbolAsyncIterator } from './abstract-ops/ecmascript';\nimport { CancelSteps } from './abstract-ops/internal-methods';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { assertObject, assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport { convertUnderlyingDefaultOrByteSource } from './validators/underlying-source';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ReadableStreamGetReaderOptions\n} from './readable-stream/reader-options';\nimport { convertReaderOptions } from './validators/reader-options';\nimport type { StreamPipeOptions, ValidatedStreamPipeOptions } from './readable-stream/pipe-options';\nimport type { ReadableStreamIteratorOptions } from './readable-stream/iterator-options';\nimport { convertIteratorOptions } from './validators/iterator-options';\nimport { convertPipeOptions } from './validators/pipe-options';\nimport type { ReadableWritablePair } from './readable-stream/readable-writable-pair';\nimport { convertReadableWritablePair } from './validators/readable-writable-pair';\nimport type { ReadableStreamDefaultReaderLike, ReadableStreamLike } from './readable-stream/readable-stream-like';\nimport type { NonShared } from './helpers/array-buffer-view';\n\nexport type DefaultReadableStream = ReadableStream & {\n _readableStreamController: ReadableStreamDefaultController\n};\n\nexport type ReadableByteStream = ReadableStream> & {\n _readableStreamController: ReadableByteStreamController\n};\n\ntype ReadableStreamState = 'readable' | 'closed' | 'errored';\n\n/**\n * A readable stream represents a source of data, from which you can read.\n *\n * @public\n */\nexport class ReadableStream implements AsyncIterable {\n /** @internal */\n _state!: ReadableStreamState;\n /** @internal */\n _reader: ReadableStreamReader | undefined;\n /** @internal */\n _storedError: any;\n /** @internal */\n _disturbed!: boolean;\n /** @internal */\n _readableStreamController!: ReadableStreamDefaultController | ReadableByteStreamController;\n\n constructor(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number; size?: undefined });\n constructor(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy);\n constructor(rawUnderlyingSource: UnderlyingSource | UnderlyingByteSource | null | undefined = {},\n rawStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawUnderlyingSource === undefined) {\n rawUnderlyingSource = null;\n } else {\n assertObject(rawUnderlyingSource, 'First parameter');\n }\n\n const strategy = convertQueuingStrategy(rawStrategy, 'Second parameter');\n const underlyingSource = convertUnderlyingDefaultOrByteSource(rawUnderlyingSource, 'First parameter');\n\n InitializeReadableStream(this);\n\n if (underlyingSource.type === 'bytes') {\n if (strategy.size !== undefined) {\n throw new RangeError('The strategy for a byte stream cannot have a size function');\n }\n const highWaterMark = ExtractHighWaterMark(strategy, 0);\n SetUpReadableByteStreamControllerFromUnderlyingSource(\n this as unknown as ReadableByteStream,\n underlyingSource,\n highWaterMark\n );\n } else {\n assert(underlyingSource.type === undefined);\n const sizeAlgorithm = ExtractSizeAlgorithm(strategy);\n const highWaterMark = ExtractHighWaterMark(strategy, 1);\n SetUpReadableStreamDefaultControllerFromUnderlyingSource(\n this,\n underlyingSource,\n highWaterMark,\n sizeAlgorithm\n );\n }\n }\n\n /**\n * Whether or not the readable stream is locked to a {@link ReadableStreamDefaultReader | reader}.\n */\n get locked(): boolean {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('locked');\n }\n\n return IsReadableStreamLocked(this);\n }\n\n /**\n * Cancels the stream, signaling a loss of interest in the stream by a consumer.\n *\n * The supplied `reason` argument will be given to the underlying source's {@link UnderlyingSource.cancel | cancel()}\n * method, which might or might not use it.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('cancel'));\n }\n\n if (IsReadableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot cancel a stream that already has a reader'));\n }\n\n return ReadableStreamCancel(this, reason);\n }\n\n /**\n * Creates a {@link ReadableStreamBYOBReader} and locks the stream to the new reader.\n *\n * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams,\n * i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading.\n * The returned BYOB reader provides the ability to directly read individual chunks from the stream via its\n * {@link ReadableStreamBYOBReader.read | read()} method, into developer-supplied buffers, allowing more precise\n * control over allocation.\n */\n getReader({ mode }: { mode: 'byob' }): ReadableStreamBYOBReader;\n /**\n * Creates a {@link ReadableStreamDefaultReader} and locks the stream to the new reader.\n * While the stream is locked, no other reader can be acquired until this one is released.\n *\n * This functionality is especially useful for creating abstractions that desire the ability to consume a stream\n * in its entirety. By getting a reader for the stream, you can ensure nobody else can interleave reads with yours\n * or cancel the stream, which would interfere with your abstraction.\n */\n getReader(): ReadableStreamDefaultReader;\n getReader(\n rawOptions: ReadableStreamGetReaderOptions | null | undefined = undefined\n ): ReadableStreamDefaultReader | ReadableStreamBYOBReader {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('getReader');\n }\n\n const options = convertReaderOptions(rawOptions, 'First parameter');\n\n if (options.mode === undefined) {\n return AcquireReadableStreamDefaultReader(this);\n }\n\n assert(options.mode === 'byob');\n return AcquireReadableStreamBYOBReader(this as unknown as ReadableByteStream);\n }\n\n /**\n * Provides a convenient, chainable way of piping this readable stream through a transform stream\n * (or any other `{ writable, readable }` pair). It simply {@link ReadableStream.pipeTo | pipes} the stream\n * into the writable side of the supplied pair, and returns the readable side for further use.\n *\n * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n */\n pipeThrough(\n transform: { readable: RS; writable: WritableStream },\n options?: StreamPipeOptions\n ): RS;\n pipeThrough(\n rawTransform: { readable: RS; writable: WritableStream } | null | undefined,\n rawOptions: StreamPipeOptions | null | undefined = {}\n ): RS {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('pipeThrough');\n }\n assertRequiredArgument(rawTransform, 1, 'pipeThrough');\n\n const transform = convertReadableWritablePair(rawTransform, 'First parameter');\n const options = convertPipeOptions(rawOptions, 'Second parameter');\n\n if (IsReadableStreamLocked(this)) {\n throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream');\n }\n if (IsWritableStreamLocked(transform.writable)) {\n throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream');\n }\n\n const promise = ReadableStreamPipeTo(\n this, transform.writable, options.preventClose, options.preventAbort, options.preventCancel, options.signal\n );\n\n setPromiseIsHandledToTrue(promise);\n\n return transform.readable;\n }\n\n /**\n * Pipes this readable stream to a given writable stream. The way in which the piping process behaves under\n * various error conditions can be customized with a number of passed options. It returns a promise that fulfills\n * when the piping process completes successfully, or rejects if any errors were encountered.\n *\n * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n */\n pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise;\n pipeTo(destination: WritableStream | null | undefined,\n rawOptions: StreamPipeOptions | null | undefined = {}): Promise {\n if (!IsReadableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('pipeTo'));\n }\n\n if (destination === undefined) {\n return promiseRejectedWith(`Parameter 1 is required in 'pipeTo'.`);\n }\n if (!IsWritableStream(destination)) {\n return promiseRejectedWith(\n new TypeError(`ReadableStream.prototype.pipeTo's first argument must be a WritableStream`)\n );\n }\n\n let options: ValidatedStreamPipeOptions;\n try {\n options = convertPipeOptions(rawOptions, 'Second parameter');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n\n if (IsReadableStreamLocked(this)) {\n return promiseRejectedWith(\n new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream')\n );\n }\n if (IsWritableStreamLocked(destination)) {\n return promiseRejectedWith(\n new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream')\n );\n }\n\n return ReadableStreamPipeTo(\n this, destination, options.preventClose, options.preventAbort, options.preventCancel, options.signal\n );\n }\n\n /**\n * Tees this readable stream, returning a two-element array containing the two resulting branches as\n * new {@link ReadableStream} instances.\n *\n * Teeing a stream will lock it, preventing any other consumer from acquiring a reader.\n * To cancel the stream, cancel both of the resulting branches; a composite cancellation reason will then be\n * propagated to the stream's underlying source.\n *\n * Note that the chunks seen in each branch will be the same object. If the chunks are not immutable,\n * this could allow interference between the two branches.\n */\n tee(): [ReadableStream, ReadableStream] {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('tee');\n }\n\n const branches = ReadableStreamTee(this, false);\n return CreateArrayFromList(branches);\n }\n\n /**\n * Asynchronously iterates over the chunks in the stream's internal queue.\n *\n * Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader.\n * The lock will be released if the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method\n * is called, e.g. by breaking out of the loop.\n *\n * By default, calling the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method will also\n * cancel the stream. To prevent this, use the stream's {@link ReadableStream.values | values()} method, passing\n * `true` for the `preventCancel` option.\n */\n values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator;\n values(rawOptions: ReadableStreamIteratorOptions | null | undefined = undefined): ReadableStreamAsyncIterator {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('values');\n }\n\n const options = convertIteratorOptions(rawOptions, 'First parameter');\n return AcquireReadableStreamAsyncIterator(this, options.preventCancel);\n }\n\n /**\n * {@inheritDoc ReadableStream.values}\n */\n [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator;\n\n [SymbolAsyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator {\n // Stub implementation, overridden below\n return this.values(options);\n }\n\n /**\n * Creates a new ReadableStream wrapping the provided iterable or async iterable.\n *\n * This can be used to adapt various kinds of objects into a readable stream,\n * such as an array, an async generator, or a Node.js readable stream.\n */\n static from(asyncIterable: Iterable | AsyncIterable | ReadableStreamLike): ReadableStream {\n return ReadableStreamFrom(asyncIterable);\n }\n}\n\nObject.defineProperties(ReadableStream, {\n from: { enumerable: true }\n});\nObject.defineProperties(ReadableStream.prototype, {\n cancel: { enumerable: true },\n getReader: { enumerable: true },\n pipeThrough: { enumerable: true },\n pipeTo: { enumerable: true },\n tee: { enumerable: true },\n values: { enumerable: true },\n locked: { enumerable: true }\n});\nsetFunctionName(ReadableStream.from, 'from');\nsetFunctionName(ReadableStream.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStream.prototype.getReader, 'getReader');\nsetFunctionName(ReadableStream.prototype.pipeThrough, 'pipeThrough');\nsetFunctionName(ReadableStream.prototype.pipeTo, 'pipeTo');\nsetFunctionName(ReadableStream.prototype.tee, 'tee');\nsetFunctionName(ReadableStream.prototype.values, 'values');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStream.prototype, Symbol.toStringTag, {\n value: 'ReadableStream',\n configurable: true\n });\n}\nObject.defineProperty(ReadableStream.prototype, SymbolAsyncIterator, {\n value: ReadableStream.prototype.values,\n writable: true,\n configurable: true\n});\n\nexport type {\n ReadableStreamAsyncIterator,\n ReadableStreamDefaultReadResult,\n ReadableStreamBYOBReadResult,\n ReadableStreamBYOBReaderReadOptions,\n UnderlyingByteSource,\n UnderlyingSource,\n UnderlyingSourceStartCallback,\n UnderlyingSourcePullCallback,\n UnderlyingSourceCancelCallback,\n UnderlyingByteSourceStartCallback,\n UnderlyingByteSourcePullCallback,\n StreamPipeOptions,\n ReadableWritablePair,\n ReadableStreamIteratorOptions,\n ReadableStreamLike,\n ReadableStreamDefaultReaderLike\n};\n\n// Abstract operations for the ReadableStream.\n\n// Throws if and only if startAlgorithm throws.\nexport function CreateReadableStream(\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark = 1,\n sizeAlgorithm: QueuingStrategySizeCallback = () => 1\n): DefaultReadableStream {\n assert(IsNonNegativeNumber(highWaterMark));\n\n const stream: DefaultReadableStream = Object.create(ReadableStream.prototype);\n InitializeReadableStream(stream);\n\n const controller: ReadableStreamDefaultController = Object.create(ReadableStreamDefaultController.prototype);\n SetUpReadableStreamDefaultController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm\n );\n\n return stream;\n}\n\n// Throws if and only if startAlgorithm throws.\nexport function CreateReadableByteStream(\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise\n): ReadableByteStream {\n const stream: ReadableByteStream = Object.create(ReadableStream.prototype);\n InitializeReadableStream(stream);\n\n const controller: ReadableByteStreamController = Object.create(ReadableByteStreamController.prototype);\n SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, 0, undefined);\n\n return stream;\n}\n\nfunction InitializeReadableStream(stream: ReadableStream) {\n stream._state = 'readable';\n stream._reader = undefined;\n stream._storedError = undefined;\n stream._disturbed = false;\n}\n\nexport function IsReadableStream(x: unknown): x is ReadableStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {\n return false;\n }\n\n return x instanceof ReadableStream;\n}\n\nexport function IsReadableStreamDisturbed(stream: ReadableStream): boolean {\n assert(IsReadableStream(stream));\n\n return stream._disturbed;\n}\n\nexport function IsReadableStreamLocked(stream: ReadableStream): boolean {\n assert(IsReadableStream(stream));\n\n if (stream._reader === undefined) {\n return false;\n }\n\n return true;\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamCancel(stream: ReadableStream, reason: any): Promise {\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n return promiseResolvedWith(undefined);\n }\n if (stream._state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n\n ReadableStreamClose(stream);\n\n const reader = stream._reader;\n if (reader !== undefined && IsReadableStreamBYOBReader(reader)) {\n const readIntoRequests = reader._readIntoRequests;\n reader._readIntoRequests = new SimpleQueue();\n readIntoRequests.forEach(readIntoRequest => {\n readIntoRequest._closeSteps(undefined);\n });\n }\n\n const sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);\n return transformPromiseWith(sourceCancelPromise, noop);\n}\n\nexport function ReadableStreamClose(stream: ReadableStream): void {\n assert(stream._state === 'readable');\n\n stream._state = 'closed';\n\n const reader = stream._reader;\n\n if (reader === undefined) {\n return;\n }\n\n defaultReaderClosedPromiseResolve(reader);\n\n if (IsReadableStreamDefaultReader(reader)) {\n const readRequests = reader._readRequests;\n reader._readRequests = new SimpleQueue();\n readRequests.forEach(readRequest => {\n readRequest._closeSteps();\n });\n }\n}\n\nexport function ReadableStreamError(stream: ReadableStream, e: any): void {\n assert(IsReadableStream(stream));\n assert(stream._state === 'readable');\n\n stream._state = 'errored';\n stream._storedError = e;\n\n const reader = stream._reader;\n\n if (reader === undefined) {\n return;\n }\n\n defaultReaderClosedPromiseReject(reader, e);\n\n if (IsReadableStreamDefaultReader(reader)) {\n ReadableStreamDefaultReaderErrorReadRequests(reader, e);\n } else {\n assert(IsReadableStreamBYOBReader(reader));\n ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);\n }\n}\n\n// Readers\n\nexport type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader;\n\nexport {\n ReadableStreamDefaultReader,\n ReadableStreamBYOBReader\n};\n\n// Controllers\n\nexport {\n ReadableStreamDefaultController,\n ReadableStreamBYOBRequest,\n ReadableByteStreamController\n};\n\n// Helper functions for the ReadableStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(`ReadableStream.prototype.${name} can only be used on a ReadableStream`);\n}\n","import type { QueuingStrategyInit } from '../queuing-strategy';\nimport { assertDictionary, assertRequiredField, convertUnrestrictedDouble } from './basic';\n\nexport function convertQueuingStrategyInit(init: QueuingStrategyInit | null | undefined,\n context: string): QueuingStrategyInit {\n assertDictionary(init, context);\n const highWaterMark = init?.highWaterMark;\n assertRequiredField(highWaterMark, 'highWaterMark', 'QueuingStrategyInit');\n return {\n highWaterMark: convertUnrestrictedDouble(highWaterMark)\n };\n}\n","import type { QueuingStrategy, QueuingStrategyInit } from './queuing-strategy';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategyInit } from './validators/queuing-strategy-init';\n\n// The size function must not have a prototype property nor be a constructor\nconst byteLengthSizeFunction = (chunk: ArrayBufferView): number => {\n return chunk.byteLength;\n};\nsetFunctionName(byteLengthSizeFunction, 'size');\n\n/**\n * A queuing strategy that counts the number of bytes in each chunk.\n *\n * @public\n */\nexport default class ByteLengthQueuingStrategy implements QueuingStrategy {\n /** @internal */\n readonly _byteLengthQueuingStrategyHighWaterMark: number;\n\n constructor(options: QueuingStrategyInit) {\n assertRequiredArgument(options, 1, 'ByteLengthQueuingStrategy');\n options = convertQueuingStrategyInit(options, 'First parameter');\n this._byteLengthQueuingStrategyHighWaterMark = options.highWaterMark;\n }\n\n /**\n * Returns the high water mark provided to the constructor.\n */\n get highWaterMark(): number {\n if (!IsByteLengthQueuingStrategy(this)) {\n throw byteLengthBrandCheckException('highWaterMark');\n }\n return this._byteLengthQueuingStrategyHighWaterMark;\n }\n\n /**\n * Measures the size of `chunk` by returning the value of its `byteLength` property.\n */\n get size(): (chunk: ArrayBufferView) => number {\n if (!IsByteLengthQueuingStrategy(this)) {\n throw byteLengthBrandCheckException('size');\n }\n return byteLengthSizeFunction;\n }\n}\n\nObject.defineProperties(ByteLengthQueuingStrategy.prototype, {\n highWaterMark: { enumerable: true },\n size: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ByteLengthQueuingStrategy.prototype, Symbol.toStringTag, {\n value: 'ByteLengthQueuingStrategy',\n configurable: true\n });\n}\n\n// Helper functions for the ByteLengthQueuingStrategy.\n\nfunction byteLengthBrandCheckException(name: string): TypeError {\n return new TypeError(`ByteLengthQueuingStrategy.prototype.${name} can only be used on a ByteLengthQueuingStrategy`);\n}\n\nexport function IsByteLengthQueuingStrategy(x: any): x is ByteLengthQueuingStrategy {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_byteLengthQueuingStrategyHighWaterMark')) {\n return false;\n }\n\n return x instanceof ByteLengthQueuingStrategy;\n}\n","import type { QueuingStrategy, QueuingStrategyInit } from './queuing-strategy';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategyInit } from './validators/queuing-strategy-init';\n\n// The size function must not have a prototype property nor be a constructor\nconst countSizeFunction = (): 1 => {\n return 1;\n};\nsetFunctionName(countSizeFunction, 'size');\n\n/**\n * A queuing strategy that counts the number of chunks.\n *\n * @public\n */\nexport default class CountQueuingStrategy implements QueuingStrategy {\n /** @internal */\n readonly _countQueuingStrategyHighWaterMark!: number;\n\n constructor(options: QueuingStrategyInit) {\n assertRequiredArgument(options, 1, 'CountQueuingStrategy');\n options = convertQueuingStrategyInit(options, 'First parameter');\n this._countQueuingStrategyHighWaterMark = options.highWaterMark;\n }\n\n /**\n * Returns the high water mark provided to the constructor.\n */\n get highWaterMark(): number {\n if (!IsCountQueuingStrategy(this)) {\n throw countBrandCheckException('highWaterMark');\n }\n return this._countQueuingStrategyHighWaterMark;\n }\n\n /**\n * Measures the size of `chunk` by always returning 1.\n * This ensures that the total queue size is a count of the number of chunks in the queue.\n */\n get size(): (chunk: any) => 1 {\n if (!IsCountQueuingStrategy(this)) {\n throw countBrandCheckException('size');\n }\n return countSizeFunction;\n }\n}\n\nObject.defineProperties(CountQueuingStrategy.prototype, {\n highWaterMark: { enumerable: true },\n size: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(CountQueuingStrategy.prototype, Symbol.toStringTag, {\n value: 'CountQueuingStrategy',\n configurable: true\n });\n}\n\n// Helper functions for the CountQueuingStrategy.\n\nfunction countBrandCheckException(name: string): TypeError {\n return new TypeError(`CountQueuingStrategy.prototype.${name} can only be used on a CountQueuingStrategy`);\n}\n\nexport function IsCountQueuingStrategy(x: any): x is CountQueuingStrategy {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_countQueuingStrategyHighWaterMark')) {\n return false;\n }\n\n return x instanceof CountQueuingStrategy;\n}\n","import { assertDictionary, assertFunction } from './basic';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\nimport type {\n Transformer,\n TransformerCancelCallback,\n TransformerFlushCallback,\n TransformerStartCallback,\n TransformerTransformCallback,\n ValidatedTransformer\n} from '../transform-stream/transformer';\nimport { TransformStreamDefaultController } from '../transform-stream';\n\nexport function convertTransformer(original: Transformer | null,\n context: string): ValidatedTransformer {\n assertDictionary(original, context);\n const cancel = original?.cancel;\n const flush = original?.flush;\n const readableType = original?.readableType;\n const start = original?.start;\n const transform = original?.transform;\n const writableType = original?.writableType;\n return {\n cancel: cancel === undefined ?\n undefined :\n convertTransformerCancelCallback(cancel, original!, `${context} has member 'cancel' that`),\n flush: flush === undefined ?\n undefined :\n convertTransformerFlushCallback(flush, original!, `${context} has member 'flush' that`),\n readableType,\n start: start === undefined ?\n undefined :\n convertTransformerStartCallback(start, original!, `${context} has member 'start' that`),\n transform: transform === undefined ?\n undefined :\n convertTransformerTransformCallback(transform, original!, `${context} has member 'transform' that`),\n writableType\n };\n}\n\nfunction convertTransformerFlushCallback(\n fn: TransformerFlushCallback,\n original: Transformer,\n context: string\n): (controller: TransformStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (controller: TransformStreamDefaultController) => promiseCall(fn, original, [controller]);\n}\n\nfunction convertTransformerStartCallback(\n fn: TransformerStartCallback,\n original: Transformer,\n context: string\n): TransformerStartCallback {\n assertFunction(fn, context);\n return (controller: TransformStreamDefaultController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertTransformerTransformCallback(\n fn: TransformerTransformCallback,\n original: Transformer,\n context: string\n): (chunk: I, controller: TransformStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (chunk: I, controller: TransformStreamDefaultController) => promiseCall(fn, original, [chunk, controller]);\n}\n\nfunction convertTransformerCancelCallback(\n fn: TransformerCancelCallback,\n original: Transformer,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n","import assert from '../stub/assert';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n transformPromiseWith,\n uponPromise\n} from './helpers/webidl';\nimport { CreateReadableStream, type DefaultReadableStream, ReadableStream } from './readable-stream';\nimport {\n ReadableStreamDefaultControllerCanCloseOrEnqueue,\n ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError,\n ReadableStreamDefaultControllerGetDesiredSize,\n ReadableStreamDefaultControllerHasBackpressure\n} from './readable-stream/default-controller';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { CreateWritableStream, WritableStream, WritableStreamDefaultControllerErrorIfNeeded } from './writable-stream';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport type {\n Transformer,\n TransformerCancelCallback,\n TransformerFlushCallback,\n TransformerStartCallback,\n TransformerTransformCallback,\n ValidatedTransformer\n} from './transform-stream/transformer';\nimport { convertTransformer } from './validators/transformer';\n\n// Class TransformStream\n\n/**\n * A transform stream consists of a pair of streams: a {@link WritableStream | writable stream},\n * known as its writable side, and a {@link ReadableStream | readable stream}, known as its readable side.\n * In a manner specific to the transform stream in question, writes to the writable side result in new data being\n * made available for reading from the readable side.\n *\n * @public\n */\nexport class TransformStream {\n /** @internal */\n _writable!: WritableStream;\n /** @internal */\n _readable!: DefaultReadableStream;\n /** @internal */\n _backpressure!: boolean;\n /** @internal */\n _backpressureChangePromise!: Promise;\n /** @internal */\n _backpressureChangePromise_resolve!: () => void;\n /** @internal */\n _transformStreamController!: TransformStreamDefaultController;\n\n constructor(\n transformer?: Transformer,\n writableStrategy?: QueuingStrategy,\n readableStrategy?: QueuingStrategy\n );\n constructor(rawTransformer: Transformer | null | undefined = {},\n rawWritableStrategy: QueuingStrategy | null | undefined = {},\n rawReadableStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawTransformer === undefined) {\n rawTransformer = null;\n }\n\n const writableStrategy = convertQueuingStrategy(rawWritableStrategy, 'Second parameter');\n const readableStrategy = convertQueuingStrategy(rawReadableStrategy, 'Third parameter');\n\n const transformer = convertTransformer(rawTransformer, 'First parameter');\n if (transformer.readableType !== undefined) {\n throw new RangeError('Invalid readableType specified');\n }\n if (transformer.writableType !== undefined) {\n throw new RangeError('Invalid writableType specified');\n }\n\n const readableHighWaterMark = ExtractHighWaterMark(readableStrategy, 0);\n const readableSizeAlgorithm = ExtractSizeAlgorithm(readableStrategy);\n const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);\n const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);\n\n let startPromise_resolve!: (value: void | PromiseLike) => void;\n const startPromise = newPromise(resolve => {\n startPromise_resolve = resolve;\n });\n\n InitializeTransformStream(\n this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm\n );\n SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);\n\n if (transformer.start !== undefined) {\n startPromise_resolve(transformer.start(this._transformStreamController));\n } else {\n startPromise_resolve(undefined);\n }\n }\n\n /**\n * The readable side of the transform stream.\n */\n get readable(): ReadableStream {\n if (!IsTransformStream(this)) {\n throw streamBrandCheckException('readable');\n }\n\n return this._readable;\n }\n\n /**\n * The writable side of the transform stream.\n */\n get writable(): WritableStream {\n if (!IsTransformStream(this)) {\n throw streamBrandCheckException('writable');\n }\n\n return this._writable;\n }\n}\n\nObject.defineProperties(TransformStream.prototype, {\n readable: { enumerable: true },\n writable: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(TransformStream.prototype, Symbol.toStringTag, {\n value: 'TransformStream',\n configurable: true\n });\n}\n\nexport type {\n Transformer,\n TransformerCancelCallback,\n TransformerStartCallback,\n TransformerFlushCallback,\n TransformerTransformCallback\n};\n\n// Transform Stream Abstract Operations\n\nexport function CreateTransformStream(startAlgorithm: () => void | PromiseLike,\n transformAlgorithm: (chunk: I) => Promise,\n flushAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n writableHighWaterMark = 1,\n writableSizeAlgorithm: QueuingStrategySizeCallback = () => 1,\n readableHighWaterMark = 0,\n readableSizeAlgorithm: QueuingStrategySizeCallback = () => 1) {\n assert(IsNonNegativeNumber(writableHighWaterMark));\n assert(IsNonNegativeNumber(readableHighWaterMark));\n\n const stream: TransformStream = Object.create(TransformStream.prototype);\n\n let startPromise_resolve!: (value: void | PromiseLike) => void;\n const startPromise = newPromise(resolve => {\n startPromise_resolve = resolve;\n });\n\n InitializeTransformStream(stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark,\n readableSizeAlgorithm);\n\n const controller: TransformStreamDefaultController = Object.create(TransformStreamDefaultController.prototype);\n\n SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);\n\n const startResult = startAlgorithm();\n startPromise_resolve(startResult);\n return stream;\n}\n\nfunction InitializeTransformStream(stream: TransformStream,\n startPromise: Promise,\n writableHighWaterMark: number,\n writableSizeAlgorithm: QueuingStrategySizeCallback,\n readableHighWaterMark: number,\n readableSizeAlgorithm: QueuingStrategySizeCallback) {\n function startAlgorithm(): Promise {\n return startPromise;\n }\n\n function writeAlgorithm(chunk: I): Promise {\n return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk);\n }\n\n function abortAlgorithm(reason: any): Promise {\n return TransformStreamDefaultSinkAbortAlgorithm(stream, reason);\n }\n\n function closeAlgorithm(): Promise {\n return TransformStreamDefaultSinkCloseAlgorithm(stream);\n }\n\n stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm,\n writableHighWaterMark, writableSizeAlgorithm);\n\n function pullAlgorithm(): Promise {\n return TransformStreamDefaultSourcePullAlgorithm(stream);\n }\n\n function cancelAlgorithm(reason: any): Promise {\n return TransformStreamDefaultSourceCancelAlgorithm(stream, reason);\n }\n\n stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark,\n readableSizeAlgorithm);\n\n // The [[backpressure]] slot is set to undefined so that it can be initialised by TransformStreamSetBackpressure.\n stream._backpressure = undefined!;\n stream._backpressureChangePromise = undefined!;\n stream._backpressureChangePromise_resolve = undefined!;\n TransformStreamSetBackpressure(stream, true);\n\n stream._transformStreamController = undefined!;\n}\n\nfunction IsTransformStream(x: unknown): x is TransformStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {\n return false;\n }\n\n return x instanceof TransformStream;\n}\n\n// This is a no-op if both sides are already errored.\nfunction TransformStreamError(stream: TransformStream, e: any) {\n ReadableStreamDefaultControllerError(stream._readable._readableStreamController, e);\n TransformStreamErrorWritableAndUnblockWrite(stream, e);\n}\n\nfunction TransformStreamErrorWritableAndUnblockWrite(stream: TransformStream, e: any) {\n TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);\n WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e);\n TransformStreamUnblockWrite(stream);\n}\n\nfunction TransformStreamUnblockWrite(stream: TransformStream) {\n if (stream._backpressure) {\n // Pretend that pull() was called to permit any pending write() calls to complete. TransformStreamSetBackpressure()\n // cannot be called from enqueue() or pull() once the ReadableStream is errored, so this will will be the final time\n // _backpressure is set.\n TransformStreamSetBackpressure(stream, false);\n }\n}\n\nfunction TransformStreamSetBackpressure(stream: TransformStream, backpressure: boolean) {\n // Passes also when called during construction.\n assert(stream._backpressure !== backpressure);\n\n if (stream._backpressureChangePromise !== undefined) {\n stream._backpressureChangePromise_resolve();\n }\n\n stream._backpressureChangePromise = newPromise(resolve => {\n stream._backpressureChangePromise_resolve = resolve;\n });\n\n stream._backpressure = backpressure;\n}\n\n// Class TransformStreamDefaultController\n\n/**\n * Allows control of the {@link ReadableStream} and {@link WritableStream} of the associated {@link TransformStream}.\n *\n * @public\n */\nexport class TransformStreamDefaultController {\n /** @internal */\n _controlledTransformStream: TransformStream;\n /** @internal */\n _finishPromise: Promise | undefined;\n /** @internal */\n _finishPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _finishPromise_reject?: (reason: any) => void;\n /** @internal */\n _transformAlgorithm: (chunk: any) => Promise;\n /** @internal */\n _flushAlgorithm: () => Promise;\n /** @internal */\n _cancelAlgorithm: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the desired size to fill the readable side’s internal queue. It can be negative, if the queue is over-full.\n */\n get desiredSize(): number | null {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n const readableController = this._controlledTransformStream._readable._readableStreamController;\n return ReadableStreamDefaultControllerGetDesiredSize(readableController);\n }\n\n /**\n * Enqueues the given chunk `chunk` in the readable side of the controlled transform stream.\n */\n enqueue(chunk: O): void;\n enqueue(chunk: O = undefined!): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n TransformStreamDefaultControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors both the readable side and the writable side of the controlled transform stream, making all future\n * interactions with it fail with the given error `e`. Any chunks queued for transformation will be discarded.\n */\n error(reason: any = undefined): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n\n TransformStreamDefaultControllerError(this, reason);\n }\n\n /**\n * Closes the readable side and errors the writable side of the controlled transform stream. This is useful when the\n * transformer only needs to consume a portion of the chunks written to the writable side.\n */\n terminate(): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('terminate');\n }\n\n TransformStreamDefaultControllerTerminate(this);\n }\n}\n\nObject.defineProperties(TransformStreamDefaultController.prototype, {\n enqueue: { enumerable: true },\n error: { enumerable: true },\n terminate: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(TransformStreamDefaultController.prototype.enqueue, 'enqueue');\nsetFunctionName(TransformStreamDefaultController.prototype.error, 'error');\nsetFunctionName(TransformStreamDefaultController.prototype.terminate, 'terminate');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(TransformStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'TransformStreamDefaultController',\n configurable: true\n });\n}\n\n// Transform Stream Default Controller Abstract Operations\n\nfunction IsTransformStreamDefaultController(x: any): x is TransformStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {\n return false;\n }\n\n return x instanceof TransformStreamDefaultController;\n}\n\nfunction SetUpTransformStreamDefaultController(stream: TransformStream,\n controller: TransformStreamDefaultController,\n transformAlgorithm: (chunk: I) => Promise,\n flushAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise) {\n assert(IsTransformStream(stream));\n assert(stream._transformStreamController === undefined);\n\n controller._controlledTransformStream = stream;\n stream._transformStreamController = controller;\n\n controller._transformAlgorithm = transformAlgorithm;\n controller._flushAlgorithm = flushAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n controller._finishPromise = undefined;\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\nfunction SetUpTransformStreamDefaultControllerFromTransformer(stream: TransformStream,\n transformer: ValidatedTransformer) {\n const controller: TransformStreamDefaultController = Object.create(TransformStreamDefaultController.prototype);\n\n let transformAlgorithm: (chunk: I) => Promise;\n let flushAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (transformer.transform !== undefined) {\n transformAlgorithm = chunk => transformer.transform!(chunk, controller);\n } else {\n transformAlgorithm = chunk => {\n try {\n TransformStreamDefaultControllerEnqueue(controller, chunk as unknown as O);\n return promiseResolvedWith(undefined);\n } catch (transformResultE) {\n return promiseRejectedWith(transformResultE);\n }\n };\n }\n\n if (transformer.flush !== undefined) {\n flushAlgorithm = () => transformer.flush!(controller);\n } else {\n flushAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n if (transformer.cancel !== undefined) {\n cancelAlgorithm = reason => transformer.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);\n}\n\nfunction TransformStreamDefaultControllerClearAlgorithms(controller: TransformStreamDefaultController) {\n controller._transformAlgorithm = undefined!;\n controller._flushAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n}\n\nfunction TransformStreamDefaultControllerEnqueue(controller: TransformStreamDefaultController, chunk: O) {\n const stream = controller._controlledTransformStream;\n const readableController = stream._readable._readableStreamController;\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController)) {\n throw new TypeError('Readable side is not in a state that permits enqueue');\n }\n\n // We throttle transform invocations based on the backpressure of the ReadableStream, but we still\n // accept TransformStreamDefaultControllerEnqueue() calls.\n\n try {\n ReadableStreamDefaultControllerEnqueue(readableController, chunk);\n } catch (e) {\n // This happens when readableStrategy.size() throws.\n TransformStreamErrorWritableAndUnblockWrite(stream, e);\n\n throw stream._readable._storedError;\n }\n\n const backpressure = ReadableStreamDefaultControllerHasBackpressure(readableController);\n if (backpressure !== stream._backpressure) {\n assert(backpressure);\n TransformStreamSetBackpressure(stream, true);\n }\n}\n\nfunction TransformStreamDefaultControllerError(controller: TransformStreamDefaultController, e: any) {\n TransformStreamError(controller._controlledTransformStream, e);\n}\n\nfunction TransformStreamDefaultControllerPerformTransform(controller: TransformStreamDefaultController,\n chunk: I) {\n const transformPromise = controller._transformAlgorithm(chunk);\n return transformPromiseWith(transformPromise, undefined, r => {\n TransformStreamError(controller._controlledTransformStream, r);\n throw r;\n });\n}\n\nfunction TransformStreamDefaultControllerTerminate(controller: TransformStreamDefaultController) {\n const stream = controller._controlledTransformStream;\n const readableController = stream._readable._readableStreamController;\n\n ReadableStreamDefaultControllerClose(readableController);\n\n const error = new TypeError('TransformStream terminated');\n TransformStreamErrorWritableAndUnblockWrite(stream, error);\n}\n\n// TransformStreamDefaultSink Algorithms\n\nfunction TransformStreamDefaultSinkWriteAlgorithm(stream: TransformStream, chunk: I): Promise {\n assert(stream._writable._state === 'writable');\n\n const controller = stream._transformStreamController;\n\n if (stream._backpressure) {\n const backpressureChangePromise = stream._backpressureChangePromise;\n assert(backpressureChangePromise !== undefined);\n return transformPromiseWith(backpressureChangePromise, () => {\n const writable = stream._writable;\n const state = writable._state;\n if (state === 'erroring') {\n throw writable._storedError;\n }\n assert(state === 'writable');\n return TransformStreamDefaultControllerPerformTransform(controller, chunk);\n });\n }\n\n return TransformStreamDefaultControllerPerformTransform(controller, chunk);\n}\n\nfunction TransformStreamDefaultSinkAbortAlgorithm(stream: TransformStream, reason: any): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._readable cannot change after construction, so caching it across a call to user code is safe.\n const readable = stream._readable;\n\n // Assign the _finishPromise now so that if _cancelAlgorithm calls readable.cancel() internally,\n // we don't run the _cancelAlgorithm again.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const cancelPromise = controller._cancelAlgorithm(reason);\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(cancelPromise, () => {\n if (readable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, readable._storedError);\n } else {\n ReadableStreamDefaultControllerError(readable._readableStreamController, reason);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n ReadableStreamDefaultControllerError(readable._readableStreamController, r);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\nfunction TransformStreamDefaultSinkCloseAlgorithm(stream: TransformStream): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._readable cannot change after construction, so caching it across a call to user code is safe.\n const readable = stream._readable;\n\n // Assign the _finishPromise now so that if _flushAlgorithm calls readable.cancel() internally,\n // we don't also run the _cancelAlgorithm.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const flushPromise = controller._flushAlgorithm();\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(flushPromise, () => {\n if (readable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, readable._storedError);\n } else {\n ReadableStreamDefaultControllerClose(readable._readableStreamController);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n ReadableStreamDefaultControllerError(readable._readableStreamController, r);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\n// TransformStreamDefaultSource Algorithms\n\nfunction TransformStreamDefaultSourcePullAlgorithm(stream: TransformStream): Promise {\n // Invariant. Enforced by the promises returned by start() and pull().\n assert(stream._backpressure);\n\n assert(stream._backpressureChangePromise !== undefined);\n\n TransformStreamSetBackpressure(stream, false);\n\n // Prevent the next pull() call until there is backpressure.\n return stream._backpressureChangePromise;\n}\n\nfunction TransformStreamDefaultSourceCancelAlgorithm(stream: TransformStream, reason: any): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._writable cannot change after construction, so caching it across a call to user code is safe.\n const writable = stream._writable;\n\n // Assign the _finishPromise now so that if _flushAlgorithm calls writable.abort() or\n // writable.cancel() internally, we don't run the _cancelAlgorithm again, or also run the\n // _flushAlgorithm.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const cancelPromise = controller._cancelAlgorithm(reason);\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(cancelPromise, () => {\n if (writable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, writable._storedError);\n } else {\n WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, reason);\n TransformStreamUnblockWrite(stream);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, r);\n TransformStreamUnblockWrite(stream);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\n// Helper functions for the TransformStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`);\n}\n\nexport function defaultControllerFinishPromiseResolve(controller: TransformStreamDefaultController) {\n if (controller._finishPromise_resolve === undefined) {\n return;\n }\n\n controller._finishPromise_resolve();\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\nexport function defaultControllerFinishPromiseReject(controller: TransformStreamDefaultController, reason: any) {\n if (controller._finishPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(controller._finishPromise!);\n controller._finishPromise_reject(reason);\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\n// Helper functions for the TransformStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(\n `TransformStream.prototype.${name} can only be used on a TransformStream`);\n}\n","/* c8 ignore start */\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\nif (!globalThis.ReadableStream) {\n // `node:stream/web` got introduced in v16.5.0 as experimental\n // and it's preferred over the polyfilled version. So we also\n // suppress the warning that gets emitted by NodeJS for using it.\n try {\n const process = require('node:process')\n const { emitWarning } = process\n try {\n process.emitWarning = () => {}\n Object.assign(globalThis, require('node:stream/web'))\n process.emitWarning = emitWarning\n } catch (error) {\n process.emitWarning = emitWarning\n throw error\n }\n } catch (error) {\n // fallback to polyfill implementation\n Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js'))\n }\n}\n\ntry {\n // Don't use node: prefix for this, require+node: is not supported until node v14.14\n // Only `import()` can use prefix in 12.20 and later\n const { Blob } = require('buffer')\n if (Blob && !Blob.prototype.stream) {\n Blob.prototype.stream = function name (params) {\n let position = 0\n const blob = this\n\n return new ReadableStream({\n type: 'bytes',\n async pull (ctrl) {\n const chunk = blob.slice(position, Math.min(blob.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n ctrl.enqueue(new Uint8Array(buffer))\n\n if (position === blob.size) {\n ctrl.close()\n }\n }\n })\n }\n }\n} catch (error) {}\n/* c8 ignore end */\n","/*! fetch-blob. MIT License. Jimmy Wärting */\n\n// TODO (jimmywarting): in the feature use conditional loading with top level await (requires 14.x)\n// Node has recently added whatwg stream into core\n\nimport './streams.cjs'\n\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\n/** @param {(Blob | Uint8Array)[]} parts */\nasync function * toIterator (parts, clone = true) {\n for (const part of parts) {\n if ('stream' in part) {\n yield * (/** @type {AsyncIterableIterator} */ (part.stream()))\n } else if (ArrayBuffer.isView(part)) {\n if (clone) {\n let position = part.byteOffset\n const end = part.byteOffset + part.byteLength\n while (position !== end) {\n const size = Math.min(end - position, POOL_SIZE)\n const chunk = part.buffer.slice(position, position + size)\n position += chunk.byteLength\n yield new Uint8Array(chunk)\n }\n } else {\n yield part\n }\n /* c8 ignore next 10 */\n } else {\n // For blobs that have arrayBuffer but no stream method (nodes buffer.Blob)\n let position = 0, b = (/** @type {Blob} */ (part))\n while (position !== b.size) {\n const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n yield new Uint8Array(buffer)\n }\n }\n }\n}\n\nconst _Blob = class Blob {\n /** @type {Array.<(Blob|Uint8Array)>} */\n #parts = []\n #type = ''\n #size = 0\n #endings = 'transparent'\n\n /**\n * The Blob() constructor returns a new Blob object. The content\n * of the blob consists of the concatenation of the values given\n * in the parameter array.\n *\n * @param {*} blobParts\n * @param {{ type?: string, endings?: string }} [options]\n */\n constructor (blobParts = [], options = {}) {\n if (typeof blobParts !== 'object' || blobParts === null) {\n throw new TypeError('Failed to construct \\'Blob\\': The provided value cannot be converted to a sequence.')\n }\n\n if (typeof blobParts[Symbol.iterator] !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': The object must have a callable @@iterator property.')\n }\n\n if (typeof options !== 'object' && typeof options !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': parameter 2 cannot convert to dictionary.')\n }\n\n if (options === null) options = {}\n\n const encoder = new TextEncoder()\n for (const element of blobParts) {\n let part\n if (ArrayBuffer.isView(element)) {\n part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength))\n } else if (element instanceof ArrayBuffer) {\n part = new Uint8Array(element.slice(0))\n } else if (element instanceof Blob) {\n part = element\n } else {\n part = encoder.encode(`${element}`)\n }\n\n this.#size += ArrayBuffer.isView(part) ? part.byteLength : part.size\n this.#parts.push(part)\n }\n\n this.#endings = `${options.endings === undefined ? 'transparent' : options.endings}`\n const type = options.type === undefined ? '' : String(options.type)\n this.#type = /^[\\x20-\\x7E]*$/.test(type) ? type : ''\n }\n\n /**\n * The Blob interface's size property returns the\n * size of the Blob in bytes.\n */\n get size () {\n return this.#size\n }\n\n /**\n * The type property of a Blob object returns the MIME type of the file.\n */\n get type () {\n return this.#type\n }\n\n /**\n * The text() method in the Blob interface returns a Promise\n * that resolves with a string containing the contents of\n * the blob, interpreted as UTF-8.\n *\n * @return {Promise}\n */\n async text () {\n // More optimized than using this.arrayBuffer()\n // that requires twice as much ram\n const decoder = new TextDecoder()\n let str = ''\n for await (const part of toIterator(this.#parts, false)) {\n str += decoder.decode(part, { stream: true })\n }\n // Remaining\n str += decoder.decode()\n return str\n }\n\n /**\n * The arrayBuffer() method in the Blob interface returns a\n * Promise that resolves with the contents of the blob as\n * binary data contained in an ArrayBuffer.\n *\n * @return {Promise}\n */\n async arrayBuffer () {\n // Easier way... Just a unnecessary overhead\n // const view = new Uint8Array(this.size);\n // await this.stream().getReader({mode: 'byob'}).read(view);\n // return view.buffer;\n\n const data = new Uint8Array(this.size)\n let offset = 0\n for await (const chunk of toIterator(this.#parts, false)) {\n data.set(chunk, offset)\n offset += chunk.length\n }\n\n return data.buffer\n }\n\n stream () {\n const it = toIterator(this.#parts, true)\n\n return new globalThis.ReadableStream({\n // @ts-ignore\n type: 'bytes',\n async pull (ctrl) {\n const chunk = await it.next()\n chunk.done ? ctrl.close() : ctrl.enqueue(chunk.value)\n },\n\n async cancel () {\n await it.return()\n }\n })\n }\n\n /**\n * The Blob interface's slice() method creates and returns a\n * new Blob object which contains data from a subset of the\n * blob on which it's called.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @param {string} [type]\n */\n slice (start = 0, end = this.size, type = '') {\n const { size } = this\n\n let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size)\n let relativeEnd = end < 0 ? Math.max(size + end, 0) : Math.min(end, size)\n\n const span = Math.max(relativeEnd - relativeStart, 0)\n const parts = this.#parts\n const blobParts = []\n let added = 0\n\n for (const part of parts) {\n // don't add the overflow to new blobParts\n if (added >= span) {\n break\n }\n\n const size = ArrayBuffer.isView(part) ? part.byteLength : part.size\n if (relativeStart && size <= relativeStart) {\n // Skip the beginning and change the relative\n // start & end position as we skip the unwanted parts\n relativeStart -= size\n relativeEnd -= size\n } else {\n let chunk\n if (ArrayBuffer.isView(part)) {\n chunk = part.subarray(relativeStart, Math.min(size, relativeEnd))\n added += chunk.byteLength\n } else {\n chunk = part.slice(relativeStart, Math.min(size, relativeEnd))\n added += chunk.size\n }\n relativeEnd -= size\n blobParts.push(chunk)\n relativeStart = 0 // All next sequential parts should start at 0\n }\n }\n\n const blob = new Blob([], { type: String(type).toLowerCase() })\n blob.#size = span\n blob.#parts = blobParts\n\n return blob\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n\n static [Symbol.hasInstance] (object) {\n return (\n object &&\n typeof object === 'object' &&\n typeof object.constructor === 'function' &&\n (\n typeof object.stream === 'function' ||\n typeof object.arrayBuffer === 'function'\n ) &&\n /^(Blob|File)$/.test(object[Symbol.toStringTag])\n )\n }\n}\n\nObject.defineProperties(_Blob.prototype, {\n size: { enumerable: true },\n type: { enumerable: true },\n slice: { enumerable: true }\n})\n\n/** @type {typeof globalThis.Blob} */\nexport const Blob = _Blob\nexport default Blob\n","import Blob from './index.js'\n\nconst _File = class File extends Blob {\n #lastModified = 0\n #name = ''\n\n /**\n * @param {*[]} fileBits\n * @param {string} fileName\n * @param {{lastModified?: number, type?: string}} options\n */// @ts-ignore\n constructor (fileBits, fileName, options = {}) {\n if (arguments.length < 2) {\n throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)\n }\n super(fileBits, options)\n\n if (options === null) options = {}\n\n // Simulate WebIDL type casting for NaN value in lastModified option.\n const lastModified = options.lastModified === undefined ? Date.now() : Number(options.lastModified)\n if (!Number.isNaN(lastModified)) {\n this.#lastModified = lastModified\n }\n\n this.#name = String(fileName)\n }\n\n get name () {\n return this.#name\n }\n\n get lastModified () {\n return this.#lastModified\n }\n\n get [Symbol.toStringTag] () {\n return 'File'\n }\n\n static [Symbol.hasInstance] (object) {\n return !!object && object instanceof Blob &&\n /^(File)$/.test(object[Symbol.toStringTag])\n }\n}\n\n/** @type {typeof globalThis.File} */// @ts-ignore\nexport const File = _File\nexport default File\n","/*! formdata-polyfill. MIT License. Jimmy Wärting */\n\nimport C from 'fetch-blob'\nimport F from 'fetch-blob/file.js'\n\nvar {toStringTag:t,iterator:i,hasInstance:h}=Symbol,\nr=Math.random,\nm='append,set,get,getAll,delete,keys,values,entries,forEach,constructor'.split(','),\nf=(a,b,c)=>(a+='',/^(Blob|File)$/.test(b && b[t])?[(c=c!==void 0?c+'':b[t]=='File'?b.name:'blob',a),b.name!==c||b[t]=='blob'?new F([b],c,b):b]:[a,b+'']),\ne=(c,f)=>(f?c:c.replace(/\\r?\\n|\\r/g,'\\r\\n')).replace(/\\n/g,'%0A').replace(/\\r/g,'%0D').replace(/\"/g,'%22'),\nx=(n, a, e)=>{if(a.lengthtypeof o[m]!='function')}\nappend(...a){x('append',arguments,2);this.#d.push(f(...a))}\ndelete(a){x('delete',arguments,1);a+='';this.#d=this.#d.filter(([b])=>b!==a)}\nget(a){x('get',arguments,1);a+='';for(var b=this.#d,l=b.length,c=0;cc[0]===a&&b.push(c[1]));return b}\nhas(a){x('has',arguments,1);a+='';return this.#d.some(b=>b[0]===a)}\nforEach(a,b){x('forEach',arguments,1);for(var [c,d]of this)a.call(b,d,c,this)}\nset(...a){x('set',arguments,2);var b=[],c=!0;a=f(...a);this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)});c&&b.push(a);this.#d=b}\n*entries(){yield*this.#d}\n*keys(){for(var[a]of this)yield a}\n*values(){for(var[,a]of this)yield a}}\n\n/** @param {FormData} F */\nexport function formDataToBlob (F,B=C){\nvar b=`${r()}${r()}`.replace(/\\./g, '').slice(-28).padStart(32, '-'),c=[],p=`--${b}\\r\\nContent-Disposition: form-data; name=\"`\nF.forEach((v,n)=>typeof v=='string'\n?c.push(p+e(n)+`\"\\r\\n\\r\\n${v.replace(/\\r(?!\\n)|(? {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.append === 'function' &&\n\t\ttypeof object.delete === 'function' &&\n\t\ttypeof object.get === 'function' &&\n\t\ttypeof object.getAll === 'function' &&\n\t\ttypeof object.has === 'function' &&\n\t\ttypeof object.set === 'function' &&\n\t\ttypeof object.sort === 'function' &&\n\t\tobject[NAME] === 'URLSearchParams'\n\t);\n};\n\n/**\n * Check if `object` is a W3C `Blob` object (which `File` inherits from)\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isBlob = object => {\n\treturn (\n\t\tobject &&\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.arrayBuffer === 'function' &&\n\t\ttypeof object.type === 'string' &&\n\t\ttypeof object.stream === 'function' &&\n\t\ttypeof object.constructor === 'function' &&\n\t\t/^(Blob|File)$/.test(object[NAME])\n\t);\n};\n\n/**\n * Check if `obj` is an instance of AbortSignal.\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isAbortSignal = object => {\n\treturn (\n\t\ttypeof object === 'object' && (\n\t\t\tobject[NAME] === 'AbortSignal' ||\n\t\t\tobject[NAME] === 'EventTarget'\n\t\t)\n\t);\n};\n\n/**\n * isDomainOrSubdomain reports whether sub is a subdomain (or exact match) of\n * the parent domain.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isDomainOrSubdomain = (destination, original) => {\n\tconst orig = new URL(original).hostname;\n\tconst dest = new URL(destination).hostname;\n\n\treturn orig === dest || orig.endsWith(`.${dest}`);\n};\n\n/**\n * isSameProtocol reports whether the two provided URLs use the same protocol.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isSameProtocol = (destination, original) => {\n\tconst orig = new URL(original).protocol;\n\tconst dest = new URL(destination).protocol;\n\n\treturn orig === dest;\n};\n","/*! node-domexception. MIT License. Jimmy Wärting */\n\nif (!globalThis.DOMException) {\n try {\n const { MessageChannel } = require('worker_threads'),\n port = new MessageChannel().port1,\n ab = new ArrayBuffer()\n port.postMessage(ab, [ab, ab])\n } catch (err) {\n err.constructor.name === 'DOMException' && (\n globalThis.DOMException = err.constructor\n )\n }\n}\n\nmodule.exports = globalThis.DOMException\n","import { statSync, createReadStream, promises as fs } from 'node:fs'\nimport { basename } from 'node:path'\nimport DOMException from 'node-domexception'\n\nimport File from './file.js'\nimport Blob from './index.js'\n\nconst { stat } = fs\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n */\nconst blobFromSync = (path, type) => fromBlob(statSync(path), path, type)\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n * @returns {Promise}\n */\nconst blobFrom = (path, type) => stat(path).then(stat => fromBlob(stat, path, type))\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n * @returns {Promise}\n */\nconst fileFrom = (path, type) => stat(path).then(stat => fromFile(stat, path, type))\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n */\nconst fileFromSync = (path, type) => fromFile(statSync(path), path, type)\n\n// @ts-ignore\nconst fromBlob = (stat, path, type = '') => new Blob([new BlobDataItem({\n path,\n size: stat.size,\n lastModified: stat.mtimeMs,\n start: 0\n})], { type })\n\n// @ts-ignore\nconst fromFile = (stat, path, type = '') => new File([new BlobDataItem({\n path,\n size: stat.size,\n lastModified: stat.mtimeMs,\n start: 0\n})], basename(path), { type, lastModified: stat.mtimeMs })\n\n/**\n * This is a blob backed up by a file on the disk\n * with minium requirement. Its wrapped around a Blob as a blobPart\n * so you have no direct access to this.\n *\n * @private\n */\nclass BlobDataItem {\n #path\n #start\n\n constructor (options) {\n this.#path = options.path\n this.#start = options.start\n this.size = options.size\n this.lastModified = options.lastModified\n }\n\n /**\n * Slicing arguments is first validated and formatted\n * to not be out of range by Blob.prototype.slice\n */\n slice (start, end) {\n return new BlobDataItem({\n path: this.#path,\n lastModified: this.lastModified,\n size: end - start,\n start: this.#start + start\n })\n }\n\n async * stream () {\n const { mtimeMs } = await stat(this.#path)\n if (mtimeMs > this.lastModified) {\n throw new DOMException('The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.', 'NotReadableError')\n }\n yield * createReadStream(this.#path, {\n start: this.#start,\n end: this.#start + this.size - 1\n })\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n}\n\nexport default blobFromSync\nexport { File, Blob, blobFrom, blobFromSync, fileFrom, fileFromSync }\n","import {File} from 'fetch-blob/from.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\n\nlet s = 0;\nconst S = {\n\tSTART_BOUNDARY: s++,\n\tHEADER_FIELD_START: s++,\n\tHEADER_FIELD: s++,\n\tHEADER_VALUE_START: s++,\n\tHEADER_VALUE: s++,\n\tHEADER_VALUE_ALMOST_DONE: s++,\n\tHEADERS_ALMOST_DONE: s++,\n\tPART_DATA_START: s++,\n\tPART_DATA: s++,\n\tEND: s++\n};\n\nlet f = 1;\nconst F = {\n\tPART_BOUNDARY: f,\n\tLAST_BOUNDARY: f *= 2\n};\n\nconst LF = 10;\nconst CR = 13;\nconst SPACE = 32;\nconst HYPHEN = 45;\nconst COLON = 58;\nconst A = 97;\nconst Z = 122;\n\nconst lower = c => c | 0x20;\n\nconst noop = () => {};\n\nclass MultipartParser {\n\t/**\n\t * @param {string} boundary\n\t */\n\tconstructor(boundary) {\n\t\tthis.index = 0;\n\t\tthis.flags = 0;\n\n\t\tthis.onHeaderEnd = noop;\n\t\tthis.onHeaderField = noop;\n\t\tthis.onHeadersEnd = noop;\n\t\tthis.onHeaderValue = noop;\n\t\tthis.onPartBegin = noop;\n\t\tthis.onPartData = noop;\n\t\tthis.onPartEnd = noop;\n\n\t\tthis.boundaryChars = {};\n\n\t\tboundary = '\\r\\n--' + boundary;\n\t\tconst ui8a = new Uint8Array(boundary.length);\n\t\tfor (let i = 0; i < boundary.length; i++) {\n\t\t\tui8a[i] = boundary.charCodeAt(i);\n\t\t\tthis.boundaryChars[ui8a[i]] = true;\n\t\t}\n\n\t\tthis.boundary = ui8a;\n\t\tthis.lookbehind = new Uint8Array(this.boundary.length + 8);\n\t\tthis.state = S.START_BOUNDARY;\n\t}\n\n\t/**\n\t * @param {Uint8Array} data\n\t */\n\twrite(data) {\n\t\tlet i = 0;\n\t\tconst length_ = data.length;\n\t\tlet previousIndex = this.index;\n\t\tlet {lookbehind, boundary, boundaryChars, index, state, flags} = this;\n\t\tconst boundaryLength = this.boundary.length;\n\t\tconst boundaryEnd = boundaryLength - 1;\n\t\tconst bufferLength = data.length;\n\t\tlet c;\n\t\tlet cl;\n\n\t\tconst mark = name => {\n\t\t\tthis[name + 'Mark'] = i;\n\t\t};\n\n\t\tconst clear = name => {\n\t\t\tdelete this[name + 'Mark'];\n\t\t};\n\n\t\tconst callback = (callbackSymbol, start, end, ui8a) => {\n\t\t\tif (start === undefined || start !== end) {\n\t\t\t\tthis[callbackSymbol](ui8a && ui8a.subarray(start, end));\n\t\t\t}\n\t\t};\n\n\t\tconst dataCallback = (name, clear) => {\n\t\t\tconst markSymbol = name + 'Mark';\n\t\t\tif (!(markSymbol in this)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (clear) {\n\t\t\t\tcallback(name, this[markSymbol], i, data);\n\t\t\t\tdelete this[markSymbol];\n\t\t\t} else {\n\t\t\t\tcallback(name, this[markSymbol], data.length, data);\n\t\t\t\tthis[markSymbol] = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (i = 0; i < length_; i++) {\n\t\t\tc = data[i];\n\n\t\t\tswitch (state) {\n\t\t\t\tcase S.START_BOUNDARY:\n\t\t\t\t\tif (index === boundary.length - 2) {\n\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else if (c !== CR) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if (index - 1 === boundary.length - 2) {\n\t\t\t\t\t\tif (flags & F.LAST_BOUNDARY && c === HYPHEN) {\n\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c !== boundary[index + 2]) {\n\t\t\t\t\t\tindex = -2;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === boundary[index + 2]) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_FIELD_START:\n\t\t\t\t\tstate = S.HEADER_FIELD;\n\t\t\t\t\tmark('onHeaderField');\n\t\t\t\t\tindex = 0;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_FIELD:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tclear('onHeaderField');\n\t\t\t\t\t\tstate = S.HEADERS_ALMOST_DONE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === COLON) {\n\t\t\t\t\t\tif (index === 1) {\n\t\t\t\t\t\t\t// empty header field\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdataCallback('onHeaderField', true);\n\t\t\t\t\t\tstate = S.HEADER_VALUE_START;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcl = lower(c);\n\t\t\t\t\tif (cl < A || cl > Z) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_START:\n\t\t\t\t\tif (c === SPACE) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tmark('onHeaderValue');\n\t\t\t\t\tstate = S.HEADER_VALUE;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_VALUE:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tdataCallback('onHeaderValue', true);\n\t\t\t\t\t\tcallback('onHeaderEnd');\n\t\t\t\t\t\tstate = S.HEADER_VALUE_ALMOST_DONE;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADERS_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tcallback('onHeadersEnd');\n\t\t\t\t\tstate = S.PART_DATA_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.PART_DATA_START:\n\t\t\t\t\tstate = S.PART_DATA;\n\t\t\t\t\tmark('onPartData');\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.PART_DATA:\n\t\t\t\t\tpreviousIndex = index;\n\n\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t// boyer-moore derrived algorithm to safely skip non-boundary data\n\t\t\t\t\t\ti += boundaryEnd;\n\t\t\t\t\t\twhile (i < bufferLength && !(data[i] in boundaryChars)) {\n\t\t\t\t\t\t\ti += boundaryLength;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ti -= boundaryEnd;\n\t\t\t\t\t\tc = data[i];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index < boundary.length) {\n\t\t\t\t\t\tif (boundary[index] === c) {\n\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\tdataCallback('onPartData', true);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === boundary.length) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\t\t// CR = part boundary\n\t\t\t\t\t\t\tflags |= F.PART_BOUNDARY;\n\t\t\t\t\t\t} else if (c === HYPHEN) {\n\t\t\t\t\t\t\t// HYPHEN = end boundary\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index - 1 === boundary.length) {\n\t\t\t\t\t\tif (flags & F.PART_BOUNDARY) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tif (c === LF) {\n\t\t\t\t\t\t\t\t// unset the PART_BOUNDARY flag\n\t\t\t\t\t\t\t\tflags &= ~F.PART_BOUNDARY;\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (flags & F.LAST_BOUNDARY) {\n\t\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index > 0) {\n\t\t\t\t\t\t// when matching a possible boundary, keep a lookbehind reference\n\t\t\t\t\t\t// in case it turns out to be a false lead\n\t\t\t\t\t\tlookbehind[index - 1] = c;\n\t\t\t\t\t} else if (previousIndex > 0) {\n\t\t\t\t\t\t// if our boundary turned out to be rubbish, the captured lookbehind\n\t\t\t\t\t\t// belongs to partData\n\t\t\t\t\t\tconst _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);\n\t\t\t\t\t\tcallback('onPartData', 0, previousIndex, _lookbehind);\n\t\t\t\t\t\tpreviousIndex = 0;\n\t\t\t\t\t\tmark('onPartData');\n\n\t\t\t\t\t\t// reconsider the current character even so it interrupted the sequence\n\t\t\t\t\t\t// it could be the beginning of a new sequence\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.END:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Unexpected state entered: ${state}`);\n\t\t\t}\n\t\t}\n\n\t\tdataCallback('onHeaderField');\n\t\tdataCallback('onHeaderValue');\n\t\tdataCallback('onPartData');\n\n\t\t// Update properties for the next call\n\t\tthis.index = index;\n\t\tthis.state = state;\n\t\tthis.flags = flags;\n\t}\n\n\tend() {\n\t\tif ((this.state === S.HEADER_FIELD_START && this.index === 0) ||\n\t\t\t(this.state === S.PART_DATA && this.index === this.boundary.length)) {\n\t\t\tthis.onPartEnd();\n\t\t} else if (this.state !== S.END) {\n\t\t\tthrow new Error('MultipartParser.end(): stream ended unexpectedly');\n\t\t}\n\t}\n}\n\nfunction _fileName(headerValue) {\n\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\tconst m = headerValue.match(/\\bfilename=(\"(.*?)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))($|;\\s)/i);\n\tif (!m) {\n\t\treturn;\n\t}\n\n\tconst match = m[2] || m[3] || '';\n\tlet filename = match.slice(match.lastIndexOf('\\\\') + 1);\n\tfilename = filename.replace(/%22/g, '\"');\n\tfilename = filename.replace(/&#(\\d{4});/g, (m, code) => {\n\t\treturn String.fromCharCode(code);\n\t});\n\treturn filename;\n}\n\nexport async function toFormData(Body, ct) {\n\tif (!/multipart/i.test(ct)) {\n\t\tthrow new TypeError('Failed to fetch');\n\t}\n\n\tconst m = ct.match(/boundary=(?:\"([^\"]+)\"|([^;]+))/i);\n\n\tif (!m) {\n\t\tthrow new TypeError('no or bad content-type header, no multipart boundary');\n\t}\n\n\tconst parser = new MultipartParser(m[1] || m[2]);\n\n\tlet headerField;\n\tlet headerValue;\n\tlet entryValue;\n\tlet entryName;\n\tlet contentType;\n\tlet filename;\n\tconst entryChunks = [];\n\tconst formData = new FormData();\n\n\tconst onPartData = ui8a => {\n\t\tentryValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tconst appendToFile = ui8a => {\n\t\tentryChunks.push(ui8a);\n\t};\n\n\tconst appendFileToFormData = () => {\n\t\tconst file = new File(entryChunks, filename, {type: contentType});\n\t\tformData.append(entryName, file);\n\t};\n\n\tconst appendEntryToFormData = () => {\n\t\tformData.append(entryName, entryValue);\n\t};\n\n\tconst decoder = new TextDecoder('utf-8');\n\tdecoder.decode();\n\n\tparser.onPartBegin = function () {\n\t\tparser.onPartData = onPartData;\n\t\tparser.onPartEnd = appendEntryToFormData;\n\n\t\theaderField = '';\n\t\theaderValue = '';\n\t\tentryValue = '';\n\t\tentryName = '';\n\t\tcontentType = '';\n\t\tfilename = null;\n\t\tentryChunks.length = 0;\n\t};\n\n\tparser.onHeaderField = function (ui8a) {\n\t\theaderField += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderValue = function (ui8a) {\n\t\theaderValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderEnd = function () {\n\t\theaderValue += decoder.decode();\n\t\theaderField = headerField.toLowerCase();\n\n\t\tif (headerField === 'content-disposition') {\n\t\t\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\t\t\tconst m = headerValue.match(/\\bname=(\"([^\"]*)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))/i);\n\n\t\t\tif (m) {\n\t\t\t\tentryName = m[2] || m[3] || '';\n\t\t\t}\n\n\t\t\tfilename = _fileName(headerValue);\n\n\t\t\tif (filename) {\n\t\t\t\tparser.onPartData = appendToFile;\n\t\t\t\tparser.onPartEnd = appendFileToFormData;\n\t\t\t}\n\t\t} else if (headerField === 'content-type') {\n\t\t\tcontentType = headerValue;\n\t\t}\n\n\t\theaderValue = '';\n\t\theaderField = '';\n\t};\n\n\tfor await (const chunk of Body) {\n\t\tparser.write(chunk);\n\t}\n\n\tparser.end();\n\n\treturn formData;\n}\n","\n/**\n * Body.js\n *\n * Body interface provides common methods for Request and Response\n */\n\nimport Stream, {PassThrough} from 'node:stream';\nimport {types, deprecate, promisify} from 'node:util';\nimport {Buffer} from 'node:buffer';\n\nimport Blob from 'fetch-blob';\nimport {FormData, formDataToBlob} from 'formdata-polyfill/esm.min.js';\n\nimport {FetchError} from './errors/fetch-error.js';\nimport {FetchBaseError} from './errors/base.js';\nimport {isBlob, isURLSearchParameters} from './utils/is.js';\n\nconst pipeline = promisify(Stream.pipeline);\nconst INTERNALS = Symbol('Body internals');\n\n/**\n * Body mixin\n *\n * Ref: https://fetch.spec.whatwg.org/#body\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Body {\n\tconstructor(body, {\n\t\tsize = 0\n\t} = {}) {\n\t\tlet boundary = null;\n\n\t\tif (body === null) {\n\t\t\t// Body is undefined or null\n\t\t\tbody = null;\n\t\t} else if (isURLSearchParameters(body)) {\n\t\t\t// Body is a URLSearchParams\n\t\t\tbody = Buffer.from(body.toString());\n\t\t} else if (isBlob(body)) {\n\t\t\t// Body is blob\n\t\t} else if (Buffer.isBuffer(body)) {\n\t\t\t// Body is Buffer\n\t\t} else if (types.isAnyArrayBuffer(body)) {\n\t\t\t// Body is ArrayBuffer\n\t\t\tbody = Buffer.from(body);\n\t\t} else if (ArrayBuffer.isView(body)) {\n\t\t\t// Body is ArrayBufferView\n\t\t\tbody = Buffer.from(body.buffer, body.byteOffset, body.byteLength);\n\t\t} else if (body instanceof Stream) {\n\t\t\t// Body is stream\n\t\t} else if (body instanceof FormData) {\n\t\t\t// Body is FormData\n\t\t\tbody = formDataToBlob(body);\n\t\t\tboundary = body.type.split('=')[1];\n\t\t} else {\n\t\t\t// None of the above\n\t\t\t// coerce to string then buffer\n\t\t\tbody = Buffer.from(String(body));\n\t\t}\n\n\t\tlet stream = body;\n\n\t\tif (Buffer.isBuffer(body)) {\n\t\t\tstream = Stream.Readable.from(body);\n\t\t} else if (isBlob(body)) {\n\t\t\tstream = Stream.Readable.from(body.stream());\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\tbody,\n\t\t\tstream,\n\t\t\tboundary,\n\t\t\tdisturbed: false,\n\t\t\terror: null\n\t\t};\n\t\tthis.size = size;\n\n\t\tif (body instanceof Stream) {\n\t\t\tbody.on('error', error_ => {\n\t\t\t\tconst error = error_ instanceof FetchBaseError ?\n\t\t\t\t\terror_ :\n\t\t\t\t\tnew FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, 'system', error_);\n\t\t\t\tthis[INTERNALS].error = error;\n\t\t\t});\n\t\t}\n\t}\n\n\tget body() {\n\t\treturn this[INTERNALS].stream;\n\t}\n\n\tget bodyUsed() {\n\t\treturn this[INTERNALS].disturbed;\n\t}\n\n\t/**\n\t * Decode response as ArrayBuffer\n\t *\n\t * @return Promise\n\t */\n\tasync arrayBuffer() {\n\t\tconst {buffer, byteOffset, byteLength} = await consumeBody(this);\n\t\treturn buffer.slice(byteOffset, byteOffset + byteLength);\n\t}\n\n\tasync formData() {\n\t\tconst ct = this.headers.get('content-type');\n\n\t\tif (ct.startsWith('application/x-www-form-urlencoded')) {\n\t\t\tconst formData = new FormData();\n\t\t\tconst parameters = new URLSearchParams(await this.text());\n\n\t\t\tfor (const [name, value] of parameters) {\n\t\t\t\tformData.append(name, value);\n\t\t\t}\n\n\t\t\treturn formData;\n\t\t}\n\n\t\tconst {toFormData} = await import('./utils/multipart-parser.js');\n\t\treturn toFormData(this.body, ct);\n\t}\n\n\t/**\n\t * Return raw response as Blob\n\t *\n\t * @return Promise\n\t */\n\tasync blob() {\n\t\tconst ct = (this.headers && this.headers.get('content-type')) || (this[INTERNALS].body && this[INTERNALS].body.type) || '';\n\t\tconst buf = await this.arrayBuffer();\n\n\t\treturn new Blob([buf], {\n\t\t\ttype: ct\n\t\t});\n\t}\n\n\t/**\n\t * Decode response as json\n\t *\n\t * @return Promise\n\t */\n\tasync json() {\n\t\tconst text = await this.text();\n\t\treturn JSON.parse(text);\n\t}\n\n\t/**\n\t * Decode response as text\n\t *\n\t * @return Promise\n\t */\n\tasync text() {\n\t\tconst buffer = await consumeBody(this);\n\t\treturn new TextDecoder().decode(buffer);\n\t}\n\n\t/**\n\t * Decode response as buffer (non-spec api)\n\t *\n\t * @return Promise\n\t */\n\tbuffer() {\n\t\treturn consumeBody(this);\n\t}\n}\n\nBody.prototype.buffer = deprecate(Body.prototype.buffer, 'Please use \\'response.arrayBuffer()\\' instead of \\'response.buffer()\\'', 'node-fetch#buffer');\n\n// In browsers, all properties are enumerable.\nObject.defineProperties(Body.prototype, {\n\tbody: {enumerable: true},\n\tbodyUsed: {enumerable: true},\n\tarrayBuffer: {enumerable: true},\n\tblob: {enumerable: true},\n\tjson: {enumerable: true},\n\ttext: {enumerable: true},\n\tdata: {get: deprecate(() => {},\n\t\t'data doesn\\'t exist, use json(), text(), arrayBuffer(), or body instead',\n\t\t'https://github.com/node-fetch/node-fetch/issues/1000 (response)')}\n});\n\n/**\n * Consume and convert an entire Body to a Buffer.\n *\n * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body\n *\n * @return Promise\n */\nasync function consumeBody(data) {\n\tif (data[INTERNALS].disturbed) {\n\t\tthrow new TypeError(`body used already for: ${data.url}`);\n\t}\n\n\tdata[INTERNALS].disturbed = true;\n\n\tif (data[INTERNALS].error) {\n\t\tthrow data[INTERNALS].error;\n\t}\n\n\tconst {body} = data;\n\n\t// Body is null\n\tif (body === null) {\n\t\treturn Buffer.alloc(0);\n\t}\n\n\t/* c8 ignore next 3 */\n\tif (!(body instanceof Stream)) {\n\t\treturn Buffer.alloc(0);\n\t}\n\n\t// Body is stream\n\t// get ready to actually consume the body\n\tconst accum = [];\n\tlet accumBytes = 0;\n\n\ttry {\n\t\tfor await (const chunk of body) {\n\t\t\tif (data.size > 0 && accumBytes + chunk.length > data.size) {\n\t\t\t\tconst error = new FetchError(`content size at ${data.url} over limit: ${data.size}`, 'max-size');\n\t\t\t\tbody.destroy(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\taccumBytes += chunk.length;\n\t\t\taccum.push(chunk);\n\t\t}\n\t} catch (error) {\n\t\tconst error_ = error instanceof FetchBaseError ? error : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`, 'system', error);\n\t\tthrow error_;\n\t}\n\n\tif (body.readableEnded === true || body._readableState.ended === true) {\n\t\ttry {\n\t\t\tif (accum.every(c => typeof c === 'string')) {\n\t\t\t\treturn Buffer.from(accum.join(''));\n\t\t\t}\n\n\t\t\treturn Buffer.concat(accum, accumBytes);\n\t\t} catch (error) {\n\t\t\tthrow new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`, 'system', error);\n\t\t}\n\t} else {\n\t\tthrow new FetchError(`Premature close of server response while trying to fetch ${data.url}`);\n\t}\n}\n\n/**\n * Clone body given Res/Req instance\n *\n * @param Mixed instance Response or Request instance\n * @param String highWaterMark highWaterMark for both PassThrough body streams\n * @return Mixed\n */\nexport const clone = (instance, highWaterMark) => {\n\tlet p1;\n\tlet p2;\n\tlet {body} = instance[INTERNALS];\n\n\t// Don't allow cloning a used body\n\tif (instance.bodyUsed) {\n\t\tthrow new Error('cannot clone body after it is used');\n\t}\n\n\t// Check that body is a stream and not form-data object\n\t// note: we can't clone the form-data object without having it as a dependency\n\tif ((body instanceof Stream) && (typeof body.getBoundary !== 'function')) {\n\t\t// Tee instance body\n\t\tp1 = new PassThrough({highWaterMark});\n\t\tp2 = new PassThrough({highWaterMark});\n\t\tbody.pipe(p1);\n\t\tbody.pipe(p2);\n\t\t// Set instance body to teed body and return the other teed body\n\t\tinstance[INTERNALS].stream = p1;\n\t\tbody = p2;\n\t}\n\n\treturn body;\n};\n\nconst getNonSpecFormDataBoundary = deprecate(\n\tbody => body.getBoundary(),\n\t'form-data doesn\\'t follow the spec and requires special treatment. Use alternative package',\n\t'https://github.com/node-fetch/node-fetch/issues/1167'\n);\n\n/**\n * Performs the operation \"extract a `Content-Type` value from |object|\" as\n * specified in the specification:\n * https://fetch.spec.whatwg.org/#concept-bodyinit-extract\n *\n * This function assumes that instance.body is present.\n *\n * @param {any} body Any options.body input\n * @returns {string | null}\n */\nexport const extractContentType = (body, request) => {\n\t// Body is null or undefined\n\tif (body === null) {\n\t\treturn null;\n\t}\n\n\t// Body is string\n\tif (typeof body === 'string') {\n\t\treturn 'text/plain;charset=UTF-8';\n\t}\n\n\t// Body is a URLSearchParams\n\tif (isURLSearchParameters(body)) {\n\t\treturn 'application/x-www-form-urlencoded;charset=UTF-8';\n\t}\n\n\t// Body is blob\n\tif (isBlob(body)) {\n\t\treturn body.type || null;\n\t}\n\n\t// Body is a Buffer (Buffer, ArrayBuffer or ArrayBufferView)\n\tif (Buffer.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {\n\t\treturn null;\n\t}\n\n\tif (body instanceof FormData) {\n\t\treturn `multipart/form-data; boundary=${request[INTERNALS].boundary}`;\n\t}\n\n\t// Detect form data input from form-data module\n\tif (body && typeof body.getBoundary === 'function') {\n\t\treturn `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`;\n\t}\n\n\t// Body is stream - can't really do much about this\n\tif (body instanceof Stream) {\n\t\treturn null;\n\t}\n\n\t// Body constructor defaults other things to string\n\treturn 'text/plain;charset=UTF-8';\n};\n\n/**\n * The Fetch Standard treats this as if \"total bytes\" is a property on the body.\n * For us, we have to explicitly get it with a function.\n *\n * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes\n *\n * @param {any} obj.body Body object from the Body instance.\n * @returns {number | null}\n */\nexport const getTotalBytes = request => {\n\tconst {body} = request[INTERNALS];\n\n\t// Body is null or undefined\n\tif (body === null) {\n\t\treturn 0;\n\t}\n\n\t// Body is Blob\n\tif (isBlob(body)) {\n\t\treturn body.size;\n\t}\n\n\t// Body is Buffer\n\tif (Buffer.isBuffer(body)) {\n\t\treturn body.length;\n\t}\n\n\t// Detect form data input from form-data module\n\tif (body && typeof body.getLengthSync === 'function') {\n\t\treturn body.hasKnownLength && body.hasKnownLength() ? body.getLengthSync() : null;\n\t}\n\n\t// Body is stream\n\treturn null;\n};\n\n/**\n * Write a Body to a Node.js WritableStream (e.g. http.Request) object.\n *\n * @param {Stream.Writable} dest The stream to write to.\n * @param obj.body Body object from the Body instance.\n * @returns {Promise}\n */\nexport const writeToStream = async (dest, {body}) => {\n\tif (body === null) {\n\t\t// Body is null\n\t\tdest.end();\n\t} else {\n\t\t// Body is stream\n\t\tawait pipeline(body, dest);\n\t}\n};\n","/**\n * Headers.js\n *\n * Headers class offers convenient helpers\n */\n\nimport {types} from 'node:util';\nimport http from 'node:http';\n\n/* c8 ignore next 9 */\nconst validateHeaderName = typeof http.validateHeaderName === 'function' ?\n\thttp.validateHeaderName :\n\tname => {\n\t\tif (!/^[\\^`\\-\\w!#$%&'*+.|~]+$/.test(name)) {\n\t\t\tconst error = new TypeError(`Header name must be a valid HTTP token [${name}]`);\n\t\t\tObject.defineProperty(error, 'code', {value: 'ERR_INVALID_HTTP_TOKEN'});\n\t\t\tthrow error;\n\t\t}\n\t};\n\n/* c8 ignore next 9 */\nconst validateHeaderValue = typeof http.validateHeaderValue === 'function' ?\n\thttp.validateHeaderValue :\n\t(name, value) => {\n\t\tif (/[^\\t\\u0020-\\u007E\\u0080-\\u00FF]/.test(value)) {\n\t\t\tconst error = new TypeError(`Invalid character in header content [\"${name}\"]`);\n\t\t\tObject.defineProperty(error, 'code', {value: 'ERR_INVALID_CHAR'});\n\t\t\tthrow error;\n\t\t}\n\t};\n\n/**\n * @typedef {Headers | Record | Iterable | Iterable>} HeadersInit\n */\n\n/**\n * This Fetch API interface allows you to perform various actions on HTTP request and response headers.\n * These actions include retrieving, setting, adding to, and removing.\n * A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.\n * You can add to this using methods like append() (see Examples.)\n * In all methods of this interface, header names are matched by case-insensitive byte sequence.\n *\n */\nexport default class Headers extends URLSearchParams {\n\t/**\n\t * Headers class\n\t *\n\t * @constructor\n\t * @param {HeadersInit} [init] - Response headers\n\t */\n\tconstructor(init) {\n\t\t// Validate and normalize init object in [name, value(s)][]\n\t\t/** @type {string[][]} */\n\t\tlet result = [];\n\t\tif (init instanceof Headers) {\n\t\t\tconst raw = init.raw();\n\t\t\tfor (const [name, values] of Object.entries(raw)) {\n\t\t\t\tresult.push(...values.map(value => [name, value]));\n\t\t\t}\n\t\t} else if (init == null) { // eslint-disable-line no-eq-null, eqeqeq\n\t\t\t// No op\n\t\t} else if (typeof init === 'object' && !types.isBoxedPrimitive(init)) {\n\t\t\tconst method = init[Symbol.iterator];\n\t\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\t\tif (method == null) {\n\t\t\t\t// Record\n\t\t\t\tresult.push(...Object.entries(init));\n\t\t\t} else {\n\t\t\t\tif (typeof method !== 'function') {\n\t\t\t\t\tthrow new TypeError('Header pairs must be iterable');\n\t\t\t\t}\n\n\t\t\t\t// Sequence>\n\t\t\t\t// Note: per spec we have to first exhaust the lists then process them\n\t\t\t\tresult = [...init]\n\t\t\t\t\t.map(pair => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof pair !== 'object' || types.isBoxedPrimitive(pair)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new TypeError('Each header pair must be an iterable object');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn [...pair];\n\t\t\t\t\t}).map(pair => {\n\t\t\t\t\t\tif (pair.length !== 2) {\n\t\t\t\t\t\t\tthrow new TypeError('Each header pair must be a name/value tuple');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn [...pair];\n\t\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new TypeError('Failed to construct \\'Headers\\': The provided value is not of type \\'(sequence> or record)');\n\t\t}\n\n\t\t// Validate and lowercase\n\t\tresult =\n\t\t\tresult.length > 0 ?\n\t\t\t\tresult.map(([name, value]) => {\n\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\treturn [String(name).toLowerCase(), String(value)];\n\t\t\t\t}) :\n\t\t\t\tundefined;\n\n\t\tsuper(result);\n\n\t\t// Returning a Proxy that will lowercase key names, validate parameters and sort keys\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn new Proxy(this, {\n\t\t\tget(target, p, receiver) {\n\t\t\t\tswitch (p) {\n\t\t\t\t\tcase 'append':\n\t\t\t\t\tcase 'set':\n\t\t\t\t\t\treturn (name, value) => {\n\t\t\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\t\t\treturn URLSearchParams.prototype[p].call(\n\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\tString(name).toLowerCase(),\n\t\t\t\t\t\t\t\tString(value)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase 'delete':\n\t\t\t\t\tcase 'has':\n\t\t\t\t\tcase 'getAll':\n\t\t\t\t\t\treturn name => {\n\t\t\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\t\t\treturn URLSearchParams.prototype[p].call(\n\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\tString(name).toLowerCase()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase 'keys':\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\ttarget.sort();\n\t\t\t\t\t\t\treturn new Set(URLSearchParams.prototype.keys.call(target)).keys();\n\t\t\t\t\t\t};\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn Reflect.get(target, p, receiver);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t/* c8 ignore next */\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn this.constructor.name;\n\t}\n\n\ttoString() {\n\t\treturn Object.prototype.toString.call(this);\n\t}\n\n\tget(name) {\n\t\tconst values = this.getAll(name);\n\t\tif (values.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet value = values.join(', ');\n\t\tif (/^content-encoding$/i.test(name)) {\n\t\t\tvalue = value.toLowerCase();\n\t\t}\n\n\t\treturn value;\n\t}\n\n\tforEach(callback, thisArg = undefined) {\n\t\tfor (const name of this.keys()) {\n\t\t\tReflect.apply(callback, thisArg, [this.get(name), name, this]);\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const name of this.keys()) {\n\t\t\tyield this.get(name);\n\t\t}\n\t}\n\n\t/**\n\t * @type {() => IterableIterator<[string, string]>}\n\t */\n\t* entries() {\n\t\tfor (const name of this.keys()) {\n\t\t\tyield [name, this.get(name)];\n\t\t}\n\t}\n\n\t[Symbol.iterator]() {\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Node-fetch non-spec method\n\t * returning all headers and their values as array\n\t * @returns {Record}\n\t */\n\traw() {\n\t\treturn [...this.keys()].reduce((result, key) => {\n\t\t\tresult[key] = this.getAll(key);\n\t\t\treturn result;\n\t\t}, {});\n\t}\n\n\t/**\n\t * For better console.log(headers) and also to convert Headers into Node.js Request compatible format\n\t */\n\t[Symbol.for('nodejs.util.inspect.custom')]() {\n\t\treturn [...this.keys()].reduce((result, key) => {\n\t\t\tconst values = this.getAll(key);\n\t\t\t// Http.request() only supports string as Host header.\n\t\t\t// This hack makes specifying custom Host header possible.\n\t\t\tif (key === 'host') {\n\t\t\t\tresult[key] = values[0];\n\t\t\t} else {\n\t\t\t\tresult[key] = values.length > 1 ? values : values[0];\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}, {});\n\t}\n}\n\n/**\n * Re-shaping object for Web IDL tests\n * Only need to do it for overridden methods\n */\nObject.defineProperties(\n\tHeaders.prototype,\n\t['get', 'entries', 'forEach', 'values'].reduce((result, property) => {\n\t\tresult[property] = {enumerable: true};\n\t\treturn result;\n\t}, {})\n);\n\n/**\n * Create a Headers object from an http.IncomingMessage.rawHeaders, ignoring those that do\n * not conform to HTTP grammar productions.\n * @param {import('http').IncomingMessage['rawHeaders']} headers\n */\nexport function fromRawHeaders(headers = []) {\n\treturn new Headers(\n\t\theaders\n\t\t\t// Split into pairs\n\t\t\t.reduce((result, value, index, array) => {\n\t\t\t\tif (index % 2 === 0) {\n\t\t\t\t\tresult.push(array.slice(index, index + 2));\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}, [])\n\t\t\t.filter(([name, value]) => {\n\t\t\t\ttry {\n\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\treturn true;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t})\n\n\t);\n}\n","const redirectStatus = new Set([301, 302, 303, 307, 308]);\n\n/**\n * Redirect code matching\n *\n * @param {number} code - Status code\n * @return {boolean}\n */\nexport const isRedirect = code => {\n\treturn redirectStatus.has(code);\n};\n","/**\n * Response.js\n *\n * Response class provides content decoding\n */\n\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType} from './body.js';\nimport {isRedirect} from './utils/is-redirect.js';\n\nconst INTERNALS = Symbol('Response internals');\n\n/**\n * Response class\n *\n * Ref: https://fetch.spec.whatwg.org/#response-class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Response extends Body {\n\tconstructor(body = null, options = {}) {\n\t\tsuper(body, options);\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq, no-negated-condition\n\t\tconst status = options.status != null ? options.status : 200;\n\n\t\tconst headers = new Headers(options.headers);\n\n\t\tif (body !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\ttype: 'default',\n\t\t\turl: options.url,\n\t\t\tstatus,\n\t\t\tstatusText: options.statusText || '',\n\t\t\theaders,\n\t\t\tcounter: options.counter,\n\t\t\thighWaterMark: options.highWaterMark\n\t\t};\n\t}\n\n\tget type() {\n\t\treturn this[INTERNALS].type;\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS].status;\n\t}\n\n\t/**\n\t * Convenience property representing if the request ended normally\n\t */\n\tget ok() {\n\t\treturn this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget highWaterMark() {\n\t\treturn this[INTERNALS].highWaterMark;\n\t}\n\n\t/**\n\t * Clone this response\n\t *\n\t * @return Response\n\t */\n\tclone() {\n\t\treturn new Response(clone(this, this.highWaterMark), {\n\t\t\ttype: this.type,\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected,\n\t\t\tsize: this.size,\n\t\t\thighWaterMark: this.highWaterMark\n\t\t});\n\t}\n\n\t/**\n\t * @param {string} url The URL that the new response is to originate from.\n\t * @param {number} status An optional status code for the response (e.g., 302.)\n\t * @returns {Response} A Response object.\n\t */\n\tstatic redirect(url, status = 302) {\n\t\tif (!isRedirect(status)) {\n\t\t\tthrow new RangeError('Failed to execute \"redirect\" on \"response\": Invalid status code');\n\t\t}\n\n\t\treturn new Response(null, {\n\t\t\theaders: {\n\t\t\t\tlocation: new URL(url).toString()\n\t\t\t},\n\t\t\tstatus\n\t\t});\n\t}\n\n\tstatic error() {\n\t\tconst response = new Response(null, {status: 0, statusText: ''});\n\t\tresponse[INTERNALS].type = 'error';\n\t\treturn response;\n\t}\n\n\tstatic json(data = undefined, init = {}) {\n\t\tconst body = JSON.stringify(data);\n\n\t\tif (body === undefined) {\n\t\t\tthrow new TypeError('data is not JSON serializable');\n\t\t}\n\n\t\tconst headers = new Headers(init && init.headers);\n\n\t\tif (!headers.has('content-type')) {\n\t\t\theaders.set('content-type', 'application/json');\n\t\t}\n\n\t\treturn new Response(body, {\n\t\t\t...init,\n\t\t\theaders\n\t\t});\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Response';\n\t}\n}\n\nObject.defineProperties(Response.prototype, {\n\ttype: {enumerable: true},\n\turl: {enumerable: true},\n\tstatus: {enumerable: true},\n\tok: {enumerable: true},\n\tredirected: {enumerable: true},\n\tstatusText: {enumerable: true},\n\theaders: {enumerable: true},\n\tclone: {enumerable: true}\n});\n","export const getSearch = parsedURL => {\n\tif (parsedURL.search) {\n\t\treturn parsedURL.search;\n\t}\n\n\tconst lastOffset = parsedURL.href.length - 1;\n\tconst hash = parsedURL.hash || (parsedURL.href[lastOffset] === '#' ? '#' : '');\n\treturn parsedURL.href[lastOffset - hash.length] === '?' ? '?' : '';\n};\n","import {isIP} from 'node:net';\n\n/**\n * @external URL\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/URL|URL}\n */\n\n/**\n * @module utils/referrer\n * @private\n */\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#strip-url|Referrer Policy §8.4. Strip url for use as a referrer}\n * @param {string} URL\n * @param {boolean} [originOnly=false]\n */\nexport function stripURLForUseAsAReferrer(url, originOnly = false) {\n\t// 1. If url is null, return no referrer.\n\tif (url == null) { // eslint-disable-line no-eq-null, eqeqeq\n\t\treturn 'no-referrer';\n\t}\n\n\turl = new URL(url);\n\n\t// 2. If url's scheme is a local scheme, then return no referrer.\n\tif (/^(about|blob|data):$/.test(url.protocol)) {\n\t\treturn 'no-referrer';\n\t}\n\n\t// 3. Set url's username to the empty string.\n\turl.username = '';\n\n\t// 4. Set url's password to null.\n\t// Note: `null` appears to be a mistake as this actually results in the password being `\"null\"`.\n\turl.password = '';\n\n\t// 5. Set url's fragment to null.\n\t// Note: `null` appears to be a mistake as this actually results in the fragment being `\"#null\"`.\n\turl.hash = '';\n\n\t// 6. If the origin-only flag is true, then:\n\tif (originOnly) {\n\t\t// 6.1. Set url's path to null.\n\t\t// Note: `null` appears to be a mistake as this actually results in the path being `\"/null\"`.\n\t\turl.pathname = '';\n\n\t\t// 6.2. Set url's query to null.\n\t\t// Note: `null` appears to be a mistake as this actually results in the query being `\"?null\"`.\n\t\turl.search = '';\n\t}\n\n\t// 7. Return url.\n\treturn url;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#enumdef-referrerpolicy|enum ReferrerPolicy}\n */\nexport const ReferrerPolicy = new Set([\n\t'',\n\t'no-referrer',\n\t'no-referrer-when-downgrade',\n\t'same-origin',\n\t'origin',\n\t'strict-origin',\n\t'origin-when-cross-origin',\n\t'strict-origin-when-cross-origin',\n\t'unsafe-url'\n]);\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#default-referrer-policy|default referrer policy}\n */\nexport const DEFAULT_REFERRER_POLICY = 'strict-origin-when-cross-origin';\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#referrer-policies|Referrer Policy §3. Referrer Policies}\n * @param {string} referrerPolicy\n * @returns {string} referrerPolicy\n */\nexport function validateReferrerPolicy(referrerPolicy) {\n\tif (!ReferrerPolicy.has(referrerPolicy)) {\n\t\tthrow new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);\n\t}\n\n\treturn referrerPolicy;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy|Referrer Policy §3.2. Is origin potentially trustworthy?}\n * @param {external:URL} url\n * @returns `true`: \"Potentially Trustworthy\", `false`: \"Not Trustworthy\"\n */\nexport function isOriginPotentiallyTrustworthy(url) {\n\t// 1. If origin is an opaque origin, return \"Not Trustworthy\".\n\t// Not applicable\n\n\t// 2. Assert: origin is a tuple origin.\n\t// Not for implementations\n\n\t// 3. If origin's scheme is either \"https\" or \"wss\", return \"Potentially Trustworthy\".\n\tif (/^(http|ws)s:$/.test(url.protocol)) {\n\t\treturn true;\n\t}\n\n\t// 4. If origin's host component matches one of the CIDR notations 127.0.0.0/8 or ::1/128 [RFC4632], return \"Potentially Trustworthy\".\n\tconst hostIp = url.host.replace(/(^\\[)|(]$)/g, '');\n\tconst hostIPVersion = isIP(hostIp);\n\n\tif (hostIPVersion === 4 && /^127\\./.test(hostIp)) {\n\t\treturn true;\n\t}\n\n\tif (hostIPVersion === 6 && /^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)) {\n\t\treturn true;\n\t}\n\n\t// 5. If origin's host component is \"localhost\" or falls within \".localhost\", and the user agent conforms to the name resolution rules in [let-localhost-be-localhost], return \"Potentially Trustworthy\".\n\t// We are returning FALSE here because we cannot ensure conformance to\n\t// let-localhost-be-loalhost (https://tools.ietf.org/html/draft-west-let-localhost-be-localhost)\n\tif (url.host === 'localhost' || url.host.endsWith('.localhost')) {\n\t\treturn false;\n\t}\n\n\t// 6. If origin's scheme component is file, return \"Potentially Trustworthy\".\n\tif (url.protocol === 'file:') {\n\t\treturn true;\n\t}\n\n\t// 7. If origin's scheme component is one which the user agent considers to be authenticated, return \"Potentially Trustworthy\".\n\t// Not supported\n\n\t// 8. If origin has been configured as a trustworthy origin, return \"Potentially Trustworthy\".\n\t// Not supported\n\n\t// 9. Return \"Not Trustworthy\".\n\treturn false;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-url-trustworthy|Referrer Policy §3.3. Is url potentially trustworthy?}\n * @param {external:URL} url\n * @returns `true`: \"Potentially Trustworthy\", `false`: \"Not Trustworthy\"\n */\nexport function isUrlPotentiallyTrustworthy(url) {\n\t// 1. If url is \"about:blank\" or \"about:srcdoc\", return \"Potentially Trustworthy\".\n\tif (/^about:(blank|srcdoc)$/.test(url)) {\n\t\treturn true;\n\t}\n\n\t// 2. If url's scheme is \"data\", return \"Potentially Trustworthy\".\n\tif (url.protocol === 'data:') {\n\t\treturn true;\n\t}\n\n\t// Note: The origin of blob: and filesystem: URLs is the origin of the context in which they were\n\t// created. Therefore, blobs created in a trustworthy origin will themselves be potentially\n\t// trustworthy.\n\tif (/^(blob|filesystem):$/.test(url.protocol)) {\n\t\treturn true;\n\t}\n\n\t// 3. Return the result of executing §3.2 Is origin potentially trustworthy? on url's origin.\n\treturn isOriginPotentiallyTrustworthy(url);\n}\n\n/**\n * Modifies the referrerURL to enforce any extra security policy considerations.\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7\n * @callback module:utils/referrer~referrerURLCallback\n * @param {external:URL} referrerURL\n * @returns {external:URL} modified referrerURL\n */\n\n/**\n * Modifies the referrerOrigin to enforce any extra security policy considerations.\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7\n * @callback module:utils/referrer~referrerOriginCallback\n * @param {external:URL} referrerOrigin\n * @returns {external:URL} modified referrerOrigin\n */\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}\n * @param {Request} request\n * @param {object} o\n * @param {module:utils/referrer~referrerURLCallback} o.referrerURLCallback\n * @param {module:utils/referrer~referrerOriginCallback} o.referrerOriginCallback\n * @returns {external:URL} Request's referrer\n */\nexport function determineRequestsReferrer(request, {referrerURLCallback, referrerOriginCallback} = {}) {\n\t// There are 2 notes in the specification about invalid pre-conditions. We return null, here, for\n\t// these cases:\n\t// > Note: If request's referrer is \"no-referrer\", Fetch will not call into this algorithm.\n\t// > Note: If request's referrer policy is the empty string, Fetch will not call into this\n\t// > algorithm.\n\tif (request.referrer === 'no-referrer' || request.referrerPolicy === '') {\n\t\treturn null;\n\t}\n\n\t// 1. Let policy be request's associated referrer policy.\n\tconst policy = request.referrerPolicy;\n\n\t// 2. Let environment be request's client.\n\t// not applicable to node.js\n\n\t// 3. Switch on request's referrer:\n\tif (request.referrer === 'about:client') {\n\t\treturn 'no-referrer';\n\t}\n\n\t// \"a URL\": Let referrerSource be request's referrer.\n\tconst referrerSource = request.referrer;\n\n\t// 4. Let request's referrerURL be the result of stripping referrerSource for use as a referrer.\n\tlet referrerURL = stripURLForUseAsAReferrer(referrerSource);\n\n\t// 5. Let referrerOrigin be the result of stripping referrerSource for use as a referrer, with the\n\t// origin-only flag set to true.\n\tlet referrerOrigin = stripURLForUseAsAReferrer(referrerSource, true);\n\n\t// 6. If the result of serializing referrerURL is a string whose length is greater than 4096, set\n\t// referrerURL to referrerOrigin.\n\tif (referrerURL.toString().length > 4096) {\n\t\treferrerURL = referrerOrigin;\n\t}\n\n\t// 7. The user agent MAY alter referrerURL or referrerOrigin at this point to enforce arbitrary\n\t// policy considerations in the interests of minimizing data leakage. For example, the user\n\t// agent could strip the URL down to an origin, modify its host, replace it with an empty\n\t// string, etc.\n\tif (referrerURLCallback) {\n\t\treferrerURL = referrerURLCallback(referrerURL);\n\t}\n\n\tif (referrerOriginCallback) {\n\t\treferrerOrigin = referrerOriginCallback(referrerOrigin);\n\t}\n\n\t// 8.Execute the statements corresponding to the value of policy:\n\tconst currentURL = new URL(request.url);\n\n\tswitch (policy) {\n\t\tcase 'no-referrer':\n\t\t\treturn 'no-referrer';\n\n\t\tcase 'origin':\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'unsafe-url':\n\t\t\treturn referrerURL;\n\n\t\tcase 'strict-origin':\n\t\t\t// 1. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 2. Return referrerOrigin.\n\t\t\treturn referrerOrigin.toString();\n\n\t\tcase 'strict-origin-when-cross-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// 2. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 3. Return referrerOrigin.\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'same-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// 2. Return no referrer.\n\t\t\treturn 'no-referrer';\n\n\t\tcase 'origin-when-cross-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// Return referrerOrigin.\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'no-referrer-when-downgrade':\n\t\t\t// 1. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 2. Return referrerURL.\n\t\t\treturn referrerURL;\n\n\t\tdefault:\n\t\t\tthrow new TypeError(`Invalid referrerPolicy: ${policy}`);\n\t}\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#parse-referrer-policy-from-header|Referrer Policy §8.1. Parse a referrer policy from a Referrer-Policy header}\n * @param {Headers} headers Response headers\n * @returns {string} policy\n */\nexport function parseReferrerPolicyFromHeader(headers) {\n\t// 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy`\n\t// and response’s header list.\n\tconst policyTokens = (headers.get('referrer-policy') || '').split(/[,\\s]+/);\n\n\t// 2. Let policy be the empty string.\n\tlet policy = '';\n\n\t// 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty\n\t// string, then set policy to token.\n\t// Note: This algorithm loops over multiple policy values to allow deployment of new policy\n\t// values with fallbacks for older user agents, as described in § 11.1 Unknown Policy Values.\n\tfor (const token of policyTokens) {\n\t\tif (token && ReferrerPolicy.has(token)) {\n\t\t\tpolicy = token;\n\t\t}\n\t}\n\n\t// 4. Return policy.\n\treturn policy;\n}\n","/**\n * Request.js\n *\n * Request class contains server only options\n *\n * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.\n */\n\nimport {format as formatUrl} from 'node:url';\nimport {deprecate} from 'node:util';\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType, getTotalBytes} from './body.js';\nimport {isAbortSignal} from './utils/is.js';\nimport {getSearch} from './utils/get-search.js';\nimport {\n\tvalidateReferrerPolicy, determineRequestsReferrer, DEFAULT_REFERRER_POLICY\n} from './utils/referrer.js';\n\nconst INTERNALS = Symbol('Request internals');\n\n/**\n * Check if `obj` is an instance of Request.\n *\n * @param {*} object\n * @return {boolean}\n */\nconst isRequest = object => {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object[INTERNALS] === 'object'\n\t);\n};\n\nconst doBadDataWarn = deprecate(() => {},\n\t'.data is not a valid RequestInit property, use .body instead',\n\t'https://github.com/node-fetch/node-fetch/issues/1000 (request)');\n\n/**\n * Request class\n *\n * Ref: https://fetch.spec.whatwg.org/#request-class\n *\n * @param Mixed input Url or Request instance\n * @param Object init Custom options\n * @return Void\n */\nexport default class Request extends Body {\n\tconstructor(input, init = {}) {\n\t\tlet parsedURL;\n\n\t\t// Normalize input and force URL to be encoded as UTF-8 (https://github.com/node-fetch/node-fetch/issues/245)\n\t\tif (isRequest(input)) {\n\t\t\tparsedURL = new URL(input.url);\n\t\t} else {\n\t\t\tparsedURL = new URL(input);\n\t\t\tinput = {};\n\t\t}\n\n\t\tif (parsedURL.username !== '' || parsedURL.password !== '') {\n\t\t\tthrow new TypeError(`${parsedURL} is an url with embedded credentials.`);\n\t\t}\n\n\t\tlet method = init.method || input.method || 'GET';\n\t\tif (/^(delete|get|head|options|post|put)$/i.test(method)) {\n\t\t\tmethod = method.toUpperCase();\n\t\t}\n\n\t\tif (!isRequest(init) && 'data' in init) {\n\t\t\tdoBadDataWarn();\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif ((init.body != null || (isRequest(input) && input.body !== null)) &&\n\t\t\t(method === 'GET' || method === 'HEAD')) {\n\t\t\tthrow new TypeError('Request with GET/HEAD method cannot have body');\n\t\t}\n\n\t\tconst inputBody = init.body ?\n\t\t\tinit.body :\n\t\t\t(isRequest(input) && input.body !== null ?\n\t\t\t\tclone(input) :\n\t\t\t\tnull);\n\n\t\tsuper(inputBody, {\n\t\t\tsize: init.size || input.size || 0\n\t\t});\n\n\t\tconst headers = new Headers(init.headers || input.headers || {});\n\n\t\tif (inputBody !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(inputBody, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.set('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tlet signal = isRequest(input) ?\n\t\t\tinput.signal :\n\t\t\tnull;\n\t\tif ('signal' in init) {\n\t\t\tsignal = init.signal;\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif (signal != null && !isAbortSignal(signal)) {\n\t\t\tthrow new TypeError('Expected signal to be an instanceof AbortSignal or EventTarget');\n\t\t}\n\n\t\t// §5.4, Request constructor steps, step 15.1\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tlet referrer = init.referrer == null ? input.referrer : init.referrer;\n\t\tif (referrer === '') {\n\t\t\t// §5.4, Request constructor steps, step 15.2\n\t\t\treferrer = 'no-referrer';\n\t\t} else if (referrer) {\n\t\t\t// §5.4, Request constructor steps, step 15.3.1, 15.3.2\n\t\t\tconst parsedReferrer = new URL(referrer);\n\t\t\t// §5.4, Request constructor steps, step 15.3.3, 15.3.4\n\t\t\treferrer = /^about:(\\/\\/)?client$/.test(parsedReferrer) ? 'client' : parsedReferrer;\n\t\t} else {\n\t\t\treferrer = undefined;\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\tmethod,\n\t\t\tredirect: init.redirect || input.redirect || 'follow',\n\t\t\theaders,\n\t\t\tparsedURL,\n\t\t\tsignal,\n\t\t\treferrer\n\t\t};\n\n\t\t// Node-fetch-only options\n\t\tthis.follow = init.follow === undefined ? (input.follow === undefined ? 20 : input.follow) : init.follow;\n\t\tthis.compress = init.compress === undefined ? (input.compress === undefined ? true : input.compress) : init.compress;\n\t\tthis.counter = init.counter || input.counter || 0;\n\t\tthis.agent = init.agent || input.agent;\n\t\tthis.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;\n\t\tthis.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;\n\n\t\t// §5.4, Request constructor steps, step 16.\n\t\t// Default is empty string per https://fetch.spec.whatwg.org/#concept-request-referrer-policy\n\t\tthis.referrerPolicy = init.referrerPolicy || input.referrerPolicy || '';\n\t}\n\n\t/** @returns {string} */\n\tget method() {\n\t\treturn this[INTERNALS].method;\n\t}\n\n\t/** @returns {string} */\n\tget url() {\n\t\treturn formatUrl(this[INTERNALS].parsedURL);\n\t}\n\n\t/** @returns {Headers} */\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget redirect() {\n\t\treturn this[INTERNALS].redirect;\n\t}\n\n\t/** @returns {AbortSignal} */\n\tget signal() {\n\t\treturn this[INTERNALS].signal;\n\t}\n\n\t// https://fetch.spec.whatwg.org/#dom-request-referrer\n\tget referrer() {\n\t\tif (this[INTERNALS].referrer === 'no-referrer') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer === 'client') {\n\t\t\treturn 'about:client';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer) {\n\t\t\treturn this[INTERNALS].referrer.toString();\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tget referrerPolicy() {\n\t\treturn this[INTERNALS].referrerPolicy;\n\t}\n\n\tset referrerPolicy(referrerPolicy) {\n\t\tthis[INTERNALS].referrerPolicy = validateReferrerPolicy(referrerPolicy);\n\t}\n\n\t/**\n\t * Clone this request\n\t *\n\t * @return Request\n\t */\n\tclone() {\n\t\treturn new Request(this);\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Request';\n\t}\n}\n\nObject.defineProperties(Request.prototype, {\n\tmethod: {enumerable: true},\n\turl: {enumerable: true},\n\theaders: {enumerable: true},\n\tredirect: {enumerable: true},\n\tclone: {enumerable: true},\n\tsignal: {enumerable: true},\n\treferrer: {enumerable: true},\n\treferrerPolicy: {enumerable: true}\n});\n\n/**\n * Convert a Request to Node.js http request options.\n *\n * @param {Request} request - A Request instance\n * @return The options object to be passed to http.request\n */\nexport const getNodeRequestOptions = request => {\n\tconst {parsedURL} = request[INTERNALS];\n\tconst headers = new Headers(request[INTERNALS].headers);\n\n\t// Fetch step 1.3\n\tif (!headers.has('Accept')) {\n\t\theaders.set('Accept', '*/*');\n\t}\n\n\t// HTTP-network-or-cache fetch steps 2.4-2.7\n\tlet contentLengthValue = null;\n\tif (request.body === null && /^(post|put)$/i.test(request.method)) {\n\t\tcontentLengthValue = '0';\n\t}\n\n\tif (request.body !== null) {\n\t\tconst totalBytes = getTotalBytes(request);\n\t\t// Set Content-Length if totalBytes is a number (that is not NaN)\n\t\tif (typeof totalBytes === 'number' && !Number.isNaN(totalBytes)) {\n\t\t\tcontentLengthValue = String(totalBytes);\n\t\t}\n\t}\n\n\tif (contentLengthValue) {\n\t\theaders.set('Content-Length', contentLengthValue);\n\t}\n\n\t// 4.1. Main fetch, step 2.6\n\t// > If request's referrer policy is the empty string, then set request's referrer policy to the\n\t// > default referrer policy.\n\tif (request.referrerPolicy === '') {\n\t\trequest.referrerPolicy = DEFAULT_REFERRER_POLICY;\n\t}\n\n\t// 4.1. Main fetch, step 2.7\n\t// > If request's referrer is not \"no-referrer\", set request's referrer to the result of invoking\n\t// > determine request's referrer.\n\tif (request.referrer && request.referrer !== 'no-referrer') {\n\t\trequest[INTERNALS].referrer = determineRequestsReferrer(request);\n\t} else {\n\t\trequest[INTERNALS].referrer = 'no-referrer';\n\t}\n\n\t// 4.5. HTTP-network-or-cache fetch, step 6.9\n\t// > If httpRequest's referrer is a URL, then append `Referer`/httpRequest's referrer, serialized\n\t// > and isomorphic encoded, to httpRequest's header list.\n\tif (request[INTERNALS].referrer instanceof URL) {\n\t\theaders.set('Referer', request.referrer);\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.11\n\tif (!headers.has('User-Agent')) {\n\t\theaders.set('User-Agent', 'node-fetch');\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.15\n\tif (request.compress && !headers.has('Accept-Encoding')) {\n\t\theaders.set('Accept-Encoding', 'gzip, deflate, br');\n\t}\n\n\tlet {agent} = request;\n\tif (typeof agent === 'function') {\n\t\tagent = agent(parsedURL);\n\t}\n\n\t// HTTP-network fetch step 4.2\n\t// chunked encoding is handled by Node.js\n\n\tconst search = getSearch(parsedURL);\n\n\t// Pass the full URL directly to request(), but overwrite the following\n\t// options:\n\tconst options = {\n\t\t// Overwrite search to retain trailing ? (issue #776)\n\t\tpath: parsedURL.pathname + search,\n\t\t// The following options are not expressed in the URL\n\t\tmethod: request.method,\n\t\theaders: headers[Symbol.for('nodejs.util.inspect.custom')](),\n\t\tinsecureHTTPParser: request.insecureHTTPParser,\n\t\tagent\n\t};\n\n\treturn {\n\t\t/** @type {URL} */\n\t\tparsedURL,\n\t\toptions\n\t};\n};\n","import {FetchBaseError} from './base.js';\n\n/**\n * AbortError interface for cancelled requests\n */\nexport class AbortError extends FetchBaseError {\n\tconstructor(message, type = 'aborted') {\n\t\tsuper(message, type);\n\t}\n}\n","/**\n * Index.js\n *\n * a request API compatible with window.fetch\n *\n * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.\n */\n\nimport http from 'node:http';\nimport https from 'node:https';\nimport zlib from 'node:zlib';\nimport Stream, {PassThrough, pipeline as pump} from 'node:stream';\nimport {Buffer} from 'node:buffer';\n\nimport dataUriToBuffer from 'data-uri-to-buffer';\n\nimport {writeToStream, clone} from './body.js';\nimport Response from './response.js';\nimport Headers, {fromRawHeaders} from './headers.js';\nimport Request, {getNodeRequestOptions} from './request.js';\nimport {FetchError} from './errors/fetch-error.js';\nimport {AbortError} from './errors/abort-error.js';\nimport {isRedirect} from './utils/is-redirect.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\nimport {isDomainOrSubdomain, isSameProtocol} from './utils/is.js';\nimport {parseReferrerPolicyFromHeader} from './utils/referrer.js';\nimport {\n\tBlob,\n\tFile,\n\tfileFromSync,\n\tfileFrom,\n\tblobFromSync,\n\tblobFrom\n} from 'fetch-blob/from.js';\n\nexport {FormData, Headers, Request, Response, FetchError, AbortError, isRedirect};\nexport {Blob, File, fileFromSync, fileFrom, blobFromSync, blobFrom};\n\nconst supportedSchemas = new Set(['data:', 'http:', 'https:']);\n\n/**\n * Fetch function\n *\n * @param {string | URL | import('./request').default} url - Absolute url or Request instance\n * @param {*} [options_] - Fetch options\n * @return {Promise}\n */\nexport default async function fetch(url, options_) {\n\treturn new Promise((resolve, reject) => {\n\t\t// Build request object\n\t\tconst request = new Request(url, options_);\n\t\tconst {parsedURL, options} = getNodeRequestOptions(request);\n\t\tif (!supportedSchemas.has(parsedURL.protocol)) {\n\t\t\tthrow new TypeError(`node-fetch cannot load ${url}. URL scheme \"${parsedURL.protocol.replace(/:$/, '')}\" is not supported.`);\n\t\t}\n\n\t\tif (parsedURL.protocol === 'data:') {\n\t\t\tconst data = dataUriToBuffer(request.url);\n\t\t\tconst response = new Response(data, {headers: {'Content-Type': data.typeFull}});\n\t\t\tresolve(response);\n\t\t\treturn;\n\t\t}\n\n\t\t// Wrap http.request into fetch\n\t\tconst send = (parsedURL.protocol === 'https:' ? https : http).request;\n\t\tconst {signal} = request;\n\t\tlet response = null;\n\n\t\tconst abort = () => {\n\t\t\tconst error = new AbortError('The operation was aborted.');\n\t\t\treject(error);\n\t\t\tif (request.body && request.body instanceof Stream.Readable) {\n\t\t\t\trequest.body.destroy(error);\n\t\t\t}\n\n\t\t\tif (!response || !response.body) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tresponse.body.emit('error', error);\n\t\t};\n\n\t\tif (signal && signal.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\n\t\tconst abortAndFinalize = () => {\n\t\t\tabort();\n\t\t\tfinalize();\n\t\t};\n\n\t\t// Send request\n\t\tconst request_ = send(parsedURL.toString(), options);\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', abortAndFinalize);\n\t\t}\n\n\t\tconst finalize = () => {\n\t\t\trequest_.abort();\n\t\t\tif (signal) {\n\t\t\t\tsignal.removeEventListener('abort', abortAndFinalize);\n\t\t\t}\n\t\t};\n\n\t\trequest_.on('error', error => {\n\t\t\treject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, 'system', error));\n\t\t\tfinalize();\n\t\t});\n\n\t\tfixResponseChunkedTransferBadEnding(request_, error => {\n\t\t\tif (response && response.body) {\n\t\t\t\tresponse.body.destroy(error);\n\t\t\t}\n\t\t});\n\n\t\t/* c8 ignore next 18 */\n\t\tif (process.version < 'v14') {\n\t\t\t// Before Node.js 14, pipeline() does not fully support async iterators and does not always\n\t\t\t// properly handle when the socket close/end events are out of order.\n\t\t\trequest_.on('socket', s => {\n\t\t\t\tlet endedWithEventsCount;\n\t\t\t\ts.prependListener('end', () => {\n\t\t\t\t\tendedWithEventsCount = s._eventsCount;\n\t\t\t\t});\n\t\t\t\ts.prependListener('close', hadError => {\n\t\t\t\t\t// if end happened before close but the socket didn't emit an error, do it now\n\t\t\t\t\tif (response && endedWithEventsCount < s._eventsCount && !hadError) {\n\t\t\t\t\t\tconst error = new Error('Premature close');\n\t\t\t\t\t\terror.code = 'ERR_STREAM_PREMATURE_CLOSE';\n\t\t\t\t\t\tresponse.body.emit('error', error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\trequest_.on('response', response_ => {\n\t\t\trequest_.setTimeout(0);\n\t\t\tconst headers = fromRawHeaders(response_.rawHeaders);\n\n\t\t\t// HTTP fetch step 5\n\t\t\tif (isRedirect(response_.statusCode)) {\n\t\t\t\t// HTTP fetch step 5.2\n\t\t\t\tconst location = headers.get('Location');\n\n\t\t\t\t// HTTP fetch step 5.3\n\t\t\t\tlet locationURL = null;\n\t\t\t\ttry {\n\t\t\t\t\tlocationURL = location === null ? null : new URL(location, request.url);\n\t\t\t\t} catch {\n\t\t\t\t\t// error here can only be invalid URL in Location: header\n\t\t\t\t\t// do not throw when options.redirect == manual\n\t\t\t\t\t// let the user extract the errorneous redirect URL\n\t\t\t\t\tif (request.redirect !== 'manual') {\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// HTTP fetch step 5.5\n\t\t\t\tswitch (request.redirect) {\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase 'manual':\n\t\t\t\t\t\t// Nothing to do\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'follow': {\n\t\t\t\t\t\t// HTTP-redirect fetch step 2\n\t\t\t\t\t\tif (locationURL === null) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 5\n\t\t\t\t\t\tif (request.counter >= request.follow) {\n\t\t\t\t\t\t\treject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 6 (counter increment)\n\t\t\t\t\t\t// Create a new Request object.\n\t\t\t\t\t\tconst requestOptions = {\n\t\t\t\t\t\t\theaders: new Headers(request.headers),\n\t\t\t\t\t\t\tfollow: request.follow,\n\t\t\t\t\t\t\tcounter: request.counter + 1,\n\t\t\t\t\t\t\tagent: request.agent,\n\t\t\t\t\t\t\tcompress: request.compress,\n\t\t\t\t\t\t\tmethod: request.method,\n\t\t\t\t\t\t\tbody: clone(request),\n\t\t\t\t\t\t\tsignal: request.signal,\n\t\t\t\t\t\t\tsize: request.size,\n\t\t\t\t\t\t\treferrer: request.referrer,\n\t\t\t\t\t\t\treferrerPolicy: request.referrerPolicy\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// when forwarding sensitive headers like \"Authorization\",\n\t\t\t\t\t\t// \"WWW-Authenticate\", and \"Cookie\" to untrusted targets,\n\t\t\t\t\t\t// headers will be ignored when following a redirect to a domain\n\t\t\t\t\t\t// that is not a subdomain match or exact match of the initial domain.\n\t\t\t\t\t\t// For example, a redirect from \"foo.com\" to either \"foo.com\" or \"sub.foo.com\"\n\t\t\t\t\t\t// will forward the sensitive headers, but a redirect to \"bar.com\" will not.\n\t\t\t\t\t\t// headers will also be ignored when following a redirect to a domain using\n\t\t\t\t\t\t// a different protocol. For example, a redirect from \"https://foo.com\" to \"http://foo.com\"\n\t\t\t\t\t\t// will not forward the sensitive headers\n\t\t\t\t\t\tif (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {\n\t\t\t\t\t\t\tfor (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {\n\t\t\t\t\t\t\t\trequestOptions.headers.delete(name);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 9\n\t\t\t\t\t\tif (response_.statusCode !== 303 && request.body && options_.body instanceof Stream.Readable) {\n\t\t\t\t\t\t\treject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 11\n\t\t\t\t\t\tif (response_.statusCode === 303 || ((response_.statusCode === 301 || response_.statusCode === 302) && request.method === 'POST')) {\n\t\t\t\t\t\t\trequestOptions.method = 'GET';\n\t\t\t\t\t\t\trequestOptions.body = undefined;\n\t\t\t\t\t\t\trequestOptions.headers.delete('content-length');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 14\n\t\t\t\t\t\tconst responseReferrerPolicy = parseReferrerPolicyFromHeader(headers);\n\t\t\t\t\t\tif (responseReferrerPolicy) {\n\t\t\t\t\t\t\trequestOptions.referrerPolicy = responseReferrerPolicy;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 15\n\t\t\t\t\t\tresolve(fetch(new Request(locationURL, requestOptions)));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Prepare response\n\t\t\tif (signal) {\n\t\t\t\tresponse_.once('end', () => {\n\t\t\t\t\tsignal.removeEventListener('abort', abortAndFinalize);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet body = pump(response_, new PassThrough(), error => {\n\t\t\t\tif (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\t\t\t});\n\t\t\t// see https://github.com/nodejs/node/pull/29376\n\t\t\t/* c8 ignore next 3 */\n\t\t\tif (process.version < 'v12.10') {\n\t\t\t\tresponse_.on('aborted', abortAndFinalize);\n\t\t\t}\n\n\t\t\tconst responseOptions = {\n\t\t\t\turl: request.url,\n\t\t\t\tstatus: response_.statusCode,\n\t\t\t\tstatusText: response_.statusMessage,\n\t\t\t\theaders,\n\t\t\t\tsize: request.size,\n\t\t\t\tcounter: request.counter,\n\t\t\t\thighWaterMark: request.highWaterMark\n\t\t\t};\n\n\t\t\t// HTTP-network fetch step 12.1.1.3\n\t\t\tconst codings = headers.get('Content-Encoding');\n\n\t\t\t// HTTP-network fetch step 12.1.1.4: handle content codings\n\n\t\t\t// in following scenarios we ignore compression support\n\t\t\t// 1. compression support is disabled\n\t\t\t// 2. HEAD request\n\t\t\t// 3. no Content-Encoding header\n\t\t\t// 4. no content response (204)\n\t\t\t// 5. content not modified response (304)\n\t\t\tif (!request.compress || request.method === 'HEAD' || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For Node v6+\n\t\t\t// Be less strict when decoding compressed responses, since sometimes\n\t\t\t// servers send slightly invalid responses that are still accepted\n\t\t\t// by common browsers.\n\t\t\t// Always using Z_SYNC_FLUSH is what cURL does.\n\t\t\tconst zlibOptions = {\n\t\t\t\tflush: zlib.Z_SYNC_FLUSH,\n\t\t\t\tfinishFlush: zlib.Z_SYNC_FLUSH\n\t\t\t};\n\n\t\t\t// For gzip\n\t\t\tif (codings === 'gzip' || codings === 'x-gzip') {\n\t\t\t\tbody = pump(body, zlib.createGunzip(zlibOptions), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For deflate\n\t\t\tif (codings === 'deflate' || codings === 'x-deflate') {\n\t\t\t\t// Handle the infamous raw deflate response from old servers\n\t\t\t\t// a hack for old IIS and Apache servers\n\t\t\t\tconst raw = pump(response_, new PassThrough(), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\traw.once('data', chunk => {\n\t\t\t\t\t// See http://stackoverflow.com/questions/37519828\n\t\t\t\t\tif ((chunk[0] & 0x0F) === 0x08) {\n\t\t\t\t\t\tbody = pump(body, zlib.createInflate(), error => {\n\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbody = pump(body, zlib.createInflateRaw(), error => {\n\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\t\tresolve(response);\n\t\t\t\t});\n\t\t\t\traw.once('end', () => {\n\t\t\t\t\t// Some old IIS servers return zero-length OK deflate responses, so\n\t\t\t\t\t// 'data' is never emitted. See https://github.com/node-fetch/node-fetch/pull/903\n\t\t\t\t\tif (!response) {\n\t\t\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\t\t\tresolve(response);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For br\n\t\t\tif (codings === 'br') {\n\t\t\t\tbody = pump(body, zlib.createBrotliDecompress(), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise, use response as-is\n\t\t\tresponse = new Response(body, responseOptions);\n\t\t\tresolve(response);\n\t\t});\n\n\t\t// eslint-disable-next-line promise/prefer-await-to-then\n\t\twriteToStream(request_, request).catch(reject);\n\t});\n}\n\nfunction fixResponseChunkedTransferBadEnding(request, errorCallback) {\n\tconst LAST_CHUNK = Buffer.from('0\\r\\n\\r\\n');\n\n\tlet isChunkedTransfer = false;\n\tlet properLastChunkReceived = false;\n\tlet previousChunk;\n\n\trequest.on('response', response => {\n\t\tconst {headers} = response;\n\t\tisChunkedTransfer = headers['transfer-encoding'] === 'chunked' && !headers['content-length'];\n\t});\n\n\trequest.on('socket', socket => {\n\t\tconst onSocketClose = () => {\n\t\t\tif (isChunkedTransfer && !properLastChunkReceived) {\n\t\t\t\tconst error = new Error('Premature close');\n\t\t\t\terror.code = 'ERR_STREAM_PREMATURE_CLOSE';\n\t\t\t\terrorCallback(error);\n\t\t\t}\n\t\t};\n\n\t\tconst onData = buf => {\n\t\t\tproperLastChunkReceived = Buffer.compare(buf.slice(-5), LAST_CHUNK) === 0;\n\n\t\t\t// Sometimes final 0-length chunk and end of message code are in separate packets\n\t\t\tif (!properLastChunkReceived && previousChunk) {\n\t\t\t\tproperLastChunkReceived = (\n\t\t\t\t\tBuffer.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 &&\n\t\t\t\t\tBuffer.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpreviousChunk = buf;\n\t\t};\n\n\t\tsocket.prependListener('close', onSocketClose);\n\t\tsocket.on('data', onData);\n\n\t\trequest.on('close', () => {\n\t\t\tsocket.removeListener('close', onSocketClose);\n\t\t\tsocket.removeListener('data', onData);\n\t\t});\n\t});\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Environment-aware HTTP client for the X API SDK.\n * \n * This module provides a universal HTTP client that works in both Node.js and browser environments\n * without requiring manual polyfills.\n */\n\n// Environment detection\nconst isNode =\n typeof process !== 'undefined' && process.versions && process.versions.node;\nconst isBrowser =\n typeof window !== 'undefined' && typeof window.fetch === 'function';\n\n// Type definitions\nexport interface RequestOptions {\n method?: string;\n headers?: Record | Headers;\n body?: string | Buffer | ArrayBuffer | ArrayBufferView;\n signal?: AbortSignal;\n timeout?: number;\n}\n\nexport interface HttpResponse {\n ok: boolean;\n status: number;\n statusText: string;\n headers: Headers;\n url: string;\n json(): Promise;\n text(): Promise;\n arrayBuffer(): Promise;\n}\n\n/**\n * Universal HTTP client that works in both Node.js and browser environments\n */\nexport class HttpClient {\n private fetch: any;\n private HeadersClass: any;\n\n constructor() {\n this.initializeEnvironment();\n }\n\n private initializeEnvironment(): void {\n if (isNode) {\n // Node.js environment - set up polyfills synchronously\n this.initializeNodeEnvironment();\n } else if (isBrowser) {\n // Browser environment - use native APIs\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n } else {\n // Fallback for other environments (Deno, etc.)\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n }\n }\n\n private initializeNodeEnvironment(): void {\n // Check if native fetch is available (Node.js 18+)\n if (\n typeof globalThis.fetch === 'function' &&\n typeof globalThis.Headers === 'function'\n ) {\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n return;\n }\n\n // Try to use node-fetch for older Node.js versions\n try {\n const nodeFetch = require('node-fetch');\n const { Headers: NodeHeaders } = nodeFetch;\n\n this.fetch = nodeFetch.default || nodeFetch;\n this.HeadersClass = NodeHeaders;\n } catch (error) {\n // If node-fetch is not available, provide a helpful error\n throw new Error(\n 'X API SDK: node-fetch not found. For Node.js environments, please install node-fetch:\\n' +\n 'npm install node-fetch\\n' +\n 'Or upgrade to Node.js 18+ for native fetch support.'\n );\n }\n }\n\n /**\n * Create a new Headers instance\n */\n createHeaders(init?: Record | Headers): Headers {\n return new this.HeadersClass(init) as Headers;\n }\n\n /**\n * Make an HTTP request\n */\n async request(\n url: string,\n options: RequestOptions = {}\n ): Promise {\n // Convert body to string if it's a Buffer or ArrayBuffer\n let body = options.body;\n if (body && typeof body !== 'string') {\n if (Buffer.isBuffer(body)) {\n body = body.toString();\n } else if (body instanceof ArrayBuffer) {\n body = new TextDecoder().decode(body);\n } else if (ArrayBuffer.isView(body)) {\n body = new TextDecoder().decode(body);\n }\n }\n\n // Handle timeout\n let signal = options.signal;\n if (options.timeout && options.timeout > 0 && !signal) {\n const controller = new AbortController();\n setTimeout(() => controller.abort(), options.timeout);\n signal = controller.signal;\n }\n\n const response = await this.fetch(url, {\n method: options.method || 'GET',\n headers: options.headers as any,\n body: body as any,\n signal: signal,\n });\n\n return response as HttpResponse;\n }\n\n /**\n * Make a GET request\n */\n async get(\n url: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'GET',\n headers,\n });\n }\n\n /**\n * Make a POST request\n */\n async post(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'POST',\n headers,\n body,\n });\n }\n\n /**\n * Make a PUT request\n */\n async put(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'PUT',\n headers,\n body,\n });\n }\n\n /**\n * Make a DELETE request\n */\n async delete(\n url: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'DELETE',\n headers,\n });\n }\n\n /**\n * Make a PATCH request\n */\n async patch(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'PATCH',\n headers,\n body,\n });\n }\n}\n\n// Export a singleton instance\nexport const httpClient = new HttpClient();\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * activity client for the X API.\n *\n * This module provides a client for interacting with the activity endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetSubscriptionsResponse,\n CreateSubscriptionRequest,\n CreateSubscriptionResponse,\n StreamResponse,\n UpdateSubscriptionRequest,\n UpdateSubscriptionResponse,\n DeleteSubscriptionResponse,\n} from './models.js';\n\n/**\n * Options for createSubscription method\n * \n * @public\n */\nexport interface CreateSubscriptionOptions {\n /** Request body */\n body?: CreateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for stream method\n * \n * @public\n */\nexport interface StreamOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for updateSubscription method\n * \n * @public\n */\nexport interface UpdateSubscriptionOptions {\n /** Request body */\n body?: UpdateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for activity operations\n * \n * This client provides methods for interacting with the activity endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all activity related operations.\n * \n * @category activity\n */\nexport class ActivityClient {\n private client: Client;\n\n /**\n * Creates a new activity client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get X activity subscriptions\n * Get a list of active subscriptions for XAA\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptions(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create X activity subscription\n * Creates a subscription for an X activity event\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubscription(\n options: CreateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Activity Stream\n * Stream of X Activities\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async stream(options: StreamOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update X activity subscription\n * Updates a subscription for an X activity event\n\n\n * @param subscriptionId The ID of the subscription to update.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async updateSubscription(\n subscriptionId: string,\n options: UpdateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions/{subscription_id}';\n\n path = path.replace(\n '{subscription_id}',\n encodeURIComponent(String(subscriptionId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Deletes X activity subscription\n * Deletes a subscription for an X activity event\n\n\n * @param subscriptionId The ID of the subscription to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubscription(\n subscriptionId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions/{subscription_id}';\n\n path = path.replace(\n '{subscription_id}',\n encodeURIComponent(String(subscriptionId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for activity operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getSubscriptions\n * \n * @public\n */\nexport type GetSubscriptionsResponse = Schemas.ActivitySubscriptionGetResponse;\n/**\n * Request for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionRequest = Schemas.ActivitySubscriptionCreateRequest;\n/**\n * Response for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionResponse = Schemas.ActivitySubscriptionCreateResponse;\n/**\n * Response for stream\n * \n * @public\n */\nexport type StreamResponse = Schemas.ActivityStreamingResponse;\n/**\n * Request for updateSubscription\n * \n * @public\n */\nexport type UpdateSubscriptionRequest = Schemas.ActivitySubscriptionUpdateRequest;\n/**\n * Response for updateSubscription\n * \n * @public\n */\nexport type UpdateSubscriptionResponse = Schemas.ActivitySubscriptionUpdateResponse;\n/**\n * Response for deleteSubscription\n * \n * @public\n */\nexport type DeleteSubscriptionResponse = Schemas.ActivitySubscriptionDeleteResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * news client for the X API.\n *\n * This module provides a client for interacting with the news endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetResponse, SearchResponse } from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The number of results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** The maximum age of the News story to search for. \n * Also accepts: max_age_hours or proper camelCase (e.g., maxAgeHours) */\n maxAgeHours?: number;\n\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for news operations\n * \n * This client provides methods for interacting with the news endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all news related operations.\n * \n * @category news\n */\nexport class NewsClient {\n private client: Client;\n\n /**\n * Creates a new news client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get news stories by ID\n * Retrieves news story by its ID.\n\n\n * @param id The ID of the news story.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(id: string, options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/news/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search News\n * Retrieves a list of News stories matching the specified search query.\n\n\n\n * @param query The search query.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n max_age_hours: 'maxAgeHours',\n\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n maxAgeHours = undefined,\n\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/news/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (maxAgeHours !== undefined) {\n params.append('max_age_hours', String(maxAgeHours));\n }\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for news operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2NewsIdResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2NewsSearchResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * connections client for the X API.\n *\n * This module provides a client for interacting with the connections endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { DeleteAllResponse } from './models.js';\n\n/**\n * Client for connections operations\n * \n * This client provides methods for interacting with the connections endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all connections related operations.\n * \n * @category connections\n */\nexport class ConnectionsClient {\n private client: Client;\n\n /**\n * Creates a new connections client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Terminate all connections\n * Terminates all active streaming connections for the authenticated application.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteAll(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/connections/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for connections operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for deleteAll\n * \n * @public\n */\nexport type DeleteAllResponse = Schemas.KillAllConnectionsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * account activity client for the X API.\n *\n * This module provides a client for interacting with the account activity endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetSubscriptionsResponse,\n ValidateSubscriptionResponse,\n CreateSubscriptionRequest,\n CreateSubscriptionResponse,\n GetSubscriptionCountResponse,\n DeleteSubscriptionResponse,\n CreateReplayJobResponse,\n} from './models.js';\n\n/**\n * Options for createSubscription method\n * \n * @public\n */\nexport interface CreateSubscriptionOptions {\n /** Request body */\n body?: CreateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for account activity operations\n * \n * This client provides methods for interacting with the account activity endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all account activity related operations.\n * \n * @category account activity\n */\nexport class AccountActivityClient {\n private client: Client;\n\n /**\n * Creates a new account activity client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get subscriptions\n * Retrieves a list of all active subscriptions for a given webhook.\n\n\n * @param webhookId The webhook ID to pull subscriptions for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptions(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Validate subscription\n * Checks a user’s Account Activity subscription for a given webhook.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async validateSubscription(\n webhookId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create subscription\n * Creates an Account Activity subscription for the user and the given webhook.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubscription(\n webhookId: string,\n options: CreateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get subscription count\n * Retrieves a count of currently active Account Activity subscriptions.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptionCount(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/account_activity/subscriptions/count';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete subscription\n * Deletes an Account Activity subscription for the given webhook and user ID.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n * @param userId User ID to unsubscribe from.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubscription(\n webhookId: string,\n userId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n path = path.replace('{user_id}', encodeURIComponent(String(userId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create replay job\n * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook.\n\n\n * @param webhookId The unique identifier for the webhook configuration.\n\n\n\n\n * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format.\n\n\n\n * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createReplayJob(\n webhookId: string,\n fromDate: string,\n toDate: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (fromDate !== undefined) {\n params.append('from_date', String(fromDate));\n }\n\n if (toDate !== undefined) {\n params.append('to_date', String(toDate));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for account activity operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getSubscriptions\n * \n * @public\n */\nexport type GetSubscriptionsResponse = Schemas.SubscriptionsListGetResponse;\n/**\n * Response for validateSubscription\n * \n * @public\n */\nexport type ValidateSubscriptionResponse = Schemas.SubscriptionsGetResponse;\n/**\n * Request for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionRequest = Schemas.SubscriptionsCreateRequest;\n/**\n * Response for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionResponse = Schemas.SubscriptionsCreateResponse;\n/**\n * Response for getSubscriptionCount\n * \n * @public\n */\nexport type GetSubscriptionCountResponse = Schemas.SubscriptionsCountGetResponse;\n/**\n * Response for deleteSubscription\n * \n * @public\n */\nexport type DeleteSubscriptionResponse = Schemas.SubscriptionsDeleteResponse;\n/**\n * Response for createReplayJob\n * \n * @public\n */\nexport type CreateReplayJobResponse = Schemas.ReplayJobCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * spaces client for the X API.\n *\n * This module provides a client for interacting with the spaces endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetByIdResponse,\n GetBuyersResponse,\n GetPostsResponse,\n GetByCreatorIdsResponse,\n GetByIdsResponse,\n SearchResponse,\n} from './models.js';\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBuyers method\n * \n * @public\n */\nexport interface GetBuyersOptions {\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByCreatorIds method\n * \n * @public\n */\nexport interface GetByCreatorIdsOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The state of Spaces to search for. \n * Also accepts: state or proper camelCase (e.g., state) */\n state?: string;\n\n /** The number of results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for spaces operations\n * \n * This client provides methods for interacting with the spaces endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all spaces related operations.\n * \n * @category spaces\n */\nexport class SpacesClient {\n private client: Client;\n\n /**\n * Creates a new spaces client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get space by ID\n * Retrieves details of a specific space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Space ticket buyers\n * Retrieves a list of Users who purchased tickets to a specific Space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBuyers(\n id: string,\n options: GetBuyersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}/buyers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Space Posts\n * Retrieves a list of Posts shared in a specific Space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Spaces by creator IDs\n * Retrieves details of Spaces created by specified User IDs.\n\n\n\n * @param userIds The IDs of Users to search through.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByCreatorIds(\n userIds: Array,\n options: GetByCreatorIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/by/creator_ids';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userIds !== undefined && userIds.length > 0) {\n params.append('user_ids', userIds.join(','));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Spaces by IDs\n * Retrieves details of multiple Spaces by their IDs.\n\n\n\n * @param ids The list of Space IDs to return.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Spaces\n * Retrieves a list of Spaces matching the specified search query.\n\n\n\n * @param query The search query.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n state = undefined,\n\n maxResults = undefined,\n\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (state !== undefined) {\n params.append('state', String(state));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for spaces operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2SpacesIdResponse;\n/**\n * Response for getBuyers\n * \n * @public\n */\nexport type GetBuyersResponse = Schemas.Get2SpacesIdBuyersResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2SpacesIdTweetsResponse;\n/**\n * Response for getByCreatorIds\n * \n * @public\n */\nexport type GetByCreatorIdsResponse = Schemas.Get2SpacesByCreatorIdsResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2SpacesResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2SpacesSearchResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * trends client for the X API.\n *\n * This module provides a client for interacting with the trends endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetPersonalizedResponse,\n GetByWoeidResponse,\n GetAiResponse,\n} from './models.js';\n\n/**\n * Options for getPersonalized method\n * \n * @public\n */\nexport interface GetPersonalizedOptions {\n /** A comma separated list of PersonalizedTrend fields to display. \n * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */\n personalizedTrendFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByWoeid method\n * \n * @public\n */\nexport interface GetByWoeidOptions {\n /** The maximum number of results. \n * Also accepts: max_trends or proper camelCase (e.g., maxTrends) */\n maxTrends?: number;\n\n /** A comma separated list of Trend fields to display. \n * Also accepts: trend.fields or proper camelCase (e.g., trendFields) */\n trendFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getAi method\n * \n * @public\n */\nexport interface GetAiOptions {\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for trends operations\n * \n * This client provides methods for interacting with the trends endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all trends related operations.\n * \n * @category trends\n */\nexport class TrendsClient {\n private client: Client;\n\n /**\n * Creates a new trends client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get personalized Trends\n * Retrieves personalized trending topics for the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPersonalized(\n options: GetPersonalizedOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'personalized_trend.fields': 'personalizedTrendFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n personalizedTrendFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/personalized_trends';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (\n personalizedTrendFields !== undefined &&\n personalizedTrendFields.length > 0\n ) {\n params.append(\n 'personalized_trend.fields',\n personalizedTrendFields.join(',')\n );\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Trends by WOEID\n * Retrieves trending topics for a specific location identified by its WOEID.\n\n\n * @param woeid The WOEID of the place to lookup a trend for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByWoeid(\n woeid: number,\n options: GetByWoeidOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_trends: 'maxTrends',\n\n 'trend.fields': 'trendFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxTrends = undefined,\n\n trendFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/trends/by/woeid/{woeid}';\n\n path = path.replace('{woeid}', encodeURIComponent(String(woeid)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxTrends !== undefined) {\n params.append('max_trends', String(maxTrends));\n }\n\n if (trendFields !== undefined && trendFields.length > 0) {\n params.append('trend.fields', trendFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get AI Trends by ID\n * Retrieves an AI trend by its ID.\n\n\n * @param id The ID of the ai trend.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAi(id: string, options: GetAiOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/ai_trends/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for trends operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getPersonalized\n * \n * @public\n */\nexport type GetPersonalizedResponse = Schemas.Get2UsersPersonalizedTrendsResponse;\n/**\n * Response for getByWoeid\n * \n * @public\n */\nexport type GetByWoeidResponse = Schemas.Get2TrendsByWoeidWoeidResponse;\n/**\n * Response for getAi\n * \n * @public\n */\nexport type GetAiResponse = Schemas.Get2AiTrendsIdResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * media client for the X API.\n *\n * This module provides a client for interacting with the media endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetByKeyResponse,\n CreateMetadataRequest,\n CreateMetadataResponse,\n FinalizeUploadResponse,\n AppendUploadRequest,\n AppendUploadResponse,\n InitializeUploadRequest,\n InitializeUploadResponse,\n GetByKeysResponse,\n GetUploadStatusResponse,\n UploadRequest,\n UploadResponse,\n GetAnalyticsResponse,\n CreateSubtitlesRequest,\n CreateSubtitlesResponse,\n DeleteSubtitlesRequest,\n DeleteSubtitlesResponse,\n} from './models.js';\n\n/**\n * Options for getByKey method\n * \n * @public\n */\nexport interface GetByKeyOptions {\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createMetadata method\n * \n * @public\n */\nexport interface CreateMetadataOptions {\n /** Request body */\n body?: CreateMetadataRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for appendUpload method\n * \n * @public\n */\nexport interface AppendUploadOptions {\n /** Request body */\n body?: AppendUploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for initializeUpload method\n * \n * @public\n */\nexport interface InitializeUploadOptions {\n /** Request body */\n body?: InitializeUploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByKeys method\n * \n * @public\n */\nexport interface GetByKeysOptions {\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getUploadStatus method\n * \n * @public\n */\nexport interface GetUploadStatusOptions {\n /** The command for the media upload request. \n * Also accepts: command or proper camelCase (e.g., command) */\n command?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for upload method\n * \n * @public\n */\nexport interface UploadOptions {\n /** Request body */\n body?: UploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getAnalytics method\n * \n * @public\n */\nexport interface GetAnalyticsOptions {\n /** A comma separated list of MediaAnalytics fields to display. \n * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */\n mediaAnalyticsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createSubtitles method\n * \n * @public\n */\nexport interface CreateSubtitlesOptions {\n /** Request body */\n body?: CreateSubtitlesRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for deleteSubtitles method\n * \n * @public\n */\nexport interface DeleteSubtitlesOptions {\n /** Request body */\n body?: DeleteSubtitlesRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for media operations\n * \n * This client provides methods for interacting with the media endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all media related operations.\n * \n * @category media\n */\nexport class MediaClient {\n private client: Client;\n\n /**\n * Creates a new media client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Media by media key\n * Retrieves details of a specific Media file by its media key.\n\n\n * @param mediaKey A single Media Key.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByKey(\n mediaKey: string,\n options: GetByKeyOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media.fields': 'mediaFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/{media_key}';\n\n path = path.replace('{media_key}', encodeURIComponent(String(mediaKey)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Media metadata\n * Creates metadata for a Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createMetadata(\n options: CreateMetadataOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/metadata';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Finalize Media upload\n * Finalizes a Media upload request.\n\n\n * @param id The media id of the targeted media to finalize.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async finalizeUpload(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/media/upload/{id}/finalize';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Append Media upload\n * Appends data to a Media upload request.\n\n\n * @param id The media identifier for the media to perform the append operation.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async appendUpload(\n id: string,\n options: AppendUploadOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload/{id}/append';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Initialize media upload\n * Initializes a media upload.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async initializeUpload(\n options: InitializeUploadOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload/initialize';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media by media keys\n * Retrieves details of Media files by their media keys.\n\n\n\n * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByKeys(\n mediaKeys: Array,\n options: GetByKeysOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media.fields': 'mediaFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaKeys !== undefined && mediaKeys.length > 0) {\n params.append('media_keys', mediaKeys.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media upload status\n * Retrieves the status of a Media upload by its ID.\n\n\n\n * @param mediaId Media id for the requested media upload status.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getUploadStatus(\n mediaId: any,\n options: GetUploadStatusOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {};\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n command = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaId !== undefined) {\n params.append('media_id', String(mediaId));\n }\n\n if (command !== undefined) {\n params.append('command', String(command));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Upload media\n * Uploads a media file for use in posts or other content.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async upload(options: UploadOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media analytics\n * Retrieves analytics data for media.\n\n\n\n * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity The granularity for the search counts results.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAnalytics(\n mediaKeys: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n options: GetAnalyticsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media_analytics.fields': 'mediaAnalyticsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaAnalyticsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/analytics';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaKeys !== undefined && mediaKeys.length > 0) {\n params.append('media_keys', mediaKeys.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (mediaAnalyticsFields !== undefined && mediaAnalyticsFields.length > 0) {\n params.append('media_analytics.fields', mediaAnalyticsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Media subtitles\n * Creates subtitles for a specific Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubtitles(\n options: CreateSubtitlesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/subtitles';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Media subtitles\n * Deletes subtitles for a specific Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubtitles(\n options: DeleteSubtitlesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/subtitles';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for media operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getByKey\n * \n * @public\n */\nexport type GetByKeyResponse = Schemas.Get2MediaMediaKeyResponse;\n/**\n * Request for createMetadata\n * \n * @public\n */\nexport type CreateMetadataRequest = Schemas.MetadataCreateRequest;\n/**\n * Response for createMetadata\n * \n * @public\n */\nexport type CreateMetadataResponse = Schemas.MetadataCreateResponse;\n/**\n * Response for finalizeUpload\n * \n * @public\n */\nexport type FinalizeUploadResponse = Schemas.MediaUploadResponse;\n/**\n * Request for appendUpload\n * \n * @public\n */\nexport type AppendUploadRequest = Schemas.MediaUploadAppendRequest;\n/**\n * Response for appendUpload\n * \n * @public\n */\nexport type AppendUploadResponse = Schemas.MediaUploadAppendResponse;\n/**\n * Request for initializeUpload\n * \n * @public\n */\nexport type InitializeUploadRequest = Schemas.MediaUploadConfigRequest;\n/**\n * Response for initializeUpload\n * \n * @public\n */\nexport type InitializeUploadResponse = Schemas.MediaUploadResponse;\n/**\n * Response for getByKeys\n * \n * @public\n */\nexport type GetByKeysResponse = Schemas.Get2MediaResponse;\n/**\n * Response for getUploadStatus\n * \n * @public\n */\nexport type GetUploadStatusResponse = Schemas.MediaUploadResponse;\n/**\n * Request for upload\n * \n * @public\n */\nexport type UploadRequest = Schemas.MediaUploadRequestOneShot;\n/**\n * Response for upload\n * \n * @public\n */\nexport type UploadResponse = Schemas.MediaUploadResponse;\n/**\n * Response for getAnalytics\n * \n * @public\n */\nexport type GetAnalyticsResponse = Schemas.MediaAnalytics;\n/**\n * Request for createSubtitles\n * \n * @public\n */\nexport type CreateSubtitlesRequest = Schemas.SubtitlesCreateRequest;\n/**\n * Response for createSubtitles\n * \n * @public\n */\nexport type CreateSubtitlesResponse = Schemas.SubtitlesCreateResponse;\n/**\n * Request for deleteSubtitles\n * \n * @public\n */\nexport type DeleteSubtitlesRequest = Schemas.SubtitlesDeleteRequest;\n/**\n * Response for deleteSubtitles\n * \n * @public\n */\nexport type DeleteSubtitlesResponse = Schemas.SubtitlesDeleteResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * direct messages client for the X API.\n *\n * This module provides a client for interacting with the direct messages endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n CreateByParticipantIdRequest,\n CreateByParticipantIdResponse,\n GetEventsResponse,\n GetEventsByParticipantIdResponse,\n GetEventsByConversationIdResponse,\n GetEventsByIdResponse,\n DeleteEventsResponse,\n CreateByConversationIdRequest,\n CreateByConversationIdResponse,\n CreateConversationRequest,\n CreateConversationResponse,\n} from './models.js';\n\n/**\n * Options for createByParticipantId method\n * \n * @public\n */\nexport interface CreateByParticipantIdOptions {\n /** Request body */\n body?: CreateByParticipantIdRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEvents method\n * \n * @public\n */\nexport interface GetEventsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsByParticipantId method\n * \n * @public\n */\nexport interface GetEventsByParticipantIdOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsByConversationId method\n * \n * @public\n */\nexport interface GetEventsByConversationIdOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsById method\n * \n * @public\n */\nexport interface GetEventsByIdOptions {\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createByConversationId method\n * \n * @public\n */\nexport interface CreateByConversationIdOptions {\n /** Request body */\n body?: CreateByConversationIdRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createConversation method\n * \n * @public\n */\nexport interface CreateConversationOptions {\n /** Request body */\n body?: CreateConversationRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for direct messages operations\n * \n * This client provides methods for interacting with the direct messages endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all direct messages related operations.\n * \n * @category direct messages\n */\nexport class DirectMessagesClient {\n private client: Client;\n\n /**\n * Creates a new direct messages client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Create DM message by participant ID\n * Sends a new direct message to a specific participant by their ID.\n\n\n * @param participantId The ID of the recipient user that will receive the DM.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createByParticipantId(\n participantId: string,\n options: CreateByParticipantIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/with/{participant_id}/messages';\n\n path = path.replace(\n '{participant_id}',\n encodeURIComponent(String(participantId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events\n * Retrieves a list of recent direct message events across all conversations.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEvents(options: GetEventsOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_events';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events for a DM conversation\n * Retrieves direct message events for a specific conversation.\n\n\n * @param participantId The ID of the participant user for the One to One DM conversation.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsByParticipantId(\n participantId: string,\n options: GetEventsByParticipantIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/with/{participant_id}/dm_events';\n\n path = path.replace(\n '{participant_id}',\n encodeURIComponent(String(participantId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events for a DM conversation\n * Retrieves direct message events for a specific conversation.\n\n\n * @param id The DM conversation ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsByConversationId(\n id: string,\n options: GetEventsByConversationIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/{id}/dm_events';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM event by ID\n * Retrieves details of a specific direct message event by its ID.\n\n\n * @param eventId dm event id.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsById(\n eventId: string,\n options: GetEventsByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_events/{event_id}';\n\n path = path.replace('{event_id}', encodeURIComponent(String(eventId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete DM event\n * Deletes a specific direct message event by its ID, if owned by the authenticated user.\n\n\n * @param eventId The ID of the direct-message event to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteEvents(eventId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/dm_events/{event_id}';\n\n path = path.replace('{event_id}', encodeURIComponent(String(eventId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM message by conversation ID\n * Sends a new direct message to a specific conversation by its ID.\n\n\n * @param dmConversationId The DM Conversation ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createByConversationId(\n dmConversationId: string,\n options: CreateByConversationIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/{dm_conversation_id}/messages';\n\n path = path.replace(\n '{dm_conversation_id}',\n encodeURIComponent(String(dmConversationId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM conversation\n * Initiates a new direct message conversation with specified participants.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createConversation(\n options: CreateConversationOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for direct messages operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Request for createByParticipantId\n * \n * @public\n */\nexport type CreateByParticipantIdRequest = Schemas.CreateMessageRequest;\n/**\n * Response for createByParticipantId\n * \n * @public\n */\nexport type CreateByParticipantIdResponse = Schemas.CreateDmEventResponse;\n/**\n * Response for getEvents\n * \n * @public\n */\nexport type GetEventsResponse = Schemas.Get2DmEventsResponse;\n/**\n * Response for getEventsByParticipantId\n * \n * @public\n */\nexport type GetEventsByParticipantIdResponse = Schemas.Get2DmConversationsWithParticipantIdDmEventsResponse;\n/**\n * Response for getEventsByConversationId\n * \n * @public\n */\nexport type GetEventsByConversationIdResponse = Schemas.Get2DmConversationsIdDmEventsResponse;\n/**\n * Response for getEventsById\n * \n * @public\n */\nexport type GetEventsByIdResponse = Schemas.Get2DmEventsEventIdResponse;\n/**\n * Response for deleteEvents\n * \n * @public\n */\nexport type DeleteEventsResponse = Schemas.DeleteDmResponse;\n/**\n * Request for createByConversationId\n * \n * @public\n */\nexport type CreateByConversationIdRequest = Schemas.CreateMessageRequest;\n/**\n * Response for createByConversationId\n * \n * @public\n */\nexport type CreateByConversationIdResponse = Schemas.CreateDmEventResponse;\n/**\n * Request for createConversation\n * \n * @public\n */\nexport type CreateConversationRequest = Schemas.CreateDmConversationRequest;\n/**\n * Response for createConversation\n * \n * @public\n */\nexport type CreateConversationResponse = Schemas.CreateDmEventResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * posts client for the X API.\n *\n * This module provides a client for interacting with the posts endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetInsights28hrResponse,\n GetRepostsResponse,\n SearchAllResponse,\n GetInsightsHistoricalResponse,\n GetByIdResponse,\n DeleteResponse,\n GetAnalyticsResponse,\n GetByIdsResponse,\n CreateRequest,\n CreateResponse,\n GetCountsRecentResponse,\n GetCountsAllResponse,\n SearchRecentResponse,\n HideReplyRequest,\n HideReplyResponse,\n GetRepostedByResponse,\n GetQuotedResponse,\n GetLikingUsersResponse,\n} from './models.js';\n\n/**\n * Options for getInsights28hr method\n * \n * @public\n */\nexport interface GetInsights28hrOptions {\n /** A comma separated list of Engagement fields to display. \n * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */\n engagementFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getReposts method\n * \n * @public\n */\nexport interface GetRepostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchAll method\n * \n * @public\n */\nexport interface SearchAllOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** This order in which to return results. \n * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */\n sortOrder?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getInsightsHistorical method\n * \n * @public\n */\nexport interface GetInsightsHistoricalOptions {\n /** A comma separated list of Engagement fields to display. \n * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */\n engagementFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getAnalytics method\n * \n * @public\n */\nexport interface GetAnalyticsOptions {\n /** A comma separated list of Analytics fields to display. \n * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */\n analyticsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getCountsRecent method\n * \n * @public\n */\nexport interface GetCountsRecentOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The granularity for the search counts results. \n * Also accepts: granularity or proper camelCase (e.g., granularity) */\n granularity?: string;\n\n /** A comma separated list of SearchCount fields to display. \n * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */\n searchCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getCountsAll method\n * \n * @public\n */\nexport interface GetCountsAllOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The granularity for the search counts results. \n * Also accepts: granularity or proper camelCase (e.g., granularity) */\n granularity?: string;\n\n /** A comma separated list of SearchCount fields to display. \n * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */\n searchCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchRecent method\n * \n * @public\n */\nexport interface SearchRecentOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** This order in which to return results. \n * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */\n sortOrder?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for hideReply method\n * \n * @public\n */\nexport interface HideReplyOptions {\n /** Request body */\n body?: HideReplyRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getRepostedBy method\n * \n * @public\n */\nexport interface GetRepostedByOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getQuoted method\n * \n * @public\n */\nexport interface GetQuotedOptions {\n /** The maximum number of results to be returned. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getLikingUsers method\n * \n * @public\n */\nexport interface GetLikingUsersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for posts operations\n * \n * This client provides methods for interacting with the posts endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all posts related operations.\n * \n * @category posts\n */\nexport class PostsClient {\n private client: Client;\n\n /**\n * Creates a new posts client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get 28-hour Post insights\n * Retrieves engagement metrics for specified Posts over the last 28 hours.\n\n\n\n * @param tweetIds List of PostIds for 28hr metrics.\n\n\n\n * @param granularity granularity of metrics response.\n\n\n\n * @param requestedMetrics request metrics for historical request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getInsights28hr(\n tweetIds: Array,\n granularity: string,\n requestedMetrics: Array,\n options: GetInsights28hrOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'engagement.fields': 'engagementFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n engagementFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/insights/28hr';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetIds !== undefined && tweetIds.length > 0) {\n params.append('tweet_ids', tweetIds.join(','));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (requestedMetrics !== undefined && requestedMetrics.length > 0) {\n params.append('requested_metrics', requestedMetrics.join(','));\n }\n\n if (engagementFields !== undefined && engagementFields.length > 0) {\n params.append('engagement.fields', engagementFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposts\n * Retrieves a list of Posts that repost a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getReposts(\n id: string,\n options: GetRepostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/retweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search all Posts\n * Retrieves Posts from the full archive matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchAll(\n query: string,\n options: SearchAllOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n sort_order: 'sortOrder',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n sortOrder = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (sortOrder !== undefined) {\n params.append('sort_order', String(sortOrder));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get historical Post insights\n * Retrieves historical engagement metrics for specified Posts within a defined time range.\n\n\n\n * @param tweetIds List of PostIds for historical metrics.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity granularity of metrics response.\n\n\n\n * @param requestedMetrics request metrics for historical request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getInsightsHistorical(\n tweetIds: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n requestedMetrics: Array,\n options: GetInsightsHistoricalOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'engagement.fields': 'engagementFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n engagementFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/insights/historical';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetIds !== undefined && tweetIds.length > 0) {\n params.append('tweet_ids', tweetIds.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (requestedMetrics !== undefined && requestedMetrics.length > 0) {\n params.append('requested_metrics', requestedMetrics.join(','));\n }\n\n if (engagementFields !== undefined && engagementFields.length > 0) {\n params.append('engagement.fields', engagementFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Post by ID\n * Retrieves details of a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Post\n * Deletes a specific Post by its ID, if owned by the authenticated user.\n\n\n * @param id The ID of the Post to be deleted.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Post analytics\n * Retrieves analytics data for specified Posts within a defined time range.\n\n\n\n * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity The granularity for the search counts results.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAnalytics(\n ids: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n options: GetAnalyticsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'analytics.fields': 'analyticsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n analyticsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/analytics';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (analyticsFields !== undefined && analyticsFields.length > 0) {\n params.append('analytics.fields', analyticsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Posts by IDs\n * Retrieves details of multiple Posts by their IDs.\n\n\n\n * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create or Edit Post\n * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided.\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(body: CreateRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get count of recent Posts\n * Retrieves the count of Posts from the last 7 days matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getCountsRecent(\n query: string,\n options: GetCountsRecentOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'search_count.fields': 'searchCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n granularity = undefined,\n\n searchCountFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/counts/recent';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (searchCountFields !== undefined && searchCountFields.length > 0) {\n params.append('search_count.fields', searchCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get count of all Posts\n * Retrieves the count of Posts matching a search query from the full archive.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getCountsAll(\n query: string,\n options: GetCountsAllOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'search_count.fields': 'searchCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n granularity = undefined,\n\n searchCountFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/counts/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (searchCountFields !== undefined && searchCountFields.length > 0) {\n params.append('search_count.fields', searchCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search recent Posts\n * Retrieves Posts from the last 7 days matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchRecent(\n query: string,\n options: SearchRecentOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n sort_order: 'sortOrder',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n sortOrder = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/recent';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (sortOrder !== undefined) {\n params.append('sort_order', String(sortOrder));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Hide reply\n * Hides or unhides a reply to a conversation owned by the authenticated user.\n\n\n * @param tweetId The ID of the reply that you want to hide or unhide.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async hideReply(\n tweetId: string,\n options: HideReplyOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{tweet_id}/hidden';\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.moderate.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposted by\n * Retrieves a list of Users who reposted a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getRepostedBy(\n id: string,\n options: GetRepostedByOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/retweeted_by';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Quoted Posts\n * Retrieves a list of Posts that quote a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getQuoted(\n id: string,\n options: GetQuotedOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/quote_tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Liking Users\n * Retrieves a list of Users who liked a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getLikingUsers(\n id: string,\n options: GetLikingUsersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/liking_users';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for posts operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getInsights28hr\n * \n * @public\n */\nexport type GetInsights28hrResponse = Schemas.Get2Insights28hrResponse;\n/**\n * Response for getReposts\n * \n * @public\n */\nexport type GetRepostsResponse = Schemas.Get2TweetsIdRetweetsResponse;\n/**\n * Response for searchAll\n * \n * @public\n */\nexport type SearchAllResponse = Schemas.Get2TweetsSearchAllResponse;\n/**\n * Response for getInsightsHistorical\n * \n * @public\n */\nexport type GetInsightsHistoricalResponse = Schemas.Get2InsightsHistoricalResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2TweetsIdResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.TweetDeleteResponse;\n/**\n * Response for getAnalytics\n * \n * @public\n */\nexport type GetAnalyticsResponse = Schemas.Analytics;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2TweetsResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.TweetCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.TweetCreateResponse;\n/**\n * Response for getCountsRecent\n * \n * @public\n */\nexport type GetCountsRecentResponse = Schemas.Get2TweetsCountsRecentResponse;\n/**\n * Response for getCountsAll\n * \n * @public\n */\nexport type GetCountsAllResponse = Schemas.Get2TweetsCountsAllResponse;\n/**\n * Response for searchRecent\n * \n * @public\n */\nexport type SearchRecentResponse = Schemas.Get2TweetsSearchRecentResponse;\n/**\n * Request for hideReply\n * \n * @public\n */\nexport type HideReplyRequest = Schemas.TweetHideRequest;\n/**\n * Response for hideReply\n * \n * @public\n */\nexport type HideReplyResponse = Schemas.TweetHideResponse;\n/**\n * Response for getRepostedBy\n * \n * @public\n */\nexport type GetRepostedByResponse = Schemas.Get2TweetsIdRetweetedByResponse;\n/**\n * Response for getQuoted\n * \n * @public\n */\nexport type GetQuotedResponse = Schemas.Get2TweetsIdQuoteTweetsResponse;\n/**\n * Response for getLikingUsers\n * \n * @public\n */\nexport type GetLikingUsersResponse = Schemas.Get2TweetsIdLikingUsersResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * lists client for the X API.\n *\n * This module provides a client for interacting with the lists endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetMembersResponse,\n AddMemberRequest,\n AddMemberResponse,\n GetFollowersResponse,\n GetPostsResponse,\n RemoveMemberByUserIdResponse,\n GetByIdResponse,\n UpdateRequest,\n UpdateResponse,\n DeleteResponse,\n CreateRequest,\n CreateResponse,\n} from './models.js';\n\n/**\n * Options for getMembers method\n * \n * @public\n */\nexport interface GetMembersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for addMember method\n * \n * @public\n */\nexport interface AddMemberOptions {\n /** Request body */\n body?: AddMemberRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowers method\n * \n * @public\n */\nexport interface GetFollowersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for update method\n * \n * @public\n */\nexport interface UpdateOptions {\n /** Request body */\n body?: UpdateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for lists operations\n * \n * This client provides methods for interacting with the lists endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all lists related operations.\n * \n * @category lists\n */\nexport class ListsClient {\n private client: Client;\n\n /**\n * Creates a new lists client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get List members\n * Retrieves a list of Users who are members of a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMembers(\n id: string,\n options: GetMembersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Add List member\n * Adds a User to a specific List by its ID.\n\n\n * @param id The ID of the List for which to add a member.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async addMember(\n id: string,\n options: AddMemberOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List followers\n * Retrieves a list of Users who follow a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowers(\n id: string,\n options: GetFollowersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/followers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List Posts\n * Retrieves a list of Posts associated with a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Remove List member\n * Removes a User from a specific List by its ID and the User’s ID.\n\n\n * @param id The ID of the List to remove a member.\n\n\n\n * @param userId The ID of User that will be removed from the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async removeMemberByUserId(\n id: string,\n userId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members/{user_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{user_id}', encodeURIComponent(String(userId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List by ID\n * Retrieves details of a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update List\n * Updates the details of a specific List owned by the authenticated user by its ID.\n\n\n * @param id The ID of the List to modify.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async update(\n id: string,\n options: UpdateOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete List\n * Deletes a specific List owned by the authenticated user by its ID.\n\n\n * @param id The ID of the List to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create List\n * Creates a new List for the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: [\n 'list.read',\n 'list.write',\n 'tweet.read',\n 'users.read',\n ],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for lists operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getMembers\n * \n * @public\n */\nexport type GetMembersResponse = Schemas.Get2ListsIdMembersResponse;\n/**\n * Request for addMember\n * \n * @public\n */\nexport type AddMemberRequest = Schemas.ListAddUserRequest;\n/**\n * Response for addMember\n * \n * @public\n */\nexport type AddMemberResponse = Schemas.ListMutateResponse;\n/**\n * Response for getFollowers\n * \n * @public\n */\nexport type GetFollowersResponse = Schemas.Get2ListsIdFollowersResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2ListsIdTweetsResponse;\n/**\n * Response for removeMemberByUserId\n * \n * @public\n */\nexport type RemoveMemberByUserIdResponse = Schemas.ListMutateResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2ListsIdResponse;\n/**\n * Request for update\n * \n * @public\n */\nexport type UpdateRequest = Schemas.ListUpdateRequest;\n/**\n * Response for update\n * \n * @public\n */\nexport type UpdateResponse = Schemas.ListUpdateResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.ListDeleteResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.ListCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.ListCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * community notes client for the X API.\n *\n * This module provides a client for interacting with the community notes endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n DeleteResponse,\n EvaluateRequest,\n EvaluateResponse,\n SearchWrittenResponse,\n CreateRequest,\n CreateResponse,\n SearchEligiblePostsResponse,\n} from './models.js';\n\n/**\n * Options for evaluate method\n * \n * @public\n */\nexport interface EvaluateOptions {\n /** Request body */\n body?: EvaluateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchWritten method\n * \n * @public\n */\nexport interface SearchWrittenOptions {\n /** Pagination token to get next set of posts eligible for notes. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Max results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Note fields to display. \n * Also accepts: note.fields or proper camelCase (e.g., noteFields) */\n noteFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchEligiblePosts method\n * \n * @public\n */\nexport interface SearchEligiblePostsOptions {\n /** Pagination token to get next set of posts eligible for notes. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Max results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. \n * Also accepts: post_selection or proper camelCase (e.g., postSelection) */\n postSelection?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for community notes operations\n * \n * This client provides methods for interacting with the community notes endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all community notes related operations.\n * \n * @category community notes\n */\nexport class CommunityNotesClient {\n private client: Client;\n\n /**\n * Creates a new community notes client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Delete a Community Note\n * Deletes a community note.\n\n\n * @param id The community note id to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/notes/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Evaluate a Community Note\n * Endpoint to evaluate a community note.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async evaluate(options: EvaluateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/evaluate_note';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search for Community Notes Written\n * Returns all the community notes written by the user.\n\n\n\n * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchWritten(\n testMode: boolean,\n options: SearchWrittenOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n 'note.fields': 'noteFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n noteFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes/search/notes_written';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (testMode !== undefined) {\n params.append('test_mode', String(testMode));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (noteFields !== undefined && noteFields.length > 0) {\n params.append('note.fields', noteFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create a Community Note\n * Creates a community note endpoint for LLM use case.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search for Posts Eligible for Community Notes\n * Returns all the posts that are eligible for community notes.\n\n\n\n * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchEligiblePosts(\n testMode: boolean,\n options: SearchEligiblePostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n post_selection: 'postSelection',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n postSelection = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes/search/posts_eligible_for_notes';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (testMode !== undefined) {\n params.append('test_mode', String(testMode));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (postSelection !== undefined) {\n params.append('post_selection', String(postSelection));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for community notes operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.DeleteNoteResponse;\n/**\n * Request for evaluate\n * \n * @public\n */\nexport type EvaluateRequest = Schemas.EvaluateNoteRequest;\n/**\n * Response for evaluate\n * \n * @public\n */\nexport type EvaluateResponse = Schemas.EvaluateNoteResponse;\n/**\n * Response for searchWritten\n * \n * @public\n */\nexport type SearchWrittenResponse = Schemas.Get2NotesSearchNotesWrittenResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.CreateNoteRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.CreateNoteResponse;\n/**\n * Response for searchEligiblePosts\n * \n * @public\n */\nexport type SearchEligiblePostsResponse = Schemas.Get2NotesSearchPostsEligibleForNotesResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * general client for the X API.\n *\n * This module provides a client for interacting with the general endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetOpenApiSpecResponse } from './models.js';\n\n/**\n * Client for general operations\n * \n * This client provides methods for interacting with the general endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all general related operations.\n * \n * @category general\n */\nexport class GeneralClient {\n private client: Client;\n\n /**\n * Creates a new general client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get OpenAPI Spec.\n * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md)\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getOpenApiSpec(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/openapi.json';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for general operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n\n/**\n * Response for getOpenApiSpec\n * \n * @public\n */\nexport type GetOpenApiSpecResponse = Record;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * webhooks client for the X API.\n *\n * This module provides a client for interacting with the webhooks endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetResponse,\n CreateRequest,\n CreateResponse,\n ValidateResponse,\n DeleteResponse,\n CreateStreamLinkResponse,\n DeleteStreamLinkResponse,\n GetStreamLinksResponse,\n} from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** A comma separated list of WebhookConfig fields to display. \n * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */\n webhookConfigFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createStreamLink method\n * \n * @public\n */\nexport interface CreateStreamLinkOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: string;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: string;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: string;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: string;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: string;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for webhooks operations\n * \n * This client provides methods for interacting with the webhooks endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all webhooks related operations.\n * \n * @category webhooks\n */\nexport class WebhooksClient {\n private client: Client;\n\n /**\n * Creates a new webhooks client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get webhook\n * Get a list of webhook configs associated with a client app.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'webhook_config.fields': 'webhookConfigFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n webhookConfigFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (webhookConfigFields !== undefined && webhookConfigFields.length > 0) {\n params.append('webhook_config.fields', webhookConfigFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create webhook\n * Creates a new webhook configuration.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Validate webhook\n * Triggers a CRC check for a given webhook.\n\n\n * @param webhookId The ID of the webhook to check.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async validate(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete webhook\n * Deletes an existing webhook configuration.\n\n\n * @param webhookId The ID of the webhook to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create stream link\n * Creates a link to deliver FilteredStream events to the given webhook.\n\n\n * @param webhookId The webhook ID to link to your FilteredStream ruleset.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createStreamLink(\n webhookId: string,\n options: CreateStreamLinkOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = undefined,\n\n expansions = undefined,\n\n mediaFields = undefined,\n\n pollFields = undefined,\n\n userFields = undefined,\n\n placeFields = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetFields !== undefined) {\n params.append('tweet.fields', String(tweetFields));\n }\n\n if (expansions !== undefined) {\n params.append('expansions', String(expansions));\n }\n\n if (mediaFields !== undefined) {\n params.append('media.fields', String(mediaFields));\n }\n\n if (pollFields !== undefined) {\n params.append('poll.fields', String(pollFields));\n }\n\n if (userFields !== undefined) {\n params.append('user.fields', String(userFields));\n }\n\n if (placeFields !== undefined) {\n params.append('place.fields', String(placeFields));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete stream link\n * Deletes a link from FilteredStream events to the given webhook.\n\n\n * @param webhookId The webhook ID to link to your FilteredStream ruleset.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteStreamLink(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get stream links\n * Get a list of webhook links associated with a filtered stream ruleset.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getStreamLinks(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for webhooks operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2WebhooksResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.WebhookConfigCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.WebhookConfigCreateResponse;\n/**\n * Response for validate\n * \n * @public\n */\nexport type ValidateResponse = Schemas.WebhookConfigPutResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.WebhookConfigDeleteResponse;\n/**\n * Response for createStreamLink\n * \n * @public\n */\nexport type CreateStreamLinkResponse = Schemas.WebhookLinksCreateResponse;\n/**\n * Response for deleteStreamLink\n * \n * @public\n */\nexport type DeleteStreamLinkResponse = Schemas.WebhookLinksDeleteResponse;\n/**\n * Response for getStreamLinks\n * \n * @public\n */\nexport type GetStreamLinksResponse = Schemas.WebhookLinksGetResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * users client for the X API.\n *\n * This module provides a client for interacting with the users endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetByUsernamesResponse,\n GetListMembershipsResponse,\n UnfollowUserResponse,\n UnfollowListResponse,\n GetByIdsResponse,\n LikePostRequest,\n LikePostResponse,\n BlockDmsResponse,\n GetPostsResponse,\n GetBookmarksByFolderIdResponse,\n GetMutingResponse,\n MuteUserRequest,\n MuteUserResponse,\n GetOwnedListsResponse,\n UnpinListResponse,\n GetByUsernameResponse,\n GetBlockingResponse,\n GetLikedPostsResponse,\n UnlikePostResponse,\n GetFollowedListsResponse,\n FollowListRequest,\n FollowListResponse,\n GetTimelineResponse,\n GetPinnedListsResponse,\n PinListRequest,\n PinListResponse,\n GetRepostsOfMeResponse,\n GetFollowingResponse,\n FollowUserRequest,\n FollowUserResponse,\n UnblockDmsResponse,\n GetMentionsResponse,\n GetBookmarkFoldersResponse,\n UnrepostPostResponse,\n DeleteBookmarkResponse,\n RepostPostRequest,\n RepostPostResponse,\n SearchResponse,\n GetByIdResponse,\n GetBookmarksResponse,\n CreateBookmarkRequest,\n CreateBookmarkResponse,\n GetFollowersResponse,\n GetMeResponse,\n UnmuteUserResponse,\n} from './models.js';\n\n/**\n * Options for getByUsernames method\n * \n * @public\n */\nexport interface GetByUsernamesOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getListMemberships method\n * \n * @public\n */\nexport interface GetListMembershipsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for likePost method\n * \n * @public\n */\nexport interface LikePostOptions {\n /** Request body */\n body?: LikePostRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMuting method\n * \n * @public\n */\nexport interface GetMutingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for muteUser method\n * \n * @public\n */\nexport interface MuteUserOptions {\n /** Request body */\n body?: MuteUserRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getOwnedLists method\n * \n * @public\n */\nexport interface GetOwnedListsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByUsername method\n * \n * @public\n */\nexport interface GetByUsernameOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBlocking method\n * \n * @public\n */\nexport interface GetBlockingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getLikedPosts method\n * \n * @public\n */\nexport interface GetLikedPostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowedLists method\n * \n * @public\n */\nexport interface GetFollowedListsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for followList method\n * \n * @public\n */\nexport interface FollowListOptions {\n /** Request body */\n body?: FollowListRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getTimeline method\n * \n * @public\n */\nexport interface GetTimelineOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPinnedLists method\n * \n * @public\n */\nexport interface GetPinnedListsOptions {\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getRepostsOfMe method\n * \n * @public\n */\nexport interface GetRepostsOfMeOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowing method\n * \n * @public\n */\nexport interface GetFollowingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for followUser method\n * \n * @public\n */\nexport interface FollowUserOptions {\n /** Request body */\n body?: FollowUserRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMentions method\n * \n * @public\n */\nexport interface GetMentionsOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBookmarkFolders method\n * \n * @public\n */\nexport interface GetBookmarkFoldersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for repostPost method\n * \n * @public\n */\nexport interface RepostPostOptions {\n /** Request body */\n body?: RepostPostRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBookmarks method\n * \n * @public\n */\nexport interface GetBookmarksOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowers method\n * \n * @public\n */\nexport interface GetFollowersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMe method\n * \n * @public\n */\nexport interface GetMeOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for users operations\n * \n * This client provides methods for interacting with the users endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all users related operations.\n * \n * @category users\n */\nexport class UsersClient {\n private client: Client;\n\n /**\n * Creates a new users client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Users by usernames\n * Retrieves details of multiple Users by their usernames.\n\n\n\n * @param usernames A list of usernames, comma-separated.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByUsernames(\n usernames: Array,\n options: GetByUsernamesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/by';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (usernames !== undefined && usernames.length > 0) {\n params.append('usernames', usernames.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List memberships\n * Retrieves a list of Lists that a specific User is a member of by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getListMemberships(\n id: string,\n options: GetListMembershipsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/list_memberships';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unfollow User\n * Causes the authenticated user to unfollow a specific user by their ID.\n\n\n * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User.\n\n\n\n * @param targetUserId The ID of the User that the source User is requesting to unfollow.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unfollowUser(\n sourceUserId: string,\n targetUserId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{source_user_id}/following/{target_user_id}';\n\n path = path.replace(\n '{source_user_id}',\n encodeURIComponent(String(sourceUserId))\n );\n\n path = path.replace(\n '{target_user_id}',\n encodeURIComponent(String(targetUserId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unfollow List\n * Causes the authenticated user to unfollow a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will unfollow the List.\n\n\n\n * @param listId The ID of the List to unfollow.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unfollowList(\n id: string,\n listId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists/{list_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{list_id}', encodeURIComponent(String(listId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Users by IDs\n * Retrieves details of multiple Users by their IDs.\n\n\n\n * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Like Post\n * Causes the authenticated user to Like a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to like the Post.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async likePost(\n id: string,\n options: LikePostOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/likes';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Block DMs\n * Blocks direct messages to or from a specific User by their ID for the authenticated user.\n\n\n * @param id The ID of the target User that the authenticated user requesting to block dms for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async blockDms(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/dm/block';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Posts\n * Retrieves a list of posts authored by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmarks by folder ID\n * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarksByFolderId(\n id: string,\n folderId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/folders/{folder_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{folder_id}', encodeURIComponent(String(folderId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get muting\n * Retrieves a list of Users muted by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMuting(\n id: string,\n options: GetMutingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/muting';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Mute User\n * Causes the authenticated user to mute a specific User by their ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to mute the target User.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async muteUser(\n id: string,\n options: MuteUserOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/muting';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get owned Lists\n * Retrieves a list of Lists owned by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getOwnedLists(\n id: string,\n options: GetOwnedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/owned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unpin List\n * Causes the authenticated user to unpin a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n * @param listId The ID of the List to unpin.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unpinList(id: string, listId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists/{list_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{list_id}', encodeURIComponent(String(listId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get User by username\n * Retrieves details of a specific User by their username.\n\n\n * @param username A username.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByUsername(\n username: string,\n options: GetByUsernameOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/by/username/{username}';\n\n path = path.replace('{username}', encodeURIComponent(String(username)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get blocking\n * Retrieves a list of Users blocked by the specified User ID.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBlocking(\n id: string,\n options: GetBlockingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/blocking';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['block.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get liked Posts\n * Retrieves a list of Posts liked by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getLikedPosts(\n id: string,\n options: GetLikedPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/liked_tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unlike Post\n * Causes the authenticated user to Unlike a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to unlike the Post.\n\n\n\n * @param tweetId The ID of the Post that the User is requesting to unlike.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unlikePost(id: string, tweetId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/likes/{tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get followed Lists\n * Retrieves a list of Lists followed by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowedLists(\n id: string,\n options: GetFollowedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Follow List\n * Causes the authenticated user to follow a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will follow the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async followList(\n id: string,\n options: FollowListOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Timeline\n * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline.\n\n\n * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getTimeline(\n id: string,\n options: GetTimelineOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/timelines/reverse_chronological';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get pinned Lists\n * Retrieves a list of Lists pinned by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPinnedLists(\n id: string,\n options: GetPinnedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Pin List\n * Causes the authenticated user to pin a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will pin the List.\n\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async pinList(id: string, body: PinListRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposts of me\n * Retrieves a list of Posts that repost content from the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getRepostsOfMe(\n options: GetRepostsOfMeOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/reposts_of_me';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['timeline.read', 'tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get following\n * Retrieves a list of Users followed by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowing(\n id: string,\n options: GetFollowingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/following';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Follow User\n * Causes the authenticated user to follow a specific user by their ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to follow the target User.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async followUser(\n id: string,\n options: FollowUserOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/following';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unblock DMs\n * Unblocks direct messages to or from a specific User by their ID for the authenticated user.\n\n\n * @param id The ID of the target User that the authenticated user requesting to unblock dms for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unblockDms(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/dm/unblock';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get mentions\n * Retrieves a list of Posts that mention a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMentions(\n id: string,\n options: GetMentionsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/mentions';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmark folders\n * Retrieves a list of Bookmark folders created by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarkFolders(\n id: string,\n options: GetBookmarkFoldersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/folders';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unrepost Post\n * Causes the authenticated user to unrepost a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to repost the Post.\n\n\n\n * @param sourceTweetId The ID of the Post that the User is requesting to unretweet.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unrepostPost(\n id: string,\n sourceTweetId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/retweets/{source_tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace(\n '{source_tweet_id}',\n encodeURIComponent(String(sourceTweetId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Bookmark\n * Removes a Post from the authenticated user’s Bookmarks by its ID.\n\n\n * @param id The ID of the authenticated source User whose bookmark is to be removed.\n\n\n\n * @param tweetId The ID of the Post that the source User is removing from bookmarks.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteBookmark(\n id: string,\n tweetId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/{tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Repost Post\n * Causes the authenticated user to repost a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to repost the Post.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async repostPost(\n id: string,\n options: RepostPostOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/retweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Users\n * Retrieves a list of Users matching a search query.\n\n\n\n * @param query TThe the query string by which to query for users.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: any,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n nextToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get User by ID\n * Retrieves details of a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmarks\n * Retrieves a list of Posts bookmarked by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarks(\n id: string,\n options: GetBookmarksOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Bookmark\n * Adds a post to the authenticated user’s bookmarks.\n\n\n * @param id The ID of the authenticated source User for whom to add bookmarks.\n\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createBookmark(\n id: string,\n body: CreateBookmarkRequest\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get followers\n * Retrieves a list of Users who follow a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowers(\n id: string,\n options: GetFollowersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get my User\n * Retrieves details of the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMe(options: GetMeOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/me';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unmute User\n * Causes the authenticated user to unmute a specific user by their ID.\n\n\n * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User.\n\n\n\n * @param targetUserId The ID of the User that the source User is requesting to unmute.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unmuteUser(\n sourceUserId: string,\n targetUserId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{source_user_id}/muting/{target_user_id}';\n\n path = path.replace(\n '{source_user_id}',\n encodeURIComponent(String(sourceUserId))\n );\n\n path = path.replace(\n '{target_user_id}',\n encodeURIComponent(String(targetUserId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for users operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getByUsernames\n * \n * @public\n */\nexport type GetByUsernamesResponse = Schemas.Get2UsersByResponse;\n/**\n * Response for getListMemberships\n * \n * @public\n */\nexport type GetListMembershipsResponse = Schemas.Get2UsersIdListMembershipsResponse;\n/**\n * Response for unfollowUser\n * \n * @public\n */\nexport type UnfollowUserResponse = Schemas.UsersFollowingDeleteResponse;\n/**\n * Response for unfollowList\n * \n * @public\n */\nexport type UnfollowListResponse = Schemas.ListFollowedResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2UsersResponse;\n/**\n * Request for likePost\n * \n * @public\n */\nexport type LikePostRequest = Schemas.UsersLikesCreateRequest;\n/**\n * Response for likePost\n * \n * @public\n */\nexport type LikePostResponse = Schemas.UsersLikesCreateResponse;\n/**\n * Response for blockDms\n * \n * @public\n */\nexport type BlockDmsResponse = Schemas.UsersDMBlockCreateResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2UsersIdTweetsResponse;\n/**\n * Response for getBookmarksByFolderId\n * \n * @public\n */\nexport type GetBookmarksByFolderIdResponse = Schemas.BookmarkFolderPostsResponse;\n/**\n * Response for getMuting\n * \n * @public\n */\nexport type GetMutingResponse = Schemas.Get2UsersIdMutingResponse;\n\n/**\n * Request for muteUser\n * \n * @public\n */\nexport type { MuteUserRequest as MuteUserRequest } from '../schemas.js';\n/**\n * Response for muteUser\n * \n * @public\n */\nexport type MuteUserResponse = Schemas.MuteUserMutationResponse;\n/**\n * Response for getOwnedLists\n * \n * @public\n */\nexport type GetOwnedListsResponse = Schemas.Get2UsersIdOwnedListsResponse;\n/**\n * Response for unpinList\n * \n * @public\n */\nexport type UnpinListResponse = Schemas.ListUnpinResponse;\n/**\n * Response for getByUsername\n * \n * @public\n */\nexport type GetByUsernameResponse = Schemas.Get2UsersByUsernameUsernameResponse;\n/**\n * Response for getBlocking\n * \n * @public\n */\nexport type GetBlockingResponse = Schemas.Get2UsersIdBlockingResponse;\n/**\n * Response for getLikedPosts\n * \n * @public\n */\nexport type GetLikedPostsResponse = Schemas.Get2UsersIdLikedTweetsResponse;\n/**\n * Response for unlikePost\n * \n * @public\n */\nexport type UnlikePostResponse = Schemas.UsersLikesDeleteResponse;\n/**\n * Response for getFollowedLists\n * \n * @public\n */\nexport type GetFollowedListsResponse = Schemas.Get2UsersIdFollowedListsResponse;\n/**\n * Request for followList\n * \n * @public\n */\nexport type FollowListRequest = Schemas.ListFollowedRequest;\n/**\n * Response for followList\n * \n * @public\n */\nexport type FollowListResponse = Schemas.ListFollowedResponse;\n/**\n * Response for getTimeline\n * \n * @public\n */\nexport type GetTimelineResponse = Schemas.Get2UsersIdTimelinesReverseChronologicalResponse;\n/**\n * Response for getPinnedLists\n * \n * @public\n */\nexport type GetPinnedListsResponse = Schemas.Get2UsersIdPinnedListsResponse;\n/**\n * Request for pinList\n * \n * @public\n */\nexport type PinListRequest = Schemas.ListPinnedRequest;\n/**\n * Response for pinList\n * \n * @public\n */\nexport type PinListResponse = Schemas.ListPinnedResponse;\n/**\n * Response for getRepostsOfMe\n * \n * @public\n */\nexport type GetRepostsOfMeResponse = Schemas.Get2UsersRepostsOfMeResponse;\n/**\n * Response for getFollowing\n * \n * @public\n */\nexport type GetFollowingResponse = Schemas.Get2UsersIdFollowingResponse;\n/**\n * Request for followUser\n * \n * @public\n */\nexport type FollowUserRequest = Schemas.UsersFollowingCreateRequest;\n/**\n * Response for followUser\n * \n * @public\n */\nexport type FollowUserResponse = Schemas.UsersFollowingCreateResponse;\n/**\n * Response for unblockDms\n * \n * @public\n */\nexport type UnblockDmsResponse = Schemas.UsersDMUnBlockCreateResponse;\n/**\n * Response for getMentions\n * \n * @public\n */\nexport type GetMentionsResponse = Schemas.Get2UsersIdMentionsResponse;\n/**\n * Response for getBookmarkFolders\n * \n * @public\n */\nexport type GetBookmarkFoldersResponse = Schemas.BookmarkFoldersResponse;\n/**\n * Response for unrepostPost\n * \n * @public\n */\nexport type UnrepostPostResponse = Schemas.UsersRetweetsDeleteResponse;\n/**\n * Response for deleteBookmark\n * \n * @public\n */\nexport type DeleteBookmarkResponse = Schemas.BookmarkMutationResponse;\n/**\n * Request for repostPost\n * \n * @public\n */\nexport type RepostPostRequest = Schemas.UsersRetweetsCreateRequest;\n/**\n * Response for repostPost\n * \n * @public\n */\nexport type RepostPostResponse = Schemas.UsersRetweetsCreateResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2UsersSearchResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2UsersIdResponse;\n/**\n * Response for getBookmarks\n * \n * @public\n */\nexport type GetBookmarksResponse = Schemas.Get2UsersIdBookmarksResponse;\n/**\n * Request for createBookmark\n * \n * @public\n */\nexport type CreateBookmarkRequest = Schemas.BookmarkAddRequest;\n/**\n * Response for createBookmark\n * \n * @public\n */\nexport type CreateBookmarkResponse = Schemas.BookmarkMutationResponse;\n/**\n * Response for getFollowers\n * \n * @public\n */\nexport type GetFollowersResponse = Schemas.Get2UsersIdFollowersResponse;\n/**\n * Response for getMe\n * \n * @public\n */\nexport type GetMeResponse = Schemas.Get2UsersMeResponse;\n/**\n * Response for unmuteUser\n * \n * @public\n */\nexport type UnmuteUserResponse = Schemas.MuteUserMutationResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * communities client for the X API.\n *\n * This module provides a client for interacting with the communities endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetByIdResponse, SearchResponse } from './models.js';\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Community fields to display. \n * Also accepts: community.fields or proper camelCase (e.g., communityFields) */\n communityFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Community fields to display. \n * Also accepts: community.fields or proper camelCase (e.g., communityFields) */\n communityFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for communities operations\n * \n * This client provides methods for interacting with the communities endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all communities related operations.\n * \n * @category communities\n */\nexport class CommunitiesClient {\n private client: Client;\n\n /**\n * Creates a new communities client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Community by ID\n * Retrieves details of a specific Community by its ID.\n\n\n * @param id The ID of the Community.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'community.fields': 'communityFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n communityFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/communities/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (communityFields !== undefined && communityFields.length > 0) {\n params.append('community.fields', communityFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Communities\n * Retrieves a list of Communities matching the specified search query.\n\n\n\n * @param query Query to search communities.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'community.fields': 'communityFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n communityFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/communities/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (communityFields !== undefined && communityFields.length > 0) {\n params.append('community.fields', communityFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for communities operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2CommunitiesIdResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2CommunitiesSearchResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Event-driven streaming utilities for the X API.\n * \n * This module provides event-driven streaming interfaces that are more user-friendly\n * than manual ReadableStream management.\n */\n\n// Event types for the stream (using string literals for simplicity)\n// Based on actual Twitter API behavior from documentation\nexport const StreamEvent = {\n Data: 'data', // When JSON data arrives\n KeepAlive: 'keepAlive', // 20-second heartbeat (newline character)\n Error: 'error', // HTTP errors, ConnectionException, operational-disconnect\n Close: 'close', // When stream ends\n};\n\n// Event data types\nexport interface StreamDataEvent {\n data: any;\n includes?: any;\n matching_rules?: any[];\n}\n\nexport interface StreamErrorEvent {\n error: Error;\n // Additional error details from the API response\n code?: string;\n status?: number;\n}\n\n/**\n * Event-driven stream class for handling streaming data from the X API.\n * \n * This class provides an event-driven interface for working with streaming endpoints,\n * allowing you to listen to 'data', 'keepAlive', 'error', and 'close' events.\n * \n * @public\n */\nexport class EventDrivenStream {\n private webStream: ReadableStream | null = null;\n private reader: ReadableStreamDefaultReader | null = null;\n private decoder: TextDecoder;\n private isConnected: boolean = false;\n private isClosed: boolean = false;\n private buffer: string = '';\n private eventListeners: Map = new Map();\n private autoReconnect: boolean = false;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = 5;\n private reconnectDelay: number = 1000;\n\n constructor() {\n this.decoder = new TextDecoder();\n this.setupEventListeners();\n }\n\n /**\n * Initialize the stream with a Web ReadableStream\n */\n async connect(webStream: ReadableStream): Promise {\n if (this.isConnected) {\n throw new Error('Stream is already connected');\n }\n\n this.webStream = webStream;\n this.isConnected = true;\n this.isClosed = false;\n this.reconnectAttempts = 0;\n\n this.emit(StreamEvent.Data, { message: 'Stream connected' });\n this.startReading(); // Don't await this - it runs in the background\n }\n\n /**\n * Start reading from the stream\n */\n private async startReading(): Promise {\n if (!this.webStream || !this.isConnected) {\n return;\n }\n\n this.reader = this.webStream.getReader();\n\n try {\n while (this.isConnected && !this.isClosed) {\n const { done, value } = await this.reader.read();\n\n if (done) {\n this.handleConnectionClosed();\n break;\n }\n\n if (value) {\n await this.processChunk(value);\n }\n }\n } catch (error) {\n this.handleConnectionError(error as Error);\n } finally {\n this.cleanup();\n }\n }\n\n /**\n * Process incoming data chunks\n */\n private async processChunk(value: Uint8Array): Promise {\n const chunk = this.decoder.decode(value, { stream: true });\n this.buffer += chunk;\n\n // Process complete lines (ending with newline)\n let boundary;\n while ((boundary = this.buffer.indexOf('\\n')) !== -1) {\n const line = this.buffer.substring(0, boundary);\n this.buffer = this.buffer.substring(boundary + 1);\n\n if (line.trim()) {\n try {\n const data = JSON.parse(line);\n\n // Check if it's a keep-alive signal (20-second heartbeat)\n if (this.isKeepAlive(data)) {\n this.emit(StreamEvent.KeepAlive, { data });\n continue;\n }\n\n // Emit data event for actual content\n this.emit(StreamEvent.Data, data);\n } catch (parseError) {\n // Skip invalid JSON lines - these are usually incomplete chunks\n console.warn('Skipping invalid JSON:', line.substring(0, 100));\n }\n }\n }\n }\n\n /**\n * Check if data is a keep-alive signal (20-second heartbeat)\n * Twitter sends newline characters every 20 seconds to prevent timeouts\n */\n private isKeepAlive(data: any): boolean {\n // Twitter sends empty objects or just newline characters as keep-alive\n return !data.data && !data.includes && !data.matching_rules && !data.errors;\n }\n\n /**\n * Handle connection errors\n */\n private handleConnectionError(error: Error): void {\n this.isConnected = false;\n\n // Emit the error as-is (API returns the actual error details)\n this.emit(StreamEvent.Error, { error });\n\n if (\n this.autoReconnect &&\n this.reconnectAttempts < this.maxReconnectAttempts\n ) {\n this.attemptReconnect();\n }\n }\n\n /**\n * Handle connection closed\n */\n private handleConnectionClosed(): void {\n this.isConnected = false;\n this.emit(StreamEvent.Close, { message: 'Connection closed' });\n }\n\n /**\n * Attempt to reconnect\n */\n private async attemptReconnect(): Promise {\n this.reconnectAttempts++;\n this.emit(StreamEvent.Data, {\n message: `Reconnect attempt ${this.reconnectAttempts}/${this\n .maxReconnectAttempts}`,\n });\n\n // Wait before reconnecting\n await new Promise(resolve =>\n setTimeout(resolve, this.reconnectDelay * this.reconnectAttempts)\n );\n\n try {\n // This would need to be implemented based on how you get a new stream\n // For now, we'll just emit the events\n this.emit(StreamEvent.Error, {\n error: new Error('Reconnect not implemented in this example'),\n });\n } catch (error) {\n this.emit(StreamEvent.Error, { error: error as Error });\n }\n }\n\n /**\n * Clean up resources\n */\n private cleanup(): void {\n if (this.reader) {\n try {\n // Try to release the lock - it will throw if already released\n this.reader.releaseLock();\n } catch (error) {\n // Ignore errors when releasing the lock (already released)\n console.debug('Reader lock already released or error:', error);\n }\n this.reader = null;\n }\n this.buffer = '';\n }\n\n /**\n * Close the stream\n */\n close(): void {\n this.isClosed = true;\n this.isConnected = false;\n this.cleanup();\n this.emit(StreamEvent.Close, { message: 'Stream closed by user' });\n }\n\n /**\n * Add event listener\n */\n on(event: string, listener: Function): this {\n if (!this.eventListeners.has(event)) {\n this.eventListeners.set(event, []);\n }\n this.eventListeners.get(event)!.push(listener);\n return this;\n }\n\n /**\n * Remove event listener\n */\n off(event: string, listener: Function): this {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n const index = listeners.indexOf(listener);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n }\n return this;\n }\n\n /**\n * Emit event to listeners\n */\n private emit(event: string, data: any): void {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n listeners.forEach(listener => {\n try {\n listener(data);\n } catch (error) {\n console.error(`Error in ${event} listener:`, error);\n }\n });\n }\n }\n\n /**\n * Setup default event listeners\n */\n private setupEventListeners(): void {\n // Default error handling\n this.on(StreamEvent.Error, (eventData: StreamErrorEvent) => {\n console.error('Stream error:', eventData.error);\n });\n }\n\n /**\n * Enable/disable auto-reconnect\n */\n set autoReconnectEnabled(enabled: boolean) {\n this.autoReconnect = enabled;\n }\n\n get autoReconnectEnabled(): boolean {\n return this.autoReconnect;\n }\n\n /**\n * Set max reconnect attempts\n */\n set maxReconnectAttemptsCount(count: number) {\n this.maxReconnectAttempts = count;\n }\n\n get maxReconnectAttemptsCount(): number {\n return this.maxReconnectAttempts;\n }\n\n /**\n * Async iterator for tweets\n */\n async *[Symbol.asyncIterator](): AsyncGenerator<\n StreamDataEvent,\n void,\n unknown\n > {\n const dataQueue: StreamDataEvent[] = [];\n let isComplete = false;\n let hasError = false;\n let error: Error | null = null;\n\n // Set up listeners\n const dataListener = (eventData: any) => {\n dataQueue.push(eventData);\n };\n\n const errorListener = (eventData: StreamErrorEvent) => {\n hasError = true;\n error = eventData.error;\n };\n\n const closeListener = () => {\n isComplete = true;\n };\n\n this.on(StreamEvent.Data, dataListener);\n this.on(StreamEvent.Error, errorListener);\n this.on(StreamEvent.Close, closeListener);\n\n try {\n while (!isComplete && !hasError) {\n if (dataQueue.length > 0) {\n yield dataQueue.shift()!;\n } else {\n // Wait a bit for more data\n await new Promise(resolve => setTimeout(resolve, 10));\n }\n }\n\n if (hasError && error) {\n throw error;\n }\n } finally {\n // Clean up listeners\n this.off(StreamEvent.Data, dataListener);\n this.off(StreamEvent.Error, errorListener);\n this.off(StreamEvent.Close, closeListener);\n }\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Stream client for the X API.\n *\n * This module provides a client for interacting with the streaming endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport { EventDrivenStream, StreamEvent } from './event_driven_stream.js';\nimport {\n PostsSampleResponse,\n PostsFirehosePtResponse,\n PostsFirehoseJaResponse,\n PostsSample10Response,\n PostsFirehoseKoResponse,\n LikesComplianceResponse,\n PostsComplianceResponse,\n GetRuleCountsResponse,\n LikesFirehoseResponse,\n PostsFirehoseEnResponse,\n PostsResponse,\n UsersComplianceResponse,\n PostsFirehoseResponse,\n LikesSample10Response,\n GetRulesResponse,\n UpdateRulesResponse,\n LabelsComplianceResponse,\n} from './models.js';\n\n/**\n * Options for postsSample method\n * \n * @public\n */\nexport interface PostsSampleStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehosePt method\n * \n * @public\n */\nexport interface PostsFirehosePtStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseJa method\n * \n * @public\n */\nexport interface PostsFirehoseJaStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsSample10 method\n * \n * @public\n */\nexport interface PostsSample10StreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseKo method\n * \n * @public\n */\nexport interface PostsFirehoseKoStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesCompliance method\n * \n * @public\n */\nexport interface LikesComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsCompliance method\n * \n * @public\n */\nexport interface PostsComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for getRuleCounts method\n * \n * @public\n */\nexport interface GetRuleCountsStreamingOptions {\n /** A comma separated list of RulesCount fields to display. \n * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */\n rulesCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesFirehose method\n * \n * @public\n */\nexport interface LikesFirehoseStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of LikeWithTweetAuthor fields to display. \n * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */\n likeWithTweetAuthorFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseEn method\n * \n * @public\n */\nexport interface PostsFirehoseEnStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for posts method\n * \n * @public\n */\nexport interface PostsStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for usersCompliance method\n * \n * @public\n */\nexport interface UsersComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehose method\n * \n * @public\n */\nexport interface PostsFirehoseStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesSample10 method\n * \n * @public\n */\nexport interface LikesSample10StreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of LikeWithTweetAuthor fields to display. \n * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */\n likeWithTweetAuthorFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for getRules method\n * \n * @public\n */\nexport interface GetRulesStreamingOptions {\n /** A comma-separated list of Rule IDs. \n * Also accepts: ids or proper camelCase (e.g., ids) */\n ids?: Array;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This value is populated by passing the 'next_token' returned in a request to paginate through results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for updateRules method\n * \n * @public\n */\nexport interface UpdateRulesStreamingOptions {\n /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. \n * Also accepts: dry_run or proper camelCase (e.g., dryRun) */\n dryRun?: boolean;\n\n /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. \n * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */\n deleteAll?: boolean;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for labelsCompliance method\n * \n * @public\n */\nexport interface LabelsComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\nexport class StreamClient {\n private client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Stream sampled Posts\n * Streams a 1% sample of public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsSample(\n options: PostsSampleStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsSample');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/sample/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Portuguese Posts\n * Streams all public Portuguese-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehosePt(\n partition: number,\n options: PostsFirehosePtStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehosePt');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/pt';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Japanese Posts\n * Streams all public Japanese-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseJa(\n partition: number,\n options: PostsFirehoseJaStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseJa');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/ja';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream 10% sampled Posts\n * Streams a 10% sample of public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsSample10(\n partition: number,\n options: PostsSample10StreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsSample10');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/sample10/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Korean Posts\n * Streams all public Korean-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseKo(\n partition: number,\n options: PostsFirehoseKoStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseKo');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/ko';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Likes compliance data\n * Streams all compliance data related to Likes for Users.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesCompliance(\n options: LikesComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Posts compliance data\n * Streams all compliance data related to Posts.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsCompliance(\n partition: number,\n options: PostsComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream all Likes\n * Streams all public Likes in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesFirehose(\n partition: number,\n options: LikesFirehoseStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesFirehose');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n likeWithTweetAuthorFields = [],\n\n expansions = [],\n\n userFields = [],\n\n tweetFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/firehose/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (\n likeWithTweetAuthorFields !== undefined &&\n likeWithTweetAuthorFields.length > 0\n ) {\n params.append(\n 'like_with_tweet_author.fields',\n likeWithTweetAuthorFields.join(',')\n );\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream English Posts\n * Streams all public English-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseEn(\n partition: number,\n options: PostsFirehoseEnStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseEn');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/en';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream filtered Posts\n * Streams Posts in real-time matching the active rule set.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async posts(options: PostsStreamingOptions = {}): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'posts');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Users compliance data\n * Streams all compliance data related to Users.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async usersCompliance(\n partition: number,\n options: UsersComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'usersCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream all Posts\n * Streams all public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehose(\n partition: number,\n options: PostsFirehoseStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehose');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream sampled Likes\n * Streams a 10% sample of public Likes in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesSample10(\n partition: number,\n options: LikesSample10StreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesSample10');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n likeWithTweetAuthorFields = [],\n\n expansions = [],\n\n userFields = [],\n\n tweetFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/sample10/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (\n likeWithTweetAuthorFields !== undefined &&\n likeWithTweetAuthorFields.length > 0\n ) {\n params.append(\n 'like_with_tweet_author.fields',\n likeWithTweetAuthorFields.join(',')\n );\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Post labels\n * Streams all labeling events applied to Posts.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async labelsCompliance(\n options: LabelsComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'labelsCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/label/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Get stream rule counts\n * Retrieves the count of rules in the active rule set for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async getRuleCounts(\n options: GetRuleCountsStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'getRuleCounts');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'rules_count.fields': 'rulesCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n rulesCountFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules/counts';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (rulesCountFields !== undefined && rulesCountFields.length > 0) {\n params.append('rules_count.fields', rulesCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get stream rules\n * Retrieves the active rule set or a subset of rules for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async getRules(\n options: GetRulesStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'getRules');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n ids = [],\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update stream rules\n * Adds or deletes rules from the active rule set for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async updateRules(\n body: any,\n options: UpdateRulesStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'updateRules');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n dry_run: 'dryRun',\n\n delete_all: 'deleteAll',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n dryRun = undefined,\n\n deleteAll = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (dryRun !== undefined) {\n params.append('dry_run', String(dryRun));\n }\n\n if (deleteAll !== undefined) {\n params.append('delete_all', String(deleteAll));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n body: JSON.stringify(body),\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * compliance client for the X API.\n *\n * This module provides a client for interacting with the compliance endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetJobsResponse,\n CreateJobsRequest,\n CreateJobsResponse,\n GetJobsByIdResponse,\n} from './models.js';\n\n/**\n * Options for getJobs method\n * \n * @public\n */\nexport interface GetJobsOptions {\n /** Status of Compliance Job to list. \n * Also accepts: status or proper camelCase (e.g., status) */\n status?: string;\n\n /** A comma separated list of ComplianceJob fields to display. \n * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */\n complianceJobFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getJobsById method\n * \n * @public\n */\nexport interface GetJobsByIdOptions {\n /** A comma separated list of ComplianceJob fields to display. \n * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */\n complianceJobFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for compliance operations\n * \n * This client provides methods for interacting with the compliance endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all compliance related operations.\n * \n * @category compliance\n */\nexport class ComplianceClient {\n private client: Client;\n\n /**\n * Creates a new compliance client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Compliance Jobs\n * Retrieves a list of Compliance Jobs filtered by job type and optional status.\n\n\n\n * @param type Type of Compliance Job to list.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getJobs(\n type: string,\n options: GetJobsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'compliance_job.fields': 'complianceJobFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n status = undefined,\n\n complianceJobFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (type !== undefined) {\n params.append('type', String(type));\n }\n\n if (status !== undefined) {\n params.append('status', String(status));\n }\n\n if (complianceJobFields !== undefined && complianceJobFields.length > 0) {\n params.append('compliance_job.fields', complianceJobFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Compliance Job\n * Creates a new Compliance Job for the specified job type.\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createJobs(body: CreateJobsRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Compliance Job by ID\n * Retrieves details of a specific Compliance Job by its ID.\n\n\n * @param id The ID of the Compliance Job to retrieve.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getJobsById(\n id: string,\n options: GetJobsByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'compliance_job.fields': 'complianceJobFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n complianceJobFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (complianceJobFields !== undefined && complianceJobFields.length > 0) {\n params.append('compliance_job.fields', complianceJobFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for compliance operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getJobs\n * \n * @public\n */\nexport type GetJobsResponse = Schemas.Get2ComplianceJobsResponse;\n/**\n * Request for createJobs\n * \n * @public\n */\nexport type CreateJobsRequest = Schemas.CreateComplianceJobRequest;\n/**\n * Response for createJobs\n * \n * @public\n */\nexport type CreateJobsResponse = Schemas.CreateComplianceJobResponse;\n/**\n * Response for getJobsById\n * \n * @public\n */\nexport type GetJobsByIdResponse = Schemas.Get2ComplianceJobsIdResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * usage client for the X API.\n *\n * This module provides a client for interacting with the usage endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetResponse } from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** The number of days for which you need usage for. \n * Also accepts: days or proper camelCase (e.g., days) */\n days?: number;\n\n /** A comma separated list of Usage fields to display. \n * Also accepts: usage.fields or proper camelCase (e.g., usageFields) */\n usageFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for usage operations\n * \n * This client provides methods for interacting with the usage endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all usage related operations.\n * \n * @category usage\n */\nexport class UsageClient {\n private client: Client;\n\n /**\n * Creates a new usage client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get usage\n * Retrieves usage statistics for Posts over a specified number of days.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'usage.fields': 'usageFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n days = undefined,\n\n usageFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/usage/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (days !== undefined) {\n params.append('days', String(days));\n }\n\n if (usageFields !== undefined && usageFields.length > 0) {\n params.append('usage.fields', usageFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for usage operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2UsageTweetsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Main client for the X API.\n *\n * This module provides the main client class for interacting with the X API.\n */\n\nimport { httpClient } from \"./http-client.js\";\nimport { \n Paginator, \n PostPaginator, \n UserPaginator, \n EventPaginator\n} from \"./paginator.js\";\n\n\n\nimport { ActivityClient } from \"./activity/index.js\";\n\n\n\nimport { NewsClient } from \"./news/index.js\";\n\n\n\nimport { ConnectionsClient } from \"./connections/index.js\";\n\n\n\nimport { AccountActivityClient } from \"./account_activity/index.js\";\n\n\n\nimport { SpacesClient } from \"./spaces/index.js\";\n\n\n\nimport { TrendsClient } from \"./trends/index.js\";\n\n\n\nimport { MediaClient } from \"./media/index.js\";\n\n\n\nimport { DirectMessagesClient } from \"./direct_messages/index.js\";\n\n\n\nimport { PostsClient } from \"./posts/index.js\";\n\n\n\nimport { ListsClient } from \"./lists/index.js\";\n\n\n\nimport { CommunityNotesClient } from \"./community_notes/index.js\";\n\n\n\nimport { GeneralClient } from \"./general/index.js\";\n\n\n\nimport { WebhooksClient } from \"./webhooks/index.js\";\n\n\n\nimport { UsersClient } from \"./users/index.js\";\n\n\n\nimport { CommunitiesClient } from \"./communities/index.js\";\n\n\n\nimport { StreamClient } from \"./stream/client.js\";\n\n\n\nimport { ComplianceClient } from \"./compliance/index.js\";\n\n\n\nimport { UsageClient } from \"./usage/index.js\";\n\n\n\n/**\n * Configuration options for the X API client\n */\nexport interface ClientConfig {\n /** Base URL for API requests */\n baseUrl?: string;\n /** Bearer token for authentication */\n bearerToken?: string;\n /** OAuth2 access token */\n accessToken?: string;\n /** OAuth1 instance for authentication */\n oauth1?: any;\n /** Custom headers to include in requests */\n headers?: Record;\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Whether to automatically retry failed requests */\n retry?: boolean;\n /** Maximum number of retry attempts */\n maxRetries?: number;\n}\n\n/**\n * API Error class for handling X API errors\n */\nexport class ApiError extends Error {\n public readonly status: number;\n public readonly statusText: string;\n public readonly headers: Headers;\n public readonly data?: any;\n\n constructor(message: string, status: number, statusText: string, headers: Headers, data?: any) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.statusText = statusText;\n this.headers = headers;\n this.data = data;\n }\n}\n\n/**\n * Request options for API calls\n */\nexport interface RequestOptions {\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Additional headers */\n headers?: Record;\n /** Request signal for cancellation */\n signal?: AbortSignal;\n /** Request body */\n body?: string;\n /** Return raw HTTP wrapper instead of parsed body */\n raw?: boolean;\n /** Security requirements for the endpoint (from OpenAPI spec) - used for smart auth selection */\n security?: Array>;\n}\n\n/**\n * Response wrapper with metadata\n */\nexport interface ApiResponse {\n /** Response body */\n body: T;\n /** Response headers */\n headers: Headers;\n /** HTTP status code */\n status: number;\n /** HTTP status text */\n statusText: string;\n /** Response URL */\n url: string;\n}\n\n/**\n * Pagination metadata\n */\nexport interface PaginationMeta {\n /** Next page token */\n next_token?: string;\n /** Previous page token */\n previous_token?: string;\n /** Total count */\n total_count?: number;\n /** Result count */\n result_count?: number;\n}\n\n\n/**\n * Main client class for the X API\n * \n * This is the primary entry point for interacting with the X API. It provides\n * access to all API endpoints through specialized client modules and handles\n * authentication, request configuration, and error handling.\n * \n * @example\n * ```typescript\n * import { Client } from 'x-api-sdk';\n * \n * const client = new Client({\n * bearerToken: 'your-bearer-token'\n * });\n * \n * // Get user information\n * const user = await client.users.getUser('783214');\n * \n * // Get followers with pagination\n * const followers = await client.users.getFollowers('783214', {\n * maxResults: 10,\n * userFields: ['id', 'name', 'username']\n * });\n * \n * // Iterate through followers\n * for await (const follower of followers) {\n * console.log(follower.username);\n * }\n * ```\n * \n * @category Client\n */\nexport class Client {\n /** Base URL for API requests */\n readonly baseUrl: string;\n /** Bearer token for authentication */\n readonly bearerToken?: string;\n /** OAuth2 access token */\n readonly accessToken?: string;\n /** OAuth1 instance for authentication */\n readonly oauth1?: any;\n /** Headers for requests */\n readonly headers: Headers;\n /** Request timeout in milliseconds */\n readonly timeout: number;\n /** Whether to automatically retry failed requests */\n readonly retry: boolean;\n /** Maximum number of retry attempts */\n readonly maxRetries: number;\n\n /** HTTP client for making requests */\n readonly httpClient = httpClient;\n\n\n /** activity client */\n readonly activity: ActivityClient;\n\n /** news client */\n readonly news: NewsClient;\n\n /** connections client */\n readonly connections: ConnectionsClient;\n\n /** account activity client */\n readonly accountActivity: AccountActivityClient;\n\n /** spaces client */\n readonly spaces: SpacesClient;\n\n /** trends client */\n readonly trends: TrendsClient;\n\n /** media client */\n readonly media: MediaClient;\n\n /** direct messages client */\n readonly directMessages: DirectMessagesClient;\n\n /** posts client */\n readonly posts: PostsClient;\n\n /** lists client */\n readonly lists: ListsClient;\n\n /** community notes client */\n readonly communityNotes: CommunityNotesClient;\n\n /** general client */\n readonly general: GeneralClient;\n\n /** webhooks client */\n readonly webhooks: WebhooksClient;\n\n /** users client */\n readonly users: UsersClient;\n\n /** communities client */\n readonly communities: CommunitiesClient;\n\n /** stream client */\n readonly stream: StreamClient;\n\n /** compliance client */\n readonly compliance: ComplianceClient;\n\n /** usage client */\n readonly usage: UsageClient;\n\n\n /**\n * Creates a new X API client instance\n * \n * @param config - Configuration options for the client\n * \n * @example\n * ```typescript\n * // Bearer token authentication\n * const client = new Client({\n * bearerToken: 'your-bearer-token'\n * });\n * \n * // OAuth2 authentication\n * const client = new Client({\n * accessToken: 'your-access-token'\n * });\n * \n * // OAuth1 authentication\n * const client = new Client({\n * oauth1: oauth1Instance\n * });\n * ```\n */\n constructor(config: ClientConfig | any) {\n // Handle OAuth1 instance passed directly\n if (config && typeof config === 'object' && config.accessToken && config.accessToken.accessToken && config.accessToken.accessTokenSecret) {\n // This is an OAuth1 instance\n this.oauth1 = config;\n this.baseUrl = \"https://api.x.com\";\n } else {\n // This is a regular config object\n const clientConfig = config as ClientConfig;\n this.baseUrl = clientConfig.baseUrl || \"https://api.x.com\";\n this.bearerToken = clientConfig.bearerToken;\n this.accessToken = clientConfig.accessToken;\n this.oauth1 = clientConfig.oauth1;\n }\n \n this.timeout = (config as ClientConfig).timeout || 30000;\n this.retry = (config as ClientConfig).retry ?? true;\n this.maxRetries = (config as ClientConfig).maxRetries || 3;\n \n // Initialize headers\n const defaultHeaders: Record = {\n 'User-Agent': 'xdk-typescript/0.2.1-beta',\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n ...((config as ClientConfig).headers || {}),\n };\n \n this.headers = httpClient.createHeaders(defaultHeaders);\n\n\n this.activity = new ActivityClient(this);\n\n this.news = new NewsClient(this);\n\n this.connections = new ConnectionsClient(this);\n\n this.accountActivity = new AccountActivityClient(this);\n\n this.spaces = new SpacesClient(this);\n\n this.trends = new TrendsClient(this);\n\n this.media = new MediaClient(this);\n\n this.directMessages = new DirectMessagesClient(this);\n\n this.posts = new PostsClient(this);\n\n this.lists = new ListsClient(this);\n\n this.communityNotes = new CommunityNotesClient(this);\n\n this.general = new GeneralClient(this);\n\n this.webhooks = new WebhooksClient(this);\n\n this.users = new UsersClient(this);\n\n this.communities = new CommunitiesClient(this);\n\n this.stream = new StreamClient(this);\n\n this.compliance = new ComplianceClient(this);\n\n this.usage = new UsageClient(this);\n\n }\n\n /**\n * Make an authenticated request to the X API\n * \n * This method handles authentication, request formatting, and error handling\n * for all API requests. It automatically adds the appropriate authentication\n * headers based on the client configuration.\n * \n * @param method - HTTP method (GET, POST, PUT, DELETE, etc.)\n * @param path - API endpoint path (e.g., '/2/users/by/username/username')\n * @param options - Request options including timeout, headers, and body\n * @returns Promise that resolves to the parsed response data\n * \n * @example\n * ```typescript\n * // GET request\n * const user = await client.request('GET', '/2/users/by/username/username', {\n * timeout: 5000\n * });\n * \n * // POST request with body\n * const result = await client.request('POST', '/2/tweets', {\n * body: JSON.stringify({ text: 'Hello World!' })\n * });\n * ```\n * \n * @throws {ApiError} When the API returns an error response\n */\n async request(\n method: string,\n path: string,\n options: RequestOptions = {}\n ): Promise {\n const url = `${this.baseUrl}${path}`;\n const headers = new Headers(this.headers);\n \n // Select the best authentication method based on endpoint requirements\n const selectedAuth = this.selectAuthMethod(method, options.security);\n \n // Add authentication headers based on selected method\n if (selectedAuth === 'bearer_token' && this.bearerToken) {\n headers.set('Authorization', `Bearer ${this.bearerToken}`);\n } else if (selectedAuth === 'oauth2_user_context' && this.accessToken) {\n headers.set('Authorization', `Bearer ${this.accessToken}`);\n } else if (selectedAuth === 'oauth1' && this.oauth1 && this.oauth1.accessToken) {\n // OAuth1 authentication - build proper OAuth1 header\n try {\n const oauthHeader = await this.oauth1.buildRequestHeader(method, url, options.body || '');\n headers.set('Authorization', oauthHeader);\n \n // Keep Content-Type header for JSON requests - X API requires it\n // Only remove Content-Type for form-encoded OAuth1 requests\n // JSON bodies are not included in OAuth1 signature (per OAuth1 spec)\n } catch (error) {\n throw new Error(`Failed to build OAuth1 header: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n } else if (!selectedAuth) {\n // No suitable auth method found - validate authentication\n const requiredSchemes = options.security \n ? options.security.flatMap(req => Object.keys(req))\n : [];\n if (requiredSchemes.length > 0) {\n this.validateAuthentication(requiredSchemes, path);\n }\n }\n \n // Add custom headers\n if (options.headers) {\n Object.entries(options.headers).forEach(([key, value]) => {\n headers.set(key, value);\n });\n }\n\n try {\n const response = await this.httpClient.request(url, {\n method,\n headers,\n signal: options.signal,\n body: options.body,\n timeout: options.timeout !== undefined ? options.timeout : this.timeout,\n });\n\n if (!response.ok) {\n let errorData: any;\n try {\n errorData = await response.json();\n } catch {\n errorData = await response.text();\n }\n \n throw new ApiError(\n errorData && errorData.message ? errorData.message : `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n response.headers,\n errorData\n );\n }\n\n // For streaming requests, return the raw Response object\n if (options.raw) {\n return response as any; // Return the actual Response object for streaming\n }\n\n let data: T;\n const contentType = response.headers.get('content-type');\n if (contentType && contentType.includes('application/json')) {\n data = await response.json();\n } else {\n data = await response.text() as T;\n }\n\n // Return parsed body for non-streaming requests\n return data;\n } catch (error) {\n if (error instanceof ApiError) {\n throw error;\n }\n throw new ApiError(\n error instanceof Error ? error.message : 'Request failed',\n 0,\n 'NETWORK_ERROR',\n new Headers(),\n error\n );\n }\n }\n\n /**\n * Check if the OAuth2 token is expired\n */\n isTokenExpired(): boolean {\n // TODO: Implement token expiration check\n return false;\n }\n\n /**\n * Refresh the OAuth2 token\n */\n async refreshToken(): Promise {\n // TODO: Implement token refresh\n }\n\n /**\n * Get the current authentication status\n */\n isAuthenticated(): boolean {\n return !!(this.bearerToken || this.accessToken || (this.oauth1 && this.oauth1.accessToken));\n }\n\n /**\n * Map OpenAPI security scheme names to internal authentication types\n * @param securitySchemeName The security scheme name from OpenAPI\n * @returns Array of internal authentication types\n */\n public mapSecuritySchemeToAuthTypes(securitySchemeName: string): string[] {\n // Mappings for X/Twitter API security schemes\n const schemeMapping: Record = {\n 'BearerToken': ['bearer_token'], // App-only OAuth2.0\n 'OAuth2UserToken': ['oauth2_user_context'], // OAuth2.0 User Context\n 'UserToken': ['oauth1'], // OAuth1.0a User Context\n // Fallback mappings for common variations\n 'OAuth2': ['bearer_token', 'oauth2_user_context'],\n 'OAuth1': ['oauth1'],\n 'Bearer': ['bearer_token'],\n 'OAuth2User': ['oauth2_user_context'],\n 'OAuth1User': ['oauth1'],\n };\n\n return schemeMapping[securitySchemeName] || [securitySchemeName.toLowerCase()];\n }\n\n /**\n * Select the best authentication method based on endpoint requirements and available credentials\n * \n * Priority strategy:\n * 1. If endpoint only accepts one method, use that (if available)\n * 2. If endpoint accepts multiple methods:\n * - For write operations (POST/PUT/DELETE): Prefer OAuth1 > OAuth2 User Token > Bearer Token\n * - For read operations (GET): Prefer Bearer Token > OAuth2 User Token > OAuth1\n * - This allows Bearer Token for read-only operations while using user context for writes\n * \n * @param method HTTP method (GET, POST, etc.)\n * @param securityRequirements Security requirements from OpenAPI spec (array of security requirement objects)\n * @returns Selected auth method: 'bearer_token', 'oauth2_user_context', 'oauth1', or null if none available\n */\n private selectAuthMethod(method: string, securityRequirements?: Array>): 'bearer_token' | 'oauth2_user_context' | 'oauth1' | null {\n // If no security requirements, use default priority\n if (!securityRequirements || securityRequirements.length === 0) {\n if (this.bearerToken) return 'bearer_token';\n if (this.accessToken) return 'oauth2_user_context';\n if (this.oauth1 && this.oauth1.accessToken) return 'oauth1';\n return null;\n }\n\n // Extract all acceptable security schemes from requirements\n // Security requirements are OR'd together (any one can be used)\n const acceptableSchemes = new Set();\n for (const requirement of securityRequirements) {\n for (const schemeName of Object.keys(requirement)) {\n acceptableSchemes.add(schemeName);\n }\n }\n\n // Check what auth methods we have available\n const availableAuth: Record = {\n 'BearerToken': !!this.bearerToken,\n 'OAuth2UserToken': !!this.accessToken,\n 'UserToken': !!(this.oauth1 && this.oauth1.accessToken),\n };\n\n // If only one scheme is acceptable, use it if available\n if (acceptableSchemes.size === 1) {\n const scheme = Array.from(acceptableSchemes)[0];\n if (availableAuth[scheme]) {\n return this.mapSecuritySchemeToAuthTypes(scheme)[0] as 'bearer_token' | 'oauth2_user_context' | 'oauth1';\n }\n return null;\n }\n\n // Multiple schemes acceptable - use priority based on operation type\n const isWriteOperation = ['POST', 'PUT', 'DELETE', 'PATCH'].includes(method.toUpperCase());\n \n // Priority order for write operations: OAuth1 > OAuth2 User Token > Bearer Token\n // (User context is required for most write operations)\n if (isWriteOperation) {\n if (acceptableSchemes.has('UserToken') && availableAuth['UserToken']) {\n return 'oauth1';\n }\n if (acceptableSchemes.has('OAuth2UserToken') && availableAuth['OAuth2UserToken']) {\n return 'oauth2_user_context';\n }\n if (acceptableSchemes.has('BearerToken') && availableAuth['BearerToken']) {\n return 'bearer_token';\n }\n } else {\n // Priority order for read operations: Bearer Token > OAuth2 User Token > OAuth1\n // (Bearer Token is simpler for read-only operations)\n if (acceptableSchemes.has('BearerToken') && availableAuth['BearerToken']) {\n return 'bearer_token';\n }\n if (acceptableSchemes.has('OAuth2UserToken') && availableAuth['OAuth2UserToken']) {\n return 'oauth2_user_context';\n }\n if (acceptableSchemes.has('UserToken') && availableAuth['UserToken']) {\n return 'oauth1';\n }\n }\n\n return null;\n }\n\n /**\n * Validate that the required authentication method is available\n * @param requiredAuthTypes Array of required authentication types (OpenAPI security scheme names)\n * @param operationName Name of the operation for error messages\n */\n public validateAuthentication(requiredAuthTypes: string[], operationName: string): void {\n if (requiredAuthTypes.length === 0) {\n return; // No authentication required\n }\n\n const availableAuthTypes: string[] = [];\n \n if (this.bearerToken) {\n availableAuthTypes.push('bearer_token');\n }\n if (this.accessToken) {\n availableAuthTypes.push('oauth2_user_context');\n }\n if (this.oauth1 && this.oauth1.accessToken) {\n availableAuthTypes.push('oauth1');\n }\n\n // Map OpenAPI security schemes to internal auth types\n const mappedRequiredTypes = requiredAuthTypes.flatMap(scheme => \n this.mapSecuritySchemeToAuthTypes(scheme)\n );\n\n // Check if any of the required auth types are available\n const hasRequiredAuth = mappedRequiredTypes.some(required => \n availableAuthTypes.includes(required)\n );\n\n if (!hasRequiredAuth) {\n const availableStr = availableAuthTypes.length > 0 ? availableAuthTypes.join(', ') : 'none';\n const requiredStr = requiredAuthTypes.join(', ');\n throw new Error(\n `Authentication required for ${operationName}. ` +\n `Required: ${requiredStr}. ` +\n `Available: ${availableStr}. ` +\n `Please configure the appropriate authentication method.`\n );\n }\n }\n\n /**\n * Get available authentication types\n */\n getAvailableAuthTypes(): string[] {\n const authTypes: string[] = [];\n if (this.bearerToken) authTypes.push('bearer_token');\n if (this.accessToken) authTypes.push('oauth2_user_context');\n if (this.oauth1 && this.oauth1.accessToken) authTypes.push('oauth1');\n return authTypes;\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Environment-agnostic cryptographic utilities for the X API SDK.\n * Provides HMAC-SHA1 implementation that works in both Node.js and browser environments.\n */\n\n/**\n * HMAC-SHA1 implementation that works in both Node.js and browser environments\n */\nexport class CryptoUtils {\n /**\n * Generate HMAC-SHA1 signature\n * @param key Signing key\n * @param message Message to sign\n * @returns Base64 encoded signature\n */\n static async hmacSha1(key: string, message: string): Promise {\n // Try to use native Node.js crypto first\n if (\n typeof process !== 'undefined' &&\n process.versions &&\n process.versions.node\n ) {\n try {\n return await this._nodeHmacSha1(key, message);\n } catch (error) {\n // Fall back to Web Crypto API or polyfill\n console.warn('Node.js crypto failed, falling back:', error);\n }\n }\n\n // Try Web Crypto API (modern browsers)\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n try {\n return await this._webCryptoHmacSha1(key, message);\n } catch (error) {\n // Fall back to polyfill\n console.warn('Web Crypto API failed, falling back:', error);\n }\n }\n\n // Fall back to polyfill implementation\n return this._polyfillHmacSha1(key, message);\n }\n\n /**\n * Node.js native HMAC-SHA1 implementation\n */\n private static async _nodeHmacSha1(\n key: string,\n message: string\n ): Promise {\n // Dynamic import for Node.js crypto module (ES module compatible)\n const crypto = await import('crypto');\n const hmac = crypto.createHmac('sha1', key);\n hmac.update(message);\n return hmac.digest('base64');\n }\n\n /**\n * Web Crypto API HMAC-SHA1 implementation\n */\n private static async _webCryptoHmacSha1(\n key: string,\n message: string\n ): Promise {\n // Convert string key to ArrayBuffer\n const keyBuffer = this._stringToArrayBuffer(key);\n const messageBuffer = this._stringToArrayBuffer(message);\n\n // Import the key\n const cryptoKey = await crypto.subtle.importKey(\n 'raw',\n keyBuffer,\n { name: 'HMAC', hash: 'SHA-1' },\n false,\n ['sign']\n );\n\n // Sign the message\n const signature = await crypto.subtle.sign(\n 'HMAC',\n cryptoKey,\n messageBuffer\n );\n\n // Convert to base64\n return this._arrayBufferToBase64(signature);\n }\n\n /**\n * Polyfill HMAC-SHA1 implementation using pure JavaScript\n * This is a fallback that works everywhere but is slower\n */\n private static _polyfillHmacSha1(key: string, message: string): string {\n // For now, throw an error to indicate that proper crypto is needed\n // This will help identify when the fallback is being used\n throw new Error(\n 'HMAC-SHA1 polyfill not implemented. Please ensure Node.js crypto or Web Crypto API is available.'\n );\n\n // In a real implementation, you would use a library like crypto-js:\n // import CryptoJS from 'crypto-js';\n // return CryptoJS.HmacSHA1(message, key).toString(CryptoJS.enc.Base64);\n }\n\n /**\n * Convert string to ArrayBuffer\n */\n private static _stringToArrayBuffer(str: string): ArrayBuffer {\n const buffer = new ArrayBuffer(str.length);\n const view = new Uint8Array(buffer);\n for (let i = 0; i < str.length; i++) {\n view[i] = str.charCodeAt(i);\n }\n return buffer;\n }\n\n /**\n * Convert ArrayBuffer to base64 string\n */\n private static _arrayBufferToBase64(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n /**\n * Generate a random nonce for OAuth\n * @param length Length of the nonce\n * @returns Random nonce string\n */\n static generateNonce(length: number = 32): string {\n if (typeof crypto !== 'undefined' && crypto.getRandomValues) {\n // Use crypto.getRandomValues if available\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join(\n ''\n );\n } else {\n // Fallback to Math.random (less secure but functional)\n let result = '';\n const characters =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n for (let i = 0; i < length; i++) {\n result += characters.charAt(\n Math.floor(Math.random() * characters.length)\n );\n }\n return result;\n }\n }\n\n /**\n * Generate timestamp for OAuth\n * @returns Unix timestamp as string\n */\n static generateTimestamp(): string {\n return Math.floor(Date.now() / 1000).toString();\n }\n\n /**\n * Generate a cryptographically secure random string for PKCE code verifier\n * @param length Length of the code verifier (43-128 characters recommended)\n * @returns Random code verifier string\n */\n static generateCodeVerifier(length: number = 128): string {\n if (typeof crypto !== 'undefined' && crypto.getRandomValues) {\n // Use crypto.getRandomValues if available\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n // Convert to base64url encoding (RFC 7636)\n return this._base64UrlEncode(array);\n } else {\n // Fallback to Math.random (less secure but functional)\n const characters =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';\n let result = '';\n for (let i = 0; i < length; i++) {\n result += characters.charAt(\n Math.floor(Math.random() * characters.length)\n );\n }\n return result;\n }\n }\n\n /**\n * Generate PKCE code challenge from code verifier\n * @param codeVerifier The code verifier string\n * @returns Base64url encoded SHA256 hash of the code verifier\n */\n static async generateCodeChallenge(codeVerifier: string): Promise {\n // Try to use native Node.js crypto first\n if (\n typeof process !== 'undefined' &&\n process.versions &&\n process.versions.node\n ) {\n try {\n return await this._nodeSha256(codeVerifier);\n } catch (error) {\n console.warn('Node.js crypto failed for SHA256, falling back:', error);\n }\n }\n\n // Try Web Crypto API (modern browsers)\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n try {\n return await this._webCryptoSha256(codeVerifier);\n } catch (error) {\n console.warn('Web Crypto API failed for SHA256, falling back:', error);\n }\n }\n\n // Fall back to polyfill implementation\n return this._polyfillSha256(codeVerifier);\n }\n\n /**\n * Node.js native SHA256 implementation for PKCE\n */\n private static async _nodeSha256(message: string): Promise {\n const crypto = await import('crypto');\n const hash = crypto.createHash('sha256');\n hash.update(message);\n const digest = hash.digest();\n return this._base64UrlEncode(digest);\n }\n\n /**\n * Web Crypto API SHA256 implementation for PKCE\n */\n private static async _webCryptoSha256(message: string): Promise {\n const messageBuffer = this._stringToArrayBuffer(message);\n const hashBuffer = await crypto.subtle.digest('SHA-256', messageBuffer);\n return this._base64UrlEncode(hashBuffer);\n }\n\n /**\n * Polyfill SHA256 implementation for PKCE\n * This is a fallback that works everywhere but is slower\n */\n private static _polyfillSha256(message: string): string {\n // For now, throw an error to indicate that proper crypto is needed\n throw new Error(\n 'SHA256 polyfill not implemented. Please ensure Node.js crypto or Web Crypto API is available.'\n );\n\n // In a real implementation, you would use a library like crypto-js:\n // import CryptoJS from 'crypto-js';\n // return CryptoJS.SHA256(message).toString(CryptoJS.enc.Base64url);\n }\n\n /**\n * Convert ArrayBuffer or Uint8Array to base64url encoding (RFC 7636)\n */\n private static _base64UrlEncode(buffer: ArrayBuffer | Uint8Array): string {\n const bytes =\n buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n // Convert to base64url: replace + with -, / with _, and remove padding =\n return btoa(binary)\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '');\n }\n}\n\n/**\n * Convenience function for HMAC-SHA1\n * @param key Signing key\n * @param message Message to sign\n * @returns Promise that resolves to base64 encoded signature\n */\nexport async function hmacSha1(key: string, message: string): Promise {\n return CryptoUtils.hmacSha1(key, message);\n}\n\n/**\n * Convenience function for generating nonce\n * @param length Length of the nonce\n * @returns Random nonce string\n */\nexport function generateNonce(length: number = 32): string {\n return CryptoUtils.generateNonce(length);\n}\n\n/**\n * Convenience function for generating timestamp\n * @returns Unix timestamp as string\n */\nexport function generateTimestamp(): string {\n return CryptoUtils.generateTimestamp();\n}\n\n/**\n * Convenience function for generating PKCE code verifier\n * @param length Length of the code verifier\n * @returns Random code verifier string\n */\nexport function generateCodeVerifier(length: number = 128): string {\n return CryptoUtils.generateCodeVerifier(length);\n}\n\n/**\n * Convenience function for generating PKCE code challenge\n * @param codeVerifier The code verifier string\n * @returns Promise that resolves to base64url encoded SHA256 hash\n */\nexport async function generateCodeChallenge(\n codeVerifier: string\n): Promise {\n return CryptoUtils.generateCodeChallenge(codeVerifier);\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OAuth2 authentication utilities for the X API.\n */\n\nimport { CryptoUtils, generateCodeVerifier, generateCodeChallenge } from './crypto_utils.js';\n\n/**\n * OAuth2 configuration options\n */\nexport interface OAuth2Config {\n /** Client ID */\n clientId: string;\n /** Client secret (optional for public clients) */\n clientSecret?: string;\n /** Redirect URI */\n redirectUri: string;\n /** Scopes to request */\n scope?: string[];\n}\n\n/**\n * OAuth2 token response\n */\nexport interface OAuth2Token {\n /** Access token */\n access_token: string;\n /** Token type */\n token_type: string;\n /** Expiration time in seconds */\n expires_in: number;\n /** Refresh token */\n refresh_token?: string;\n /** Scopes granted */\n scope?: string;\n}\n\n/**\n * OAuth2 authentication handler\n */\nexport class OAuth2 {\n private config: OAuth2Config;\n private token?: OAuth2Token;\n private codeVerifier?: string;\n private codeChallenge?: string;\n\n constructor(config: OAuth2Config) {\n this.config = {\n scope: ['tweet.read', 'users.read'],\n ...config\n };\n }\n\n /**\n * Get the authorization URL\n * @param state Optional state parameter for security\n * @returns Authorization URL\n */\n async getAuthorizationUrl(state?: string): Promise {\n const params = new URLSearchParams({\n response_type: 'code',\n client_id: this.config.clientId,\n redirect_uri: this.config.redirectUri,\n scope: this.config.scope?.join(' ') || '',\n state: state || ''\n });\n\n // PKCE parameters are handled separately - not generated automatically\n\n return `https://x.com/i/oauth2/authorize?${params.toString()}`;\n }\n\n /**\n * Exchange authorization code for tokens\n * @param code Authorization code from callback\n * @param codeVerifier Optional code verifier for PKCE\n * @returns Promise with OAuth2 token\n */\n async exchangeCode(code: string, codeVerifier?: string): Promise {\n const params = new URLSearchParams({\n grant_type: 'authorization_code',\n code,\n redirect_uri: this.config.redirectUri\n });\n\n // Add PKCE code verifier if provided\n if (codeVerifier) {\n params.append('code_verifier', codeVerifier);\n }\n\n // Prepare headers\n const headers: Record = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n };\n\n // Add Basic Auth header if client secret is provided (optional but recommended)\n if (this.config.clientSecret) {\n const credentials = this._base64Encode(`${this.config.clientId}:${this.config.clientSecret}`);\n headers['Authorization'] = `Basic ${credentials}`;\n } else {\n // Only add client_id to body if no client_secret (public client)\n params.append('client_id', this.config.clientId);\n }\n \n const response = await fetch('https://api.x.com/2/oauth2/token', {\n method: 'POST',\n headers,\n body: params.toString()\n });\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => response.text());\n throw new Error(`HTTP error! status: ${response.status}, body: ${JSON.stringify(errorData)}`);\n }\n\n const data = await response.json();\n this.token = {\n access_token: data.access_token,\n token_type: data.token_type,\n expires_in: data.expires_in,\n refresh_token: data.refresh_token,\n scope: data.scope\n };\n\n return this.token;\n }\n\n /**\n * Get the current token\n * @returns Current OAuth2 token if available\n */\n getToken(): OAuth2Token | undefined {\n return this.token;\n }\n\n /**\n * Get the current code verifier (for PKCE)\n * @returns Current code verifier if available\n */\n getCodeVerifier(): string | undefined {\n return this.codeVerifier;\n }\n\n\n /**\n * Manually set PKCE parameters\n * @param codeVerifier The code verifier to use\n * @param codeChallenge Optional code challenge (will be generated if not provided)\n */\n async setPkceParameters(codeVerifier: string, codeChallenge?: string): Promise {\n this.codeVerifier = codeVerifier;\n if (codeChallenge) {\n this.codeChallenge = codeChallenge;\n } else {\n this.codeChallenge = await generateCodeChallenge(codeVerifier);\n }\n }\n\n /**\n * Get the current code challenge (for PKCE)\n * @returns Current code challenge if available\n */\n getCodeChallenge(): string | undefined {\n return this.codeChallenge;\n }\n\n /**\n * Base64 encode a string (with fallback for environments without btoa)\n * @param str String to encode\n * @returns Base64 encoded string\n */\n private _base64Encode(str: string): string {\n if (typeof btoa !== 'undefined') {\n return btoa(str);\n } else if (typeof Buffer !== 'undefined') {\n // Node.js fallback\n return Buffer.from(str, 'utf8').toString('base64');\n } else {\n // Manual base64 encoding fallback\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n let result = '';\n let i = 0;\n while (i < str.length) {\n const a = str.charCodeAt(i++);\n const b = i < str.length ? str.charCodeAt(i++) : 0;\n const c = i < str.length ? str.charCodeAt(i++) : 0;\n const bitmap = (a << 16) | (b << 8) | c;\n result += chars.charAt((bitmap >> 18) & 63);\n result += chars.charAt((bitmap >> 12) & 63);\n result += i - 2 < str.length ? chars.charAt((bitmap >> 6) & 63) : '=';\n result += i - 1 < str.length ? chars.charAt(bitmap & 63) : '=';\n }\n return result;\n }\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OAuth1 authentication utilities for the X API.\n */\n\nimport { CryptoUtils, generateNonce, generateTimestamp } from './crypto_utils.js';\n\n/**\n * OAuth1 configuration options\n */\nexport interface OAuth1Config {\n /** API Key (Consumer Key) */\n apiKey: string;\n /** API Secret (Consumer Secret) */\n apiSecret: string;\n /** Callback URL for OAuth flow */\n callback: string;\n /** Access Token (if already obtained) */\n accessToken?: string;\n /** Access Token Secret (if already obtained) */\n accessTokenSecret?: string;\n}\n\n/**\n * OAuth1 request token response\n */\nexport interface OAuth1RequestToken {\n /** OAuth token */\n oauthToken: string;\n /** OAuth token secret */\n oauthTokenSecret: string;\n}\n\n/**\n * OAuth1 access token response\n */\nexport interface OAuth1AccessToken {\n /** Access token */\n accessToken: string;\n /** Access token secret */\n accessTokenSecret: string;\n}\n\n/**\n * OAuth1 authentication handler\n */\nexport class OAuth1 {\n private config: OAuth1Config;\n public requestToken?: OAuth1RequestToken;\n public accessToken?: OAuth1AccessToken;\n\n constructor(config: OAuth1Config) {\n this.config = config;\n \n // If access token is provided, set it\n if (config.accessToken && config.accessTokenSecret) {\n this.accessToken = {\n accessToken: config.accessToken,\n accessTokenSecret: config.accessTokenSecret\n };\n }\n }\n\n /**\n * Get the authorization URL for OAuth1 flow\n * @param loginWithX Whether to use \"Log in with X\" flow\n * @returns Authorization URL\n */\n getAuthorizationUrl(loginWithX: boolean = false): string {\n if (!this.requestToken) {\n throw new Error('Request token not obtained. Call getRequestToken() first.');\n }\n\n const baseUrl = loginWithX \n ? 'https://x.com/i/oauth/authenticate'\n : 'https://x.com/oauth/authorize';\n\n const params = new URLSearchParams({\n oauth_token: this.requestToken.oauthToken\n });\n\n return `${baseUrl}?${params.toString()}`;\n }\n\n /**\n * Get request token to start OAuth1 flow\n * @returns Promise with request token\n */\n async getRequestToken(): Promise {\n const url = 'https://api.x.com/oauth/request_token';\n \n const params = new URLSearchParams({\n oauth_callback: this.config.callback\n });\n\n const response = await fetch(`${url}?${params.toString()}`, {\n method: 'POST',\n headers: {\n 'Authorization': await this._buildOAuthHeader('POST', url, params.toString())\n }\n });\n\n if (!response.ok) {\n throw new Error(`Failed to get request token: ${response.status} ${response.statusText}`);\n }\n\n const responseText = await response.text();\n const responseParams = new URLSearchParams(responseText);\n \n this.requestToken = {\n oauthToken: responseParams.get('oauth_token')!,\n oauthTokenSecret: responseParams.get('oauth_token_secret')!\n };\n\n return this.requestToken;\n }\n\n /**\n * Exchange verifier for access token\n * @param verifier OAuth verifier from callback or PIN\n * @returns Promise with access token\n */\n async getAccessToken(verifier: string): Promise {\n if (!this.requestToken) {\n throw new Error('Request token not obtained. Call getRequestToken() first.');\n }\n\n const url = 'https://api.x.com/oauth/access_token';\n \n const params = new URLSearchParams({\n oauth_token: this.requestToken.oauthToken,\n oauth_verifier: verifier\n });\n\n const response = await fetch(`${url}?${params.toString()}`, {\n method: 'POST',\n headers: {\n 'Authorization': await this._buildOAuthHeader('POST', url, params.toString())\n }\n });\n\n if (!response.ok) {\n throw new Error(`Failed to get access token: ${response.status} ${response.statusText}`);\n }\n\n const responseText = await response.text();\n const responseParams = new URLSearchParams(responseText);\n \n this.accessToken = {\n accessToken: responseParams.get('oauth_token')!,\n accessTokenSecret: responseParams.get('oauth_token_secret')!\n };\n\n return this.accessToken;\n }\n\n /**\n * Build OAuth1 authorization header\n * @param method HTTP method\n * @param url Request URL\n * @param body Request body\n * @returns Promise that resolves to OAuth1 authorization header string\n */\n private async _buildOAuthHeader(method: string, url: string, body: string): Promise {\n const timestamp = generateTimestamp();\n const nonce = generateNonce();\n \n const oauthParams: Record = {\n oauth_consumer_key: this.config.apiKey,\n oauth_nonce: nonce,\n oauth_signature_method: 'HMAC-SHA1',\n oauth_timestamp: timestamp,\n oauth_version: '1.0'\n };\n\n // Add request token if available\n if (this.requestToken) {\n oauthParams['oauth_token'] = this.requestToken.oauthToken;\n }\n\n // Add access token if available\n if (this.accessToken) {\n oauthParams['oauth_token'] = this.accessToken.accessToken;\n }\n\n // Build signature base string\n const paramString = this._buildParamString(oauthParams, body);\n const signatureBase = `${method.toUpperCase()}&${this._encode(url)}&${this._encode(paramString)}`;\n \n // Generate signature\n const signingKey = `${this._encode(this.config.apiSecret)}&${this._encode(\n this.requestToken?.oauthTokenSecret || this.accessToken?.accessTokenSecret || ''\n )}`;\n \n const signature = await CryptoUtils.hmacSha1(signingKey, signatureBase);\n oauthParams['oauth_signature'] = signature;\n\n // Build authorization header\n const headerParams = Object.entries(oauthParams)\n .map(([key, value]) => `${key}=\"${this._encode(value)}\"`)\n .join(', ');\n\n return `OAuth ${headerParams}`;\n }\n\n /**\n * Build parameter string for OAuth signature\n * @param oauthParams OAuth parameters\n * @param body Request body\n * @returns Parameter string\n */\n private _buildParamString(oauthParams: Record, body: string): string {\n const allParams = { ...oauthParams };\n \n // Parse body parameters if present and it's form-encoded (not JSON)\n // According to OAuth1 spec, JSON bodies should NOT be included in the signature\n if (body) {\n // Check if body is JSON by attempting to parse it\n let isJson = false;\n try {\n JSON.parse(body);\n isJson = true;\n } catch {\n // Not valid JSON, treat as form-encoded\n isJson = false;\n }\n \n if (!isJson) {\n // Only parse form-encoded bodies\n try {\n const bodyParams = new URLSearchParams(body);\n bodyParams.forEach((value, key) => {\n allParams[key] = value;\n });\n } catch (error) {\n // If body parsing fails, ignore it\n console.warn('Failed to parse body parameters:', error);\n }\n }\n // If body is JSON, we don't include it in the signature (per OAuth1 spec)\n }\n\n // Sort parameters alphabetically\n const sortedParams = Object.entries(allParams).sort(([a], [b]) => a.localeCompare(b));\n \n return sortedParams\n .map(([key, value]) => `${this._encode(key)}=${this._encode(value)}`)\n .join('&');\n }\n\n /**\n * URL encode string according to OAuth1 specification\n * @param str String to encode\n * @returns Encoded string\n */\n private _encode(str: string): string {\n return encodeURIComponent(str)\n .replace(/!/g, '%21')\n .replace(/\\*/g, '%2A')\n .replace(/'/g, '%27')\n .replace(/\\(/g, '%28')\n .replace(/\\)/g, '%29')\n .replace(/%7E/g, '~');\n }\n\n /**\n * Convenience method to start the OAuth1 flow\n * @param loginWithX Whether to use \"Log in with X\" flow\n * @returns Promise that resolves to the authorization URL\n */\n async startOAuthFlow(loginWithX: boolean = false): Promise {\n await this.getRequestToken();\n return this.getAuthorizationUrl(loginWithX);\n }\n\n /**\n * Build OAuth1 authorization header for API requests\n * @param method HTTP method\n * @param url Request URL\n * @param body Request body\n * @returns Promise that resolves to OAuth1 authorization header string\n */\n async buildRequestHeader(method: string, url: string, body: string = ''): Promise {\n if (!this.accessToken) {\n throw new Error('Access token not available. Complete OAuth1 flow first.');\n }\n\n // Extract query parameters from URL if present\n let urlWithoutQuery = url;\n let queryParams = '';\n \n try {\n const urlObj = new URL(url);\n if (urlObj.search) {\n queryParams = urlObj.search.substring(1); // Remove the '?' prefix\n urlWithoutQuery = urlObj.origin + urlObj.pathname;\n }\n } catch (error) {\n // If URL parsing fails, use the original URL\n console.warn('Failed to parse URL for OAuth1:', error);\n }\n\n // Combine query parameters with body parameters\n let allParams = '';\n if (queryParams && body) {\n allParams = `${queryParams}&${body}`;\n } else if (queryParams) {\n allParams = queryParams;\n } else if (body) {\n allParams = body;\n }\n\n return this._buildOAuthHeader(method, urlWithoutQuery, allParams);\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OpenAPI Schema Types\n * Auto-generated from OpenAPI components/schemas\n *\n * @internal\n */\n\n/**\nThe unique identifier of an Activity event.\n *\n * @public\n */\nexport type ActivityEventId = string; /**\nAn activity event or error that can be returned by the x activity streaming API.\n *\n * @public\n */\nexport interface ActivityStreamingResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for ActivityStreamingResponsePayload\n *\n * @public\n */\nexport type ActivityStreamingResponsePayload = any; /**\nAn XActivity subscription.\n *\n * @public\n */\nexport interface ActivitySubscription {\n /** none */ createdAt: string;\n /** none */ eventType: string;\n filter: ActivitySubscriptionFilter;\n subscriptionId: ActivitySubscriptionId;\n /** none */ tag?: string;\n /** none */ updatedAt: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionCreateRequest\n *\n * @public\n */\nexport interface ActivitySubscriptionCreateRequest {\n /** none */ eventType:\n | 'ProfileBioUpdate'\n | 'ProfilePictureUpdate'\n | 'ProfileBannerPictureUpdate'\n | 'ProfileScreennameUpdate'\n | 'ProfileGeoUpdate'\n | 'ProfileUrlUpdate'\n | 'ProfileVerifiedBadgeUpdate'\n | 'TrendsNew';\n filter: ActivitySubscriptionFilter;\n /** none */ tag?: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionCreateResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for ActivitySubscriptionDeleteResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nAn XAA subscription.\n *\n * @public\n */\nexport interface ActivitySubscriptionFilter {\n keyword?: Keyword;\n userId?: UserId;\n} /**\nSchema type for ActivitySubscriptionGetResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionGetResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nThe unique identifier of this subscription.\n *\n * @public\n */\nexport type ActivitySubscriptionId = string; /**\nSchema type for ActivitySubscriptionUpdateRequest\n *\n * @public\n */\nexport interface ActivitySubscriptionUpdateRequest {\n /** none */ tag?: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionUpdateResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionUpdateResponse {\n /** none */ data?: Record;\n}\n/**\nSchema type for AddOrDeleteRulesRequest\n *\n * @public\n */\nexport type AddOrDeleteRulesRequest = any; /**\nA response from modifying user-specified stream filtering rules.\n *\n * @public\n */\nexport interface AddOrDeleteRulesResponse {\n /** All user-specified stream filtering rules that were created. */ data?: Array<\n Rule\n >;\n /** none */ errors?: Array;\n meta: RulesResponseMetadata;\n} /**\nA request to add a user-specified stream filtering rule.\n *\n * @public\n */\nexport interface AddRulesRequest {\n /** none */ add: Array;\n} /**\nThe sum of results returned in this response.\n *\n * @public\n */\nexport type Aggregate = number; /**\nUnique identifier of ai trend.\n *\n * @public\n */\nexport type AiTrendId = string; /**\nSchema type for AllowDownloadStatus\n *\n * @public\n */\nexport interface AllowDownloadStatus {\n /** none */ allowDownload?: boolean;\n} /**\nClient App Rule Counts for all applications in the project\n *\n * @public\n */\nexport type AllProjectClientApps = Array<\n AppRulesCount\n>; /**\nSchema type for AltText\n *\n * @public\n */\nexport interface AltText {\n /** Description of media ( <= 1000 characters ) */ text: string;\n} /**\nSchema type for Analytics\n *\n * @public\n */\nexport interface Analytics {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n}\n/**\nSchema type for AnimatedGif\n *\n * @public\n */\nexport type AnimatedGif = any; /**\nA count of user-provided stream filtering rules at the client application level.\n *\n * @public\n */\nexport interface AppRulesCount {\n clientAppId?: ClientAppId;\n /** Number of rules for client application */ ruleCount?: number;\n} /**\nSchema type for AudiencePolicy\n *\n * @public\n */\nexport interface AudiencePolicy {\n /** none */ creatorSubscriptions?: Array<'Any'>;\n /** none */ xSubscriptions?: Array<'Any'>;\n} /**\nSchema type for BookmarkAddRequest\n *\n * @public\n */\nexport interface BookmarkAddRequest {\n tweetId: TweetId;\n} /**\nThe unique identifier of this Bookmark folder.\n *\n * @public\n */\nexport type BookmarkFolderId = string; /**\nSchema type for BookmarkFolderPostsResponse\n *\n * @public\n */\nexport interface BookmarkFolderPostsResponse {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for BookmarkFoldersResponse\n *\n * @public\n */\nexport interface BookmarkFoldersResponse {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for BookmarkMutationResponse\n *\n * @public\n */\nexport interface BookmarkMutationResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for CashtagEntity\n *\n * @public\n */\nexport type CashtagEntity = any; /**\nRepresent the portion of text recognized as a Cashtag, and its start and end position within the text.\n *\n * @public\n */\nexport interface CashtagFields {\n /** none */ tag: string;\n} /**\nThe ID of the client application\n *\n * @public\n */\nexport type ClientAppId = string; /**\nUsage per client app\n *\n * @public\n */\nexport interface ClientAppUsage {\n /** The unique identifier for this project */ clientAppId?: string;\n /** The usage value */ usage?: Array;\n /** The number of results returned */ usageResultCount?: number;\n}\n/**\nYour client has gone away.\n *\n * @public\n */\nexport type ClientDisconnectedProblem = any;\n/**\nA problem that indicates your client is forbidden from making this request.\n *\n * @public\n */\nexport type ClientForbiddenProblem = any; /**\nA X Community is a curated group of Posts.\n *\n * @public\n */\nexport interface Community {\n /** none */ createdAt?: string;\n id: CommunityId;\n /** The name of this Community. */ name: string;\n} /**\nThe unique identifier of this Community.\n *\n * @public\n */\nexport type CommunityId = string; /**\nSchema type for ComplianceJob\n *\n * @public\n */\nexport interface ComplianceJob {\n createdAt: CreatedAt;\n downloadExpiresAt: DownloadExpiration;\n downloadUrl: DownloadUrl;\n id: JobId;\n name?: ComplianceJobName;\n status: ComplianceJobStatus;\n type: ComplianceJobType;\n uploadExpiresAt: UploadExpiration;\n uploadUrl: UploadUrl;\n} /**\nUser-provided name for a compliance job.\n *\n * @public\n */\nexport type ComplianceJobName = string; /**\nStatus of a compliance job.\n *\n * @public\n */\nexport type ComplianceJobStatus =\n | 'created'\n | 'in_progress'\n | 'failed'\n | 'complete'\n | 'expired'; /**\nType of compliance job to list.\n *\n * @public\n */\nexport type ComplianceJobType = 'tweets' | 'users';\n/**\nYou cannot create a new job if one is already in progress.\n *\n * @public\n */\nexport type ConflictProblem = any;\n/**\nA problem that indicates something is wrong with the connection.\n *\n * @public\n */\nexport type ConnectionExceptionProblem = any; /**\nSchema type for ContentExpiration\n *\n * @public\n */\nexport interface ContentExpiration {\n /** Expiration time for content as a Unix timestamp in seconds */ timestampSec: number;\n} /**\nAnnotation inferred from the Tweet text.\n *\n * @public\n */\nexport interface ContextAnnotation {\n domain: ContextAnnotationDomainFields;\n entity: ContextAnnotationEntityFields;\n} /**\nRepresents the data for the context annotation domain.\n *\n * @public\n */\nexport interface ContextAnnotationDomainFields {\n /** Description of the context annotation domain. */ description?: string;\n /** The unique id for a context annotation domain. */ id: string;\n /** Name of the context annotation domain. */ name?: string;\n} /**\nRepresents the data for the context annotation entity.\n *\n * @public\n */\nexport interface ContextAnnotationEntityFields {\n /** Description of the context annotation entity. */ description?: string;\n /** The unique id for a context annotation entity. */ id: string;\n /** Name of the context annotation entity. */ name?: string;\n} /**\nA two-letter ISO 3166-1 alpha-2 country code.\n *\n * @public\n */\nexport type CountryCode = string; /**\nSchema type for CreateAttachmentsMessageRequest\n *\n * @public\n */\nexport interface CreateAttachmentsMessageRequest {\n attachments: DmAttachments;\n /** Text of the message. */ text?: string;\n} /**\nA request to create a new batch compliance job.\n *\n * @public\n */\nexport interface CreateComplianceJobRequest {\n name?: ComplianceJobName;\n /** If true, this endpoint will return a pre-signed URL with resumable uploads enabled. */ resumable?: boolean;\n /** Type of compliance job to list. */ type: 'tweets' | 'users';\n} /**\nSchema type for CreateComplianceJobResponse\n *\n * @public\n */\nexport interface CreateComplianceJobResponse {\n data?: ComplianceJob;\n /** none */ errors?: Array;\n} /**\nCreation time of the compliance job.\n *\n * @public\n */\nexport type CreatedAt = string; /**\nSchema type for CreateDmConversationRequest\n *\n * @public\n */\nexport interface CreateDmConversationRequest {\n /** The conversation type that is being created. */ conversationType: 'Group';\n message: CreateMessageRequest;\n participantIds: DmParticipants;\n} /**\nSchema type for CreateDmEventResponse\n *\n * @public\n */\nexport interface CreateDmEventResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for CreateMessageRequest\n *\n * @public\n */\nexport type CreateMessageRequest = any; /**\nSchema type for CreateNoteRequest\n *\n * @public\n */\nexport interface CreateNoteRequest {\n info: NoteInfo;\n postId: TweetId;\n /** If true, the note being submitted is only for testing the capability of the bot, and won't be publicly visible. If false, the note being submitted will be a new proposed note on the product. */ testMode: boolean;\n} /**\nSchema type for CreateNoteResponse\n *\n * @public\n */\nexport interface CreateNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for CreateTextMessageRequest\n *\n * @public\n */\nexport interface CreateTextMessageRequest {\n attachments?: DmAttachments;\n /** Text of the message. */ text: string;\n} /**\nSchema type for DeleteDmResponse\n *\n * @public\n */\nexport interface DeleteDmResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for DeleteNoteResponse\n *\n * @public\n */\nexport interface DeleteNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nA response from deleting user-specified stream filtering rules.\n *\n * @public\n */\nexport interface DeleteRulesRequest {\n /** IDs and values of all deleted user-specified stream filtering rules. */ delete: Record<\n string,\n any\n >;\n}\n/**\nA problem that indicates that the resource requested violates the precepts of this API.\n *\n * @public\n */\nexport type DisallowedResourceProblem = any; /**\nRepresent a boundary range (start and end zero-based indices) for the portion of text that is displayed for a post. `start` must be smaller than `end`. The start index is inclusive, the end index is exclusive.\n *\n * @public\n */\nexport type DisplayTextRange = Array<\n number\n>; /**\nAttachments to a DM Event.\n *\n * @public\n */\nexport type DmAttachments = Array<\n DmMediaAttachment\n>; /**\nUnique identifier of a DM conversation. This can either be a numeric string, or a pair of numeric strings separated by a '-' character in the case of one-on-one DM Conversations.\n *\n * @public\n */\nexport type DmConversationId = string; /**\nSchema type for DmEvent\n *\n * @public\n */\nexport interface DmEvent {\n /** Specifies the type of attachments (if any) present in this DM. */ attachments?: Record<\n string,\n any\n >;\n /** none */ cashtags?: Array;\n /** none */ createdAt?: string;\n dmConversationId?: DmConversationId;\n /** none */ eventType: string;\n /** none */ hashtags?: Array;\n id: DmEventId;\n /** none */ mentions?: Array;\n /** A list of participants for a ParticipantsJoin or ParticipantsLeave event_type. */ participantIds?: Array<\n UserId\n >;\n /** A list of Posts this DM refers to. */ referencedTweets?: Array<\n Record\n >;\n senderId?: UserId;\n /** none */ text?: string;\n /** none */ urls?: Array;\n} /**\nUnique identifier of a DM Event.\n *\n * @public\n */\nexport type DmEventId = string; /**\nSchema type for DmMediaAttachment\n *\n * @public\n */\nexport interface DmMediaAttachment {\n mediaId: MediaId;\n} /**\nParticipants for the DM Conversation.\n *\n * @public\n */\nexport type DmParticipants = Array<\n UserId\n>; /**\nSchema type for DomainRestrictions\n *\n * @public\n */\nexport interface DomainRestrictions {\n /** List of whitelisted domains */ whitelist: Array;\n} /**\nExpiration time of the download URL.\n *\n * @public\n */\nexport type DownloadExpiration = string; /**\nURL from which the user will retrieve their compliance results.\n *\n * @public\n */\nexport type DownloadUrl = string;\n/**\nThe rule you have submitted is a duplicate.\n *\n * @public\n */\nexport type DuplicateRuleProblem = any; /**\nThe end time of the bucket.\n *\n * @public\n */\nexport type End = string; /**\nAn Engagement Api Response.\n *\n * @public\n */\nexport interface Engagement {\n /** none */ errors?: Array>;\n /** none */ measurement?: Record;\n} /**\nRepresent a boundary range (start and end index) for a recognized entity (for example a hashtag or a mention). `start` must be smaller than `end`. The start index is inclusive, the end index is exclusive.\n *\n * @public\n */\nexport interface EntityIndicesInclusiveExclusive {\n /** Index (zero-based) at which position this entity ends. The index is exclusive. */ end: number;\n /** Index (zero-based) at which position this entity starts. The index is inclusive. */ start: number;\n} /**\nRepresent a boundary range (start and end index) for a recognized entity (for example a hashtag or a mention). `start` must be smaller than `end`. The start index is inclusive, the end index is inclusive.\n *\n * @public\n */\nexport interface EntityIndicesInclusiveInclusive {\n /** Index (zero-based) at which position this entity ends. The index is inclusive. */ end: number;\n /** Index (zero-based) at which position this entity starts. The index is inclusive. */ start: number;\n} /**\nSchema type for Error\n *\n * @public\n */\nexport interface Error {\n /** none */ code: number;\n /** none */ message: string;\n} /**\nSchema type for EvaluateNoteRequest\n *\n * @public\n */\nexport interface EvaluateNoteRequest {\n /** Text for the community note. */ noteText: string;\n postId: TweetId;\n} /**\nSchema type for EvaluateNoteResponse\n *\n * @public\n */\nexport interface EvaluateNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for Expansions\n *\n * @public\n */\nexport interface Expansions {\n /** none */ media?: Array;\n /** none */ places?: Array;\n /** none */ polls?: Array;\n /** none */ topics?: Array;\n /** none */ tweets?: Array;\n /** none */ users?: Array;\n}\n/**\nA problem that indicates that you are not allowed to see a particular field on a Tweet, User, etc.\n *\n * @public\n */\nexport type FieldUnauthorizedProblem = any; /**\nA Tweet or error that can be returned by the streaming Tweet API. The values returned with a successful streamed Tweet includes the user provided rules that the Tweet matched.\n *\n * @public\n */\nexport interface FilteredStreamingTweetResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** The list of rules which matched the Tweet */ matchingRules?: Array<\n Record\n >;\n} /**\nSchema type for FoundMediaOrigin\n *\n * @public\n */\nexport interface FoundMediaOrigin {\n /** Unique Identifier of media within provider ( <= 24 characters )) */ id: string;\n /** The media provider (e.g., 'giphy') that sourced the media ( <= 8 Characters ) */ provider: string;\n} /**\nSchema type for FullTextEntities\n *\n * @public\n */\nexport interface FullTextEntities {\n /** none */ annotations?: Array;\n /** none */ cashtags?: Array;\n /** none */ hashtags?: Array;\n /** none */ mentions?: Array;\n /** none */ urls?: Array;\n}\n/**\nA generic problem with no additional information beyond that provided by the HTTP status code.\n *\n * @public\n */\nexport type GenericProblem = any; /**\nSchema type for Geo\n *\n * @public\n */\nexport interface Geo {\n /** none */ bbox: Array;\n geometry?: Point;\n /** none */ properties: Record;\n /** none */ type: 'Feature';\n}\n/**\nSchema type for GeoRestrictions\n *\n * @public\n */\nexport type GeoRestrictions = any; /**\nSchema type for Get2AiTrendsIdResponse\n *\n * @public\n */\nexport interface Get2AiTrendsIdResponse {\n data?: News;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2CommunitiesIdResponse\n *\n * @public\n */\nexport interface Get2CommunitiesIdResponse {\n data?: Community;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2CommunitiesSearchResponse\n *\n * @public\n */\nexport interface Get2CommunitiesSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ComplianceJobsIdResponse\n *\n * @public\n */\nexport interface Get2ComplianceJobsIdResponse {\n data?: ComplianceJob;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2ComplianceJobsResponse\n *\n * @public\n */\nexport interface Get2ComplianceJobsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmConversationsIdDmEventsResponse\n *\n * @public\n */\nexport interface Get2DmConversationsIdDmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmConversationsWithParticipantIdDmEventsResponse\n *\n * @public\n */\nexport interface Get2DmConversationsWithParticipantIdDmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmEventsEventIdResponse\n *\n * @public\n */\nexport interface Get2DmEventsEventIdResponse {\n data?: DmEvent;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2DmEventsResponse\n *\n * @public\n */\nexport interface Get2DmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2FdxAccountsAccountidContactResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidContactResponse {\n data?: PlaidAccountContact;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidPayment-networksResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidPayment_networksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidResponse {\n data?: PlaidAccount;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidTransactionsResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidTransactionsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxCustomersCurrentResponse\n *\n * @public\n */\nexport interface Get2FdxCustomersCurrentResponse {\n data?: PlaidCustomer;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2Insights28hrResponse\n *\n * @public\n */\nexport interface Get2Insights28hrResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2InsightsHistoricalResponse\n *\n * @public\n */\nexport interface Get2InsightsHistoricalResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2LikesFirehoseStreamResponse\n *\n * @public\n */\nexport interface Get2LikesFirehoseStreamResponse {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2LikesSample10StreamResponse\n *\n * @public\n */\nexport interface Get2LikesSample10StreamResponse {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2ListsIdFollowersResponse\n *\n * @public\n */\nexport interface Get2ListsIdFollowersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ListsIdMembersResponse\n *\n * @public\n */\nexport interface Get2ListsIdMembersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ListsIdResponse\n *\n * @public\n */\nexport interface Get2ListsIdResponse {\n data?: List;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2ListsIdTweetsResponse\n *\n * @public\n */\nexport interface Get2ListsIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2MediaAnalyticsResponse\n *\n * @public\n */\nexport interface Get2MediaAnalyticsResponse {\n data?: MediaAnalytics;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2MediaMediaKeyResponse\n *\n * @public\n */\nexport interface Get2MediaMediaKeyResponse {\n data?: Media;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2MediaResponse\n *\n * @public\n */\nexport interface Get2MediaResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2NewsIdResponse\n *\n * @public\n */\nexport interface Get2NewsIdResponse {\n data?: News;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2NewsSearchResponse\n *\n * @public\n */\nexport interface Get2NewsSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2NotesSearchNotesWrittenResponse\n *\n * @public\n */\nexport interface Get2NotesSearchNotesWrittenResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2NotesSearchPostsEligibleForNotesResponse\n *\n * @public\n */\nexport interface Get2NotesSearchPostsEligibleForNotesResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesByCreatorIdsResponse\n *\n * @public\n */\nexport interface Get2SpacesByCreatorIdsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesIdBuyersResponse\n *\n * @public\n */\nexport interface Get2SpacesIdBuyersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesIdResponse\n *\n * @public\n */\nexport interface Get2SpacesIdResponse {\n data?: Space;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2SpacesIdTweetsResponse\n *\n * @public\n */\nexport interface Get2SpacesIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesResponse\n *\n * @public\n */\nexport interface Get2SpacesResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2SpacesSearchResponse\n *\n * @public\n */\nexport interface Get2SpacesSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TrendsByWoeidWoeidResponse\n *\n * @public\n */\nexport interface Get2TrendsByWoeidWoeidResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2TweetsAnalyticsResponse\n *\n * @public\n */\nexport interface Get2TweetsAnalyticsResponse {\n data?: Analytics;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2TweetsCountsAllResponse\n *\n * @public\n */\nexport interface Get2TweetsCountsAllResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsCountsRecentResponse\n *\n * @public\n */\nexport interface Get2TweetsCountsRecentResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangEnResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangEnResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangJaResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangJaResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangKoResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangKoResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangPtResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangPtResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsIdLikingUsersResponse\n *\n * @public\n */\nexport interface Get2TweetsIdLikingUsersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdQuoteTweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsIdQuoteTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdResponse\n *\n * @public\n */\nexport interface Get2TweetsIdResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsIdRetweetedByResponse\n *\n * @public\n */\nexport interface Get2TweetsIdRetweetedByResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdRetweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsIdRetweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSample10StreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSample10StreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSampleStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSampleStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSearchAllResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchAllResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsSearchRecentResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchRecentResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsSearchStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSearchStreamRulesCountsResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchStreamRulesCountsResponse {\n data?: RulesCount;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsageTweetsResponse\n *\n * @public\n */\nexport interface Get2UsageTweetsResponse {\n data?: Usage;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsersByResponse\n *\n * @public\n */\nexport interface Get2UsersByResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersByUsernameUsernameResponse\n *\n * @public\n */\nexport interface Get2UsersByUsernameUsernameResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersIdBlockingResponse\n *\n * @public\n */\nexport interface Get2UsersIdBlockingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdBookmarksResponse\n *\n * @public\n */\nexport interface Get2UsersIdBookmarksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowersResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowingResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdLikedTweetsResponse\n *\n * @public\n */\nexport interface Get2UsersIdLikedTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdListMembershipsResponse\n *\n * @public\n */\nexport interface Get2UsersIdListMembershipsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdMentionsResponse\n *\n * @public\n */\nexport interface Get2UsersIdMentionsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdMutingResponse\n *\n * @public\n */\nexport interface Get2UsersIdMutingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdOwnedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdOwnedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdPinnedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdPinnedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdResponse\n *\n * @public\n */\nexport interface Get2UsersIdResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersIdTimelinesReverseChronologicalResponse\n *\n * @public\n */\nexport interface Get2UsersIdTimelinesReverseChronologicalResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdTweetsResponse\n *\n * @public\n */\nexport interface Get2UsersIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersMeResponse\n *\n * @public\n */\nexport interface Get2UsersMeResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersPersonalizedTrendsResponse\n *\n * @public\n */\nexport interface Get2UsersPersonalizedTrendsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsersRepostsOfMeResponse\n *\n * @public\n */\nexport interface Get2UsersRepostsOfMeResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersResponse\n *\n * @public\n */\nexport interface Get2UsersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersSearchResponse\n *\n * @public\n */\nexport interface Get2UsersSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2WebhooksResponse\n *\n * @public\n */\nexport interface Get2WebhooksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n}\n/**\nSchema type for HashtagEntity\n *\n * @public\n */\nexport type HashtagEntity = any; /**\nRepresent the portion of text recognized as a Hashtag, and its start and end position within the text.\n *\n * @public\n */\nexport interface HashtagFields {\n /** The text of the Hashtag. */ tag: string;\n} /**\nHTTP Status Code.\n *\n * @public\n */\nexport type HttpStatusCode = number;\n/**\nA problem that indicates this request is invalid.\n *\n * @public\n */\nexport type InvalidRequestProblem = any;\n/**\nThe rule you have submitted is invalid.\n *\n * @public\n */\nexport type InvalidRuleProblem = any; /**\nCompliance Job ID.\n *\n * @public\n */\nexport type JobId = string; /**\nA keyword to filter on.\n *\n * @public\n */\nexport type Keyword = string; /**\nSchema type for KillAllConnectionsResponse\n *\n * @public\n */\nexport interface KillAllConnectionsResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for LikeComplianceSchema\n *\n * @public\n */\nexport interface LikeComplianceSchema {\n delete: UnlikeComplianceSchema;\n} /**\nThe unique identifier of this Like.\n *\n * @public\n */\nexport type LikeId = string;\n/**\nLikes compliance stream events.\n *\n * @public\n */\nexport type LikesComplianceStreamResponse = any; /**\nA Like event, with the tweet author user and the tweet being liked\n *\n * @public\n */\nexport interface LikeWithTweetAuthor {\n /** Creation time of the Tweet. */ createdAt?: string;\n id?: LikeId;\n likedTweetId?: TweetId;\n /** Timestamp in milliseconds of creation. */ timestampMs?: number;\n tweetAuthorId?: UserId;\n} /**\nA X List is a curated group of accounts.\n *\n * @public\n */\nexport interface List {\n /** none */ createdAt?: string;\n /** none */ description?: string;\n /** none */ followerCount?: number;\n id: ListId;\n /** none */ memberCount?: number;\n /** The name of this List. */ name: string;\n ownerId?: UserId;\n /** none */ private?: boolean;\n} /**\nSchema type for ListAddUserRequest\n *\n * @public\n */\nexport interface ListAddUserRequest {\n userId: UserId;\n} /**\nSchema type for ListCreateRequest\n *\n * @public\n */\nexport interface ListCreateRequest {\n /** none */ description?: string;\n /** none */ name: string;\n /** none */ private?: boolean;\n} /**\nSchema type for ListCreateResponse\n *\n * @public\n */\nexport interface ListCreateResponse {\n /** A X List is a curated group of accounts. */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListDeleteResponse\n *\n * @public\n */\nexport interface ListDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListFollowedRequest\n *\n * @public\n */\nexport interface ListFollowedRequest {\n listId: ListId;\n} /**\nSchema type for ListFollowedResponse\n *\n * @public\n */\nexport interface ListFollowedResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe unique identifier of this List.\n *\n * @public\n */\nexport type ListId = string; /**\nSchema type for ListMutateResponse\n *\n * @public\n */\nexport interface ListMutateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListPinnedRequest\n *\n * @public\n */\nexport interface ListPinnedRequest {\n listId: ListId;\n} /**\nSchema type for ListPinnedResponse\n *\n * @public\n */\nexport interface ListPinnedResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListUnpinResponse\n *\n * @public\n */\nexport interface ListUnpinResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListUpdateRequest\n *\n * @public\n */\nexport interface ListUpdateRequest {\n /** none */ description?: string;\n /** none */ name?: string;\n /** none */ private?: boolean;\n} /**\nSchema type for ListUpdateResponse\n *\n * @public\n */\nexport interface ListUpdateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ManagementInfo\n *\n * @public\n */\nexport interface ManagementInfo {\n /** Indicates if the media is managed by Media Studio */ managed: boolean;\n} /**\nSchema type for Media\n *\n * @public\n */\nexport interface Media {\n height?: MediaHeight;\n mediaKey?: MediaKey;\n /** none */ type: string;\n width?: MediaWidth;\n} /**\nSchema type for MediaAnalytics\n *\n * @public\n */\nexport interface MediaAnalytics {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n} /**\nA string enum value which identifies a media use-case. This identifier is used to enforce use-case specific constraints (e.g. file size, video duration) and enable advanced features.\n *\n * @public\n */\nexport type MediaCategory =\n | 'amplify_video'\n | 'tweet_gif'\n | 'tweet_image'\n | 'tweet_video'\n | 'dm_gif'\n | 'dm_image'\n | 'dm_video'\n | 'subtitles'; /**\nA string enum value which identifies a media use-case. This identifier is used to enforce use-case specific constraints (e.g. file size) and enable advanced features.\n *\n * @public\n */\nexport type MediaCategoryOneShot =\n | 'tweet_image'\n | 'dm_image'\n | 'subtitles'; /**\nThe media category of uploaded media to which subtitles should be added/deleted\n *\n * @public\n */\nexport type MediaCategorySubtitles =\n | 'AmplifyVideo'\n | 'TweetVideo'; /**\nThe height of the media in pixels.\n *\n * @public\n */\nexport type MediaHeight = number; /**\nThe unique identifier of this Media.\n *\n * @public\n */\nexport type MediaId = string; /**\nThe Media Key identifier for this attachment.\n *\n * @public\n */\nexport type MediaKey = string; /**\nSchema type for MediaMetrics\n *\n * @public\n */\nexport interface MediaMetrics {\n /** Tracks the number of clicks on a call-to-action URL */ ctaUrlClicks?: number;\n /** Tracks the number of clicks to watch a video or media content */ ctaWatchClicks?: number;\n /** Tracks the number of times a video or media is played from a user tap */ playFromTap?: number;\n /** Tracks the number of times a video reaches 25% of its duration */ playback25?: number;\n /** Tracks the number of times a video reaches 50% of its duration */ playback50?: number;\n /** Tracks the number of times a video reaches 75% of its duration */ playback75?: number;\n /** Tracks the number of times a video is played to completion */ playbackComplete?: number;\n /** Tracks the number of times a video playback is initiated */ playbackStart?: number;\n /** Tracks the number of times a video is viewed */ videoViews?: number;\n /** Tracks the total time spent watching a video, measured in milliseconds */ watchTimeMs?: number;\n} /**\nThe file to upload.\n *\n * @public\n */\nexport type MediaPayloadBinary = string; /**\nThe file to upload.\n *\n * @public\n */\nexport type MediaPayloadByte = string;\n/**\nSchema type for MediaSegments\n *\n * @public\n */\nexport type MediaSegments = any; /**\nSchema type for MediaTimestampedMetrics\n *\n * @public\n */\nexport interface MediaTimestampedMetrics {\n metrics?: MediaMetrics;\n /** ISO8601 Time */ timestamp?: string;\n}\n/**\nSchema type for MediaUploadAppendRequest\n *\n * @public\n */\nexport type MediaUploadAppendRequest = any; /**\nA response from getting a media upload request status.\n *\n * @public\n */\nexport interface MediaUploadAppendResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for MediaUploadConfigRequest\n *\n * @public\n */\nexport interface MediaUploadConfigRequest {\n /** none */ additionalOwners?: Array;\n mediaCategory?: MediaCategory;\n /** The type of media. */ mediaType?:\n | 'video/mp4'\n | 'video/webm'\n | 'video/mp2t'\n | 'video/quicktime'\n | 'text/srt'\n | 'text/vtt'\n | 'image/jpeg'\n | 'image/gif'\n | 'image/bmp'\n | 'image/png'\n | 'image/webp'\n | 'image/pjpeg'\n | 'image/tiff'\n | 'model/gltf-binary'\n | 'model/vnd.usdz+zip';\n /** Whether this media is shared or not. */ shared?: boolean;\n /** The total size of the media upload in bytes. */ totalBytes?: number;\n} /**\nSchema type for MediaUploadRequestOneShot\n *\n * @public\n */\nexport interface MediaUploadRequestOneShot {\n /** none */ additionalOwners?: Array;\n /** none */ media: any;\n mediaCategory: MediaCategoryOneShot;\n /** The type of image or subtitle. */ mediaType?:\n | 'text/srt'\n | 'text/vtt'\n | 'image/jpeg'\n | 'image/bmp'\n | 'image/png'\n | 'image/webp'\n | 'image/pjpeg'\n | 'image/tiff';\n /** Whether this media is shared or not. */ shared?: boolean;\n} /**\nA response from getting a media upload request status.\n *\n * @public\n */\nexport interface MediaUploadResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe width of the media in pixels.\n *\n * @public\n */\nexport type MediaWidth = number;\n/**\nSchema type for MentionEntity\n *\n * @public\n */\nexport type MentionEntity = any; /**\nRepresent the portion of text recognized as a User mention, and its start and end position within the text.\n *\n * @public\n */\nexport interface MentionFields {\n id?: UserId;\n username: UserName;\n} /**\nSchema type for MetadataCreateRequest\n *\n * @public\n */\nexport interface MetadataCreateRequest {\n id: MediaId;\n /** none */ metadata?: Record;\n} /**\nSchema type for MetadataCreateResponse\n *\n * @public\n */\nexport interface MetadataCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for Metrics\n *\n * @public\n */\nexport interface Metrics {\n /** Tracks number of App Install Attempts */ appInstallAttempts?: number;\n /** Tracks number of App opens */ appOpens?: number;\n /** Tracks number of Detail expands */ detailExpands?: number;\n /** Tracks number of Email Tweet actions */ emailTweet?: number;\n /** Tracks total Engagements */ engagements?: number;\n /** Tracks number of Follows */ follows?: number;\n /** Tracks number of Hashtag clicks */ hashtagClicks?: number;\n /** Tracks number of Impressions */ impressions?: number;\n /** Tracks number of Likes */ likes?: number;\n /** Tracks number of Link clicks */ linkClicks?: number;\n /** Tracks number of Media engagements */ mediaEngagements?: number;\n /** Tracks number of Media views */ mediaViews?: number;\n /** Tracks number of Permalink clicks */ permalinkClicks?: number;\n /** Tracks number of Profile visits */ profileVisits?: number;\n /** Tracks number of Quote Tweets */ quoteTweets?: number;\n /** Tracks number of Replies */ replies?: number;\n /** Tracks number of Retweets */ retweets?: number;\n /** Tracks number of URL clicks */ urlClicks?: number;\n /** Tracks number of User Profile clicks */ userProfileClicks?: number;\n} /**\nCommunity Note misleading tags type.\n *\n * @public\n */\nexport type MisleadingTags =\n | 'disputed_claim_as_fact'\n | 'factual_error'\n | 'manipulated_media'\n | 'misinterpreted_satire'\n | 'missing_important_context'\n | 'other'\n | 'outdated_information'; /**\nSchema type for MuteUserMutationResponse\n *\n * @public\n */\nexport interface MuteUserMutationResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for MuteUserRequest\n *\n * @public\n */\nexport interface MuteUserRequest {\n targetUserId: UserId;\n} /**\nThe newest id in this response.\n *\n * @public\n */\nexport type NewestId = string; /**\nAn AI generated news story.\n *\n * @public\n */\nexport interface News {\n /** The news category. */ category?: string;\n /** none */ clusterPostsResults?: Array>;\n /** none */ contexts?: Record;\n /** none */ disclaimer?: string;\n /** The news hook. */ hook?: string;\n /** none */ keywords?: Array;\n /** none */ lastUpdatedAtMs?: string;\n /** The headline. */ name?: string;\n restId: NewsId;\n /** The news summary. */ summary?: string;\n} /**\nUnique identifier of news story.\n *\n * @public\n */\nexport type NewsId = string; /**\nThe next token.\n *\n * @public\n */\nexport type NextToken = string;\n/**\nA problem that indicates the user's rule set is not compliant.\n *\n * @public\n */\nexport type NonCompliantRulesProblem = any; /**\nA X Community Note is a note on a Post.\n *\n * @public\n */\nexport interface Note {\n id: NoteId;\n info?: NoteInfo;\n postId: TweetId;\n status?: NoteRatingStatus;\n testResult?: NoteTestResult;\n} /**\nCommunity Note classification type.\n *\n * @public\n */\nexport type NoteClassification =\n | 'misinformed_or_potentially_misleading'\n | 'not_misleading'; /**\nThe unique identifier of this Community Note.\n *\n * @public\n */\nexport type NoteId = string; /**\nA X Community Note is a note on a Post.\n *\n * @public\n */\nexport interface NoteInfo {\n classification: NoteClassification;\n /** none */ misleadingTags: Array;\n /** The text summary in the Community Note. */ text: string;\n /** Whether the note provided trustworthy links. */ trustworthySources: boolean;\n} /**\nCommunity Note rating status\n *\n * @public\n */\nexport type NoteRatingStatus =\n | 'currently_rated_helpful'\n | 'currently_rated_not_helpful'\n | 'firm_reject'\n | 'insufficient_consensus'\n | 'minimum_ratings_not_met'\n | 'needs_more_ratings'\n | 'needs_your_help'; /**\nThe evaluation result of a community note.\n *\n * @public\n */\nexport interface NoteTestResult {\n /** Score bucket from the evaluator result. */ evaluatorScoreBucket?: string;\n /** The type of the evaluator. */ evaluatorType?: string;\n} /**\nThe note content of the Tweet.\n *\n * @public\n */\nexport type NoteTweetText = string;\n/**\nA problem that indicates your client application does not have the required OAuth1 permissions for the requested endpoint.\n *\n * @public\n */\nexport type Oauth1PermissionsProblem = any; /**\nThe oldest id in this response.\n *\n * @public\n */\nexport type OldestId = string;\n/**\nYou have been disconnected for operational reasons.\n *\n * @public\n */\nexport type OperationalDisconnectProblem = any; /**\nA base32 pagination token.\n *\n * @public\n */\nexport type PaginationToken32 = string; /**\nA base36 pagination token.\n *\n * @public\n */\nexport type PaginationToken36 = string; /**\nA 'long' pagination token.\n *\n * @public\n */\nexport type PaginationTokenLong = string; /**\nA trend.\n *\n * @public\n */\nexport interface PersonalizedTrend {\n /** Category of this trend. */ category?: string;\n /** Number of posts pertaining to this trend. */ postCount?: number;\n /** Name of the trend. */ trendName?: string;\n /** Time since this is trending. */ trendingSince?: string;\n}\n/**\nSchema type for Photo\n *\n * @public\n */\nexport type Photo = any; /**\nSchema type for Place\n *\n * @public\n */\nexport interface Place {\n /** none */ containedWithin?: Array;\n /** The full name of the county in which this place exists. */ country?: string;\n countryCode?: CountryCode;\n /** The full name of this place. */ fullName: string;\n geo?: Geo;\n id: PlaceId;\n /** The human readable name of this place. */ name?: string;\n placeType?: PlaceType;\n} /**\nThe identifier for this place.\n *\n * @public\n */\nexport type PlaceId = string; /**\nSchema type for PlaceType\n *\n * @public\n */\nexport type PlaceType =\n | 'poi'\n | 'neighborhood'\n | 'city'\n | 'admin'\n | 'country'\n | 'unknown'; /**\nDescriptor for a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccount {\n /** The category of the account (e.g., personal, business). */ accountCategory: string;\n /** The Plaid account ID. */ accountId: string;\n /** The last 2-4 digits of the account number. */ accountNumberDisplay: string;\n /** The type of the account (e.g., checking, savings). */ accountType: string;\n /** The available balance of the account. */ availableBalance?: number;\n currency: PlaidCurrency;\n /** The current balance of the account. */ currentBalance?: number;\n /** The nickname of the account. */ nickname?: string;\n /** The name of the product associated with the account. */ productName: string;\n /** The status of the account. */ status: string;\n} /**\nContact information associated with a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccountContact {\n /** List of addresses associated with the account holder. */ addresses: Array<\n PlaidAddress\n >;\n /** List of email addresses associated with the account holder. */ emails: Array<\n string\n >;\n name: PlaidName;\n /** Relationship of the contact to the account. */ relationship?: string;\n /** List of telephone numbers associated with the account holder. */ telephones: Array<\n PlaidTelephone\n >;\n} /**\nPayment network details associated with the account.\n *\n * @public\n */\nexport interface PlaidAccountPaymentNetwork {\n /** The bank ID associated with the account. */ bankId: string;\n /** The payment network identifier. */ identifier: string;\n /** Indicates if transfers into the account are supported. */ transferIn: boolean;\n /** Indicates if transfers out of the account are supported. */ transferOut: boolean;\n /** The type of payment network (e.g., ACH, SEPA). */ type: string;\n} /**\nDescriptor for a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccountTransaction {\n /** The category of the account (e.g., personal, business). */ accountCategory: string;\n /** The amount transacted. */ amount: number;\n /** Memo for transaction (e.g. CREDIT) */ debitCreditMemo: string;\n /** The transaction description */ description: string;\n /** The timestamp when the transaction was posted. */ postedTimestamp?: string;\n /** The status of the transaction. */ status: string;\n /** The identifier for the transaction. */ transactionId: string;\n /** The timestamp when the transaction occurred. */ transactionTimestamp: string;\n} /**\nAddress information for the account holder.\n *\n * @public\n */\nexport interface PlaidAddress {\n /** The city of the address. */ city: string;\n /** The country of the address (ISO 3166-1 alpha-2 code). */ country: string;\n /** The first line of the address. */ line1: string;\n /** The second line of the address. */ line2?: string;\n /** The postal code of the address. */ postalCode?: string;\n /** The region or state of the address. */ region?: string;\n} /**\nCurrency information.\n *\n * @public\n */\nexport interface PlaidCurrency {\n /** The ISO 4217 currency code. */ currencyCode: string;\n} /**\nA user id for the plaid customer\n *\n * @public\n */\nexport interface PlaidCustomer {\n customerId?: UserId;\n} /**\nName information for the account holder.\n *\n * @public\n */\nexport interface PlaidName {\n /** The first name of the account holder. */ first: string;\n /** The last name of the account holder. */ last: string;\n} /**\nTelephone information for the account holder.\n *\n * @public\n */\nexport interface PlaidTelephone {\n /** The country code for the phone number (e.g., '+1'). */ country: string;\n /** The phone number. */ number: string;\n /** The type of phone number (e.g., 'mobile'). */ type: string;\n} /**\nA [GeoJson Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) geometry object.\n *\n * @public\n */\nexport interface Point {\n coordinates: Position;\n /** none */ type: 'Point';\n} /**\nRepresent a Poll attached to a Tweet.\n *\n * @public\n */\nexport interface Poll {\n /** none */ durationMinutes?: number;\n /** none */ endDatetime?: string;\n id: PollId;\n /** none */ options: Array;\n /** none */ votingStatus?: 'open' | 'closed';\n} /**\nUnique identifier of this poll.\n *\n * @public\n */\nexport type PollId = string; /**\nDescribes a choice in a Poll object.\n *\n * @public\n */\nexport interface PollOption {\n label: PollOptionLabel;\n /** Position of this choice in the poll. */ position: number;\n /** Number of users who voted for this choice. */ votes: number;\n} /**\nThe text of a poll choice.\n *\n * @public\n */\nexport type PollOptionLabel = string; /**\nA [GeoJson Position](https://tools.ietf.org/html/rfc7946#section-3.1.1) in the format `[longitude,latitude]`.\n *\n * @public\n */\nexport type Position = Array<\n number\n>; /**\nSchema type for PreviewImage\n *\n * @public\n */\nexport interface PreviewImage {\n /** none */ mediaKey: Record;\n} /**\nThe previous token.\n *\n * @public\n */\nexport type PreviousToken = string; /**\nAn HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807).\n *\n * @public\n */\nexport interface Problem {\n /** none */ detail?: string;\n /** none */ status?: number;\n /** none */ title: string;\n /** none */ type: string;\n} /**\nSchema type for ProcessingInfo\n *\n * @public\n */\nexport interface ProcessingInfo {\n /** Number of seconds to check again for status */ checkAfterSecs?: number;\n /** Percent of upload progress */ progressPercent?: number;\n /** State of upload */ state?:\n | 'succeeded'\n | 'in_progress'\n | 'pending'\n | 'failed';\n} /**\nSchema type for ProfileUpdateActivityResponsePayload\n *\n * @public\n */\nexport interface ProfileUpdateActivityResponsePayload {\n /** none */ after?: string;\n /** none */ before?: string;\n} /**\nConfirmation that the replay job request was accepted.\n *\n * @public\n */\nexport interface ReplayJobCreateResponse {\n /** The UTC timestamp indicating when the replay job was created. */ createdAt: string;\n /** The unique identifier for the initiated replay job. */ jobId: string;\n} /**\nShows who can reply a Tweet. Fields returned are everyone, mentioned_users, and following.\n *\n * @public\n */\nexport type ReplySettings =\n | 'everyone'\n | 'mentionedUsers'\n | 'following'\n | 'other'; /**\nShows who can reply a Tweet. Fields returned are everyone, mentioned_users, subscribers, verified and following.\n *\n * @public\n */\nexport type ReplySettingsWithVerifiedUsers =\n | 'everyone'\n | 'mentionedUsers'\n | 'following'\n | 'other'\n | 'subscribers'\n | 'verified';\n/**\nA problem that indicates that a given Tweet, User, etc. does not exist.\n *\n * @public\n */\nexport type ResourceNotFoundProblem = any;\n/**\nA problem that indicates you are not allowed to see a particular Tweet, User, etc.\n *\n * @public\n */\nexport type ResourceUnauthorizedProblem = any;\n/**\nA problem that indicates a particular Tweet, User, etc. is not available to you.\n *\n * @public\n */\nexport type ResourceUnavailableProblem = any; /**\nThe number of results returned in this response.\n *\n * @public\n */\nexport type ResultCount = number; /**\nA user-provided stream filtering rule.\n *\n * @public\n */\nexport interface Rule {\n id?: RuleId;\n tag?: RuleTag;\n value: RuleValue;\n} /**\nUnique identifier of this rule.\n *\n * @public\n */\nexport type RuleId = string; /**\nA user-provided stream filtering rule.\n *\n * @public\n */\nexport interface RuleNoId {\n tag?: RuleTag;\n value: RuleValue;\n}\n/**\nYou have exceeded the maximum number of rules.\n *\n * @public\n */\nexport type RulesCapProblem = any; /**\nA count of user-provided stream filtering rules at the application and project levels.\n *\n * @public\n */\nexport interface RulesCount {\n allProjectClientApps?: AllProjectClientApps;\n /** Cap of number of rules allowed per client application */ capPerClientApp?: number;\n /** Cap of number of rules allowed per project */ capPerProject?: number;\n clientAppRulesCount?: AppRulesCount;\n /** Number of rules for project */ projectRulesCount?: number;\n} /**\nSchema type for RulesLookupResponse\n *\n * @public\n */\nexport interface RulesLookupResponse {\n /** none */ data?: Array;\n meta: RulesResponseMetadata;\n}\n/**\nSchema type for RulesRequestSummary\n *\n * @public\n */\nexport type RulesRequestSummary = any; /**\nSchema type for RulesResponseMetadata\n *\n * @public\n */\nexport interface RulesResponseMetadata {\n nextToken?: NextToken;\n /** Number of Rules in result set. */ resultCount?: number;\n /** none */ sent: string;\n summary?: RulesRequestSummary;\n} /**\nA tag meant for the labeling of user provided rules.\n *\n * @public\n */\nexport type RuleTag = string; /**\nThe filterlang value of the rule.\n *\n * @public\n */\nexport type RuleValue = string; /**\nRepresent a Search Count Result.\n *\n * @public\n */\nexport interface SearchCount {\n end: End;\n start: Start;\n tweetCount: TweetCount;\n} /**\nSchema type for SensitiveMediaWarning\n *\n * @public\n */\nexport interface SensitiveMediaWarning {\n /** Indicates if the content contains adult material */ adultContent?: boolean;\n /** Indicates if the content depicts graphic violence */ graphicViolence?: boolean;\n /** Indicates if the content has other sensitive characteristics */ other?: boolean;\n} /**\nSchema type for SharedInfo\n *\n * @public\n */\nexport interface SharedInfo {\n /** Indicates if the media is shared in direct messages */ shared: boolean;\n} /**\nSchema type for Space\n *\n * @public\n */\nexport interface Space {\n /** Creation time of the Space. */ createdAt?: string;\n creatorId?: UserId;\n /** End time of the Space. */ endedAt?: string;\n /** The user ids for the hosts of the Space. */ hostIds?: Array;\n id: SpaceId;\n /** An array of user ids for people who were invited to a Space. */ invitedUserIds?: Array<\n UserId\n >;\n /** Denotes if the Space is a ticketed Space. */ isTicketed?: boolean;\n /** The language of the Space. */ lang?: string;\n /** The number of participants in a Space. */ participantCount?: number;\n /** A date time stamp for when a Space is scheduled to begin. */ scheduledStart?: string;\n /** An array of user ids for people who were speakers in a Space. */ speakerIds?: Array<\n UserId\n >;\n /** When the Space was started as a date string. */ startedAt?: string;\n /** The current state of the Space. */ state: 'live' | 'scheduled' | 'ended';\n /** The number of people who have either purchased a ticket or set a reminder for this Space. */ subscriberCount?: number;\n /** The title of the Space. */ title?: string;\n /** The topics of a Space, as selected by its creator. */ topics?: Array<\n Record\n >;\n /** When the Space was last updated. */ updatedAt?: string;\n} /**\nThe unique identifier of this Space.\n *\n * @public\n */\nexport type SpaceId = string; /**\nThe start time of the bucket.\n *\n * @public\n */\nexport type Start = string; /**\nSchema type for Sticker\n *\n * @public\n */\nexport interface Sticker {\n /** width-to-height ratio of the media */ aspectRatio?: number;\n /** A unique identifier for the group of annotations associated with the media */ groupAnnotationId?: number;\n /** Unique identifier for sticker */ id?: string;\n /** A unique identifier for the sticker set associated with the media */ stickerSetAnnotationId?: number;\n /** Scale or rotate the media on the x-axis */ transformA?: number;\n /** Skew the media on the x-axis */ transformB?: number;\n /** Skew the media on the y-axis */ transformC?: number;\n /** Scale or rotate the media on the y-axis */ transformD?: number;\n /** Scale or rotate the media on the x-axis */ transformTx?: number;\n /** The vertical translation (shift) value for the media */ transformTy?: number;\n} /**\nSchema type for StickerInfo\n *\n * @public\n */\nexport interface StickerInfo {\n /** Stickers list must not be empty and should not exceed 25 */ stickers: Array<\n Sticker\n >;\n} /**\nSchema type for StreamingLikeResponseV2\n *\n * @public\n */\nexport interface StreamingLikeResponseV2 {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for StreamingTweetResponse\n *\n * @public\n */\nexport interface StreamingTweetResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for SubscriptionsCountGetResponse\n *\n * @public\n */\nexport interface SubscriptionsCountGetResponse {\n /** The count of active subscriptions across all webhooks */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsCreateRequest\n *\n * @public\n */\nexport type SubscriptionsCreateRequest = Record<\n string,\n any\n>; /**\nSchema type for SubscriptionsCreateResponse\n *\n * @public\n */\nexport interface SubscriptionsCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsDeleteResponse\n *\n * @public\n */\nexport interface SubscriptionsDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsGetResponse\n *\n * @public\n */\nexport interface SubscriptionsGetResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsListGetResponse\n *\n * @public\n */\nexport interface SubscriptionsListGetResponse {\n /** The list of active subscriptions for a specified webhook */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n} /**\nThe language code should be a BCP47 code (e.g. 'EN\", \"SP\")\n *\n * @public\n */\nexport type SubtitleLanguageCode = string; /**\nSchema type for Subtitles\n *\n * @public\n */\nexport interface Subtitles {\n /** Language name in a human readable form */ displayName?: string;\n id?: MediaId;\n languageCode?: SubtitleLanguageCode;\n} /**\nSchema type for SubtitlesCreateRequest\n *\n * @public\n */\nexport interface SubtitlesCreateRequest {\n id?: MediaId;\n mediaCategory?: MediaCategorySubtitles;\n subtitles?: Subtitles;\n} /**\nSchema type for SubtitlesCreateResponse\n *\n * @public\n */\nexport interface SubtitlesCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubtitlesDeleteRequest\n *\n * @public\n */\nexport interface SubtitlesDeleteRequest {\n id?: MediaId;\n languageCode?: SubtitleLanguageCode;\n mediaCategory?: MediaCategorySubtitles;\n} /**\nSchema type for SubtitlesDeleteResponse\n *\n * @public\n */\nexport interface SubtitlesDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TimestampedMetrics\n *\n * @public\n */\nexport interface TimestampedMetrics {\n metrics?: Metrics;\n /** ISO8601 Time */ timestamp?: string;\n} /**\nThe topic of a Space, as selected by its creator.\n *\n * @public\n */\nexport interface Topic {\n /** The description of the given topic. */ description?: string;\n id: TopicId;\n /** The name of the given topic. */ name: string;\n} /**\nUnique identifier of this Topic.\n *\n * @public\n */\nexport type TopicId = string; /**\nA trend.\n *\n * @public\n */\nexport interface Trend {\n /** Name of the trend. */ trendName?: string;\n /** Number of Posts in this trend. */ tweetCount?: number;\n} /**\nSchema type for TrendActivityResponsePayload\n *\n * @public\n */\nexport interface TrendActivityResponsePayload {\n /** none */ category?: string;\n /** none */ headline?: string;\n /** none */ hook?: string;\n /** none */ summary?: string;\n} /**\nSchema type for Tweet\n *\n * @public\n */\nexport interface Tweet {\n /** Specifies the type of attachments (if any) present in this Tweet. */ attachments?: Record<\n string,\n any\n >;\n authorId?: UserId;\n communityId?: CommunityId;\n /** none */ contextAnnotations?: Array;\n conversationId?: TweetId;\n /** Creation time of the Tweet. */ createdAt?: string;\n displayTextRange?: DisplayTextRange;\n /** none */ editControls?: Record;\n /** A list of Tweet Ids in this Tweet chain. */ editHistoryTweetIds?: Array<\n TweetId\n >;\n entities?: FullTextEntities;\n /** The location tagged on the Tweet, if the user provided one. */ geo?: Record<\n string,\n any\n >;\n id?: TweetId;\n inReplyToUserId?: UserId;\n /** Language of the Tweet, if detected by X. Returned as a BCP47 language tag. */ lang?: string;\n /** Nonpublic engagement metrics for the Tweet at the time of the request. */ nonPublicMetrics?: Record<\n string,\n any\n >;\n /** The full-content of the Tweet, including text beyond 280 characters. */ noteTweet?: Record<\n string,\n any\n >;\n /** Organic nonpublic engagement metrics for the Tweet at the time of the request. */ organicMetrics?: Record<\n string,\n any\n >;\n /** Indicates if this Tweet contains URLs marked as sensitive, for example content suitable for mature audiences. */ possiblySensitive?: boolean;\n /** Promoted nonpublic engagement metrics for the Tweet at the time of the request. */ promotedMetrics?: Record<\n string,\n any\n >;\n /** Engagement metrics for the Tweet at the time of the request. */ publicMetrics?: Record<\n string,\n any\n >;\n /** A list of Posts this Tweet refers to. For example, if the parent Tweet is a Retweet, a Quoted Tweet or a Reply, it will include the related Tweet referenced to by its parent. */ referencedTweets?: Array<\n Record\n >;\n replySettings?: ReplySettingsWithVerifiedUsers;\n /** The scopes for this tweet */ scopes?: Record;\n /** This is deprecated. */ source?: string;\n /** none */ suggestedSourceLinks?: Array;\n text?: TweetText;\n username?: UserName;\n withheld?: TweetWithheld;\n}\n/**\nTweet compliance data.\n *\n * @public\n */\nexport type TweetComplianceData = any; /**\nSchema type for TweetComplianceSchema\n *\n * @public\n */\nexport interface TweetComplianceSchema {\n /** Event time. */ eventAt: string;\n quoteTweetId?: TweetId;\n /** none */ tweet: Record;\n}\n/**\nTweet compliance stream events.\n *\n * @public\n */\nexport type TweetComplianceStreamResponse = any; /**\nThe count for the bucket.\n *\n * @public\n */\nexport type TweetCount = number; /**\nSchema type for TweetCreateRequest\n *\n * @public\n */\nexport interface TweetCreateRequest {\n /** Card Uri Parameter. This is mutually exclusive from Quote Tweet Id, Poll, Media, and Direct Message Deep Link. */ cardUri?: string;\n communityId?: CommunityId;\n /** Link to take the conversation from the public timeline to a private Direct Message. */ directMessageDeepLink?: string;\n /** Options for editing an existing Post. When provided, this request will edit the specified Post instead of creating a new one. */ editOptions?: Record<\n string,\n any\n >;\n /** Exclusive Tweet for super followers. */ forSuperFollowersOnly?: boolean;\n /** Place ID being attached to the Tweet for geo location. */ geo?: Record<\n string,\n any\n >;\n /** Media information being attached to created Tweet. This is mutually exclusive from Quote Tweet Id, Poll, and Card URI. */ media?: Record<\n string,\n any\n >;\n /** Nullcasted (promoted-only) Posts do not appear in the public timeline and are not served to followers. */ nullcast?: boolean;\n /** Poll options for a Tweet with a poll. This is mutually exclusive from Media, Quote Tweet Id, and Card URI. */ poll?: Record<\n string,\n any\n >;\n quoteTweetId?: TweetId;\n /** Tweet information of the Tweet being replied to. */ reply?: Record<\n string,\n any\n >;\n /** Settings to indicate who can reply to the Tweet. */ replySettings?:\n | 'following'\n | 'mentionedUsers'\n | 'subscribers'\n | 'verified';\n /** Share community post with followers too. */ shareWithFollowers?: boolean;\n text?: TweetText;\n} /**\nSchema type for TweetCreateResponse\n *\n * @public\n */\nexport interface TweetCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TweetDeleteComplianceSchema\n *\n * @public\n */\nexport interface TweetDeleteComplianceSchema {\n delete: TweetComplianceSchema;\n} /**\nSchema type for TweetDeleteResponse\n *\n * @public\n */\nexport interface TweetDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TweetDropComplianceSchema\n *\n * @public\n */\nexport interface TweetDropComplianceSchema {\n drop: TweetComplianceSchema;\n} /**\nSchema type for TweetEditComplianceObjectSchema\n *\n * @public\n */\nexport interface TweetEditComplianceObjectSchema {\n /** none */ editTweetIds: Array;\n /** Event time. */ eventAt: string;\n initialTweetId: TweetId;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetEditComplianceSchema\n *\n * @public\n */\nexport interface TweetEditComplianceSchema {\n tweetEdit: TweetEditComplianceObjectSchema;\n} /**\nSchema type for TweetHideRequest\n *\n * @public\n */\nexport interface TweetHideRequest {\n /** none */ hidden: boolean;\n} /**\nSchema type for TweetHideResponse\n *\n * @public\n */\nexport interface TweetHideResponse {\n /** none */ data?: Record;\n} /**\nUnique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.\n *\n * @public\n */\nexport type TweetId = string;\n/**\nTweet label data.\n *\n * @public\n */\nexport type TweetLabelData = any;\n/**\nTweet label stream events.\n *\n * @public\n */\nexport type TweetLabelStreamResponse = any; /**\nSchema type for TweetNotice\n *\n * @public\n */\nexport interface TweetNotice {\n /** If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. */ application: string;\n /** Information shown on the Tweet label */ details?: string;\n /** Event time. */ eventAt: string;\n /** The type of label on the Tweet */ eventType: string;\n /** Link to more information about this kind of label */ extendedDetailsUrl?: string;\n /** Title/header of the Tweet label */ labelTitle?: string;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetNoticeSchema\n *\n * @public\n */\nexport interface TweetNoticeSchema {\n publicTweetNotice: TweetNotice;\n} /**\nSchema type for TweetTakedownComplianceSchema\n *\n * @public\n */\nexport interface TweetTakedownComplianceSchema {\n /** Event time. */ eventAt: string;\n quoteTweetId?: TweetId;\n /** none */ tweet: Record;\n /** none */ withheldInCountries: Array;\n} /**\nThe content of the Tweet.\n *\n * @public\n */\nexport type TweetText = string; /**\nSchema type for TweetUndropComplianceSchema\n *\n * @public\n */\nexport interface TweetUndropComplianceSchema {\n undrop: TweetComplianceSchema;\n} /**\nSchema type for TweetUnviewable\n *\n * @public\n */\nexport interface TweetUnviewable {\n /** If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. */ application: string;\n /** Event time. */ eventAt: string;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetUnviewableSchema\n *\n * @public\n */\nexport interface TweetUnviewableSchema {\n publicTweetUnviewable: TweetUnviewable;\n} /**\nIndicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).\n *\n * @public\n */\nexport interface TweetWithheld {\n /** Indicates if the content is being withheld for on the basis of copyright infringement. */ copyright: boolean;\n /** Provides a list of countries where this content is not available. */ countryCodes: Array<\n CountryCode\n >;\n /** Indicates whether the content being withheld is the `tweet` or a `user`. */ scope?:\n | 'tweet'\n | 'user';\n} /**\nSchema type for TweetWithheldComplianceSchema\n *\n * @public\n */\nexport interface TweetWithheldComplianceSchema {\n withheld: TweetTakedownComplianceSchema;\n} /**\nSchema type for UnlikeComplianceSchema\n *\n * @public\n */\nexport interface UnlikeComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ favorite: Record;\n}\n/**\nA problem that indicates that the authentication used is not supported.\n *\n * @public\n */\nexport type UnsupportedAuthenticationProblem = any; /**\nExpiration time of the upload URL.\n *\n * @public\n */\nexport type UploadExpiration = string; /**\nSchema type for UploadSource\n *\n * @public\n */\nexport interface UploadSource {\n /** Records the source (e.g., app, device) from which the media was uploaded */ uploadSource: string;\n} /**\nURL to which the user will upload their Tweet or user IDs.\n *\n * @public\n */\nexport type UploadUrl = string; /**\nA validly formatted URL.\n *\n * @public\n */\nexport type Url = string;\n/**\nRepresent the portion of text recognized as a URL, and its start and end position within the text.\n *\n * @public\n */\nexport type UrlEntity = any;\n/**\nRepresent the portion of text recognized as a URL, and its start and end position within the text.\n *\n * @public\n */\nexport type UrlEntityDm = any; /**\nRepresent the portion of text recognized as a URL.\n *\n * @public\n */\nexport interface UrlFields {\n /** Description of the URL landing page. */ description?: string;\n /** The URL as displayed in the X client. */ displayUrl?: string;\n expandedUrl?: Url;\n /** none */ images?: Array;\n mediaKey?: MediaKey;\n status?: HttpStatusCode;\n /** Title of the page the URL points to. */ title?: string;\n /** Fully resolved url. */ unwoundUrl?: string;\n url: Url;\n} /**\nRepresent the information for the URL image.\n *\n * @public\n */\nexport interface UrlImage {\n height?: MediaHeight;\n url?: Url;\n width?: MediaWidth;\n} /**\nUsage per client app\n *\n * @public\n */\nexport interface Usage {\n /** Number of days left for the Tweet cap to reset */ capResetDay?: number;\n /** The daily usage breakdown for each Client Application a project */ dailyClientAppUsage?: Array<\n ClientAppUsage\n >;\n /** The daily usage breakdown for a project */ dailyProjectUsage?: Record<\n string,\n any\n >;\n /** Total number of Posts that can be read in this project per month */ projectCap?: number;\n /** The unique identifier for this project */ projectId?: string;\n /** The number of Posts read in this project */ projectUsage?: number;\n}\n/**\nA problem that indicates that a usage cap has been exceeded.\n *\n * @public\n */\nexport type UsageCapExceededProblem = any; /**\nRepresents the data for Usage\n *\n * @public\n */\nexport interface UsageFields {\n /** The time period for the usage */ date?: string;\n /** The usage value */ usage?: number;\n} /**\nThe X User object.\n *\n * @public\n */\nexport interface User {\n /** Metadata about a user's affiliation. */ affiliation?: Record;\n /** Returns detailed information about the relationship between two users. */ connectionStatus?: Array<\n | 'follow_request_received'\n | 'follow_request_sent'\n | 'blocking'\n | 'followed_by'\n | 'following'\n | 'muting'\n >;\n /** Creation time of this User. */ createdAt?: string;\n /** The text of this User's profile description (also known as bio), if the User provided one. */ description?: string;\n /** A list of metadata found in the User's profile description. */ entities?: Record<\n string,\n any\n >;\n id: UserId;\n /** The location specified in the User's profile, if the User provided one. As this is a freeform value, it may not indicate a valid location, but it may be fuzzily evaluated when performing searches with location queries. */ location?: string;\n mostRecentTweetId?: TweetId;\n /** The friendly name of this User, as shown on their profile. */ name: string;\n pinnedTweetId?: TweetId;\n /** The URL to the profile banner for this User. */ profileBannerUrl?: string;\n /** The URL to the profile image for this User. */ profileImageUrl?: string;\n /** Indicates if this User has chosen to protect their Posts (in other words, if this User's Posts are private). */ protected?: boolean;\n /** A list of metrics for this User. */ publicMetrics?: Record;\n /** Indicates if you can send a DM to this User */ receivesYourDm?: boolean;\n /** The X Blue subscription type of the user, eg: Basic, Premium, PremiumPlus or None. */ subscriptionType?:\n | 'Basic'\n | 'Premium'\n | 'PremiumPlus'\n | 'None';\n /** The URL specified in the User's profile. */ url?: string;\n username: UserName;\n /** Indicate if this User is a verified X User. */ verified?: boolean;\n /** The X Blue verified type of the user, eg: blue, government, business or none. */ verifiedType?:\n | 'blue'\n | 'government'\n | 'business'\n | 'none';\n withheld?: UserWithheld;\n}\n/**\nUser compliance data.\n *\n * @public\n */\nexport type UserComplianceData = any; /**\nSchema type for UserComplianceSchema\n *\n * @public\n */\nexport interface UserComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ user: Record;\n}\n/**\nUser compliance stream events.\n *\n * @public\n */\nexport type UserComplianceStreamResponse = any; /**\nSchema type for UserDeleteComplianceSchema\n *\n * @public\n */\nexport interface UserDeleteComplianceSchema {\n userDelete: UserComplianceSchema;\n} /**\nUnique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.\n *\n * @public\n */\nexport type UserId = string; /**\nUnique identifier of this User. The value must be the same as the authenticated user.\n *\n * @public\n */\nexport type UserIdMatchesAuthenticatedUser = string; /**\nThe X handle (screen name) of this user.\n *\n * @public\n */\nexport type UserName = string; /**\nSchema type for UserProfileModificationComplianceSchema\n *\n * @public\n */\nexport interface UserProfileModificationComplianceSchema {\n userProfileModification: UserProfileModificationObjectSchema;\n} /**\nSchema type for UserProfileModificationObjectSchema\n *\n * @public\n */\nexport interface UserProfileModificationObjectSchema {\n /** Event time. */ eventAt: string;\n /** none */ newValue: string;\n /** none */ profileField: string;\n /** none */ user: Record;\n} /**\nSchema type for UserProtectComplianceSchema\n *\n * @public\n */\nexport interface UserProtectComplianceSchema {\n userProtect: UserComplianceSchema;\n} /**\nSchema type for UserScrubGeoObjectSchema\n *\n * @public\n */\nexport interface UserScrubGeoObjectSchema {\n /** Event time. */ eventAt: string;\n upToTweetId: TweetId;\n /** none */ user: Record;\n} /**\nSchema type for UserScrubGeoSchema\n *\n * @public\n */\nexport interface UserScrubGeoSchema {\n scrubGeo: UserScrubGeoObjectSchema;\n} /**\nSchema type for UsersDMBlockCreateResponse\n *\n * @public\n */\nexport interface UsersDMBlockCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersDMUnBlockCreateResponse\n *\n * @public\n */\nexport interface UsersDMUnBlockCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe the search string by which to query for users.\n *\n * @public\n */\nexport type UserSearchQueryVnext = string; /**\nSchema type for UsersFollowingCreateRequest\n *\n * @public\n */\nexport interface UsersFollowingCreateRequest {\n targetUserId: UserId;\n} /**\nSchema type for UsersFollowingCreateResponse\n *\n * @public\n */\nexport interface UsersFollowingCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersFollowingDeleteResponse\n *\n * @public\n */\nexport interface UsersFollowingDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersLikesCreateRequest\n *\n * @public\n */\nexport interface UsersLikesCreateRequest {\n tweetId: TweetId;\n} /**\nSchema type for UsersLikesCreateResponse\n *\n * @public\n */\nexport interface UsersLikesCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersLikesDeleteResponse\n *\n * @public\n */\nexport interface UsersLikesDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersRetweetsCreateRequest\n *\n * @public\n */\nexport interface UsersRetweetsCreateRequest {\n tweetId: TweetId;\n} /**\nSchema type for UsersRetweetsCreateResponse\n *\n * @public\n */\nexport interface UsersRetweetsCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersRetweetsDeleteResponse\n *\n * @public\n */\nexport interface UsersRetweetsDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UserSuspendComplianceSchema\n *\n * @public\n */\nexport interface UserSuspendComplianceSchema {\n userSuspend: UserComplianceSchema;\n} /**\nSchema type for UserTakedownComplianceSchema\n *\n * @public\n */\nexport interface UserTakedownComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ user: Record;\n /** none */ withheldInCountries: Array;\n} /**\nSchema type for UserUndeleteComplianceSchema\n *\n * @public\n */\nexport interface UserUndeleteComplianceSchema {\n userUndelete: UserComplianceSchema;\n} /**\nSchema type for UserUnprotectComplianceSchema\n *\n * @public\n */\nexport interface UserUnprotectComplianceSchema {\n userUnprotect: UserComplianceSchema;\n} /**\nSchema type for UserUnsuspendComplianceSchema\n *\n * @public\n */\nexport interface UserUnsuspendComplianceSchema {\n userUnsuspend: UserComplianceSchema;\n} /**\nIndicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).\n *\n * @public\n */\nexport interface UserWithheld {\n /** Provides a list of countries where this content is not available. */ countryCodes: Array<\n CountryCode\n >;\n /** Indicates that the content being withheld is a `user`. */ scope?: 'user';\n} /**\nSchema type for UserWithheldComplianceSchema\n *\n * @public\n */\nexport interface UserWithheldComplianceSchema {\n userWithheld: UserTakedownComplianceSchema;\n} /**\nSchema type for Variant\n *\n * @public\n */\nexport interface Variant {\n /** The bit rate of the media. */ bitRate?: number;\n /** The content type of the media. */ contentType?: string;\n /** The url to the media. */ url?: string;\n} /**\nAn array of all available variants of the media.\n *\n * @public\n */\nexport type Variants = Array;\n/**\nSchema type for Video\n *\n * @public\n */\nexport type Video = any; /**\nA Webhook Configuration\n *\n * @public\n */\nexport interface WebhookConfig {\n /** none */ createdAt: string;\n id: WebhookConfigId;\n /** The callback URL of the webhook. */ url: string;\n /** none */ valid: boolean;\n} /**\nSchema type for WebhookConfigCreateRequest\n *\n * @public\n */\nexport interface WebhookConfigCreateRequest {\n /** none */ url: string;\n} /**\nA Webhook Configuration\n *\n * @public\n */\nexport interface WebhookConfigCreateResponse {\n /** none */ createdAt: string;\n id: WebhookConfigId;\n /** The callback URL of the webhook. */ url: string;\n /** none */ valid: boolean;\n} /**\nSchema type for WebhookConfigDeleteResponse\n *\n * @public\n */\nexport interface WebhookConfigDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe unique identifier of this webhook config.\n *\n * @public\n */\nexport type WebhookConfigId = string; /**\nSchema type for WebhookConfigPutResponse\n *\n * @public\n */\nexport interface WebhookConfigPutResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksCreateResponse\n *\n * @public\n */\nexport interface WebhookLinksCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksDeleteResponse\n *\n * @public\n */\nexport interface WebhookLinksDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksGetResponse\n *\n * @public\n */\nexport interface WebhookLinksGetResponse {\n /** The list of active webhook links for a given stream */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for stream operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for postsSample\n * \n * @public\n */\nexport type PostsSampleResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsFirehosePt\n * \n * @public\n */\nexport type PostsFirehosePtResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsFirehoseJa\n * \n * @public\n */\nexport type PostsFirehoseJaResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsSample10\n * \n * @public\n */\nexport type PostsSample10Response = Schemas.Get2TweetsSample10StreamResponse;\n/**\n * Response for postsFirehoseKo\n * \n * @public\n */\nexport type PostsFirehoseKoResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for likesCompliance\n * \n * @public\n */\nexport type LikesComplianceResponse = Schemas.LikesComplianceStreamResponse;\n/**\n * Response for postsCompliance\n * \n * @public\n */\nexport type PostsComplianceResponse = Schemas.TweetComplianceStreamResponse;\n/**\n * Response for getRuleCounts\n * \n * @public\n */\nexport type GetRuleCountsResponse = Schemas.Get2TweetsSearchStreamRulesCountsResponse;\n/**\n * Response for likesFirehose\n * \n * @public\n */\nexport type LikesFirehoseResponse = Schemas.StreamingLikeResponseV2;\n/**\n * Response for postsFirehoseEn\n * \n * @public\n */\nexport type PostsFirehoseEnResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for posts\n * \n * @public\n */\nexport type PostsResponse = Schemas.FilteredStreamingTweetResponse;\n/**\n * Response for usersCompliance\n * \n * @public\n */\nexport type UsersComplianceResponse = Schemas.UserComplianceStreamResponse;\n/**\n * Response for postsFirehose\n * \n * @public\n */\nexport type PostsFirehoseResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for likesSample10\n * \n * @public\n */\nexport type LikesSample10Response = Schemas.StreamingLikeResponseV2;\n/**\n * Response for getRules\n * \n * @public\n */\nexport type GetRulesResponse = Schemas.RulesLookupResponse;\n/**\n * Request for updateRules\n * \n * @public\n */\nexport type UpdateRulesRequest = Schemas.AddOrDeleteRulesRequest;\n/**\n * Response for updateRules\n * \n * @public\n */\nexport type UpdateRulesResponse = Schemas.AddOrDeleteRulesResponse;\n/**\n * Response for labelsCompliance\n * \n * @public\n */\nexport type LabelsComplianceResponse = Schemas.TweetLabelStreamResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Pagination utilities for the X API.\n * \n * This module provides comprehensive pagination support for the X API, including\n * automatic iteration, manual page control, and metadata access.\n * \n * @category Pagination\n */\n\n/**\n * Paginated response interface\n * \n * Represents the structure of a paginated API response from the X API.\n * \n * @template T - The type of items in the response\n */\nexport interface PaginatedResponse {\n /** Array of items in the current page */\n data: T[];\n /** Pagination metadata */\n meta?: {\n /** Number of results in the current page */\n result_count?: number;\n /** Token for fetching the next page */\n next_token?: string;\n /** Token for fetching the previous page */\n previous_token?: string;\n };\n /** Additional included objects (users, tweets, etc.) */\n includes?: Record;\n /** Any errors in the response */\n errors?: Array;\n}\n\n\n/**\n * X API paginator with rich functionality\n * \n * This class provides comprehensive pagination support for the X API, including:\n * - Automatic iteration with `for await...of` loops\n * - Manual page control with `fetchNext()` and `fetchPrevious()`\n * - Metadata access for pagination tokens and counts\n * - Error handling and rate limit detection\n * - Support for both forward and backward pagination\n * \n * @template T - The type of items being paginated\n * \n * @example\n * ```typescript\n * // Automatic iteration\n * const followers = await client.users.getFollowers('783214');\n * for await (const follower of followers) {\n * console.log(follower.username);\n * }\n * \n * // Manual control\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext();\n * console.log(followers.items.length); // Number of followers\n * console.log(followers.meta.next_token); // Next page token\n * \n * // Check status\n * if (!followers.done) {\n * await followers.fetchNext();\n * }\n * ```\n * \n * @category Pagination\n */\nexport class Paginator implements AsyncIterable {\n private fetchPage: (token?: string) => Promise>;\n private currentToken?: string;\n private previousToken?: string;\n private hasMore: boolean = true;\n private isDone: boolean = false;\n private allItems: T[] = [];\n private currentMeta?: any;\n private currentIncludes?: Record;\n private currentErrors?: Array;\n private rateLimitHit: boolean = false;\n\n /**\n * Creates a new paginator instance\n * \n * @param fetchPage - Function that fetches a page of data given a pagination token\n */\n constructor(fetchPage: (token?: string) => Promise>) {\n this.fetchPage = fetchPage;\n }\n\n /**\n * Get all fetched items\n */\n get items(): T[] {\n return [...this.allItems];\n }\n\n /**\n * Get current pagination metadata\n */\n get meta(): any {\n return this.currentMeta;\n }\n\n /**\n * Get current includes data\n */\n get includes(): Record | undefined {\n return this.currentIncludes;\n }\n\n /**\n * Get current errors\n */\n get errors(): Array | undefined {\n return this.currentErrors;\n }\n\n /**\n * Check if pagination is done\n */\n get done(): boolean {\n return this.isDone || this.rateLimitHit;\n }\n\n /**\n * Check if rate limit was hit\n */\n get rateLimited(): boolean {\n return this.rateLimitHit;\n }\n\n /**\n * Fetch the next page and add items to current instance\n * \n * This method fetches the next page of data and appends the items to the\n * current paginator instance. It updates the pagination state and metadata.\n * \n * @example\n * ```typescript\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext(); // Fetch first page\n * console.log(followers.items.length); // Number of followers\n * \n * if (!followers.done) {\n * await followers.fetchNext(); // Fetch second page\n * console.log(followers.items.length); // Total followers across pages\n * }\n * ```\n * \n * @throws {Error} When the API request fails\n */\n async fetchNext(): Promise {\n if (this.done) {\n return;\n }\n\n try {\n const response = await this.fetchPage(this.currentToken);\n \n // Update tokens\n this.previousToken = this.currentToken;\n this.currentToken = response.meta?.next_token;\n \n // Update state\n this.hasMore = !!this.currentToken;\n this.isDone = !this.hasMore;\n \n // Add new items to collection\n if (response.data) {\n this.allItems.push(...response.data);\n }\n \n // Update metadata\n this.currentMeta = response.meta;\n this.currentIncludes = response.includes;\n this.currentErrors = response.errors;\n \n } catch (error: any) {\n // Check if it's a rate limit error\n if (error.status === 429 || error.message?.includes('rate limit')) {\n this.rateLimitHit = true;\n }\n throw error;\n }\n }\n\n /**\n * Get next page as a new instance\n * \n * This method creates a new paginator instance that starts from the next page,\n * without affecting the current paginator's state.\n * \n * @example\n * ```typescript\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext(); // Fetch first page\n * \n * if (!followers.done) {\n * const nextPage = await followers.next(); // Get next page as new instance\n * console.log(followers.items.length); // Still first page\n * console.log(nextPage.items.length); // Second page\n * }\n * ```\n * \n * @returns New paginator instance for the next page\n */\n async next(): Promise> {\n if (this.done) {\n return new Paginator(this.fetchPage);\n }\n\n const nextPaginator = new Paginator(this.fetchPage);\n nextPaginator.currentToken = this.currentToken;\n await nextPaginator.fetchNext();\n return nextPaginator;\n }\n\n /**\n * Fetch previous page (if supported)\n */\n async fetchPrevious(): Promise {\n if (!this.previousToken) {\n return;\n }\n\n try {\n const response = await this.fetchPage(this.previousToken);\n \n // Update tokens\n this.currentToken = this.previousToken;\n this.previousToken = response.meta?.previous_token;\n \n // Update state\n this.hasMore = !!this.currentToken;\n this.isDone = !this.hasMore;\n \n // Replace items with previous page items\n this.allItems = response.data || [];\n \n // Update metadata\n this.currentMeta = response.meta;\n this.currentIncludes = response.includes;\n this.currentErrors = response.errors;\n \n } catch (error: any) {\n if (error.status === 429 || error.message?.includes('rate limit')) {\n this.rateLimitHit = true;\n }\n throw error;\n }\n }\n\n /**\n * Get previous page as a new instance\n */\n async previous(): Promise> {\n if (!this.previousToken) {\n return new Paginator(this.fetchPage);\n }\n\n const prevPaginator = new Paginator(this.fetchPage);\n prevPaginator.currentToken = this.previousToken;\n await prevPaginator.fetchNext();\n return prevPaginator;\n }\n\n /**\n * Fetch up to a specified number of additional items\n */\n async fetchLast(count: number): Promise {\n let fetched = 0;\n \n while (!this.done && fetched < count) {\n const beforeCount = this.allItems.length;\n await this.fetchNext();\n const afterCount = this.allItems.length;\n fetched += (afterCount - beforeCount);\n }\n }\n\n /**\n * Reset paginator to initial state\n */\n reset(): void {\n this.currentToken = undefined;\n this.previousToken = undefined;\n this.hasMore = true;\n this.isDone = false;\n this.allItems = [];\n this.currentMeta = undefined;\n this.currentIncludes = undefined;\n this.currentErrors = undefined;\n this.rateLimitHit = false;\n }\n\n /**\n * Iterator for all fetched items\n */\n *[Symbol.iterator](): Iterator {\n for (const item of this.allItems) {\n yield item;\n }\n }\n\n /**\n * Async iterator that fetches pages automatically\n */\n async *[Symbol.asyncIterator](): AsyncIterator {\n let lastYieldedIndex = 0;\n \n // First, yield all currently fetched items\n for (let i = lastYieldedIndex; i < this.allItems.length; i++) {\n yield this.allItems[i];\n }\n lastYieldedIndex = this.allItems.length;\n\n // Then continue fetching and yielding new items\n while (!this.done) {\n await this.fetchNext();\n \n // Yield only new items since last iteration\n for (let i = lastYieldedIndex; i < this.allItems.length; i++) {\n yield this.allItems[i];\n }\n lastYieldedIndex = this.allItems.length;\n }\n }\n}\n\n/**\n * Specialized paginators for different data types\n */\n\n/**\n * Paginator for posts\n */\nexport class PostPaginator extends Paginator {\n get posts(): any[] {\n return this.items;\n }\n}\n\n/**\n * Paginator for users\n */\nexport class UserPaginator extends Paginator {\n get users(): any[] {\n return this.items;\n }\n}\n\n\n\n/**\n * Paginator for events (like DM events)\n */\nexport class EventPaginator extends Paginator {\n get events(): any[] {\n return this.items;\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * X API SDK\n *\n * A modern TypeScript/JavaScript SDK for interacting with the X API.\n * Built with full TypeScript support, React hooks, and Next.js integration.\n */\n\n// Automatic polyfill setup for Node.js environments\nif (typeof process !== 'undefined' && process.versions && process.versions.node) {\n // Node.js environment - set up polyfills if needed\n if (typeof globalThis.fetch === 'undefined' || typeof globalThis.Headers === 'undefined') {\n try {\n // Try to use native Node.js fetch (Node 18+)\n if (typeof globalThis.fetch === 'function' && typeof globalThis.Headers === 'function') {\n // Native APIs are available, no polyfills needed\n } else {\n // Need to set up polyfills for older Node.js versions\n const nodeFetch = require('node-fetch');\n const { Headers: NodeHeaders } = nodeFetch;\n \n if (typeof globalThis.fetch === 'undefined') {\n (globalThis as any).fetch = nodeFetch.default || nodeFetch;\n }\n if (typeof globalThis.Headers === 'undefined') {\n (globalThis as any).Headers = NodeHeaders;\n }\n }\n } catch (error) {\n // If node-fetch is not available, provide a helpful error\n console.warn(\n 'X API SDK: node-fetch not found. For Node.js environments, please install node-fetch:\\n' +\n 'npm install node-fetch\\n' +\n 'Or upgrade to Node.js 18+ for native fetch support.'\n );\n }\n }\n}\n\n// Main client\nexport { Client } from './client.js';\nexport type { ClientConfig } from './client.js';\n\n// Error handling\nexport { ApiError } from './client.js';\nexport type { RequestOptions, ApiResponse, PaginationMeta } from './client.js';\n\n// HTTP client\nexport { httpClient, HttpClient } from './http-client.js';\nexport type { RequestOptions as HttpClientRequestOptions, HttpResponse } from './http-client.js';\n\n// Authentication\nexport { OAuth2 } from './oauth2_auth.js';\nexport type { OAuth2Config, OAuth2Token } from './oauth2_auth.js';\nexport { OAuth1 } from './oauth1_auth.js';\nexport type { OAuth1Config, OAuth1RequestToken, OAuth1AccessToken } from './oauth1_auth.js';\n\n// Crypto utilities\nexport { CryptoUtils, hmacSha1, generateNonce, generateTimestamp, generateCodeVerifier, generateCodeChallenge } from './crypto_utils.js';\n\n// Streaming\nexport type { StreamListener, TweetStreamListener } from './stream_listener.js';\n\n// Schema types (export all OpenAPI schema types)\nexport * as Schemas from './schemas.js';\n\n// Client modules (export client classes and types)\n\nexport { ActivityClient } from './activity/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Activity from './activity/models.js';\n\nexport { NewsClient } from './news/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as News from './news/models.js';\n\nexport { ConnectionsClient } from './connections/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Connections from './connections/models.js';\n\nexport { AccountActivityClient } from './account_activity/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as AccountActivity from './account_activity/models.js';\n\nexport { SpacesClient } from './spaces/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Spaces from './spaces/models.js';\n\nexport { TrendsClient } from './trends/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Trends from './trends/models.js';\n\nexport { MediaClient } from './media/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Media from './media/models.js';\n\nexport { DirectMessagesClient } from './direct_messages/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as DirectMessages from './direct_messages/models.js';\n\nexport { PostsClient } from './posts/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Posts from './posts/models.js';\n\nexport { ListsClient } from './lists/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Lists from './lists/models.js';\n\nexport { CommunityNotesClient } from './community_notes/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as CommunityNotes from './community_notes/models.js';\n\nexport { GeneralClient } from './general/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as General from './general/models.js';\n\nexport { WebhooksClient } from './webhooks/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Webhooks from './webhooks/models.js';\n\nexport { UsersClient } from './users/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Users from './users/models.js';\n\nexport { CommunitiesClient } from './communities/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Communities from './communities/models.js';\n\nexport { StreamClient } from './stream/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Stream from './stream/models.js';\n\nexport { ComplianceClient } from './compliance/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Compliance from './compliance/models.js';\n\nexport { UsageClient } from './usage/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Usage from './usage/models.js';\n\n\n// Utilities\nexport * from './paginator.js'; "]} \ No newline at end of file diff --git a/xdk/typescript/dist/index.d.cts b/xdk/typescript/dist/index.d.cts index 38a252bc..9db29190 100644 --- a/xdk/typescript/dist/index.d.cts +++ b/xdk/typescript/dist/index.d.cts @@ -946,6 +946,15 @@ interface Get2NewsIdResponse { data?: News; /** none */ errors?: Array; } /** +Schema type for Get2NewsSearchResponse + * + * @public + */ +interface Get2NewsSearchResponse { + /** none */ data?: Array; + /** none */ errors?: Array; + /** none */ meta?: Record; +} /** Schema type for Get2NotesSearchNotesWrittenResponse * * @public @@ -3313,6 +3322,7 @@ type schemas_Get2MediaAnalyticsResponse = Get2MediaAnalyticsResponse; type schemas_Get2MediaMediaKeyResponse = Get2MediaMediaKeyResponse; type schemas_Get2MediaResponse = Get2MediaResponse; type schemas_Get2NewsIdResponse = Get2NewsIdResponse; +type schemas_Get2NewsSearchResponse = Get2NewsSearchResponse; type schemas_Get2NotesSearchNotesWrittenResponse = Get2NotesSearchNotesWrittenResponse; type schemas_Get2NotesSearchPostsEligibleForNotesResponse = Get2NotesSearchPostsEligibleForNotesResponse; type schemas_Get2SpacesByCreatorIdsResponse = Get2SpacesByCreatorIdsResponse; @@ -3705,6 +3715,7 @@ declare namespace schemas { schemas_Get2MediaMediaKeyResponse as Get2MediaMediaKeyResponse, schemas_Get2MediaResponse as Get2MediaResponse, schemas_Get2NewsIdResponse as Get2NewsIdResponse, + schemas_Get2NewsSearchResponse as Get2NewsSearchResponse, schemas_Get2NotesSearchNotesWrittenResponse as Get2NotesSearchNotesWrittenResponse, schemas_Get2NotesSearchPostsEligibleForNotesResponse as Get2NotesSearchPostsEligibleForNotesResponse, schemas_Get2SpacesByCreatorIdsResponse as Get2SpacesByCreatorIdsResponse, @@ -3984,6 +3995,197 @@ declare namespace schemas { }; } +/** + * Models for activity operations + */ + +/** + * Response for getSubscriptions + * + * @public + */ +type GetSubscriptionsResponse$1 = ActivitySubscriptionGetResponse; +/** + * Request for createSubscription + * + * @public + */ +type CreateSubscriptionRequest$1 = ActivitySubscriptionCreateRequest; +/** + * Response for createSubscription + * + * @public + */ +type CreateSubscriptionResponse$1 = ActivitySubscriptionCreateResponse; +/** + * Response for stream + * + * @public + */ +type StreamResponse = ActivityStreamingResponse; +/** + * Request for updateSubscription + * + * @public + */ +type UpdateSubscriptionRequest = ActivitySubscriptionUpdateRequest; +/** + * Response for updateSubscription + * + * @public + */ +type UpdateSubscriptionResponse = ActivitySubscriptionUpdateResponse; +/** + * Response for deleteSubscription + * + * @public + */ +type DeleteSubscriptionResponse$1 = ActivitySubscriptionDeleteResponse; + +type models$h_StreamResponse = StreamResponse; +type models$h_UpdateSubscriptionRequest = UpdateSubscriptionRequest; +type models$h_UpdateSubscriptionResponse = UpdateSubscriptionResponse; +declare namespace models$h { + export { + CreateSubscriptionRequest$1 as CreateSubscriptionRequest, + CreateSubscriptionResponse$1 as CreateSubscriptionResponse, + DeleteSubscriptionResponse$1 as DeleteSubscriptionResponse, + GetSubscriptionsResponse$1 as GetSubscriptionsResponse, + models$h_StreamResponse as StreamResponse, + models$h_UpdateSubscriptionRequest as UpdateSubscriptionRequest, + models$h_UpdateSubscriptionResponse as UpdateSubscriptionResponse, + }; +} + +/** + * activity client for the X API. + * + * This module provides a client for interacting with the activity endpoints of the X API. + */ + +/** + * Options for createSubscription method + * + * @public + */ +interface CreateSubscriptionOptions$1 { + /** Request body */ + body?: CreateSubscriptionRequest$1; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for stream method + * + * @public + */ +interface StreamOptions { + /** The number of minutes of backfill requested. + * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ + backfillMinutes?: number; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for updateSubscription method + * + * @public + */ +interface UpdateSubscriptionOptions { + /** Request body */ + body?: UpdateSubscriptionRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for activity operations + * + * This client provides methods for interacting with the activity endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all activity related operations. + * + * @category activity + */ +declare class ActivityClient { + private client; + /** + * Creates a new activity client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get X activity subscriptions + * Get a list of active subscriptions for XAA + + + + * @returns {Promise} Promise resolving to the API response + */ + getSubscriptions(): Promise; + /** + * Create X activity subscription + * Creates a subscription for an X activity event + + + + * @returns {Promise} Promise resolving to the API response + */ + createSubscription(options?: CreateSubscriptionOptions$1): Promise; + /** + * Activity Stream + * Stream of X Activities + + + + * @returns {Promise} Promise resolving to the API response + */ + stream(options?: StreamOptions): Promise; + /** + * Update X activity subscription + * Updates a subscription for an X activity event + + + * @param subscriptionId The ID of the subscription to update. + + + + + * @returns {Promise} Promise resolving to the API response + */ + updateSubscription(subscriptionId: string, options?: UpdateSubscriptionOptions): Promise; + /** + * Deletes X activity subscription + * Deletes a subscription for an X activity event + + + * @param subscriptionId The ID of the subscription to delete. + + + + + * @returns {Promise} Promise resolving to the API response + */ + deleteSubscription(subscriptionId: string): Promise; +} + /** * Models for news operations */ @@ -3994,10 +4196,17 @@ declare namespace schemas { * @public */ type GetResponse$2 = Get2NewsIdResponse; +/** + * Response for search + * + * @public + */ +type SearchResponse$3 = Get2NewsSearchResponse; -declare namespace models$h { +declare namespace models$g { export { GetResponse$2 as GetResponse, + SearchResponse$3 as SearchResponse, }; } @@ -4021,6 +4230,26 @@ interface GetOptions$2 { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for search method + * + * @public + */ +interface SearchOptions$3 { + /** The number of results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** The maximum age of the News story to search for. + * Also accepts: max_age_hours or proper camelCase (e.g., maxAgeHours) */ + maxAgeHours?: number; + /** A comma separated list of News fields to display. + * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ + newsFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** * Client for news operations * @@ -4056,432 +4285,368 @@ declare class NewsClient { * @returns {Promise} Promise resolving to the API response */ get(id: string, options?: GetOptions$2): Promise; + /** + * Search News + * Retrieves a list of News stories matching the specified search query. + + + + * @param query The search query. + + + + * @returns {Promise} Promise resolving to the API response + */ + search(query: string, options?: SearchOptions$3): Promise; } /** - * Models for users operations + * Models for connections operations */ /** - * Response for unlikePost + * Response for deleteAll * * @public */ -type UnlikePostResponse = UsersLikesDeleteResponse; +type DeleteAllResponse = KillAllConnectionsResponse; + +type models$f_DeleteAllResponse = DeleteAllResponse; +declare namespace models$f { + export { + models$f_DeleteAllResponse as DeleteAllResponse, + }; +} + /** - * Response for getOwnedLists + * connections client for the X API. * - * @public + * This module provides a client for interacting with the connections endpoints of the X API. */ -type GetOwnedListsResponse = Get2UsersIdOwnedListsResponse; + /** - * Response for getBlocking + * Client for connections operations * - * @public - */ -type GetBlockingResponse = Get2UsersIdBlockingResponse; -/** - * Response for deleteBookmark + * This client provides methods for interacting with the connections endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all connections related operations. * - * @public + * @category connections */ -type DeleteBookmarkResponse = BookmarkMutationResponse; -/** - * Response for getByUsername - * - * @public +declare class ConnectionsClient { + private client; + /** + * Creates a new connections client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Terminate all connections + * Terminates all active streaming connections for the authenticated application. + + + + * @returns {Promise} Promise resolving to the API response + */ + deleteAll(): Promise; +} + +/** + * Models for account activity operations */ -type GetByUsernameResponse = Get2UsersByUsernameUsernameResponse; + /** - * Response for unpinList + * Response for getSubscriptions * * @public */ -type UnpinListResponse = ListUnpinResponse; +type GetSubscriptionsResponse = SubscriptionsListGetResponse; /** - * Response for getPosts + * Response for validateSubscription * * @public */ -type GetPostsResponse$2 = Get2UsersIdTweetsResponse; +type ValidateSubscriptionResponse = SubscriptionsGetResponse; /** - * Response for getBookmarks + * Request for createSubscription * * @public */ -type GetBookmarksResponse = Get2UsersIdBookmarksResponse; +type CreateSubscriptionRequest = SubscriptionsCreateRequest; /** - * Request for createBookmark + * Response for createSubscription * * @public */ -type CreateBookmarkRequest = BookmarkAddRequest; +type CreateSubscriptionResponse = SubscriptionsCreateResponse; /** - * Response for createBookmark + * Response for getSubscriptionCount * * @public */ -type CreateBookmarkResponse = BookmarkMutationResponse; +type GetSubscriptionCountResponse = SubscriptionsCountGetResponse; /** - * Response for blockDms + * Response for deleteSubscription * * @public */ -type BlockDmsResponse = UsersDMBlockCreateResponse; +type DeleteSubscriptionResponse = SubscriptionsDeleteResponse; /** - * Response for unfollowList + * Response for createReplayJob * * @public */ -type UnfollowListResponse = ListFollowedResponse; +type CreateReplayJobResponse = ReplayJobCreateResponse; + +type models$e_CreateReplayJobResponse = CreateReplayJobResponse; +type models$e_CreateSubscriptionRequest = CreateSubscriptionRequest; +type models$e_CreateSubscriptionResponse = CreateSubscriptionResponse; +type models$e_DeleteSubscriptionResponse = DeleteSubscriptionResponse; +type models$e_GetSubscriptionCountResponse = GetSubscriptionCountResponse; +type models$e_GetSubscriptionsResponse = GetSubscriptionsResponse; +type models$e_ValidateSubscriptionResponse = ValidateSubscriptionResponse; +declare namespace models$e { + export { + models$e_CreateReplayJobResponse as CreateReplayJobResponse, + models$e_CreateSubscriptionRequest as CreateSubscriptionRequest, + models$e_CreateSubscriptionResponse as CreateSubscriptionResponse, + models$e_DeleteSubscriptionResponse as DeleteSubscriptionResponse, + models$e_GetSubscriptionCountResponse as GetSubscriptionCountResponse, + models$e_GetSubscriptionsResponse as GetSubscriptionsResponse, + models$e_ValidateSubscriptionResponse as ValidateSubscriptionResponse, + }; +} + /** - * Response for getMuting + * account activity client for the X API. * - * @public + * This module provides a client for interacting with the account activity endpoints of the X API. */ -type GetMutingResponse = Get2UsersIdMutingResponse; /** - * Response for muteUser + * Options for createSubscription method * * @public */ -type MuteUserResponse = MuteUserMutationResponse; +interface CreateSubscriptionOptions { + /** Request body */ + body?: CreateSubscriptionRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** - * Response for getById + * Client for account activity operations * - * @public + * This client provides methods for interacting with the account activity endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all account activity related operations. + * + * @category account activity */ -type GetByIdResponse$4 = Get2UsersIdResponse; +declare class AccountActivityClient { + private client; + /** + * Creates a new account activity client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get subscriptions + * Retrieves a list of all active subscriptions for a given webhook. + + + * @param webhookId The webhook ID to pull subscriptions for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getSubscriptions(webhookId: string): Promise; + /** + * Validate subscription + * Checks a user’s Account Activity subscription for a given webhook. + + + * @param webhookId The webhook ID to check subscription against. + + + + + * @returns {Promise} Promise resolving to the API response + */ + validateSubscription(webhookId: string): Promise; + /** + * Create subscription + * Creates an Account Activity subscription for the user and the given webhook. + + + * @param webhookId The webhook ID to check subscription against. + + + + + * @returns {Promise} Promise resolving to the API response + */ + createSubscription(webhookId: string, options?: CreateSubscriptionOptions): Promise; + /** + * Get subscription count + * Retrieves a count of currently active Account Activity subscriptions. + + + + * @returns {Promise} Promise resolving to the API response + */ + getSubscriptionCount(): Promise; + /** + * Delete subscription + * Deletes an Account Activity subscription for the given webhook and user ID. + + + * @param webhookId The webhook ID to check subscription against. + + + + * @param userId User ID to unsubscribe from. + + + + + * @returns {Promise} Promise resolving to the API response + */ + deleteSubscription(webhookId: string, userId: string): Promise; + /** + * Create replay job + * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook. + + + * @param webhookId The unique identifier for the webhook configuration. + + + + + * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. + + + + * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. + + + + * @returns {Promise} Promise resolving to the API response + */ + createReplayJob(webhookId: string, fromDate: string, toDate: string): Promise; +} + /** - * Response for getMe - * - * @public + * Models for spaces operations */ -type GetMeResponse = Get2UsersMeResponse; + /** - * Response for unrepostPost + * Response for getById * * @public */ -type UnrepostPostResponse = UsersRetweetsDeleteResponse; +type GetByIdResponse$4 = Get2SpacesIdResponse; /** - * Response for unmuteUser + * Response for getBuyers * * @public */ -type UnmuteUserResponse = MuteUserMutationResponse; +type GetBuyersResponse = Get2SpacesIdBuyersResponse; /** - * Response for search + * Response for getPosts * * @public */ -type SearchResponse$2 = Get2UsersSearchResponse; +type GetPostsResponse$2 = Get2SpacesIdTweetsResponse; /** - * Response for getPinnedLists + * Response for getByCreatorIds * * @public */ -type GetPinnedListsResponse = Get2UsersIdPinnedListsResponse; +type GetByCreatorIdsResponse = Get2SpacesByCreatorIdsResponse; /** - * Request for pinList + * Response for getByIds * * @public */ -type PinListRequest = ListPinnedRequest; +type GetByIdsResponse$2 = Get2SpacesResponse; /** - * Response for pinList + * Response for search * * @public */ -type PinListResponse = ListPinnedResponse; +type SearchResponse$2 = Get2SpacesSearchResponse; + +type models$d_GetBuyersResponse = GetBuyersResponse; +type models$d_GetByCreatorIdsResponse = GetByCreatorIdsResponse; +declare namespace models$d { + export { + models$d_GetBuyersResponse as GetBuyersResponse, + models$d_GetByCreatorIdsResponse as GetByCreatorIdsResponse, + GetByIdResponse$4 as GetByIdResponse, + GetByIdsResponse$2 as GetByIdsResponse, + GetPostsResponse$2 as GetPostsResponse, + SearchResponse$2 as SearchResponse, + }; +} + /** - * Response for getFollowedLists + * spaces client for the X API. * - * @public + * This module provides a client for interacting with the spaces endpoints of the X API. */ -type GetFollowedListsResponse = Get2UsersIdFollowedListsResponse; + /** - * Request for followList + * Options for getById method * * @public */ -type FollowListRequest = ListFollowedRequest; +interface GetByIdOptions$4 { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** - * Response for followList + * Options for getBuyers method * * @public */ -type FollowListResponse = ListFollowedResponse; -/** - * Request for likePost - * - * @public - */ -type LikePostRequest = UsersLikesCreateRequest; -/** - * Response for likePost - * - * @public - */ -type LikePostResponse = UsersLikesCreateResponse; -/** - * Response for getLikedPosts - * - * @public - */ -type GetLikedPostsResponse = Get2UsersIdLikedTweetsResponse; -/** - * Response for getByUsernames - * - * @public - */ -type GetByUsernamesResponse = Get2UsersByResponse; -/** - * Request for repostPost - * - * @public - */ -type RepostPostRequest = UsersRetweetsCreateRequest; -/** - * Response for repostPost - * - * @public - */ -type RepostPostResponse = UsersRetweetsCreateResponse; -/** - * Response for unfollowUser - * - * @public - */ -type UnfollowUserResponse = UsersFollowingDeleteResponse; -/** - * Response for getFollowers - * - * @public - */ -type GetFollowersResponse$1 = Get2UsersIdFollowersResponse; -/** - * Response for getByIds - * - * @public - */ -type GetByIdsResponse$2 = Get2UsersResponse; -/** - * Response for getBookmarksByFolderId - * - * @public - */ -type GetBookmarksByFolderIdResponse = BookmarkFolderPostsResponse; -/** - * Response for getBookmarkFolders - * - * @public - */ -type GetBookmarkFoldersResponse = BookmarkFoldersResponse; -/** - * Response for getFollowing - * - * @public - */ -type GetFollowingResponse = Get2UsersIdFollowingResponse; -/** - * Request for followUser - * - * @public - */ -type FollowUserRequest = UsersFollowingCreateRequest; -/** - * Response for followUser - * - * @public - */ -type FollowUserResponse = UsersFollowingCreateResponse; -/** - * Response for getTimeline - * - * @public - */ -type GetTimelineResponse = Get2UsersIdTimelinesReverseChronologicalResponse; -/** - * Response for unblockDms - * - * @public - */ -type UnblockDmsResponse = UsersDMUnBlockCreateResponse; -/** - * Response for getMentions - * - * @public - */ -type GetMentionsResponse = Get2UsersIdMentionsResponse; -/** - * Response for getListMemberships - * - * @public - */ -type GetListMembershipsResponse = Get2UsersIdListMembershipsResponse; -/** - * Response for getRepostsOfMe - * - * @public - */ -type GetRepostsOfMeResponse = Get2UsersRepostsOfMeResponse; - -type models$g_BlockDmsResponse = BlockDmsResponse; -type models$g_CreateBookmarkRequest = CreateBookmarkRequest; -type models$g_CreateBookmarkResponse = CreateBookmarkResponse; -type models$g_DeleteBookmarkResponse = DeleteBookmarkResponse; -type models$g_FollowListRequest = FollowListRequest; -type models$g_FollowListResponse = FollowListResponse; -type models$g_FollowUserRequest = FollowUserRequest; -type models$g_FollowUserResponse = FollowUserResponse; -type models$g_GetBlockingResponse = GetBlockingResponse; -type models$g_GetBookmarkFoldersResponse = GetBookmarkFoldersResponse; -type models$g_GetBookmarksByFolderIdResponse = GetBookmarksByFolderIdResponse; -type models$g_GetBookmarksResponse = GetBookmarksResponse; -type models$g_GetByUsernameResponse = GetByUsernameResponse; -type models$g_GetByUsernamesResponse = GetByUsernamesResponse; -type models$g_GetFollowedListsResponse = GetFollowedListsResponse; -type models$g_GetFollowingResponse = GetFollowingResponse; -type models$g_GetLikedPostsResponse = GetLikedPostsResponse; -type models$g_GetListMembershipsResponse = GetListMembershipsResponse; -type models$g_GetMeResponse = GetMeResponse; -type models$g_GetMentionsResponse = GetMentionsResponse; -type models$g_GetMutingResponse = GetMutingResponse; -type models$g_GetOwnedListsResponse = GetOwnedListsResponse; -type models$g_GetPinnedListsResponse = GetPinnedListsResponse; -type models$g_GetRepostsOfMeResponse = GetRepostsOfMeResponse; -type models$g_GetTimelineResponse = GetTimelineResponse; -type models$g_LikePostRequest = LikePostRequest; -type models$g_LikePostResponse = LikePostResponse; -type models$g_MuteUserRequest = MuteUserRequest; -type models$g_MuteUserResponse = MuteUserResponse; -type models$g_PinListRequest = PinListRequest; -type models$g_PinListResponse = PinListResponse; -type models$g_RepostPostRequest = RepostPostRequest; -type models$g_RepostPostResponse = RepostPostResponse; -type models$g_UnblockDmsResponse = UnblockDmsResponse; -type models$g_UnfollowListResponse = UnfollowListResponse; -type models$g_UnfollowUserResponse = UnfollowUserResponse; -type models$g_UnlikePostResponse = UnlikePostResponse; -type models$g_UnmuteUserResponse = UnmuteUserResponse; -type models$g_UnpinListResponse = UnpinListResponse; -type models$g_UnrepostPostResponse = UnrepostPostResponse; -declare namespace models$g { - export { - models$g_BlockDmsResponse as BlockDmsResponse, - models$g_CreateBookmarkRequest as CreateBookmarkRequest, - models$g_CreateBookmarkResponse as CreateBookmarkResponse, - models$g_DeleteBookmarkResponse as DeleteBookmarkResponse, - models$g_FollowListRequest as FollowListRequest, - models$g_FollowListResponse as FollowListResponse, - models$g_FollowUserRequest as FollowUserRequest, - models$g_FollowUserResponse as FollowUserResponse, - models$g_GetBlockingResponse as GetBlockingResponse, - models$g_GetBookmarkFoldersResponse as GetBookmarkFoldersResponse, - models$g_GetBookmarksByFolderIdResponse as GetBookmarksByFolderIdResponse, - models$g_GetBookmarksResponse as GetBookmarksResponse, - GetByIdResponse$4 as GetByIdResponse, - GetByIdsResponse$2 as GetByIdsResponse, - models$g_GetByUsernameResponse as GetByUsernameResponse, - models$g_GetByUsernamesResponse as GetByUsernamesResponse, - models$g_GetFollowedListsResponse as GetFollowedListsResponse, - GetFollowersResponse$1 as GetFollowersResponse, - models$g_GetFollowingResponse as GetFollowingResponse, - models$g_GetLikedPostsResponse as GetLikedPostsResponse, - models$g_GetListMembershipsResponse as GetListMembershipsResponse, - models$g_GetMeResponse as GetMeResponse, - models$g_GetMentionsResponse as GetMentionsResponse, - models$g_GetMutingResponse as GetMutingResponse, - models$g_GetOwnedListsResponse as GetOwnedListsResponse, - models$g_GetPinnedListsResponse as GetPinnedListsResponse, - GetPostsResponse$2 as GetPostsResponse, - models$g_GetRepostsOfMeResponse as GetRepostsOfMeResponse, - models$g_GetTimelineResponse as GetTimelineResponse, - models$g_LikePostRequest as LikePostRequest, - models$g_LikePostResponse as LikePostResponse, - models$g_MuteUserRequest as MuteUserRequest, - models$g_MuteUserResponse as MuteUserResponse, - models$g_PinListRequest as PinListRequest, - models$g_PinListResponse as PinListResponse, - models$g_RepostPostRequest as RepostPostRequest, - models$g_RepostPostResponse as RepostPostResponse, - SearchResponse$2 as SearchResponse, - models$g_UnblockDmsResponse as UnblockDmsResponse, - models$g_UnfollowListResponse as UnfollowListResponse, - models$g_UnfollowUserResponse as UnfollowUserResponse, - models$g_UnlikePostResponse as UnlikePostResponse, - models$g_UnmuteUserResponse as UnmuteUserResponse, - models$g_UnpinListResponse as UnpinListResponse, - models$g_UnrepostPostResponse as UnrepostPostResponse, - }; -} - -/** - * users client for the X API. - * - * This module provides a client for interacting with the users endpoints of the X API. - */ - -/** - * Options for getOwnedLists method - * - * @public - */ -interface GetOwnedListsOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; +interface GetBuyersOptions { /** This parameter is used to get a specified 'page' of results. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getBlocking method - * - * @public - */ -interface GetBlockingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByUsername method - * - * @public - */ -interface GetByUsernameOptions { /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; @@ -4502,27 +4667,9 @@ interface GetByUsernameOptions { * @public */ interface GetPostsOptions$2 { - /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of results. + /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The set of entities to exclude (e.g. 'replies' or 'retweets'). - * Also accepts: exclude or proper camelCase (e.g., exclude) */ - exclude?: Array; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -4547,558 +4694,624 @@ interface GetPostsOptions$2 { [key: string]: any; } /** - * Options for getBookmarks method + * Options for getByCreatorIds method * * @public */ -interface GetBookmarksOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +interface GetByCreatorIdsOptions { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getMuting method + * Options for getByIds method * * @public */ -interface GetMutingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; +interface GetByIdsOptions$2 { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for muteUser method + * Options for search method * * @public */ -interface MuteUserOptions { - /** Request body */ - body?: MuteUserRequest; +interface SearchOptions$2 { + /** The state of Spaces to search for. + * Also accepts: state or proper camelCase (e.g., state) */ + state?: string; + /** The number of results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getById method + * Client for spaces operations * - * @public + * This client provides methods for interacting with the spaces endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all spaces related operations. + * + * @category spaces */ -interface GetByIdOptions$4 { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; +declare class SpacesClient { + private client; + /** + * Creates a new spaces client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get space by ID + * Retrieves details of a specific space by its ID. + + + * @param id The ID of the Space to be retrieved. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getById(id: string, options?: GetByIdOptions$4): Promise; + /** + * Get Space ticket buyers + * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + + + * @param id The ID of the Space to be retrieved. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getBuyers(id: string, options?: GetBuyersOptions): Promise; + /** + * Get Space Posts + * Retrieves a list of Posts shared in a specific Space by its ID. + + + * @param id The ID of the Space to be retrieved. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getPosts(id: string, options?: GetPostsOptions$2): Promise; + /** + * Get Spaces by creator IDs + * Retrieves details of Spaces created by specified User IDs. + + + + * @param userIds The IDs of Users to search through. + + + + * @returns {Promise} Promise resolving to the API response + */ + getByCreatorIds(userIds: Array, options?: GetByCreatorIdsOptions): Promise; + /** + * Get Spaces by IDs + * Retrieves details of multiple Spaces by their IDs. + + + + * @param ids The list of Space IDs to return. + + + + * @returns {Promise} Promise resolving to the API response + */ + getByIds(ids: Array, options?: GetByIdsOptions$2): Promise; + /** + * Search Spaces + * Retrieves a list of Spaces matching the specified search query. + + + + * @param query The search query. + + + + * @returns {Promise} Promise resolving to the API response + */ + search(query: string, options?: SearchOptions$2): Promise; } + /** - * Options for getMe method + * Models for trends operations + */ + +/** + * Response for getPersonalized * * @public */ -interface GetMeOptions { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetPersonalizedResponse = Get2UsersPersonalizedTrendsResponse; /** - * Options for search method + * Response for getByWoeid * * @public */ -interface SearchOptions$2 { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; +type GetByWoeidResponse = Get2TrendsByWoeidWoeidResponse; +/** + * Response for getAi + * + * @public + */ +type GetAiResponse = Get2AiTrendsIdResponse; + +type models$c_GetAiResponse = GetAiResponse; +type models$c_GetByWoeidResponse = GetByWoeidResponse; +type models$c_GetPersonalizedResponse = GetPersonalizedResponse; +declare namespace models$c { + export { + models$c_GetAiResponse as GetAiResponse, + models$c_GetByWoeidResponse as GetByWoeidResponse, + models$c_GetPersonalizedResponse as GetPersonalizedResponse, + }; } + /** - * Options for getPinnedLists method + * trends client for the X API. + * + * This module provides a client for interacting with the trends endpoints of the X API. + */ + +/** + * Options for getPersonalized method * * @public */ -interface GetPinnedListsOptions { - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; +interface GetPersonalizedOptions { + /** A comma separated list of PersonalizedTrend fields to display. + * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */ + personalizedTrendFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getFollowedLists method + * Options for getByWoeid method * * @public */ -interface GetFollowedListsOptions { +interface GetByWoeidOptions { /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; + * Also accepts: max_trends or proper camelCase (e.g., maxTrends) */ + maxTrends?: number; + /** A comma separated list of Trend fields to display. + * Also accepts: trend.fields or proper camelCase (e.g., trendFields) */ + trendFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for followList method + * Options for getAi method * * @public */ -interface FollowListOptions { - /** Request body */ - body?: FollowListRequest; +interface GetAiOptions { + /** A comma separated list of News fields to display. + * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ + newsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for likePost method + * Client for trends operations * - * @public - */ -interface LikePostOptions { - /** Request body */ - body?: LikePostRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; + * This client provides methods for interacting with the trends endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all trends related operations. + * + * @category trends + */ +declare class TrendsClient { + private client; + /** + * Creates a new trends client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get personalized Trends + * Retrieves personalized trending topics for the authenticated user. + + + + * @returns {Promise} Promise resolving to the API response + */ + getPersonalized(options?: GetPersonalizedOptions): Promise; + /** + * Get Trends by WOEID + * Retrieves trending topics for a specific location identified by its WOEID. + + + * @param woeid The WOEID of the place to lookup a trend for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getByWoeid(woeid: number, options?: GetByWoeidOptions): Promise; + /** + * Get AI Trends by ID + * Retrieves an AI trend by its ID. + + + * @param id The ID of the ai trend. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getAi(id: string, options?: GetAiOptions): Promise; } + /** - * Options for getLikedPosts method + * Models for media operations + */ + +/** + * Response for getByKey * * @public */ -interface GetLikedPostsOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; +type GetByKeyResponse = Get2MediaMediaKeyResponse; +/** + * Request for createMetadata + * + * @public + */ +type CreateMetadataRequest = MetadataCreateRequest; +/** + * Response for createMetadata + * + * @public + */ +type CreateMetadataResponse = MetadataCreateResponse; +/** + * Response for finalizeUpload + * + * @public + */ +type FinalizeUploadResponse = MediaUploadResponse; +/** + * Request for appendUpload + * + * @public + */ +type AppendUploadRequest = MediaUploadAppendRequest; +/** + * Response for appendUpload + * + * @public + */ +type AppendUploadResponse = MediaUploadAppendResponse; +/** + * Request for initializeUpload + * + * @public + */ +type InitializeUploadRequest = MediaUploadConfigRequest; +/** + * Response for initializeUpload + * + * @public + */ +type InitializeUploadResponse = MediaUploadResponse; +/** + * Response for getByKeys + * + * @public + */ +type GetByKeysResponse = Get2MediaResponse; +/** + * Response for getUploadStatus + * + * @public + */ +type GetUploadStatusResponse = MediaUploadResponse; +/** + * Request for upload + * + * @public + */ +type UploadRequest = MediaUploadRequestOneShot; +/** + * Response for upload + * + * @public + */ +type UploadResponse = MediaUploadResponse; +/** + * Response for getAnalytics + * + * @public + */ +type GetAnalyticsResponse$1 = MediaAnalytics; +/** + * Request for createSubtitles + * + * @public + */ +type CreateSubtitlesRequest = SubtitlesCreateRequest; +/** + * Response for createSubtitles + * + * @public + */ +type CreateSubtitlesResponse = SubtitlesCreateResponse; +/** + * Request for deleteSubtitles + * + * @public + */ +type DeleteSubtitlesRequest = SubtitlesDeleteRequest; +/** + * Response for deleteSubtitles + * + * @public + */ +type DeleteSubtitlesResponse = SubtitlesDeleteResponse; + +type models$b_AppendUploadRequest = AppendUploadRequest; +type models$b_AppendUploadResponse = AppendUploadResponse; +type models$b_CreateMetadataRequest = CreateMetadataRequest; +type models$b_CreateMetadataResponse = CreateMetadataResponse; +type models$b_CreateSubtitlesRequest = CreateSubtitlesRequest; +type models$b_CreateSubtitlesResponse = CreateSubtitlesResponse; +type models$b_DeleteSubtitlesRequest = DeleteSubtitlesRequest; +type models$b_DeleteSubtitlesResponse = DeleteSubtitlesResponse; +type models$b_FinalizeUploadResponse = FinalizeUploadResponse; +type models$b_GetByKeyResponse = GetByKeyResponse; +type models$b_GetByKeysResponse = GetByKeysResponse; +type models$b_GetUploadStatusResponse = GetUploadStatusResponse; +type models$b_InitializeUploadRequest = InitializeUploadRequest; +type models$b_InitializeUploadResponse = InitializeUploadResponse; +type models$b_UploadRequest = UploadRequest; +type models$b_UploadResponse = UploadResponse; +declare namespace models$b { + export { + models$b_AppendUploadRequest as AppendUploadRequest, + models$b_AppendUploadResponse as AppendUploadResponse, + models$b_CreateMetadataRequest as CreateMetadataRequest, + models$b_CreateMetadataResponse as CreateMetadataResponse, + models$b_CreateSubtitlesRequest as CreateSubtitlesRequest, + models$b_CreateSubtitlesResponse as CreateSubtitlesResponse, + models$b_DeleteSubtitlesRequest as DeleteSubtitlesRequest, + models$b_DeleteSubtitlesResponse as DeleteSubtitlesResponse, + models$b_FinalizeUploadResponse as FinalizeUploadResponse, + GetAnalyticsResponse$1 as GetAnalyticsResponse, + models$b_GetByKeyResponse as GetByKeyResponse, + models$b_GetByKeysResponse as GetByKeysResponse, + models$b_GetUploadStatusResponse as GetUploadStatusResponse, + models$b_InitializeUploadRequest as InitializeUploadRequest, + models$b_InitializeUploadResponse as InitializeUploadResponse, + models$b_UploadRequest as UploadRequest, + models$b_UploadResponse as UploadResponse, + }; +} + +/** + * media client for the X API. + * + * This module provides a client for interacting with the media endpoints of the X API. + */ + +/** + * Options for getByKey method + * + * @public + */ +interface GetByKeyOptions { /** A comma separated list of Media fields to display. * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getByUsernames method + * Options for createMetadata method * * @public */ -interface GetByUsernamesOptions { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +interface CreateMetadataOptions { + /** Request body */ + body?: CreateMetadataRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for repostPost method + * Options for appendUpload method * * @public */ -interface RepostPostOptions { +interface AppendUploadOptions { /** Request body */ - body?: RepostPostRequest; + body?: AppendUploadRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getFollowers method + * Options for initializeUpload method * * @public */ -interface GetFollowersOptions$1 { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +interface InitializeUploadOptions { + /** Request body */ + body?: InitializeUploadRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getByIds method + * Options for getByKeys method * * @public */ -interface GetByIdsOptions$2 { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getBookmarkFolders method - * - * @public - */ -interface GetBookmarkFoldersOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; +interface GetByKeysOptions { + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getFollowing method + * Options for getUploadStatus method * * @public */ -interface GetFollowingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +interface GetUploadStatusOptions { + /** The command for the media upload request. + * Also accepts: command or proper camelCase (e.g., command) */ + command?: string; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for followUser method + * Options for upload method * * @public */ -interface FollowUserOptions { +interface UploadOptions { /** Request body */ - body?: FollowUserRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getTimeline method - * - * @public - */ -interface GetTimelineOptions { - /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The set of entities to exclude (e.g. 'replies' or 'retweets'). - * Also accepts: exclude or proper camelCase (e.g., exclude) */ - exclude?: Array; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + body?: UploadRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getMentions method + * Options for getAnalytics method * * @public */ -interface GetMentionsOptions { - /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; +interface GetAnalyticsOptions$1 { + /** A comma separated list of MediaAnalytics fields to display. + * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */ + mediaAnalyticsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getListMemberships method + * Options for createSubtitles method * * @public */ -interface GetListMembershipsOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; +interface CreateSubtitlesOptions { + /** Request body */ + body?: CreateSubtitlesRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getRepostsOfMe method + * Options for deleteSubtitles method * * @public */ -interface GetRepostsOfMeOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; +interface DeleteSubtitlesOptions { + /** Request body */ + body?: DeleteSubtitlesRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for users operations + * Client for media operations * - * This client provides methods for interacting with the users endpoints + * This client provides methods for interacting with the media endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all users related operations. + * parsing for all media related operations. * - * @category users + * @category media */ -declare class UsersClient { +declare class MediaClient { private client; /** - * Creates a new users client instance + * Creates a new media client instance * * @param client - The main X API client instance */ @@ -5109,527 +5322,140 @@ declare class UsersClient { */ private _normalizeOptions; /** - * Unlike Post - * Causes the authenticated user to Unlike a specific Post by its ID. + * Get Media by media key + * Retrieves details of a specific Media file by its media key. - * @param id The ID of the authenticated source User that is requesting to unlike the Post. + * @param mediaKey A single Media Key. - * @param tweetId The ID of the Post that the User is requesting to unlike. + * @returns {Promise} Promise resolving to the API response + */ + getByKey(mediaKey: string, options?: GetByKeyOptions): Promise; + /** + * Create Media metadata + * Creates metadata for a Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - unlikePost(id: string, tweetId: string): Promise; + createMetadata(options?: CreateMetadataOptions): Promise; /** - * Get owned Lists - * Retrieves a list of Lists owned by a specific User by their ID. + * Finalize Media upload + * Finalizes a Media upload request. - * @param id The ID of the User to lookup. + * @param id The media id of the targeted media to finalize. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getOwnedLists(id: string, options?: GetOwnedListsOptions): Promise; + finalizeUpload(id: string): Promise; /** - * Get blocking - * Retrieves a list of Users blocked by the specified User ID. + * Append Media upload + * Appends data to a Media upload request. - * @param id The ID of the authenticated source User for whom to return results. + * @param id The media identifier for the media to perform the append operation. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getBlocking(id: string, options?: GetBlockingOptions): Promise; + appendUpload(id: string, options?: AppendUploadOptions): Promise; /** - * Delete Bookmark - * Removes a Post from the authenticated user’s Bookmarks by its ID. + * Initialize media upload + * Initializes a media upload. - * @param id The ID of the authenticated source User whose bookmark is to be removed. + * @returns {Promise} Promise resolving to the API response + */ + initializeUpload(options?: InitializeUploadOptions): Promise; + /** + * Get Media by media keys + * Retrieves details of Media files by their media keys. - * @param tweetId The ID of the Post that the source User is removing from bookmarks. + * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response - */ - deleteBookmark(id: string, tweetId: string): Promise; - /** - * Get User by username - * Retrieves details of a specific User by their username. - - - * @param username A username. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getByUsername(username: string, options?: GetByUsernameOptions): Promise; - /** - * Unpin List - * Causes the authenticated user to unpin a specific List by its ID. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - * @param listId The ID of the List to unpin. - - - - - * @returns {Promise} Promise resolving to the API response - */ - unpinList(id: string, listId: string): Promise; - /** - * Get Posts - * Retrieves a list of posts authored by a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getPosts(id: string, options?: GetPostsOptions$2): Promise; - /** - * Get Bookmarks - * Retrieves a list of Posts bookmarked by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getBookmarks(id: string, options?: GetBookmarksOptions): Promise; - /** - * Create Bookmark - * Adds a post to the authenticated user’s bookmarks. - - - * @param id The ID of the authenticated source User for whom to add bookmarks. - - - - - * @param body Request body - - * @returns {Promise} Promise resolving to the API response - */ - createBookmark(id: string, body: CreateBookmarkRequest): Promise; - /** - * Block DMs - * Blocks direct messages to or from a specific User by their ID for the authenticated user. - - - * @param id The ID of the target User that the authenticated user requesting to block dms for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - blockDms(id: string): Promise; - /** - * Unfollow List - * Causes the authenticated user to unfollow a specific List by its ID. - - - * @param id The ID of the authenticated source User that will unfollow the List. - - - - * @param listId The ID of the List to unfollow. - - - - - * @returns {Promise} Promise resolving to the API response - */ - unfollowList(id: string, listId: string): Promise; - /** - * Get muting - * Retrieves a list of Users muted by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getMuting(id: string, options?: GetMutingOptions): Promise; - /** - * Mute User - * Causes the authenticated user to mute a specific User by their ID. - - - * @param id The ID of the authenticated source User that is requesting to mute the target User. - - - - - * @returns {Promise} Promise resolving to the API response - */ - muteUser(id: string, options?: MuteUserOptions): Promise; - /** - * Get User by ID - * Retrieves details of a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getById(id: string, options?: GetByIdOptions$4): Promise; - /** - * Get my User - * Retrieves details of the authenticated user. - - - - * @returns {Promise} Promise resolving to the API response - */ - getMe(options?: GetMeOptions): Promise; - /** - * Unrepost Post - * Causes the authenticated user to unrepost a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to repost the Post. - - - - * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. - - - - - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - unrepostPost(id: string, sourceTweetId: string): Promise; + getByKeys(mediaKeys: Array, options?: GetByKeysOptions): Promise; /** - * Unmute User - * Causes the authenticated user to unmute a specific user by their ID. - - - * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. - + * Get Media upload status + * Retrieves the status of a Media upload by its ID. - * @param targetUserId The ID of the User that the source User is requesting to unmute. + * @param mediaId Media id for the requested media upload status. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - unmuteUser(sourceUserId: string, targetUserId: string): Promise; + getUploadStatus(mediaId: any, options?: GetUploadStatusOptions): Promise; /** - * Search Users - * Retrieves a list of Users matching a search query. - - - - * @param query TThe the query string by which to query for users. + * Upload media + * Uploads a media file for use in posts or other content. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - search(query: any, options?: SearchOptions$2): Promise; + upload(options?: UploadOptions): Promise; /** - * Get pinned Lists - * Retrieves a list of Lists pinned by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - + * Get Media analytics + * Retrieves analytics data for media. - * @returns {Promise} Promise resolving to the API response - */ - getPinnedLists(id: string, options?: GetPinnedListsOptions): Promise; - /** - * Pin List - * Causes the authenticated user to pin a specific List by its ID. + * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @param id The ID of the authenticated source User that will pin the List. + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - * @param body Request body - * @returns {Promise} Promise resolving to the API response - */ - pinList(id: string, body: PinListRequest): Promise; - /** - * Get followed Lists - * Retrieves a list of Lists followed by a specific User by their ID. + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - * @param id The ID of the User to lookup. + * @param granularity The granularity for the search counts results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getFollowedLists(id: string, options?: GetFollowedListsOptions): Promise; + getAnalytics(mediaKeys: Array, endTime: string, startTime: string, granularity: string, options?: GetAnalyticsOptions$1): Promise; /** - * Follow List - * Causes the authenticated user to follow a specific List by its ID. - - - * @param id The ID of the authenticated source User that will follow the List. - + * Create Media subtitles + * Creates subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - followList(id: string, options?: FollowListOptions): Promise; + createSubtitles(options?: CreateSubtitlesOptions): Promise; /** - * Like Post - * Causes the authenticated user to Like a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to like the Post. - + * Delete Media subtitles + * Deletes subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - likePost(id: string, options?: LikePostOptions): Promise; - /** - * Get liked Posts - * Retrieves a list of Posts liked by a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getLikedPosts(id: string, options?: GetLikedPostsOptions): Promise; - /** - * Get Users by usernames - * Retrieves details of multiple Users by their usernames. - - - - * @param usernames A list of usernames, comma-separated. - - - - * @returns {Promise} Promise resolving to the API response - */ - getByUsernames(usernames: Array, options?: GetByUsernamesOptions): Promise; - /** - * Repost Post - * Causes the authenticated user to repost a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to repost the Post. - - - - - * @returns {Promise} Promise resolving to the API response - */ - repostPost(id: string, options?: RepostPostOptions): Promise; - /** - * Unfollow User - * Causes the authenticated user to unfollow a specific user by their ID. - - - * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. - - - - * @param targetUserId The ID of the User that the source User is requesting to unfollow. - - - - - * @returns {Promise} Promise resolving to the API response - */ - unfollowUser(sourceUserId: string, targetUserId: string): Promise; - /** - * Get followers - * Retrieves a list of Users who follow a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getFollowers(id: string, options?: GetFollowersOptions$1): Promise; - /** - * Get Users by IDs - * Retrieves details of multiple Users by their IDs. - - - - * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. - - - - * @returns {Promise} Promise resolving to the API response - */ - getByIds(ids: Array, options?: GetByIdsOptions$2): Promise; - /** - * Get Bookmarks by folder ID - * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getBookmarksByFolderId(id: string, folderId: string): Promise; - /** - * Get Bookmark folders - * Retrieves a list of Bookmark folders created by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getBookmarkFolders(id: string, options?: GetBookmarkFoldersOptions): Promise; - /** - * Get following - * Retrieves a list of Users followed by a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getFollowing(id: string, options?: GetFollowingOptions): Promise; - /** - * Follow User - * Causes the authenticated user to follow a specific user by their ID. - - - * @param id The ID of the authenticated source User that is requesting to follow the target User. - - - - - * @returns {Promise} Promise resolving to the API response - */ - followUser(id: string, options?: FollowUserOptions): Promise; - /** - * Get Timeline - * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. - - - * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getTimeline(id: string, options?: GetTimelineOptions): Promise; - /** - * Unblock DMs - * Unblocks direct messages to or from a specific User by their ID for the authenticated user. - - - * @param id The ID of the target User that the authenticated user requesting to unblock dms for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - unblockDms(id: string): Promise; - /** - * Get mentions - * Retrieves a list of Posts that mention a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getMentions(id: string, options?: GetMentionsOptions): Promise; - /** - * Get List memberships - * Retrieves a list of Lists that a specific User is a member of by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getListMemberships(id: string, options?: GetListMembershipsOptions): Promise; - /** - * Get Reposts of me - * Retrieves a list of Posts that repost content from the authenticated user. - - - - * @returns {Promise} Promise resolving to the API response - */ - getRepostsOfMe(options?: GetRepostsOfMeOptions): Promise; + deleteSubtitles(options?: DeleteSubtitlesOptions): Promise; } /** @@ -5637,96 +5463,96 @@ declare class UsersClient { */ /** - * Response for getEventsByParticipantId + * Request for createByParticipantId * * @public */ -type GetEventsByParticipantIdResponse = Get2DmConversationsWithParticipantIdDmEventsResponse; +type CreateByParticipantIdRequest = CreateMessageRequest; /** - * Request for createByConversationId + * Response for createByParticipantId * * @public */ -type CreateByConversationIdRequest = CreateMessageRequest; +type CreateByParticipantIdResponse = CreateDmEventResponse; /** - * Response for createByConversationId + * Response for getEvents * * @public */ -type CreateByConversationIdResponse = CreateDmEventResponse; +type GetEventsResponse = Get2DmEventsResponse; /** - * Request for createByParticipantId + * Response for getEventsByParticipantId * * @public */ -type CreateByParticipantIdRequest = CreateMessageRequest; +type GetEventsByParticipantIdResponse = Get2DmConversationsWithParticipantIdDmEventsResponse; /** - * Response for createByParticipantId + * Response for getEventsByConversationId * * @public */ -type CreateByParticipantIdResponse = CreateDmEventResponse; +type GetEventsByConversationIdResponse = Get2DmConversationsIdDmEventsResponse; /** - * Request for createConversation + * Response for getEventsById * * @public */ -type CreateConversationRequest = CreateDmConversationRequest; +type GetEventsByIdResponse = Get2DmEventsEventIdResponse; /** - * Response for createConversation + * Response for deleteEvents * * @public */ -type CreateConversationResponse = CreateDmEventResponse; +type DeleteEventsResponse = DeleteDmResponse; /** - * Response for getEventsById + * Request for createByConversationId * * @public */ -type GetEventsByIdResponse = Get2DmEventsEventIdResponse; +type CreateByConversationIdRequest = CreateMessageRequest; /** - * Response for deleteEvents + * Response for createByConversationId * * @public */ -type DeleteEventsResponse = DeleteDmResponse; +type CreateByConversationIdResponse = CreateDmEventResponse; /** - * Response for getEvents + * Request for createConversation * * @public */ -type GetEventsResponse = Get2DmEventsResponse; +type CreateConversationRequest = CreateDmConversationRequest; /** - * Response for getEventsByConversationId + * Response for createConversation * * @public */ -type GetEventsByConversationIdResponse = Get2DmConversationsIdDmEventsResponse; +type CreateConversationResponse = CreateDmEventResponse; -type models$f_CreateByConversationIdRequest = CreateByConversationIdRequest; -type models$f_CreateByConversationIdResponse = CreateByConversationIdResponse; -type models$f_CreateByParticipantIdRequest = CreateByParticipantIdRequest; -type models$f_CreateByParticipantIdResponse = CreateByParticipantIdResponse; -type models$f_CreateConversationRequest = CreateConversationRequest; -type models$f_CreateConversationResponse = CreateConversationResponse; -type models$f_DeleteEventsResponse = DeleteEventsResponse; -type models$f_GetEventsByConversationIdResponse = GetEventsByConversationIdResponse; -type models$f_GetEventsByIdResponse = GetEventsByIdResponse; -type models$f_GetEventsByParticipantIdResponse = GetEventsByParticipantIdResponse; -type models$f_GetEventsResponse = GetEventsResponse; -declare namespace models$f { +type models$a_CreateByConversationIdRequest = CreateByConversationIdRequest; +type models$a_CreateByConversationIdResponse = CreateByConversationIdResponse; +type models$a_CreateByParticipantIdRequest = CreateByParticipantIdRequest; +type models$a_CreateByParticipantIdResponse = CreateByParticipantIdResponse; +type models$a_CreateConversationRequest = CreateConversationRequest; +type models$a_CreateConversationResponse = CreateConversationResponse; +type models$a_DeleteEventsResponse = DeleteEventsResponse; +type models$a_GetEventsByConversationIdResponse = GetEventsByConversationIdResponse; +type models$a_GetEventsByIdResponse = GetEventsByIdResponse; +type models$a_GetEventsByParticipantIdResponse = GetEventsByParticipantIdResponse; +type models$a_GetEventsResponse = GetEventsResponse; +declare namespace models$a { export { - models$f_CreateByConversationIdRequest as CreateByConversationIdRequest, - models$f_CreateByConversationIdResponse as CreateByConversationIdResponse, - models$f_CreateByParticipantIdRequest as CreateByParticipantIdRequest, - models$f_CreateByParticipantIdResponse as CreateByParticipantIdResponse, - models$f_CreateConversationRequest as CreateConversationRequest, - models$f_CreateConversationResponse as CreateConversationResponse, - models$f_DeleteEventsResponse as DeleteEventsResponse, - models$f_GetEventsByConversationIdResponse as GetEventsByConversationIdResponse, - models$f_GetEventsByIdResponse as GetEventsByIdResponse, - models$f_GetEventsByParticipantIdResponse as GetEventsByParticipantIdResponse, - models$f_GetEventsResponse as GetEventsResponse, + models$a_CreateByConversationIdRequest as CreateByConversationIdRequest, + models$a_CreateByConversationIdResponse as CreateByConversationIdResponse, + models$a_CreateByParticipantIdRequest as CreateByParticipantIdRequest, + models$a_CreateByParticipantIdResponse as CreateByParticipantIdResponse, + models$a_CreateConversationRequest as CreateConversationRequest, + models$a_CreateConversationResponse as CreateConversationResponse, + models$a_DeleteEventsResponse as DeleteEventsResponse, + models$a_GetEventsByConversationIdResponse as GetEventsByConversationIdResponse, + models$a_GetEventsByIdResponse as GetEventsByIdResponse, + models$a_GetEventsByParticipantIdResponse as GetEventsByParticipantIdResponse, + models$a_GetEventsResponse as GetEventsResponse, }; } @@ -5737,11 +5563,24 @@ declare namespace models$f { */ /** - * Options for getEventsByParticipantId method + * Options for createByParticipantId method * * @public */ -interface GetEventsByParticipantIdOptions { +interface CreateByParticipantIdOptions { + /** Request body */ + body?: CreateByParticipantIdRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getEvents method + * + * @public + */ +interface GetEventsOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -5772,50 +5611,20 @@ interface GetEventsByParticipantIdOptions { [key: string]: any; } /** - * Options for createByConversationId method - * - * @public - */ -interface CreateByConversationIdOptions { - /** Request body */ - body?: CreateByConversationIdRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for createByParticipantId method - * - * @public - */ -interface CreateByParticipantIdOptions { - /** Request body */ - body?: CreateByParticipantIdRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for createConversation method - * - * @public - */ -interface CreateConversationOptions { - /** Request body */ - body?: CreateConversationRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getEventsById method + * Options for getEventsByParticipantId method * * @public */ -interface GetEventsByIdOptions { +interface GetEventsByParticipantIdOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** The set of event_types to include in the results. + * Also accepts: event_types or proper camelCase (e.g., eventTypes) */ + eventTypes?: Array; /** A comma separated list of DmEvent fields to display. * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */ dmEventFields?: Array; @@ -5837,11 +5646,11 @@ interface GetEventsByIdOptions { [key: string]: any; } /** - * Options for getEvents method + * Options for getEventsByConversationId method * * @public */ -interface GetEventsOptions { +interface GetEventsByConversationIdOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -5872,20 +5681,11 @@ interface GetEventsOptions { [key: string]: any; } /** - * Options for getEventsByConversationId method + * Options for getEventsById method * * @public */ -interface GetEventsByConversationIdOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The set of event_types to include in the results. - * Also accepts: event_types or proper camelCase (e.g., eventTypes) */ - eventTypes?: Array; +interface GetEventsByIdOptions { /** A comma separated list of DmEvent fields to display. * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */ dmEventFields?: Array; @@ -5906,6 +5706,32 @@ interface GetEventsByConversationIdOptions { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for createByConversationId method + * + * @public + */ +interface CreateByConversationIdOptions { + /** Request body */ + body?: CreateByConversationIdRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for createConversation method + * + * @public + */ +interface CreateConversationOptions { + /** Request body */ + body?: CreateConversationRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** * Client for direct messages operations * @@ -5929,53 +5755,53 @@ declare class DirectMessagesClient { */ private _normalizeOptions; /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. + * Create DM message by participant ID + * Sends a new direct message to a specific participant by their ID. - * @param participantId The ID of the participant user for the One to One DM conversation. + * @param participantId The ID of the recipient user that will receive the DM. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getEventsByParticipantId(participantId: string, options?: GetEventsByParticipantIdOptions): Promise; + createByParticipantId(participantId: string, options?: CreateByParticipantIdOptions): Promise; /** - * Create DM message by conversation ID - * Sends a new direct message to a specific conversation by its ID. - - - * @param dmConversationId The DM Conversation ID. - + * Get DM events + * Retrieves a list of recent direct message events across all conversations. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createByConversationId(dmConversationId: string, options?: CreateByConversationIdOptions): Promise; + getEvents(options?: GetEventsOptions): Promise; /** - * Create DM message by participant ID - * Sends a new direct message to a specific participant by their ID. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. - * @param participantId The ID of the recipient user that will receive the DM. + * @param participantId The ID of the participant user for the One to One DM conversation. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createByParticipantId(participantId: string, options?: CreateByParticipantIdOptions): Promise; + getEventsByParticipantId(participantId: string, options?: GetEventsByParticipantIdOptions): Promise; /** - * Create DM conversation - * Initiates a new direct message conversation with specified participants. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. + + * @param id The DM conversation ID. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ - createConversation(options?: CreateConversationOptions): Promise; + getEventsByConversationId(id: string, options?: GetEventsByConversationIdOptions): Promise; /** * Get DM event by ID * Retrieves details of a specific direct message event by its ID. @@ -6003,113 +5829,210 @@ declare class DirectMessagesClient { */ deleteEvents(eventId: string): Promise; /** - * Get DM events - * Retrieves a list of recent direct message events across all conversations. + * Create DM message by conversation ID + * Sends a new direct message to a specific conversation by its ID. + * @param dmConversationId The DM Conversation ID. - * @returns {Promise} Promise resolving to the API response - */ - getEvents(options?: GetEventsOptions): Promise; - /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. - * @param id The DM conversation ID. + * @returns {Promise} Promise resolving to the API response + */ + createByConversationId(dmConversationId: string, options?: CreateByConversationIdOptions): Promise; + /** + * Create DM conversation + * Initiates a new direct message conversation with specified participants. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getEventsByConversationId(id: string, options?: GetEventsByConversationIdOptions): Promise; + createConversation(options?: CreateConversationOptions): Promise; } /** - * Models for community notes operations + * Models for posts operations */ /** - * Response for delete + * Response for getInsights28hr * * @public */ -type DeleteResponse$3 = DeleteNoteResponse; +type GetInsights28hrResponse = Get2Insights28hrResponse; /** - * Response for searchEligiblePosts + * Response for getReposts * * @public */ -type SearchEligiblePostsResponse = Get2NotesSearchPostsEligibleForNotesResponse; +type GetRepostsResponse = Get2TweetsIdRetweetsResponse; /** - * Request for evaluate + * Response for searchAll * * @public */ -type EvaluateRequest = EvaluateNoteRequest; +type SearchAllResponse = Get2TweetsSearchAllResponse; /** - * Response for evaluate + * Response for getInsightsHistorical * * @public */ -type EvaluateResponse = EvaluateNoteResponse; +type GetInsightsHistoricalResponse = Get2InsightsHistoricalResponse; /** - * Response for searchWritten + * Response for getById * * @public */ -type SearchWrittenResponse = Get2NotesSearchNotesWrittenResponse; +type GetByIdResponse$3 = Get2TweetsIdResponse; +/** + * Response for delete + * + * @public + */ +type DeleteResponse$3 = TweetDeleteResponse; +/** + * Response for getAnalytics + * + * @public + */ +type GetAnalyticsResponse = Analytics; +/** + * Response for getByIds + * + * @public + */ +type GetByIdsResponse$1 = Get2TweetsResponse; /** * Request for create * * @public */ -type CreateRequest$3 = CreateNoteRequest; +type CreateRequest$3 = TweetCreateRequest; /** * Response for create * * @public */ -type CreateResponse$3 = CreateNoteResponse; +type CreateResponse$3 = TweetCreateResponse; +/** + * Response for getCountsRecent + * + * @public + */ +type GetCountsRecentResponse = Get2TweetsCountsRecentResponse; +/** + * Response for getCountsAll + * + * @public + */ +type GetCountsAllResponse = Get2TweetsCountsAllResponse; +/** + * Response for searchRecent + * + * @public + */ +type SearchRecentResponse = Get2TweetsSearchRecentResponse; +/** + * Request for hideReply + * + * @public + */ +type HideReplyRequest = TweetHideRequest; +/** + * Response for hideReply + * + * @public + */ +type HideReplyResponse = TweetHideResponse; +/** + * Response for getRepostedBy + * + * @public + */ +type GetRepostedByResponse = Get2TweetsIdRetweetedByResponse; +/** + * Response for getQuoted + * + * @public + */ +type GetQuotedResponse = Get2TweetsIdQuoteTweetsResponse; +/** + * Response for getLikingUsers + * + * @public + */ +type GetLikingUsersResponse = Get2TweetsIdLikingUsersResponse; -type models$e_EvaluateRequest = EvaluateRequest; -type models$e_EvaluateResponse = EvaluateResponse; -type models$e_SearchEligiblePostsResponse = SearchEligiblePostsResponse; -type models$e_SearchWrittenResponse = SearchWrittenResponse; -declare namespace models$e { +type models$9_GetAnalyticsResponse = GetAnalyticsResponse; +type models$9_GetCountsAllResponse = GetCountsAllResponse; +type models$9_GetCountsRecentResponse = GetCountsRecentResponse; +type models$9_GetInsights28hrResponse = GetInsights28hrResponse; +type models$9_GetInsightsHistoricalResponse = GetInsightsHistoricalResponse; +type models$9_GetLikingUsersResponse = GetLikingUsersResponse; +type models$9_GetQuotedResponse = GetQuotedResponse; +type models$9_GetRepostedByResponse = GetRepostedByResponse; +type models$9_GetRepostsResponse = GetRepostsResponse; +type models$9_HideReplyRequest = HideReplyRequest; +type models$9_HideReplyResponse = HideReplyResponse; +type models$9_SearchAllResponse = SearchAllResponse; +type models$9_SearchRecentResponse = SearchRecentResponse; +declare namespace models$9 { export { CreateRequest$3 as CreateRequest, CreateResponse$3 as CreateResponse, DeleteResponse$3 as DeleteResponse, - models$e_EvaluateRequest as EvaluateRequest, - models$e_EvaluateResponse as EvaluateResponse, - models$e_SearchEligiblePostsResponse as SearchEligiblePostsResponse, - models$e_SearchWrittenResponse as SearchWrittenResponse, + models$9_GetAnalyticsResponse as GetAnalyticsResponse, + GetByIdResponse$3 as GetByIdResponse, + GetByIdsResponse$1 as GetByIdsResponse, + models$9_GetCountsAllResponse as GetCountsAllResponse, + models$9_GetCountsRecentResponse as GetCountsRecentResponse, + models$9_GetInsights28hrResponse as GetInsights28hrResponse, + models$9_GetInsightsHistoricalResponse as GetInsightsHistoricalResponse, + models$9_GetLikingUsersResponse as GetLikingUsersResponse, + models$9_GetQuotedResponse as GetQuotedResponse, + models$9_GetRepostedByResponse as GetRepostedByResponse, + models$9_GetRepostsResponse as GetRepostsResponse, + models$9_HideReplyRequest as HideReplyRequest, + models$9_HideReplyResponse as HideReplyResponse, + models$9_SearchAllResponse as SearchAllResponse, + models$9_SearchRecentResponse as SearchRecentResponse, }; } /** - * community notes client for the X API. + * posts client for the X API. * - * This module provides a client for interacting with the community notes endpoints of the X API. + * This module provides a client for interacting with the posts endpoints of the X API. */ /** - * Options for searchEligiblePosts method + * Options for getInsights28hr method * * @public */ -interface SearchEligiblePostsOptions { - /** Pagination token to get next set of posts eligible for notes. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: string; - /** Max results to return. +interface GetInsights28hrOptions { + /** A comma separated list of Engagement fields to display. + * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ + engagementFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getReposts method + * + * @public + */ +interface GetRepostsOptions { + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. - * Also accepts: post_selection or proper camelCase (e.g., postSelection) */ - postSelection?: string; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -6134,329 +6057,146 @@ interface SearchEligiblePostsOptions { [key: string]: any; } /** - * Options for evaluate method + * Options for searchAll method * * @public */ -interface EvaluateOptions { - /** Request body */ - body?: EvaluateRequest; +interface SearchAllOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** Returns results with a Post ID less than (that is, older than) the specified ID. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of search results to be returned by a request. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** This order in which to return results. + * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ + sortOrder?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for searchWritten method + * Options for getInsightsHistorical method * * @public */ -interface SearchWrittenOptions { - /** Pagination token to get next set of posts eligible for notes. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: string; - /** Max results to return. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** A comma separated list of Note fields to display. - * Also accepts: note.fields or proper camelCase (e.g., noteFields) */ - noteFields?: Array; +interface GetInsightsHistoricalOptions { + /** A comma separated list of Engagement fields to display. + * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ + engagementFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for create method + * Options for getById method * * @public */ -interface CreateOptions$2 { - /** Request body */ - body?: CreateRequest$3; +interface GetByIdOptions$3 { + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for community notes operations - * - * This client provides methods for interacting with the community notes endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all community notes related operations. - * - * @category community notes - */ -declare class CommunityNotesClient { - private client; - /** - * Creates a new community notes client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; - /** - * Delete a Community Note - * Deletes a community note. - - - * @param id The community note id to delete. - - - - - * @returns {Promise} Promise resolving to the API response - */ - delete(id: string): Promise; - /** - * Search for Posts Eligible for Community Notes - * Returns all the posts that are eligible for community notes. - - - - * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. - - - - * @returns {Promise} Promise resolving to the API response - */ - searchEligiblePosts(testMode: boolean, options?: SearchEligiblePostsOptions): Promise; - /** - * Evaluate a Community Note - * Endpoint to evaluate a community note. - - - - * @returns {Promise} Promise resolving to the API response - */ - evaluate(options?: EvaluateOptions): Promise; - /** - * Search for Community Notes Written - * Returns all the community notes written by the user. - - - - * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. - - - - * @returns {Promise} Promise resolving to the API response - */ - searchWritten(testMode: boolean, options?: SearchWrittenOptions): Promise; - /** - * Create a Community Note - * Creates a community note endpoint for LLM use case. - - - - * @returns {Promise} Promise resolving to the API response - */ - create(options?: CreateOptions$2): Promise; -} - -/** - * Models for posts operations - */ - -/** - * Request for hideReply - * - * @public - */ -type HideReplyRequest = TweetHideRequest; -/** - * Response for hideReply - * - * @public - */ -type HideReplyResponse = TweetHideResponse; -/** - * Response for getAnalytics - * - * @public - */ -type GetAnalyticsResponse$1 = Analytics; -/** - * Response for getInsightsHistorical + * Options for getAnalytics method * * @public */ -type GetInsightsHistoricalResponse = Get2InsightsHistoricalResponse; +interface GetAnalyticsOptions { + /** A comma separated list of Analytics fields to display. + * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */ + analyticsFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** - * Response for getCountsRecent + * Options for getByIds method * * @public */ -type GetCountsRecentResponse = Get2TweetsCountsRecentResponse; +interface GetByIdsOptions$1 { + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** - * Response for getCountsAll - * - * @public - */ -type GetCountsAllResponse = Get2TweetsCountsAllResponse; -/** - * Response for getReposts - * - * @public - */ -type GetRepostsResponse = Get2TweetsIdRetweetsResponse; -/** - * Response for getById - * - * @public - */ -type GetByIdResponse$3 = Get2TweetsIdResponse; -/** - * Response for delete - * - * @public - */ -type DeleteResponse$2 = TweetDeleteResponse; -/** - * Response for getRepostedBy - * - * @public - */ -type GetRepostedByResponse = Get2TweetsIdRetweetedByResponse; -/** - * Response for getInsights28hr - * - * @public - */ -type GetInsights28hrResponse = Get2Insights28hrResponse; -/** - * Response for getByIds - * - * @public - */ -type GetByIdsResponse$1 = Get2TweetsResponse; -/** - * Request for create - * - * @public - */ -type CreateRequest$2 = TweetCreateRequest; -/** - * Response for create - * - * @public - */ -type CreateResponse$2 = TweetCreateResponse; -/** - * Response for getLikingUsers - * - * @public - */ -type GetLikingUsersResponse = Get2TweetsIdLikingUsersResponse; -/** - * Response for searchAll - * - * @public - */ -type SearchAllResponse = Get2TweetsSearchAllResponse; -/** - * Response for getQuoted - * - * @public - */ -type GetQuotedResponse = Get2TweetsIdQuoteTweetsResponse; -/** - * Response for searchRecent - * - * @public - */ -type SearchRecentResponse = Get2TweetsSearchRecentResponse; - -type models$d_GetCountsAllResponse = GetCountsAllResponse; -type models$d_GetCountsRecentResponse = GetCountsRecentResponse; -type models$d_GetInsights28hrResponse = GetInsights28hrResponse; -type models$d_GetInsightsHistoricalResponse = GetInsightsHistoricalResponse; -type models$d_GetLikingUsersResponse = GetLikingUsersResponse; -type models$d_GetQuotedResponse = GetQuotedResponse; -type models$d_GetRepostedByResponse = GetRepostedByResponse; -type models$d_GetRepostsResponse = GetRepostsResponse; -type models$d_HideReplyRequest = HideReplyRequest; -type models$d_HideReplyResponse = HideReplyResponse; -type models$d_SearchAllResponse = SearchAllResponse; -type models$d_SearchRecentResponse = SearchRecentResponse; -declare namespace models$d { - export { - CreateRequest$2 as CreateRequest, - CreateResponse$2 as CreateResponse, - DeleteResponse$2 as DeleteResponse, - GetAnalyticsResponse$1 as GetAnalyticsResponse, - GetByIdResponse$3 as GetByIdResponse, - GetByIdsResponse$1 as GetByIdsResponse, - models$d_GetCountsAllResponse as GetCountsAllResponse, - models$d_GetCountsRecentResponse as GetCountsRecentResponse, - models$d_GetInsights28hrResponse as GetInsights28hrResponse, - models$d_GetInsightsHistoricalResponse as GetInsightsHistoricalResponse, - models$d_GetLikingUsersResponse as GetLikingUsersResponse, - models$d_GetQuotedResponse as GetQuotedResponse, - models$d_GetRepostedByResponse as GetRepostedByResponse, - models$d_GetRepostsResponse as GetRepostsResponse, - models$d_HideReplyRequest as HideReplyRequest, - models$d_HideReplyResponse as HideReplyResponse, - models$d_SearchAllResponse as SearchAllResponse, - models$d_SearchRecentResponse as SearchRecentResponse, - }; -} - -/** - * posts client for the X API. - * - * This module provides a client for interacting with the posts endpoints of the X API. - */ - -/** - * Options for hideReply method - * - * @public - */ -interface HideReplyOptions { - /** Request body */ - body?: HideReplyRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getAnalytics method - * - * @public - */ -interface GetAnalyticsOptions$1 { - /** A comma separated list of Analytics fields to display. - * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */ - analyticsFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getInsightsHistorical method - * - * @public - */ -interface GetInsightsHistoricalOptions { - /** A comma separated list of Engagement fields to display. - * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ - engagementFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getCountsRecent method + * Options for getCountsRecent method * * @public */ @@ -6526,17 +6266,35 @@ interface GetCountsAllOptions { [key: string]: any; } /** - * Options for getReposts method + * Options for searchRecent method * * @public */ -interface GetRepostsOptions { - /** The maximum number of results. +interface SearchRecentOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** Returns results with a Post ID less than (that is, older than) the specified ID. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of search results to be returned by a request. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; + /** This order in which to return results. + * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ + sortOrder?: string; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -6561,29 +6319,13 @@ interface GetRepostsOptions { [key: string]: any; } /** - * Options for getById method + * Options for hideReply method * * @public */ -interface GetByIdOptions$3 { - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; +interface HideReplyOptions { + /** Request body */ + body?: HideReplyRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ @@ -6616,25 +6358,20 @@ interface GetRepostedByOptions { [key: string]: any; } /** - * Options for getInsights28hr method - * - * @public - */ -interface GetInsights28hrOptions { - /** A comma separated list of Engagement fields to display. - * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ - engagementFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByIds method + * Options for getQuoted method * * @public */ -interface GetByIdsOptions$1 { +interface GetQuotedOptions { + /** The maximum number of results to be returned. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** The set of entities to exclude (e.g. 'replies' or 'retweets'). + * Also accepts: exclude or proper camelCase (e.g., exclude) */ + exclude?: Array; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -6685,157 +6422,13 @@ interface GetLikingUsersOptions { [key: string]: any; } /** - * Options for searchAll method + * Client for posts operations * - * @public - */ -interface SearchAllOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** Returns results with a Post ID less than (that is, older than) the specified ID. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of search results to be returned by a request. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** This order in which to return results. - * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ - sortOrder?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getQuoted method - * - * @public - */ -interface GetQuotedOptions { - /** The maximum number of results to be returned. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The set of entities to exclude (e.g. 'replies' or 'retweets'). - * Also accepts: exclude or proper camelCase (e.g., exclude) */ - exclude?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for searchRecent method - * - * @public - */ -interface SearchRecentOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** Returns results with a Post ID less than (that is, older than) the specified ID. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of search results to be returned by a request. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** This order in which to return results. - * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ - sortOrder?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Client for posts operations - * - * This client provides methods for interacting with the posts endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all posts related operations. - * - * @category posts + * This client provides methods for interacting with the posts endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all posts related operations. + * + * @category posts */ declare class PostsClient { private client; @@ -6851,43 +6444,52 @@ declare class PostsClient { */ private _normalizeOptions; /** - * Hide reply - * Hides or unhides a reply to a conversation owned by the authenticated user. + * Get 28-hour Post insights + * Retrieves engagement metrics for specified Posts over the last 28 hours. - * @param tweetId The ID of the reply that you want to hide or unhide. + * @param tweetIds List of PostIds for 28hr metrics. - * @returns {Promise} Promise resolving to the API response - */ - hideReply(tweetId: string, options?: HideReplyOptions): Promise; - /** - * Get Post analytics - * Retrieves analytics data for specified Posts within a defined time range. + * @param granularity granularity of metrics response. - * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. + * @param requestedMetrics request metrics for historical request. - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + * @returns {Promise} Promise resolving to the API response + */ + getInsights28hr(tweetIds: Array, granularity: string, requestedMetrics: Array, options?: GetInsights28hrOptions): Promise; + /** + * Get Reposts + * Retrieves a list of Posts that repost a specific Post by its ID. + * @param id A single Post ID. - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - * @param granularity The granularity for the search counts results. + * @returns {Promise} Promise resolving to the API response + */ + getReposts(id: string, options?: GetRepostsOptions): Promise; + /** + * Search all Posts + * Retrieves Posts from the full archive matching a search query. - * @returns {Promise} Promise resolving to the API response + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. + + + + * @returns {Promise} Promise resolving to the API response */ - getAnalytics(ids: Array, endTime: string, startTime: string, granularity: string, options?: GetAnalyticsOptions$1): Promise; + searchAll(query: string, options?: SearchAllOptions): Promise; /** * Get historical Post insights * Retrieves historical engagement metrics for specified Posts within a defined time range. @@ -6917,45 +6519,6 @@ declare class PostsClient { * @returns {Promise} Promise resolving to the API response */ getInsightsHistorical(tweetIds: Array, endTime: string, startTime: string, granularity: string, requestedMetrics: Array, options?: GetInsightsHistoricalOptions): Promise; - /** - * Get count of recent Posts - * Retrieves the count of Posts from the last 7 days matching a search query. - - - - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - - - - * @returns {Promise} Promise resolving to the API response - */ - getCountsRecent(query: string, options?: GetCountsRecentOptions): Promise; - /** - * Get count of all Posts - * Retrieves the count of Posts matching a search query from the full archive. - - - - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - - - - * @returns {Promise} Promise resolving to the API response - */ - getCountsAll(query: string, options?: GetCountsAllOptions): Promise; - /** - * Get Reposts - * Retrieves a list of Posts that repost a specific Post by its ID. - - - * @param id A single Post ID. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getReposts(id: string, options?: GetRepostsOptions): Promise; /** * Get Post by ID * Retrieves details of a specific Post by its ID. @@ -6981,41 +6544,32 @@ declare class PostsClient { * @returns {Promise} Promise resolving to the API response */ - delete(id: string): Promise; + delete(id: string): Promise; /** - * Get Reposted by - * Retrieves a list of Users who reposted a specific Post by its ID. - - - * @param id A single Post ID. - + * Get Post analytics + * Retrieves analytics data for specified Posts within a defined time range. - * @returns {Promise} Promise resolving to the API response - */ - getRepostedBy(id: string, options?: GetRepostedByOptions): Promise; - /** - * Get 28-hour Post insights - * Retrieves engagement metrics for specified Posts over the last 28 hours. + * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. - * @param tweetIds List of PostIds for 28hr metrics. + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - * @param granularity granularity of metrics response. + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - * @param requestedMetrics request metrics for historical request. + * @param granularity The granularity for the search counts results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getInsights28hr(tweetIds: Array, granularity: string, requestedMetrics: Array, options?: GetInsights28hrOptions): Promise; + getAnalytics(ids: Array, endTime: string, startTime: string, granularity: string, options?: GetAnalyticsOptions): Promise; /** * Get Posts by IDs * Retrieves details of multiple Posts by their IDs. @@ -7039,23 +6593,23 @@ declare class PostsClient { * @returns {Promise} Promise resolving to the API response */ - create(body: CreateRequest$2): Promise; + create(body: CreateRequest$3): Promise; /** - * Get Liking Users - * Retrieves a list of Users who liked a specific Post by its ID. + * Get count of recent Posts + * Retrieves the count of Posts from the last 7 days matching a search query. - * @param id A single Post ID. + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getLikingUsers(id: string, options?: GetLikingUsersOptions): Promise; + getCountsRecent(query: string, options?: GetCountsRecentOptions): Promise; /** - * Search all Posts - * Retrieves Posts from the full archive matching a search query. + * Get count of all Posts + * Retrieves the count of Posts matching a search query from the full archive. @@ -7063,515 +6617,259 @@ declare class PostsClient { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - searchAll(query: string, options?: SearchAllOptions): Promise; + getCountsAll(query: string, options?: GetCountsAllOptions): Promise; /** - * Get Quoted Posts - * Retrieves a list of Posts that quote a specific Post by its ID. + * Search recent Posts + * Retrieves Posts from the last 7 days matching a search query. - * @param id A single Post ID. + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getQuoted(id: string, options?: GetQuotedOptions): Promise; + searchRecent(query: string, options?: SearchRecentOptions): Promise; /** - * Search recent Posts - * Retrieves Posts from the last 7 days matching a search query. + * Hide reply + * Hides or unhides a reply to a conversation owned by the authenticated user. + * @param tweetId The ID of the reply that you want to hide or unhide. - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - searchRecent(query: string, options?: SearchRecentOptions): Promise; -} - -/** - * Models for trends operations - */ - -/** - * Response for getAi - * - * @public - */ -type GetAiResponse = Get2AiTrendsIdResponse; -/** - * Response for getByWoeid - * - * @public - */ -type GetByWoeidResponse = Get2TrendsByWoeidWoeidResponse; -/** - * Response for getPersonalized - * - * @public - */ -type GetPersonalizedResponse = Get2UsersPersonalizedTrendsResponse; - -type models$c_GetAiResponse = GetAiResponse; -type models$c_GetByWoeidResponse = GetByWoeidResponse; -type models$c_GetPersonalizedResponse = GetPersonalizedResponse; -declare namespace models$c { - export { - models$c_GetAiResponse as GetAiResponse, - models$c_GetByWoeidResponse as GetByWoeidResponse, - models$c_GetPersonalizedResponse as GetPersonalizedResponse, - }; -} - -/** - * trends client for the X API. - * - * This module provides a client for interacting with the trends endpoints of the X API. - */ - -/** - * Options for getAi method - * - * @public - */ -interface GetAiOptions { - /** A comma separated list of News fields to display. - * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ - newsFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByWoeid method - * - * @public - */ -interface GetByWoeidOptions { - /** The maximum number of results. - * Also accepts: max_trends or proper camelCase (e.g., maxTrends) */ - maxTrends?: number; - /** A comma separated list of Trend fields to display. - * Also accepts: trend.fields or proper camelCase (e.g., trendFields) */ - trendFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getPersonalized method - * - * @public - */ -interface GetPersonalizedOptions { - /** A comma separated list of PersonalizedTrend fields to display. - * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */ - personalizedTrendFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Client for trends operations - * - * This client provides methods for interacting with the trends endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all trends related operations. - * - * @category trends - */ -declare class TrendsClient { - private client; - /** - * Creates a new trends client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; + hideReply(tweetId: string, options?: HideReplyOptions): Promise; /** - * Get AI Trends by ID - * Retrieves an AI trend by its ID. + * Get Reposted by + * Retrieves a list of Users who reposted a specific Post by its ID. - * @param id The ID of the ai trend. + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getAi(id: string, options?: GetAiOptions): Promise; + getRepostedBy(id: string, options?: GetRepostedByOptions): Promise; /** - * Get Trends by WOEID - * Retrieves trending topics for a specific location identified by its WOEID. + * Get Quoted Posts + * Retrieves a list of Posts that quote a specific Post by its ID. - * @param woeid The WOEID of the place to lookup a trend for. + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByWoeid(woeid: number, options?: GetByWoeidOptions): Promise; + getQuoted(id: string, options?: GetQuotedOptions): Promise; /** - * Get personalized Trends - * Retrieves personalized trending topics for the authenticated user. + * Get Liking Users + * Retrieves a list of Users who liked a specific Post by its ID. + + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ - getPersonalized(options?: GetPersonalizedOptions): Promise; + getLikingUsers(id: string, options?: GetLikingUsersOptions): Promise; } /** - * Models for activity operations + * Models for lists operations */ /** - * Response for getSubscriptions + * Response for getMembers * * @public */ -type GetSubscriptionsResponse$1 = ActivitySubscriptionGetResponse; +type GetMembersResponse = Get2ListsIdMembersResponse; /** - * Request for createSubscription + * Request for addMember * * @public */ -type CreateSubscriptionRequest$1 = ActivitySubscriptionCreateRequest; +type AddMemberRequest = ListAddUserRequest; /** - * Response for createSubscription + * Response for addMember * * @public */ -type CreateSubscriptionResponse$1 = ActivitySubscriptionCreateResponse; +type AddMemberResponse = ListMutateResponse; /** - * Request for updateSubscription + * Response for getFollowers * * @public */ -type UpdateSubscriptionRequest = ActivitySubscriptionUpdateRequest; +type GetFollowersResponse$1 = Get2ListsIdFollowersResponse; /** - * Response for updateSubscription + * Response for getPosts * * @public */ -type UpdateSubscriptionResponse = ActivitySubscriptionUpdateResponse; +type GetPostsResponse$1 = Get2ListsIdTweetsResponse; /** - * Response for deleteSubscription + * Response for removeMemberByUserId * * @public */ -type DeleteSubscriptionResponse$1 = ActivitySubscriptionDeleteResponse; +type RemoveMemberByUserIdResponse = ListMutateResponse; /** - * Response for stream + * Response for getById * * @public */ -type StreamResponse = ActivityStreamingResponse; +type GetByIdResponse$2 = Get2ListsIdResponse; +/** + * Request for update + * + * @public + */ +type UpdateRequest = ListUpdateRequest; +/** + * Response for update + * + * @public + */ +type UpdateResponse = ListUpdateResponse; +/** + * Response for delete + * + * @public + */ +type DeleteResponse$2 = ListDeleteResponse; +/** + * Request for create + * + * @public + */ +type CreateRequest$2 = ListCreateRequest; +/** + * Response for create + * + * @public + */ +type CreateResponse$2 = ListCreateResponse; -type models$b_StreamResponse = StreamResponse; -type models$b_UpdateSubscriptionRequest = UpdateSubscriptionRequest; -type models$b_UpdateSubscriptionResponse = UpdateSubscriptionResponse; -declare namespace models$b { +type models$8_AddMemberRequest = AddMemberRequest; +type models$8_AddMemberResponse = AddMemberResponse; +type models$8_GetMembersResponse = GetMembersResponse; +type models$8_RemoveMemberByUserIdResponse = RemoveMemberByUserIdResponse; +type models$8_UpdateRequest = UpdateRequest; +type models$8_UpdateResponse = UpdateResponse; +declare namespace models$8 { export { - CreateSubscriptionRequest$1 as CreateSubscriptionRequest, - CreateSubscriptionResponse$1 as CreateSubscriptionResponse, - DeleteSubscriptionResponse$1 as DeleteSubscriptionResponse, - GetSubscriptionsResponse$1 as GetSubscriptionsResponse, - models$b_StreamResponse as StreamResponse, - models$b_UpdateSubscriptionRequest as UpdateSubscriptionRequest, - models$b_UpdateSubscriptionResponse as UpdateSubscriptionResponse, + models$8_AddMemberRequest as AddMemberRequest, + models$8_AddMemberResponse as AddMemberResponse, + CreateRequest$2 as CreateRequest, + CreateResponse$2 as CreateResponse, + DeleteResponse$2 as DeleteResponse, + GetByIdResponse$2 as GetByIdResponse, + GetFollowersResponse$1 as GetFollowersResponse, + models$8_GetMembersResponse as GetMembersResponse, + GetPostsResponse$1 as GetPostsResponse, + models$8_RemoveMemberByUserIdResponse as RemoveMemberByUserIdResponse, + models$8_UpdateRequest as UpdateRequest, + models$8_UpdateResponse as UpdateResponse, }; } /** - * activity client for the X API. + * lists client for the X API. * - * This module provides a client for interacting with the activity endpoints of the X API. + * This module provides a client for interacting with the lists endpoints of the X API. */ /** - * Options for createSubscription method + * Options for getMembers method * * @public */ -interface CreateSubscriptionOptions$1 { - /** Request body */ - body?: CreateSubscriptionRequest$1; +interface GetMembersOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for updateSubscription method + * Options for addMember method * * @public */ -interface UpdateSubscriptionOptions { +interface AddMemberOptions { /** Request body */ - body?: UpdateSubscriptionRequest; + body?: AddMemberRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for stream method + * Options for getFollowers method * * @public */ -interface StreamOptions { - /** The number of minutes of backfill requested. - * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ - backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Client for activity operations - * - * This client provides methods for interacting with the activity endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all activity related operations. - * - * @category activity - */ -declare class ActivityClient { - private client; - /** - * Creates a new activity client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; - /** - * Get X activity subscriptions - * Get a list of active subscriptions for XAA - - - - * @returns {Promise} Promise resolving to the API response - */ - getSubscriptions(): Promise; - /** - * Create X activity subscription - * Creates a subscription for an X activity event - - - - * @returns {Promise} Promise resolving to the API response - */ - createSubscription(options?: CreateSubscriptionOptions$1): Promise; - /** - * Update X activity subscription - * Updates a subscription for an X activity event - - - * @param subscriptionId The ID of the subscription to update. - - - - - * @returns {Promise} Promise resolving to the API response - */ - updateSubscription(subscriptionId: string, options?: UpdateSubscriptionOptions): Promise; - /** - * Deletes X activity subscription - * Deletes a subscription for an X activity event - - - * @param subscriptionId The ID of the subscription to delete. - - - - - * @returns {Promise} Promise resolving to the API response - */ - deleteSubscription(subscriptionId: string): Promise; - /** - * Activity Stream - * Stream of X Activities - - - - * @returns {Promise} Promise resolving to the API response - */ - stream(options?: StreamOptions): Promise; -} - -/** - * Models for usage operations - */ - -/** - * Response for get - * - * @public - */ -type GetResponse$1 = Get2UsageTweetsResponse; - -declare namespace models$a { - export { - GetResponse$1 as GetResponse, - }; -} - -/** - * usage client for the X API. - * - * This module provides a client for interacting with the usage endpoints of the X API. - */ - -/** - * Options for get method - * - * @public - */ -interface GetOptions$1 { - /** The number of days for which you need usage for. - * Also accepts: days or proper camelCase (e.g., days) */ - days?: number; - /** A comma separated list of Usage fields to display. - * Also accepts: usage.fields or proper camelCase (e.g., usageFields) */ - usageFields?: Array; +interface GetFollowersOptions$1 { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } -/** - * Client for usage operations - * - * This client provides methods for interacting with the usage endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all usage related operations. - * - * @category usage - */ -declare class UsageClient { - private client; - /** - * Creates a new usage client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; - /** - * Get usage - * Retrieves usage statistics for Posts over a specified number of days. - - - - * @returns {Promise} Promise resolving to the API response - */ - get(options?: GetOptions$1): Promise; -} - -/** - * Models for spaces operations - */ - -/** - * Response for getPosts - * - * @public - */ -type GetPostsResponse$1 = Get2SpacesIdTweetsResponse; -/** - * Response for search - * - * @public - */ -type SearchResponse$1 = Get2SpacesSearchResponse; -/** - * Response for getById - * - * @public - */ -type GetByIdResponse$2 = Get2SpacesIdResponse; -/** - * Response for getByCreatorIds - * - * @public - */ -type GetByCreatorIdsResponse = Get2SpacesByCreatorIdsResponse; -/** - * Response for getBuyers - * - * @public - */ -type GetBuyersResponse = Get2SpacesIdBuyersResponse; -/** - * Response for getByIds - * - * @public - */ -type GetByIdsResponse = Get2SpacesResponse; - -type models$9_GetBuyersResponse = GetBuyersResponse; -type models$9_GetByCreatorIdsResponse = GetByCreatorIdsResponse; -type models$9_GetByIdsResponse = GetByIdsResponse; -declare namespace models$9 { - export { - models$9_GetBuyersResponse as GetBuyersResponse, - models$9_GetByCreatorIdsResponse as GetByCreatorIdsResponse, - GetByIdResponse$2 as GetByIdResponse, - models$9_GetByIdsResponse as GetByIdsResponse, - GetPostsResponse$1 as GetPostsResponse, - SearchResponse$1 as SearchResponse, - }; -} - -/** - * spaces client for the X API. - * - * This module provides a client for interacting with the spaces endpoints of the X API. - */ - /** * Options for getPosts method * * @public */ interface GetPostsOptions$1 { - /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -7596,142 +6894,64 @@ interface GetPostsOptions$1 { [key: string]: any; } /** - * Options for search method + * Options for getById method * * @public */ -interface SearchOptions$1 { - /** The state of Spaces to search for. - * Also accepts: state or proper camelCase (e.g., state) */ - state?: string; - /** The number of results to return. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; +interface GetByIdOptions$2 { + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getById method + * Options for update method * * @public */ -interface GetByIdOptions$2 { - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; +interface UpdateOptions { + /** Request body */ + body?: UpdateRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getByCreatorIds method + * Options for create method * * @public */ -interface GetByCreatorIdsOptions { - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getBuyers method - * - * @public - */ -interface GetBuyersOptions { - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByIds method - * - * @public - */ -interface GetByIdsOptions { - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; +interface CreateOptions$2 { + /** Request body */ + body?: CreateRequest$2; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for spaces operations + * Client for lists operations * - * This client provides methods for interacting with the spaces endpoints + * This client provides methods for interacting with the lists endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all spaces related operations. + * parsing for all lists related operations. * - * @category spaces + * @category lists */ -declare class SpacesClient { +declare class ListsClient { private client; /** - * Creates a new spaces client instance + * Creates a new lists client instance * * @param client - The main X API client instance */ @@ -7742,11 +6962,50 @@ declare class SpacesClient { */ private _normalizeOptions; /** - * Get Space Posts - * Retrieves a list of Posts shared in a specific Space by its ID. + * Get List members + * Retrieves a list of Users who are members of a specific List by its ID. - * @param id The ID of the Space to be retrieved. + * @param id The ID of the List. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getMembers(id: string, options?: GetMembersOptions): Promise; + /** + * Add List member + * Adds a User to a specific List by its ID. + + + * @param id The ID of the List for which to add a member. + + + + + * @returns {Promise} Promise resolving to the API response + */ + addMember(id: string, options?: AddMemberOptions): Promise; + /** + * Get List followers + * Retrieves a list of Users who follow a specific List by its ID. + + + * @param id The ID of the List. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getFollowers(id: string, options?: GetFollowersOptions$1): Promise; + /** + * Get List Posts + * Retrieves a list of Posts associated with a specific List by its ID. + + + * @param id The ID of the List. @@ -7755,24 +7014,28 @@ declare class SpacesClient { */ getPosts(id: string, options?: GetPostsOptions$1): Promise; /** - * Search Spaces - * Retrieves a list of Spaces matching the specified search query. + * Remove List member + * Removes a User from a specific List by its ID and the User’s ID. + + * @param id The ID of the List to remove a member. - * @param query The search query. + * @param userId The ID of User that will be removed from the List. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ - search(query: string, options?: SearchOptions$1): Promise; + removeMemberByUserId(id: string, userId: string): Promise; /** - * Get space by ID - * Retrieves details of a specific space by its ID. + * Get List by ID + * Retrieves details of a specific List by its ID. - * @param id The ID of the Space to be retrieved. + * @param id The ID of the List. @@ -7781,130 +7044,211 @@ declare class SpacesClient { */ getById(id: string, options?: GetByIdOptions$2): Promise; /** - * Get Spaces by creator IDs - * Retrieves details of Spaces created by specified User IDs. + * Update List + * Updates the details of a specific List owned by the authenticated user by its ID. + * @param id The ID of the List to modify. - * @param userIds The IDs of Users to search through. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByCreatorIds(userIds: Array, options?: GetByCreatorIdsOptions): Promise; + update(id: string, options?: UpdateOptions): Promise; /** - * Get Space ticket buyers - * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + * Delete List + * Deletes a specific List owned by the authenticated user by its ID. - * @param id The ID of the Space to be retrieved. + * @param id The ID of the List to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getBuyers(id: string, options?: GetBuyersOptions): Promise; + delete(id: string): Promise; /** - * Get Spaces by IDs - * Retrieves details of multiple Spaces by their IDs. - - - - * @param ids The list of Space IDs to return. + * Create List + * Creates a new List for the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByIds(ids: Array, options?: GetByIdsOptions): Promise; + create(options?: CreateOptions$2): Promise; } /** - * Models for communities operations + * Models for community notes operations */ /** - * Response for getById + * Response for delete * * @public */ -type GetByIdResponse$1 = Get2CommunitiesIdResponse; +type DeleteResponse$1 = DeleteNoteResponse; /** - * Response for search + * Request for evaluate * * @public */ -type SearchResponse = Get2CommunitiesSearchResponse; +type EvaluateRequest = EvaluateNoteRequest; +/** + * Response for evaluate + * + * @public + */ +type EvaluateResponse = EvaluateNoteResponse; +/** + * Response for searchWritten + * + * @public + */ +type SearchWrittenResponse = Get2NotesSearchNotesWrittenResponse; +/** + * Request for create + * + * @public + */ +type CreateRequest$1 = CreateNoteRequest; +/** + * Response for create + * + * @public + */ +type CreateResponse$1 = CreateNoteResponse; +/** + * Response for searchEligiblePosts + * + * @public + */ +type SearchEligiblePostsResponse = Get2NotesSearchPostsEligibleForNotesResponse; -type models$8_SearchResponse = SearchResponse; -declare namespace models$8 { +type models$7_EvaluateRequest = EvaluateRequest; +type models$7_EvaluateResponse = EvaluateResponse; +type models$7_SearchEligiblePostsResponse = SearchEligiblePostsResponse; +type models$7_SearchWrittenResponse = SearchWrittenResponse; +declare namespace models$7 { export { - GetByIdResponse$1 as GetByIdResponse, - models$8_SearchResponse as SearchResponse, + CreateRequest$1 as CreateRequest, + CreateResponse$1 as CreateResponse, + DeleteResponse$1 as DeleteResponse, + models$7_EvaluateRequest as EvaluateRequest, + models$7_EvaluateResponse as EvaluateResponse, + models$7_SearchEligiblePostsResponse as SearchEligiblePostsResponse, + models$7_SearchWrittenResponse as SearchWrittenResponse, }; } /** - * communities client for the X API. + * community notes client for the X API. * - * This module provides a client for interacting with the communities endpoints of the X API. + * This module provides a client for interacting with the community notes endpoints of the X API. */ /** - * Options for getById method + * Options for evaluate method * * @public */ -interface GetByIdOptions$1 { - /** A comma separated list of Community fields to display. - * Also accepts: community.fields or proper camelCase (e.g., communityFields) */ - communityFields?: Array; +interface EvaluateOptions { + /** Request body */ + body?: EvaluateRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for search method + * Options for searchWritten method * * @public */ -interface SearchOptions { - /** The maximum number of search results to be returned by a request. +interface SearchWrittenOptions { + /** Pagination token to get next set of posts eligible for notes. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: string; + /** Max results to return. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Community fields to display. - * Also accepts: community.fields or proper camelCase (e.g., communityFields) */ - communityFields?: Array; + /** A comma separated list of Note fields to display. + * Also accepts: note.fields or proper camelCase (e.g., noteFields) */ + noteFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for communities operations - * - * This client provides methods for interacting with the communities endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all communities related operations. + * Options for create method * - * @category communities + * @public */ -declare class CommunitiesClient { - private client; - /** - * Creates a new communities client instance - * - * @param client - The main X API client instance - */ +interface CreateOptions$1 { + /** Request body */ + body?: CreateRequest$1; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for searchEligiblePosts method + * + * @public + */ +interface SearchEligiblePostsOptions { + /** Pagination token to get next set of posts eligible for notes. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: string; + /** Max results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. + * Also accepts: post_selection or proper camelCase (e.g., postSelection) */ + postSelection?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for community notes operations + * + * This client provides methods for interacting with the community notes endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all community notes related operations. + * + * @category community notes + */ +declare class CommunityNotesClient { + private client; + /** + * Creates a new community notes client instance + * + * @param client - The main X API client instance + */ constructor(client: Client); /** * Normalize options object to handle both camelCase and original API parameter names @@ -7912,70 +7256,97 @@ declare class CommunitiesClient { */ private _normalizeOptions; /** - * Get Community by ID - * Retrieves details of a specific Community by its ID. + * Delete a Community Note + * Deletes a community note. - * @param id The ID of the Community. + * @param id The community note id to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getById(id: string, options?: GetByIdOptions$1): Promise; + delete(id: string): Promise; /** - * Search Communities - * Retrieves a list of Communities matching the specified search query. + * Evaluate a Community Note + * Endpoint to evaluate a community note. - * @param query Query to search communities. + * @returns {Promise} Promise resolving to the API response + */ + evaluate(options?: EvaluateOptions): Promise; + /** + * Search for Community Notes Written + * Returns all the community notes written by the user. - * @returns {Promise} Promise resolving to the API response + * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. + + + + * @returns {Promise} Promise resolving to the API response */ - search(query: string, options?: SearchOptions): Promise; + searchWritten(testMode: boolean, options?: SearchWrittenOptions): Promise; + /** + * Create a Community Note + * Creates a community note endpoint for LLM use case. + + + + * @returns {Promise} Promise resolving to the API response + */ + create(options?: CreateOptions$1): Promise; + /** + * Search for Posts Eligible for Community Notes + * Returns all the posts that are eligible for community notes. + + + + * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. + + + + * @returns {Promise} Promise resolving to the API response + */ + searchEligiblePosts(testMode: boolean, options?: SearchEligiblePostsOptions): Promise; } /** - * Models for connections operations - */ - -/** - * Response for deleteAll + * Response for getOpenApiSpec * * @public */ -type DeleteAllResponse = KillAllConnectionsResponse; +type GetOpenApiSpecResponse = Record; -type models$7_DeleteAllResponse = DeleteAllResponse; -declare namespace models$7 { +type models$6_GetOpenApiSpecResponse = GetOpenApiSpecResponse; +declare namespace models$6 { export { - models$7_DeleteAllResponse as DeleteAllResponse, + models$6_GetOpenApiSpecResponse as GetOpenApiSpecResponse, }; } /** - * connections client for the X API. + * general client for the X API. * - * This module provides a client for interacting with the connections endpoints of the X API. + * This module provides a client for interacting with the general endpoints of the X API. */ /** - * Client for connections operations + * Client for general operations * - * This client provides methods for interacting with the connections endpoints + * This client provides methods for interacting with the general endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all connections related operations. + * parsing for all general related operations. * - * @category connections + * @category general */ -declare class ConnectionsClient { +declare class GeneralClient { private client; /** - * Creates a new connections client instance + * Creates a new general client instance * * @param client - The main X API client instance */ @@ -7986,315 +7357,164 @@ declare class ConnectionsClient { */ private _normalizeOptions; /** - * Terminate all connections - * Terminates all active streaming connections for the authenticated application. + * Get OpenAPI Spec. + * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - deleteAll(): Promise; + getOpenApiSpec(): Promise; } /** - * Models for media operations + * Models for webhooks operations */ /** - * Response for getAnalytics - * - * @public - */ -type GetAnalyticsResponse = MediaAnalytics; -/** - * Request for createSubtitles - * - * @public - */ -type CreateSubtitlesRequest = SubtitlesCreateRequest; -/** - * Response for createSubtitles - * - * @public - */ -type CreateSubtitlesResponse = SubtitlesCreateResponse; -/** - * Request for deleteSubtitles - * - * @public - */ -type DeleteSubtitlesRequest = SubtitlesDeleteRequest; -/** - * Response for deleteSubtitles - * - * @public - */ -type DeleteSubtitlesResponse = SubtitlesDeleteResponse; -/** - * Request for initializeUpload - * - * @public - */ -type InitializeUploadRequest = MediaUploadConfigRequest; -/** - * Response for initializeUpload - * - * @public - */ -type InitializeUploadResponse = MediaUploadResponse; -/** - * Response for getUploadStatus - * - * @public - */ -type GetUploadStatusResponse = MediaUploadResponse; -/** - * Request for upload - * - * @public - */ -type UploadRequest = MediaUploadRequestOneShot; -/** - * Response for upload + * Response for get * * @public */ -type UploadResponse = MediaUploadResponse; +type GetResponse$1 = Get2WebhooksResponse; /** - * Response for getByKey + * Request for create * * @public */ -type GetByKeyResponse = Get2MediaMediaKeyResponse; +type CreateRequest = WebhookConfigCreateRequest; /** - * Request for appendUpload + * Response for create * * @public */ -type AppendUploadRequest = MediaUploadAppendRequest; +type CreateResponse = WebhookConfigCreateResponse; /** - * Response for appendUpload + * Response for validate * * @public */ -type AppendUploadResponse = MediaUploadAppendResponse; +type ValidateResponse = WebhookConfigPutResponse; /** - * Response for getByKeys + * Response for delete * * @public */ -type GetByKeysResponse = Get2MediaResponse; +type DeleteResponse = WebhookConfigDeleteResponse; /** - * Response for finalizeUpload + * Response for createStreamLink * * @public */ -type FinalizeUploadResponse = MediaUploadResponse; +type CreateStreamLinkResponse = WebhookLinksCreateResponse; /** - * Request for createMetadata + * Response for deleteStreamLink * * @public */ -type CreateMetadataRequest = MetadataCreateRequest; +type DeleteStreamLinkResponse = WebhookLinksDeleteResponse; /** - * Response for createMetadata + * Response for getStreamLinks * * @public */ -type CreateMetadataResponse = MetadataCreateResponse; +type GetStreamLinksResponse = WebhookLinksGetResponse; -type models$6_AppendUploadRequest = AppendUploadRequest; -type models$6_AppendUploadResponse = AppendUploadResponse; -type models$6_CreateMetadataRequest = CreateMetadataRequest; -type models$6_CreateMetadataResponse = CreateMetadataResponse; -type models$6_CreateSubtitlesRequest = CreateSubtitlesRequest; -type models$6_CreateSubtitlesResponse = CreateSubtitlesResponse; -type models$6_DeleteSubtitlesRequest = DeleteSubtitlesRequest; -type models$6_DeleteSubtitlesResponse = DeleteSubtitlesResponse; -type models$6_FinalizeUploadResponse = FinalizeUploadResponse; -type models$6_GetAnalyticsResponse = GetAnalyticsResponse; -type models$6_GetByKeyResponse = GetByKeyResponse; -type models$6_GetByKeysResponse = GetByKeysResponse; -type models$6_GetUploadStatusResponse = GetUploadStatusResponse; -type models$6_InitializeUploadRequest = InitializeUploadRequest; -type models$6_InitializeUploadResponse = InitializeUploadResponse; -type models$6_UploadRequest = UploadRequest; -type models$6_UploadResponse = UploadResponse; -declare namespace models$6 { +type models$5_CreateRequest = CreateRequest; +type models$5_CreateResponse = CreateResponse; +type models$5_CreateStreamLinkResponse = CreateStreamLinkResponse; +type models$5_DeleteResponse = DeleteResponse; +type models$5_DeleteStreamLinkResponse = DeleteStreamLinkResponse; +type models$5_GetStreamLinksResponse = GetStreamLinksResponse; +type models$5_ValidateResponse = ValidateResponse; +declare namespace models$5 { export { - models$6_AppendUploadRequest as AppendUploadRequest, - models$6_AppendUploadResponse as AppendUploadResponse, - models$6_CreateMetadataRequest as CreateMetadataRequest, - models$6_CreateMetadataResponse as CreateMetadataResponse, - models$6_CreateSubtitlesRequest as CreateSubtitlesRequest, - models$6_CreateSubtitlesResponse as CreateSubtitlesResponse, - models$6_DeleteSubtitlesRequest as DeleteSubtitlesRequest, - models$6_DeleteSubtitlesResponse as DeleteSubtitlesResponse, - models$6_FinalizeUploadResponse as FinalizeUploadResponse, - models$6_GetAnalyticsResponse as GetAnalyticsResponse, - models$6_GetByKeyResponse as GetByKeyResponse, - models$6_GetByKeysResponse as GetByKeysResponse, - models$6_GetUploadStatusResponse as GetUploadStatusResponse, - models$6_InitializeUploadRequest as InitializeUploadRequest, - models$6_InitializeUploadResponse as InitializeUploadResponse, - models$6_UploadRequest as UploadRequest, - models$6_UploadResponse as UploadResponse, + models$5_CreateRequest as CreateRequest, + models$5_CreateResponse as CreateResponse, + models$5_CreateStreamLinkResponse as CreateStreamLinkResponse, + models$5_DeleteResponse as DeleteResponse, + models$5_DeleteStreamLinkResponse as DeleteStreamLinkResponse, + GetResponse$1 as GetResponse, + models$5_GetStreamLinksResponse as GetStreamLinksResponse, + models$5_ValidateResponse as ValidateResponse, }; } /** - * media client for the X API. + * webhooks client for the X API. * - * This module provides a client for interacting with the media endpoints of the X API. + * This module provides a client for interacting with the webhooks endpoints of the X API. */ /** - * Options for getAnalytics method + * Options for get method * * @public */ -interface GetAnalyticsOptions { - /** A comma separated list of MediaAnalytics fields to display. - * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */ - mediaAnalyticsFields?: Array; +interface GetOptions$1 { + /** A comma separated list of WebhookConfig fields to display. + * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */ + webhookConfigFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for createSubtitles method + * Options for create method * * @public */ -interface CreateSubtitlesOptions { +interface CreateOptions { /** Request body */ - body?: CreateSubtitlesRequest; + body?: CreateRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for deleteSubtitles method - * - * @public - */ -interface DeleteSubtitlesOptions { - /** Request body */ - body?: DeleteSubtitlesRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for initializeUpload method - * - * @public - */ -interface InitializeUploadOptions { - /** Request body */ - body?: InitializeUploadRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getUploadStatus method - * - * @public - */ -interface GetUploadStatusOptions { - /** The command for the media upload request. - * Also accepts: command or proper camelCase (e.g., command) */ - command?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for upload method - * - * @public - */ -interface UploadOptions { - /** Request body */ - body?: UploadRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByKey method - * - * @public - */ -interface GetByKeyOptions { - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for appendUpload method - * - * @public - */ -interface AppendUploadOptions { - /** Request body */ - body?: AppendUploadRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByKeys method + * Options for createStreamLink method * * @public */ -interface GetByKeysOptions { +interface CreateStreamLinkOptions { + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: string; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: string; /** A comma separated list of Media fields to display. * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for createMetadata method - * - * @public - */ -interface CreateMetadataOptions { - /** Request body */ - body?: CreateMetadataRequest; + mediaFields?: string; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: string; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: string; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: string; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for media operations + * Client for webhooks operations * - * This client provides methods for interacting with the media endpoints + * This client provides methods for interacting with the webhooks endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all media related operations. + * parsing for all webhooks related operations. * - * @category media + * @category webhooks */ -declare class MediaClient { +declare class WebhooksClient { private client; /** - * Creates a new media client instance + * Creates a new webhooks client instance * * @param client - The main X API client instance */ @@ -8305,829 +7525,1745 @@ declare class MediaClient { */ private _normalizeOptions; /** - * Get Media analytics - * Retrieves analytics data for media. - - - - * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - - - - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - - - - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - - - - * @param granularity The granularity for the search counts results. - - - - * @returns {Promise} Promise resolving to the API response - */ - getAnalytics(mediaKeys: Array, endTime: string, startTime: string, granularity: string, options?: GetAnalyticsOptions): Promise; - /** - * Create Media subtitles - * Creates subtitles for a specific Media file. - - - - * @returns {Promise} Promise resolving to the API response - */ - createSubtitles(options?: CreateSubtitlesOptions): Promise; - /** - * Delete Media subtitles - * Deletes subtitles for a specific Media file. - - - - * @returns {Promise} Promise resolving to the API response - */ - deleteSubtitles(options?: DeleteSubtitlesOptions): Promise; - /** - * Initialize media upload - * Initializes a media upload. - - - - * @returns {Promise} Promise resolving to the API response - */ - initializeUpload(options?: InitializeUploadOptions): Promise; - /** - * Get Media upload status - * Retrieves the status of a Media upload by its ID. - - - - * @param mediaId Media id for the requested media upload status. + * Get webhook + * Get a list of webhook configs associated with a client app. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getUploadStatus(mediaId: any, options?: GetUploadStatusOptions): Promise; + get(options?: GetOptions$1): Promise; /** - * Upload media - * Uploads a media file for use in posts or other content. + * Create webhook + * Creates a new webhook configuration. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - upload(options?: UploadOptions): Promise; + create(options?: CreateOptions): Promise; /** - * Get Media by media key - * Retrieves details of a specific Media file by its media key. + * Validate webhook + * Triggers a CRC check for a given webhook. - * @param mediaKey A single Media Key. + * @param webhookId The ID of the webhook to check. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByKey(mediaKey: string, options?: GetByKeyOptions): Promise; + validate(webhookId: string): Promise; /** - * Append Media upload - * Appends data to a Media upload request. + * Delete webhook + * Deletes an existing webhook configuration. - * @param id The media identifier for the media to perform the append operation. + * @param webhookId The ID of the webhook to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - appendUpload(id: string, options?: AppendUploadOptions): Promise; + delete(webhookId: string): Promise; /** - * Get Media by media keys - * Retrieves details of Media files by their media keys. + * Create stream link + * Creates a link to deliver FilteredStream events to the given webhook. + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByKeys(mediaKeys: Array, options?: GetByKeysOptions): Promise; + createStreamLink(webhookId: string, options?: CreateStreamLinkOptions): Promise; /** - * Finalize Media upload - * Finalizes a Media upload request. + * Delete stream link + * Deletes a link from FilteredStream events to the given webhook. - * @param id The media id of the targeted media to finalize. + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - finalizeUpload(id: string): Promise; + deleteStreamLink(webhookId: string): Promise; /** - * Create Media metadata - * Creates metadata for a Media file. + * Get stream links + * Get a list of webhook links associated with a filtered stream ruleset. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createMetadata(options?: CreateMetadataOptions): Promise; + getStreamLinks(): Promise; } /** - * Models for lists operations + * Models for users operations */ /** - * Response for removeMemberByUserId + * Response for getByUsernames * * @public */ -type RemoveMemberByUserIdResponse = ListMutateResponse; +type GetByUsernamesResponse = Get2UsersByResponse; /** - * Response for getById + * Response for getListMemberships * * @public */ -type GetByIdResponse = Get2ListsIdResponse; +type GetListMembershipsResponse = Get2UsersIdListMembershipsResponse; /** - * Request for update + * Response for unfollowUser * * @public */ -type UpdateRequest = ListUpdateRequest; +type UnfollowUserResponse = UsersFollowingDeleteResponse; /** - * Response for update + * Response for unfollowList * * @public */ -type UpdateResponse = ListUpdateResponse; +type UnfollowListResponse = ListFollowedResponse; /** - * Response for delete + * Response for getByIds * * @public */ -type DeleteResponse$1 = ListDeleteResponse; +type GetByIdsResponse = Get2UsersResponse; /** - * Response for getMembers + * Request for likePost * * @public */ -type GetMembersResponse = Get2ListsIdMembersResponse; +type LikePostRequest = UsersLikesCreateRequest; /** - * Request for addMember + * Response for likePost * * @public */ -type AddMemberRequest = ListAddUserRequest; +type LikePostResponse = UsersLikesCreateResponse; /** - * Response for addMember + * Response for blockDms * * @public */ -type AddMemberResponse = ListMutateResponse; +type BlockDmsResponse = UsersDMBlockCreateResponse; /** - * Response for getFollowers + * Response for getPosts * * @public */ -type GetFollowersResponse = Get2ListsIdFollowersResponse; +type GetPostsResponse = Get2UsersIdTweetsResponse; /** - * Response for getPosts + * Response for getBookmarksByFolderId * * @public */ -type GetPostsResponse = Get2ListsIdTweetsResponse; +type GetBookmarksByFolderIdResponse = BookmarkFolderPostsResponse; /** - * Request for create + * Response for getMuting * * @public */ -type CreateRequest$1 = ListCreateRequest; +type GetMutingResponse = Get2UsersIdMutingResponse; + /** - * Response for create + * Response for muteUser * * @public */ -type CreateResponse$1 = ListCreateResponse; - -type models$5_AddMemberRequest = AddMemberRequest; -type models$5_AddMemberResponse = AddMemberResponse; -type models$5_GetByIdResponse = GetByIdResponse; -type models$5_GetFollowersResponse = GetFollowersResponse; -type models$5_GetMembersResponse = GetMembersResponse; -type models$5_GetPostsResponse = GetPostsResponse; -type models$5_RemoveMemberByUserIdResponse = RemoveMemberByUserIdResponse; -type models$5_UpdateRequest = UpdateRequest; -type models$5_UpdateResponse = UpdateResponse; -declare namespace models$5 { - export { - models$5_AddMemberRequest as AddMemberRequest, - models$5_AddMemberResponse as AddMemberResponse, - CreateRequest$1 as CreateRequest, - CreateResponse$1 as CreateResponse, - DeleteResponse$1 as DeleteResponse, - models$5_GetByIdResponse as GetByIdResponse, - models$5_GetFollowersResponse as GetFollowersResponse, - models$5_GetMembersResponse as GetMembersResponse, - models$5_GetPostsResponse as GetPostsResponse, - models$5_RemoveMemberByUserIdResponse as RemoveMemberByUserIdResponse, - models$5_UpdateRequest as UpdateRequest, - models$5_UpdateResponse as UpdateResponse, - }; -} - +type MuteUserResponse = MuteUserMutationResponse; /** - * lists client for the X API. + * Response for getOwnedLists * - * This module provides a client for interacting with the lists endpoints of the X API. + * @public */ - +type GetOwnedListsResponse = Get2UsersIdOwnedListsResponse; /** - * Options for getById method + * Response for unpinList * * @public */ -interface GetByIdOptions { - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type UnpinListResponse = ListUnpinResponse; /** - * Options for update method + * Response for getByUsername * * @public */ -interface UpdateOptions { - /** Request body */ - body?: UpdateRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetByUsernameResponse = Get2UsersByUsernameUsernameResponse; /** - * Options for getMembers method + * Response for getBlocking * * @public */ -interface GetMembersOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetBlockingResponse = Get2UsersIdBlockingResponse; /** - * Options for addMember method + * Response for getLikedPosts * * @public */ -interface AddMemberOptions { - /** Request body */ - body?: AddMemberRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetLikedPostsResponse = Get2UsersIdLikedTweetsResponse; /** - * Options for getFollowers method + * Response for unlikePost * * @public */ -interface GetFollowersOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type UnlikePostResponse = UsersLikesDeleteResponse; /** - * Options for getPosts method + * Response for getFollowedLists * * @public */ -interface GetPostsOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetFollowedListsResponse = Get2UsersIdFollowedListsResponse; /** - * Options for create method + * Request for followList * * @public */ -interface CreateOptions$1 { - /** Request body */ - body?: CreateRequest$1; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type FollowListRequest = ListFollowedRequest; /** - * Client for lists operations + * Response for followList * - * This client provides methods for interacting with the lists endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all lists related operations. + * @public + */ +type FollowListResponse = ListFollowedResponse; +/** + * Response for getTimeline * - * @category lists + * @public */ -declare class ListsClient { - private client; - /** - * Creates a new lists client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); +type GetTimelineResponse = Get2UsersIdTimelinesReverseChronologicalResponse; +/** + * Response for getPinnedLists + * + * @public + */ +type GetPinnedListsResponse = Get2UsersIdPinnedListsResponse; +/** + * Request for pinList + * + * @public + */ +type PinListRequest = ListPinnedRequest; +/** + * Response for pinList + * + * @public + */ +type PinListResponse = ListPinnedResponse; +/** + * Response for getRepostsOfMe + * + * @public + */ +type GetRepostsOfMeResponse = Get2UsersRepostsOfMeResponse; +/** + * Response for getFollowing + * + * @public + */ +type GetFollowingResponse = Get2UsersIdFollowingResponse; +/** + * Request for followUser + * + * @public + */ +type FollowUserRequest = UsersFollowingCreateRequest; +/** + * Response for followUser + * + * @public + */ +type FollowUserResponse = UsersFollowingCreateResponse; +/** + * Response for unblockDms + * + * @public + */ +type UnblockDmsResponse = UsersDMUnBlockCreateResponse; +/** + * Response for getMentions + * + * @public + */ +type GetMentionsResponse = Get2UsersIdMentionsResponse; +/** + * Response for getBookmarkFolders + * + * @public + */ +type GetBookmarkFoldersResponse = BookmarkFoldersResponse; +/** + * Response for unrepostPost + * + * @public + */ +type UnrepostPostResponse = UsersRetweetsDeleteResponse; +/** + * Response for deleteBookmark + * + * @public + */ +type DeleteBookmarkResponse = BookmarkMutationResponse; +/** + * Request for repostPost + * + * @public + */ +type RepostPostRequest = UsersRetweetsCreateRequest; +/** + * Response for repostPost + * + * @public + */ +type RepostPostResponse = UsersRetweetsCreateResponse; +/** + * Response for search + * + * @public + */ +type SearchResponse$1 = Get2UsersSearchResponse; +/** + * Response for getById + * + * @public + */ +type GetByIdResponse$1 = Get2UsersIdResponse; +/** + * Response for getBookmarks + * + * @public + */ +type GetBookmarksResponse = Get2UsersIdBookmarksResponse; +/** + * Request for createBookmark + * + * @public + */ +type CreateBookmarkRequest = BookmarkAddRequest; +/** + * Response for createBookmark + * + * @public + */ +type CreateBookmarkResponse = BookmarkMutationResponse; +/** + * Response for getFollowers + * + * @public + */ +type GetFollowersResponse = Get2UsersIdFollowersResponse; +/** + * Response for getMe + * + * @public + */ +type GetMeResponse = Get2UsersMeResponse; +/** + * Response for unmuteUser + * + * @public + */ +type UnmuteUserResponse = MuteUserMutationResponse; + +type models$4_BlockDmsResponse = BlockDmsResponse; +type models$4_CreateBookmarkRequest = CreateBookmarkRequest; +type models$4_CreateBookmarkResponse = CreateBookmarkResponse; +type models$4_DeleteBookmarkResponse = DeleteBookmarkResponse; +type models$4_FollowListRequest = FollowListRequest; +type models$4_FollowListResponse = FollowListResponse; +type models$4_FollowUserRequest = FollowUserRequest; +type models$4_FollowUserResponse = FollowUserResponse; +type models$4_GetBlockingResponse = GetBlockingResponse; +type models$4_GetBookmarkFoldersResponse = GetBookmarkFoldersResponse; +type models$4_GetBookmarksByFolderIdResponse = GetBookmarksByFolderIdResponse; +type models$4_GetBookmarksResponse = GetBookmarksResponse; +type models$4_GetByIdsResponse = GetByIdsResponse; +type models$4_GetByUsernameResponse = GetByUsernameResponse; +type models$4_GetByUsernamesResponse = GetByUsernamesResponse; +type models$4_GetFollowedListsResponse = GetFollowedListsResponse; +type models$4_GetFollowersResponse = GetFollowersResponse; +type models$4_GetFollowingResponse = GetFollowingResponse; +type models$4_GetLikedPostsResponse = GetLikedPostsResponse; +type models$4_GetListMembershipsResponse = GetListMembershipsResponse; +type models$4_GetMeResponse = GetMeResponse; +type models$4_GetMentionsResponse = GetMentionsResponse; +type models$4_GetMutingResponse = GetMutingResponse; +type models$4_GetOwnedListsResponse = GetOwnedListsResponse; +type models$4_GetPinnedListsResponse = GetPinnedListsResponse; +type models$4_GetPostsResponse = GetPostsResponse; +type models$4_GetRepostsOfMeResponse = GetRepostsOfMeResponse; +type models$4_GetTimelineResponse = GetTimelineResponse; +type models$4_LikePostRequest = LikePostRequest; +type models$4_LikePostResponse = LikePostResponse; +type models$4_MuteUserRequest = MuteUserRequest; +type models$4_MuteUserResponse = MuteUserResponse; +type models$4_PinListRequest = PinListRequest; +type models$4_PinListResponse = PinListResponse; +type models$4_RepostPostRequest = RepostPostRequest; +type models$4_RepostPostResponse = RepostPostResponse; +type models$4_UnblockDmsResponse = UnblockDmsResponse; +type models$4_UnfollowListResponse = UnfollowListResponse; +type models$4_UnfollowUserResponse = UnfollowUserResponse; +type models$4_UnlikePostResponse = UnlikePostResponse; +type models$4_UnmuteUserResponse = UnmuteUserResponse; +type models$4_UnpinListResponse = UnpinListResponse; +type models$4_UnrepostPostResponse = UnrepostPostResponse; +declare namespace models$4 { + export { + models$4_BlockDmsResponse as BlockDmsResponse, + models$4_CreateBookmarkRequest as CreateBookmarkRequest, + models$4_CreateBookmarkResponse as CreateBookmarkResponse, + models$4_DeleteBookmarkResponse as DeleteBookmarkResponse, + models$4_FollowListRequest as FollowListRequest, + models$4_FollowListResponse as FollowListResponse, + models$4_FollowUserRequest as FollowUserRequest, + models$4_FollowUserResponse as FollowUserResponse, + models$4_GetBlockingResponse as GetBlockingResponse, + models$4_GetBookmarkFoldersResponse as GetBookmarkFoldersResponse, + models$4_GetBookmarksByFolderIdResponse as GetBookmarksByFolderIdResponse, + models$4_GetBookmarksResponse as GetBookmarksResponse, + GetByIdResponse$1 as GetByIdResponse, + models$4_GetByIdsResponse as GetByIdsResponse, + models$4_GetByUsernameResponse as GetByUsernameResponse, + models$4_GetByUsernamesResponse as GetByUsernamesResponse, + models$4_GetFollowedListsResponse as GetFollowedListsResponse, + models$4_GetFollowersResponse as GetFollowersResponse, + models$4_GetFollowingResponse as GetFollowingResponse, + models$4_GetLikedPostsResponse as GetLikedPostsResponse, + models$4_GetListMembershipsResponse as GetListMembershipsResponse, + models$4_GetMeResponse as GetMeResponse, + models$4_GetMentionsResponse as GetMentionsResponse, + models$4_GetMutingResponse as GetMutingResponse, + models$4_GetOwnedListsResponse as GetOwnedListsResponse, + models$4_GetPinnedListsResponse as GetPinnedListsResponse, + models$4_GetPostsResponse as GetPostsResponse, + models$4_GetRepostsOfMeResponse as GetRepostsOfMeResponse, + models$4_GetTimelineResponse as GetTimelineResponse, + models$4_LikePostRequest as LikePostRequest, + models$4_LikePostResponse as LikePostResponse, + models$4_MuteUserRequest as MuteUserRequest, + models$4_MuteUserResponse as MuteUserResponse, + models$4_PinListRequest as PinListRequest, + models$4_PinListResponse as PinListResponse, + models$4_RepostPostRequest as RepostPostRequest, + models$4_RepostPostResponse as RepostPostResponse, + SearchResponse$1 as SearchResponse, + models$4_UnblockDmsResponse as UnblockDmsResponse, + models$4_UnfollowListResponse as UnfollowListResponse, + models$4_UnfollowUserResponse as UnfollowUserResponse, + models$4_UnlikePostResponse as UnlikePostResponse, + models$4_UnmuteUserResponse as UnmuteUserResponse, + models$4_UnpinListResponse as UnpinListResponse, + models$4_UnrepostPostResponse as UnrepostPostResponse, + }; +} + +/** + * users client for the X API. + * + * This module provides a client for interacting with the users endpoints of the X API. + */ + +/** + * Options for getByUsernames method + * + * @public + */ +interface GetByUsernamesOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getListMemberships method + * + * @public + */ +interface GetListMembershipsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getByIds method + * + * @public + */ +interface GetByIdsOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for likePost method + * + * @public + */ +interface LikePostOptions { + /** Request body */ + body?: LikePostRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getPosts method + * + * @public + */ +interface GetPostsOptions { + /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** The set of entities to exclude (e.g. 'replies' or 'retweets'). + * Also accepts: exclude or proper camelCase (e.g., exclude) */ + exclude?: Array; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getMuting method + * + * @public + */ +interface GetMutingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for muteUser method + * + * @public + */ +interface MuteUserOptions { + /** Request body */ + body?: MuteUserRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getOwnedLists method + * + * @public + */ +interface GetOwnedListsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getByUsername method + * + * @public + */ +interface GetByUsernameOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getBlocking method + * + * @public + */ +interface GetBlockingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getLikedPosts method + * + * @public + */ +interface GetLikedPostsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getFollowedLists method + * + * @public + */ +interface GetFollowedListsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for followList method + * + * @public + */ +interface FollowListOptions { + /** Request body */ + body?: FollowListRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getTimeline method + * + * @public + */ +interface GetTimelineOptions { + /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** The set of entities to exclude (e.g. 'replies' or 'retweets'). + * Also accepts: exclude or proper camelCase (e.g., exclude) */ + exclude?: Array; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getPinnedLists method + * + * @public + */ +interface GetPinnedListsOptions { + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getRepostsOfMe method + * + * @public + */ +interface GetRepostsOfMeOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getFollowing method + * + * @public + */ +interface GetFollowingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for followUser method + * + * @public + */ +interface FollowUserOptions { + /** Request body */ + body?: FollowUserRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getMentions method + * + * @public + */ +interface GetMentionsOptions { + /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getBookmarkFolders method + * + * @public + */ +interface GetBookmarkFoldersOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for repostPost method + * + * @public + */ +interface RepostPostOptions { + /** Request body */ + body?: RepostPostRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for search method + * + * @public + */ +interface SearchOptions$1 { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getById method + * + * @public + */ +interface GetByIdOptions$1 { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getBookmarks method + * + * @public + */ +interface GetBookmarksOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getFollowers method + * + * @public + */ +interface GetFollowersOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getMe method + * + * @public + */ +interface GetMeOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for users operations + * + * This client provides methods for interacting with the users endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all users related operations. + * + * @category users + */ +declare class UsersClient { + private client; + /** + * Creates a new users client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get Users by usernames + * Retrieves details of multiple Users by their usernames. + + + + * @param usernames A list of usernames, comma-separated. + + + + * @returns {Promise} Promise resolving to the API response + */ + getByUsernames(usernames: Array, options?: GetByUsernamesOptions): Promise; + /** + * Get List memberships + * Retrieves a list of Lists that a specific User is a member of by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getListMemberships(id: string, options?: GetListMembershipsOptions): Promise; + /** + * Unfollow User + * Causes the authenticated user to unfollow a specific user by their ID. + + + * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. + + + + * @param targetUserId The ID of the User that the source User is requesting to unfollow. + + + + + * @returns {Promise} Promise resolving to the API response + */ + unfollowUser(sourceUserId: string, targetUserId: string): Promise; + /** + * Unfollow List + * Causes the authenticated user to unfollow a specific List by its ID. + + + * @param id The ID of the authenticated source User that will unfollow the List. + + + + * @param listId The ID of the List to unfollow. + + + + + * @returns {Promise} Promise resolving to the API response + */ + unfollowList(id: string, listId: string): Promise; + /** + * Get Users by IDs + * Retrieves details of multiple Users by their IDs. + + + + * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. + + + + * @returns {Promise} Promise resolving to the API response + */ + getByIds(ids: Array, options?: GetByIdsOptions): Promise; + /** + * Like Post + * Causes the authenticated user to Like a specific Post by its ID. + + + * @param id The ID of the authenticated source User that is requesting to like the Post. + + + + + * @returns {Promise} Promise resolving to the API response + */ + likePost(id: string, options?: LikePostOptions): Promise; + /** + * Block DMs + * Blocks direct messages to or from a specific User by their ID for the authenticated user. + + + * @param id The ID of the target User that the authenticated user requesting to block dms for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + blockDms(id: string): Promise; + /** + * Get Posts + * Retrieves a list of posts authored by a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getPosts(id: string, options?: GetPostsOptions): Promise; + /** + * Get Bookmarks by folder ID + * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getBookmarksByFolderId(id: string, folderId: string): Promise; + /** + * Get muting + * Retrieves a list of Users muted by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getMuting(id: string, options?: GetMutingOptions): Promise; + /** + * Mute User + * Causes the authenticated user to mute a specific User by their ID. + + + * @param id The ID of the authenticated source User that is requesting to mute the target User. + + + + + * @returns {Promise} Promise resolving to the API response + */ + muteUser(id: string, options?: MuteUserOptions): Promise; + /** + * Get owned Lists + * Retrieves a list of Lists owned by a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getOwnedLists(id: string, options?: GetOwnedListsOptions): Promise; + /** + * Unpin List + * Causes the authenticated user to unpin a specific List by its ID. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + * @param listId The ID of the List to unpin. + + + + + * @returns {Promise} Promise resolving to the API response + */ + unpinList(id: string, listId: string): Promise; + /** + * Get User by username + * Retrieves details of a specific User by their username. + + + * @param username A username. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getByUsername(username: string, options?: GetByUsernameOptions): Promise; + /** + * Get blocking + * Retrieves a list of Users blocked by the specified User ID. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getBlocking(id: string, options?: GetBlockingOptions): Promise; + /** + * Get liked Posts + * Retrieves a list of Posts liked by a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getLikedPosts(id: string, options?: GetLikedPostsOptions): Promise; + /** + * Unlike Post + * Causes the authenticated user to Unlike a specific Post by its ID. + + + * @param id The ID of the authenticated source User that is requesting to unlike the Post. + + + + * @param tweetId The ID of the Post that the User is requesting to unlike. + + + + + * @returns {Promise} Promise resolving to the API response + */ + unlikePost(id: string, tweetId: string): Promise; + /** + * Get followed Lists + * Retrieves a list of Lists followed by a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getFollowedLists(id: string, options?: GetFollowedListsOptions): Promise; + /** + * Follow List + * Causes the authenticated user to follow a specific List by its ID. + + + * @param id The ID of the authenticated source User that will follow the List. + + + + + * @returns {Promise} Promise resolving to the API response + */ + followList(id: string, options?: FollowListOptions): Promise; + /** + * Get Timeline + * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. + + + * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getTimeline(id: string, options?: GetTimelineOptions): Promise; + /** + * Get pinned Lists + * Retrieves a list of Lists pinned by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getPinnedLists(id: string, options?: GetPinnedListsOptions): Promise; /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; + * Pin List + * Causes the authenticated user to pin a specific List by its ID. + + + * @param id The ID of the authenticated source User that will pin the List. + + + + + * @param body Request body + + * @returns {Promise} Promise resolving to the API response + */ + pinList(id: string, body: PinListRequest): Promise; /** - * Remove List member - * Removes a User from a specific List by its ID and the User’s ID. + * Get Reposts of me + * Retrieves a list of Posts that repost content from the authenticated user. - * @param id The ID of the List to remove a member. + * @returns {Promise} Promise resolving to the API response + */ + getRepostsOfMe(options?: GetRepostsOfMeOptions): Promise; + /** + * Get following + * Retrieves a list of Users followed by a specific User by their ID. - * @param userId The ID of User that will be removed from the List. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - removeMemberByUserId(id: string, userId: string): Promise; + getFollowing(id: string, options?: GetFollowingOptions): Promise; /** - * Get List by ID - * Retrieves details of a specific List by its ID. + * Follow User + * Causes the authenticated user to follow a specific user by their ID. - * @param id The ID of the List. + * @param id The ID of the authenticated source User that is requesting to follow the target User. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getById(id: string, options?: GetByIdOptions): Promise; + followUser(id: string, options?: FollowUserOptions): Promise; /** - * Update List - * Updates the details of a specific List owned by the authenticated user by its ID. + * Unblock DMs + * Unblocks direct messages to or from a specific User by their ID for the authenticated user. - * @param id The ID of the List to modify. + * @param id The ID of the target User that the authenticated user requesting to unblock dms for. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - update(id: string, options?: UpdateOptions): Promise; + unblockDms(id: string): Promise; /** - * Delete List - * Deletes a specific List owned by the authenticated user by its ID. + * Get mentions + * Retrieves a list of Posts that mention a specific User by their ID. - * @param id The ID of the List to delete. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - delete(id: string): Promise; + getMentions(id: string, options?: GetMentionsOptions): Promise; /** - * Get List members - * Retrieves a list of Users who are members of a specific List by its ID. + * Get Bookmark folders + * Retrieves a list of Bookmark folders created by the authenticated user. - * @param id The ID of the List. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getMembers(id: string, options?: GetMembersOptions): Promise; + getBookmarkFolders(id: string, options?: GetBookmarkFoldersOptions): Promise; /** - * Add List member - * Adds a User to a specific List by its ID. + * Unrepost Post + * Causes the authenticated user to unrepost a specific Post by its ID. - * @param id The ID of the List for which to add a member. + * @param id The ID of the authenticated source User that is requesting to repost the Post. + * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ - addMember(id: string, options?: AddMemberOptions): Promise; + unrepostPost(id: string, sourceTweetId: string): Promise; /** - * Get List followers - * Retrieves a list of Users who follow a specific List by its ID. + * Delete Bookmark + * Removes a Post from the authenticated user’s Bookmarks by its ID. - * @param id The ID of the List. + * @param id The ID of the authenticated source User whose bookmark is to be removed. + * @param tweetId The ID of the Post that the source User is removing from bookmarks. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ - getFollowers(id: string, options?: GetFollowersOptions): Promise; + deleteBookmark(id: string, tweetId: string): Promise; /** - * Get List Posts - * Retrieves a list of Posts associated with a specific List by its ID. + * Repost Post + * Causes the authenticated user to repost a specific Post by its ID. - * @param id The ID of the List. + * @param id The ID of the authenticated source User that is requesting to repost the Post. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getPosts(id: string, options?: GetPostsOptions): Promise; + repostPost(id: string, options?: RepostPostOptions): Promise; /** - * Create List - * Creates a new List for the authenticated user. + * Search Users + * Retrieves a list of Users matching a search query. - * @returns {Promise} Promise resolving to the API response + * @param query TThe the query string by which to query for users. + + + + * @returns {Promise} Promise resolving to the API response */ - create(options?: CreateOptions$1): Promise; -} - -/** - * Models for compliance operations - */ - -/** - * Response for getJobsById - * - * @public - */ -type GetJobsByIdResponse = Get2ComplianceJobsIdResponse; -/** - * Response for getJobs - * - * @public - */ -type GetJobsResponse = Get2ComplianceJobsResponse; -/** - * Request for createJobs - * - * @public - */ -type CreateJobsRequest = CreateComplianceJobRequest; -/** - * Response for createJobs - * - * @public - */ -type CreateJobsResponse = CreateComplianceJobResponse; - -type models$4_CreateJobsRequest = CreateJobsRequest; -type models$4_CreateJobsResponse = CreateJobsResponse; -type models$4_GetJobsByIdResponse = GetJobsByIdResponse; -type models$4_GetJobsResponse = GetJobsResponse; -declare namespace models$4 { - export { - models$4_CreateJobsRequest as CreateJobsRequest, - models$4_CreateJobsResponse as CreateJobsResponse, - models$4_GetJobsByIdResponse as GetJobsByIdResponse, - models$4_GetJobsResponse as GetJobsResponse, - }; -} - -/** - * compliance client for the X API. - * - * This module provides a client for interacting with the compliance endpoints of the X API. - */ - -/** - * Options for getJobsById method - * - * @public - */ -interface GetJobsByIdOptions { - /** A comma separated list of ComplianceJob fields to display. - * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ - complianceJobFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getJobs method - * - * @public - */ -interface GetJobsOptions { - /** Status of Compliance Job to list. - * Also accepts: status or proper camelCase (e.g., status) */ - status?: string; - /** A comma separated list of ComplianceJob fields to display. - * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ - complianceJobFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Client for compliance operations - * - * This client provides methods for interacting with the compliance endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all compliance related operations. - * - * @category compliance - */ -declare class ComplianceClient { - private client; + search(query: any, options?: SearchOptions$1): Promise; /** - * Creates a new compliance client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); + * Get User by ID + * Retrieves details of a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getById(id: string, options?: GetByIdOptions$1): Promise; /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; + * Get Bookmarks + * Retrieves a list of Posts bookmarked by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getBookmarks(id: string, options?: GetBookmarksOptions): Promise; /** - * Get Compliance Job by ID - * Retrieves details of a specific Compliance Job by its ID. + * Create Bookmark + * Adds a post to the authenticated user’s bookmarks. - * @param id The ID of the Compliance Job to retrieve. + * @param id The ID of the authenticated source User for whom to add bookmarks. - * @returns {Promise} Promise resolving to the API response + * @param body Request body + + * @returns {Promise} Promise resolving to the API response */ - getJobsById(id: string, options?: GetJobsByIdOptions): Promise; + createBookmark(id: string, body: CreateBookmarkRequest): Promise; /** - * Get Compliance Jobs - * Retrieves a list of Compliance Jobs filtered by job type and optional status. + * Get followers + * Retrieves a list of Users who follow a specific User by their ID. + * @param id The ID of the User to lookup. - * @param type Type of Compliance Job to list. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getJobs(type: string, options?: GetJobsOptions): Promise; + getFollowers(id: string, options?: GetFollowersOptions): Promise; /** - * Create Compliance Job - * Creates a new Compliance Job for the specified job type. - + * Get my User + * Retrieves details of the authenticated user. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createJobs(body: CreateJobsRequest): Promise; -} - -/** - * Response for getOpenApiSpec - * - * @public - */ -type GetOpenApiSpecResponse = Record; - -type models$3_GetOpenApiSpecResponse = GetOpenApiSpecResponse; -declare namespace models$3 { - export { - models$3_GetOpenApiSpecResponse as GetOpenApiSpecResponse, - }; -} - -/** - * general client for the X API. - * - * This module provides a client for interacting with the general endpoints of the X API. - */ - -/** - * Client for general operations - * - * This client provides methods for interacting with the general endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all general related operations. - * - * @category general - */ -declare class GeneralClient { - private client; - /** - * Creates a new general client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; + getMe(options?: GetMeOptions): Promise; /** - * Get OpenAPI Spec. - * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) + * Unmute User + * Causes the authenticated user to unmute a specific user by their ID. + * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. - * @returns {Promise} Promise resolving to the API response + + + * @param targetUserId The ID of the User that the source User is requesting to unmute. + + + + + * @returns {Promise} Promise resolving to the API response */ - getOpenApiSpec(): Promise; + unmuteUser(sourceUserId: string, targetUserId: string): Promise; } /** - * Models for account activity operations + * Models for communities operations */ /** - * Response for validateSubscription - * - * @public - */ -type ValidateSubscriptionResponse = SubscriptionsGetResponse; -/** - * Request for createSubscription - * - * @public - */ -type CreateSubscriptionRequest = SubscriptionsCreateRequest; -/** - * Response for createSubscription - * - * @public - */ -type CreateSubscriptionResponse = SubscriptionsCreateResponse; -/** - * Response for getSubscriptionCount - * - * @public - */ -type GetSubscriptionCountResponse = SubscriptionsCountGetResponse; -/** - * Response for getSubscriptions - * - * @public - */ -type GetSubscriptionsResponse = SubscriptionsListGetResponse; -/** - * Response for createReplayJob + * Response for getById * * @public */ -type CreateReplayJobResponse = ReplayJobCreateResponse; +type GetByIdResponse = Get2CommunitiesIdResponse; /** - * Response for deleteSubscription + * Response for search * * @public */ -type DeleteSubscriptionResponse = SubscriptionsDeleteResponse; +type SearchResponse = Get2CommunitiesSearchResponse; -type models$2_CreateReplayJobResponse = CreateReplayJobResponse; -type models$2_CreateSubscriptionRequest = CreateSubscriptionRequest; -type models$2_CreateSubscriptionResponse = CreateSubscriptionResponse; -type models$2_DeleteSubscriptionResponse = DeleteSubscriptionResponse; -type models$2_GetSubscriptionCountResponse = GetSubscriptionCountResponse; -type models$2_GetSubscriptionsResponse = GetSubscriptionsResponse; -type models$2_ValidateSubscriptionResponse = ValidateSubscriptionResponse; -declare namespace models$2 { +type models$3_GetByIdResponse = GetByIdResponse; +type models$3_SearchResponse = SearchResponse; +declare namespace models$3 { export { - models$2_CreateReplayJobResponse as CreateReplayJobResponse, - models$2_CreateSubscriptionRequest as CreateSubscriptionRequest, - models$2_CreateSubscriptionResponse as CreateSubscriptionResponse, - models$2_DeleteSubscriptionResponse as DeleteSubscriptionResponse, - models$2_GetSubscriptionCountResponse as GetSubscriptionCountResponse, - models$2_GetSubscriptionsResponse as GetSubscriptionsResponse, - models$2_ValidateSubscriptionResponse as ValidateSubscriptionResponse, + models$3_GetByIdResponse as GetByIdResponse, + models$3_SearchResponse as SearchResponse, }; } /** - * account activity client for the X API. + * communities client for the X API. * - * This module provides a client for interacting with the account activity endpoints of the X API. + * This module provides a client for interacting with the communities endpoints of the X API. */ /** - * Options for createSubscription method + * Options for getById method * * @public */ -interface CreateSubscriptionOptions { - /** Request body */ - body?: CreateSubscriptionRequest; +interface GetByIdOptions { + /** A comma separated list of Community fields to display. + * Also accepts: community.fields or proper camelCase (e.g., communityFields) */ + communityFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for account activity operations + * Options for search method * - * This client provides methods for interacting with the account activity endpoints + * @public + */ +interface SearchOptions { + /** The maximum number of search results to be returned by a request. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of Community fields to display. + * Also accepts: community.fields or proper camelCase (e.g., communityFields) */ + communityFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for communities operations + * + * This client provides methods for interacting with the communities endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all account activity related operations. + * parsing for all communities related operations. * - * @category account activity + * @category communities */ -declare class AccountActivityClient { +declare class CommunitiesClient { private client; /** - * Creates a new account activity client instance + * Creates a new communities client instance * * @param client - The main X API client instance */ @@ -9138,91 +9274,31 @@ declare class AccountActivityClient { */ private _normalizeOptions; /** - * Validate subscription - * Checks a user’s Account Activity subscription for a given webhook. - - - * @param webhookId The webhook ID to check subscription against. - - - - - * @returns {Promise} Promise resolving to the API response - */ - validateSubscription(webhookId: string): Promise; - /** - * Create subscription - * Creates an Account Activity subscription for the user and the given webhook. - - - * @param webhookId The webhook ID to check subscription against. - - - - - * @returns {Promise} Promise resolving to the API response - */ - createSubscription(webhookId: string, options?: CreateSubscriptionOptions): Promise; - /** - * Get subscription count - * Retrieves a count of currently active Account Activity subscriptions. - - - - * @returns {Promise} Promise resolving to the API response - */ - getSubscriptionCount(): Promise; - /** - * Get subscriptions - * Retrieves a list of all active subscriptions for a given webhook. - - - * @param webhookId The webhook ID to pull subscriptions for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getSubscriptions(webhookId: string): Promise; - /** - * Create replay job - * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook. - - - * @param webhookId The unique identifier for the webhook configuration. - - - - - * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. + * Get Community by ID + * Retrieves details of a specific Community by its ID. + * @param id The ID of the Community. - * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createReplayJob(webhookId: string, fromDate: string, toDate: string): Promise; + getById(id: string, options?: GetByIdOptions): Promise; /** - * Delete subscription - * Deletes an Account Activity subscription for the given webhook and user ID. - - - * @param webhookId The webhook ID to check subscription against. - + * Search Communities + * Retrieves a list of Communities matching the specified search query. - * @param userId User ID to unsubscribe from. + * @param query Query to search communities. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - deleteSubscription(webhookId: string, userId: string): Promise; + search(query: string, options?: SearchOptions): Promise; } interface StreamDataEvent { @@ -9331,146 +9407,146 @@ declare class EventDrivenStream { */ type PostsSampleResponse = StreamingTweetResponse; /** - * Response for postsFirehose + * Response for postsFirehosePt * * @public */ -type PostsFirehoseResponse = StreamingTweetResponse; +type PostsFirehosePtResponse = StreamingTweetResponse; /** - * Response for labelsCompliance + * Response for postsFirehoseJa * * @public */ -type LabelsComplianceResponse = TweetLabelStreamResponse; +type PostsFirehoseJaResponse = StreamingTweetResponse; /** - * Response for likesCompliance + * Response for postsSample10 * * @public */ -type LikesComplianceResponse = LikesComplianceStreamResponse; +type PostsSample10Response = Get2TweetsSample10StreamResponse; /** - * Response for likesSample10 + * Response for postsFirehoseKo * * @public */ -type LikesSample10Response = StreamingLikeResponseV2; +type PostsFirehoseKoResponse = StreamingTweetResponse; /** - * Response for postsFirehosePt + * Response for likesCompliance * * @public */ -type PostsFirehosePtResponse = StreamingTweetResponse; +type LikesComplianceResponse = LikesComplianceStreamResponse; /** - * Response for postsFirehoseEn + * Response for postsCompliance * * @public */ -type PostsFirehoseEnResponse = StreamingTweetResponse; +type PostsComplianceResponse = TweetComplianceStreamResponse; /** - * Response for posts + * Response for getRuleCounts * * @public */ -type PostsResponse = FilteredStreamingTweetResponse; +type GetRuleCountsResponse = Get2TweetsSearchStreamRulesCountsResponse; /** - * Response for getRules + * Response for likesFirehose * * @public */ -type GetRulesResponse = RulesLookupResponse; +type LikesFirehoseResponse = StreamingLikeResponseV2; /** - * Request for updateRules + * Response for postsFirehoseEn * * @public */ -type UpdateRulesRequest = AddOrDeleteRulesRequest; +type PostsFirehoseEnResponse = StreamingTweetResponse; /** - * Response for updateRules + * Response for posts * * @public */ -type UpdateRulesResponse = AddOrDeleteRulesResponse; +type PostsResponse = FilteredStreamingTweetResponse; /** - * Response for postsCompliance + * Response for usersCompliance * * @public */ -type PostsComplianceResponse = TweetComplianceStreamResponse; +type UsersComplianceResponse = UserComplianceStreamResponse; /** - * Response for postsFirehoseKo + * Response for postsFirehose * * @public */ -type PostsFirehoseKoResponse = StreamingTweetResponse; +type PostsFirehoseResponse = StreamingTweetResponse; /** - * Response for likesFirehose + * Response for likesSample10 * * @public */ -type LikesFirehoseResponse = StreamingLikeResponseV2; +type LikesSample10Response = StreamingLikeResponseV2; /** - * Response for postsSample10 + * Response for getRules * * @public */ -type PostsSample10Response = Get2TweetsSample10StreamResponse; +type GetRulesResponse = RulesLookupResponse; /** - * Response for postsFirehoseJa + * Request for updateRules * * @public */ -type PostsFirehoseJaResponse = StreamingTweetResponse; +type UpdateRulesRequest = AddOrDeleteRulesRequest; /** - * Response for getRuleCounts + * Response for updateRules * * @public */ -type GetRuleCountsResponse = Get2TweetsSearchStreamRulesCountsResponse; +type UpdateRulesResponse = AddOrDeleteRulesResponse; /** - * Response for usersCompliance + * Response for labelsCompliance * * @public */ -type UsersComplianceResponse = UserComplianceStreamResponse; +type LabelsComplianceResponse = TweetLabelStreamResponse; -type models$1_GetRuleCountsResponse = GetRuleCountsResponse; -type models$1_GetRulesResponse = GetRulesResponse; -type models$1_LabelsComplianceResponse = LabelsComplianceResponse; -type models$1_LikesComplianceResponse = LikesComplianceResponse; -type models$1_LikesFirehoseResponse = LikesFirehoseResponse; -type models$1_LikesSample10Response = LikesSample10Response; -type models$1_PostsComplianceResponse = PostsComplianceResponse; -type models$1_PostsFirehoseEnResponse = PostsFirehoseEnResponse; -type models$1_PostsFirehoseJaResponse = PostsFirehoseJaResponse; -type models$1_PostsFirehoseKoResponse = PostsFirehoseKoResponse; -type models$1_PostsFirehosePtResponse = PostsFirehosePtResponse; -type models$1_PostsFirehoseResponse = PostsFirehoseResponse; -type models$1_PostsResponse = PostsResponse; -type models$1_PostsSample10Response = PostsSample10Response; -type models$1_PostsSampleResponse = PostsSampleResponse; -type models$1_UpdateRulesRequest = UpdateRulesRequest; -type models$1_UpdateRulesResponse = UpdateRulesResponse; -type models$1_UsersComplianceResponse = UsersComplianceResponse; -declare namespace models$1 { +type models$2_GetRuleCountsResponse = GetRuleCountsResponse; +type models$2_GetRulesResponse = GetRulesResponse; +type models$2_LabelsComplianceResponse = LabelsComplianceResponse; +type models$2_LikesComplianceResponse = LikesComplianceResponse; +type models$2_LikesFirehoseResponse = LikesFirehoseResponse; +type models$2_LikesSample10Response = LikesSample10Response; +type models$2_PostsComplianceResponse = PostsComplianceResponse; +type models$2_PostsFirehoseEnResponse = PostsFirehoseEnResponse; +type models$2_PostsFirehoseJaResponse = PostsFirehoseJaResponse; +type models$2_PostsFirehoseKoResponse = PostsFirehoseKoResponse; +type models$2_PostsFirehosePtResponse = PostsFirehosePtResponse; +type models$2_PostsFirehoseResponse = PostsFirehoseResponse; +type models$2_PostsResponse = PostsResponse; +type models$2_PostsSample10Response = PostsSample10Response; +type models$2_PostsSampleResponse = PostsSampleResponse; +type models$2_UpdateRulesRequest = UpdateRulesRequest; +type models$2_UpdateRulesResponse = UpdateRulesResponse; +type models$2_UsersComplianceResponse = UsersComplianceResponse; +declare namespace models$2 { export { - models$1_GetRuleCountsResponse as GetRuleCountsResponse, - models$1_GetRulesResponse as GetRulesResponse, - models$1_LabelsComplianceResponse as LabelsComplianceResponse, - models$1_LikesComplianceResponse as LikesComplianceResponse, - models$1_LikesFirehoseResponse as LikesFirehoseResponse, - models$1_LikesSample10Response as LikesSample10Response, - models$1_PostsComplianceResponse as PostsComplianceResponse, - models$1_PostsFirehoseEnResponse as PostsFirehoseEnResponse, - models$1_PostsFirehoseJaResponse as PostsFirehoseJaResponse, - models$1_PostsFirehoseKoResponse as PostsFirehoseKoResponse, - models$1_PostsFirehosePtResponse as PostsFirehosePtResponse, - models$1_PostsFirehoseResponse as PostsFirehoseResponse, - models$1_PostsResponse as PostsResponse, - models$1_PostsSample10Response as PostsSample10Response, - models$1_PostsSampleResponse as PostsSampleResponse, - models$1_UpdateRulesRequest as UpdateRulesRequest, - models$1_UpdateRulesResponse as UpdateRulesResponse, - models$1_UsersComplianceResponse as UsersComplianceResponse, + models$2_GetRuleCountsResponse as GetRuleCountsResponse, + models$2_GetRulesResponse as GetRulesResponse, + models$2_LabelsComplianceResponse as LabelsComplianceResponse, + models$2_LikesComplianceResponse as LikesComplianceResponse, + models$2_LikesFirehoseResponse as LikesFirehoseResponse, + models$2_LikesSample10Response as LikesSample10Response, + models$2_PostsComplianceResponse as PostsComplianceResponse, + models$2_PostsFirehoseEnResponse as PostsFirehoseEnResponse, + models$2_PostsFirehoseJaResponse as PostsFirehoseJaResponse, + models$2_PostsFirehoseKoResponse as PostsFirehoseKoResponse, + models$2_PostsFirehosePtResponse as PostsFirehosePtResponse, + models$2_PostsFirehoseResponse as PostsFirehoseResponse, + models$2_PostsResponse as PostsResponse, + models$2_PostsSample10Response as PostsSample10Response, + models$2_PostsSampleResponse as PostsSampleResponse, + models$2_UpdateRulesRequest as UpdateRulesRequest, + models$2_UpdateRulesResponse as UpdateRulesResponse, + models$2_UsersComplianceResponse as UsersComplianceResponse, }; } @@ -9517,11 +9593,11 @@ interface PostsSampleStreamingOptions { [key: string]: any; } /** - * Options for postsFirehose method + * Options for postsFirehosePt method * * @public */ -interface PostsFirehoseStreamingOptions { +interface PostsFirehosePtStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -9559,80 +9635,38 @@ interface PostsFirehoseStreamingOptions { [key: string]: any; } /** - * Options for labelsCompliance method - * - * @public - */ -interface LabelsComplianceStreamingOptions { - /** The number of minutes of backfill requested. - * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ - backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for likesCompliance method - * - * @public - */ -interface LikesComplianceStreamingOptions { - /** The number of minutes of backfill requested. - * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ - backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for likesSample10 method + * Options for postsFirehoseJa method * * @public */ -interface LikesSample10StreamingOptions { +interface PostsFirehoseJaStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of LikeWithTweetAuthor fields to display. - * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ - likeWithTweetAuthorFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9643,11 +9677,11 @@ interface LikesSample10StreamingOptions { [key: string]: any; } /** - * Options for postsFirehosePt method + * Options for postsSample10 method * * @public */ -interface PostsFirehosePtStreamingOptions { +interface PostsSample10StreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -9685,11 +9719,11 @@ interface PostsFirehosePtStreamingOptions { [key: string]: any; } /** - * Options for postsFirehoseEn method + * Options for postsFirehoseKo method * * @public */ -interface PostsFirehoseEnStreamingOptions { +interface PostsFirehoseKoStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -9727,38 +9761,20 @@ interface PostsFirehoseEnStreamingOptions { [key: string]: any; } /** - * Options for posts method + * Options for likesCompliance method * * @public */ -interface PostsStreamingOptions { +interface LikesComplianceStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9769,20 +9785,20 @@ interface PostsStreamingOptions { [key: string]: any; } /** - * Options for getRules method + * Options for postsCompliance method * * @public */ -interface GetRulesStreamingOptions { - /** A comma-separated list of Rule IDs. - * Also accepts: ids or proper camelCase (e.g., ids) */ - ids?: Array; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This value is populated by passing the 'next_token' returned in a request to paginate through results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: string; +interface PostsComplianceStreamingOptions { + /** The number of minutes of backfill requested. + * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ + backfillMinutes?: number; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9793,17 +9809,14 @@ interface GetRulesStreamingOptions { [key: string]: any; } /** - * Options for updateRules method + * Options for getRuleCounts method * * @public */ -interface UpdateRulesStreamingOptions { - /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. - * Also accepts: dry_run or proper camelCase (e.g., dryRun) */ - dryRun?: boolean; - /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. - * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */ - deleteAll?: boolean; +interface GetRuleCountsStreamingOptions { + /** A comma separated list of RulesCount fields to display. + * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */ + rulesCountFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9814,20 +9827,74 @@ interface UpdateRulesStreamingOptions { [key: string]: any; } /** - * Options for postsCompliance method + * Options for likesFirehose method * * @public */ -interface PostsComplianceStreamingOptions { +interface LikesFirehoseStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** A comma separated list of LikeWithTweetAuthor fields to display. + * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ + likeWithTweetAuthorFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for postsFirehoseEn method + * + * @public + */ +interface PostsFirehoseEnStreamingOptions { + /** The number of minutes of backfill requested. + * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ + backfillMinutes?: number; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9838,15 +9905,15 @@ interface PostsComplianceStreamingOptions { [key: string]: any; } /** - * Options for postsFirehoseKo method + * Options for posts method * * @public */ -interface PostsFirehoseKoStreamingOptions { +interface PostsStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. @@ -9880,32 +9947,20 @@ interface PostsFirehoseKoStreamingOptions { [key: string]: any; } /** - * Options for likesFirehose method + * Options for usersCompliance method * * @public */ -interface LikesFirehoseStreamingOptions { +interface UsersComplianceStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of LikeWithTweetAuthor fields to display. - * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ - likeWithTweetAuthorFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9916,11 +9971,11 @@ interface LikesFirehoseStreamingOptions { [key: string]: any; } /** - * Options for postsSample10 method + * Options for postsFirehose method * * @public */ -interface PostsSample10StreamingOptions { +interface PostsFirehoseStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -9958,38 +10013,32 @@ interface PostsSample10StreamingOptions { [key: string]: any; } /** - * Options for postsFirehoseJa method + * Options for likesSample10 method * * @public */ -interface PostsFirehoseJaStreamingOptions { +interface LikesSample10StreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of LikeWithTweetAuthor fields to display. + * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ + likeWithTweetAuthorFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -10000,14 +10049,20 @@ interface PostsFirehoseJaStreamingOptions { [key: string]: any; } /** - * Options for getRuleCounts method + * Options for getRules method * * @public */ -interface GetRuleCountsStreamingOptions { - /** A comma separated list of RulesCount fields to display. - * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */ - rulesCountFields?: Array; +interface GetRulesStreamingOptions { + /** A comma-separated list of Rule IDs. + * Also accepts: ids or proper camelCase (e.g., ids) */ + ids?: Array; + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This value is populated by passing the 'next_token' returned in a request to paginate through results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: string; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -10018,18 +10073,39 @@ interface GetRuleCountsStreamingOptions { [key: string]: any; } /** - * Options for usersCompliance method + * Options for updateRules method * * @public */ -interface UsersComplianceStreamingOptions { +interface UpdateRulesStreamingOptions { + /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. + * Also accepts: dry_run or proper camelCase (e.g., dryRun) */ + dryRun?: boolean; + /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. + * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */ + deleteAll?: boolean; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for labelsCompliance method + * + * @public + */ +interface LabelsComplianceStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; /** Additional request options */ @@ -10063,8 +10139,8 @@ declare class StreamClient { */ postsSample(options?: PostsSampleStreamingOptions): Promise; /** - * Stream all Posts - * Streams all public Posts in real-time. + * Stream Portuguese Posts + * Streams all public Portuguese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10078,10 +10154,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehose(partition: number, options?: PostsFirehoseStreamingOptions): Promise; + postsFirehosePt(partition: number, options?: PostsFirehosePtStreamingOptions): Promise; /** - * Stream Post labels - * Streams all labeling events applied to Posts. + * Stream Japanese Posts + * Streams all public Japanese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10089,12 +10165,16 @@ declare class StreamClient { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - labelsCompliance(options?: LabelsComplianceStreamingOptions): Promise; + postsFirehoseJa(partition: number, options?: PostsFirehoseJaStreamingOptions): Promise; /** - * Stream Likes compliance data - * Streams all compliance data related to Likes for Users. + * Stream 10% sampled Posts + * Streams a 10% sample of public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10102,12 +10182,16 @@ declare class StreamClient { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - likesCompliance(options?: LikesComplianceStreamingOptions): Promise; + postsSample10(partition: number, options?: PostsSample10StreamingOptions): Promise; /** - * Stream sampled Likes - * Streams a 10% sample of public Likes in real-time. + * Stream Korean Posts + * Streams all public Korean-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10121,10 +10205,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - likesSample10(partition: number, options?: LikesSample10StreamingOptions): Promise; + postsFirehoseKo(partition: number, options?: PostsFirehoseKoStreamingOptions): Promise; /** - * Stream Portuguese Posts - * Streams all public Portuguese-language Posts in real-time. + * Stream Likes compliance data + * Streams all compliance data related to Likes for Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10132,16 +10216,12 @@ declare class StreamClient { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehosePt(partition: number, options?: PostsFirehosePtStreamingOptions): Promise; + likesCompliance(options?: LikesComplianceStreamingOptions): Promise; /** - * Stream English Posts - * Streams all public English-language Posts in real-time. + * Stream Posts compliance data + * Streams all compliance data related to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10155,10 +10235,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehoseEn(partition: number, options?: PostsFirehoseEnStreamingOptions): Promise; + postsCompliance(partition: number, options?: PostsComplianceStreamingOptions): Promise; /** - * Stream filtered Posts - * Streams Posts in real-time matching the active rule set. + * Stream all Likes + * Streams all public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10166,12 +10246,16 @@ declare class StreamClient { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - posts(options?: PostsStreamingOptions): Promise; + likesFirehose(partition: number, options?: LikesFirehoseStreamingOptions): Promise; /** - * Stream Posts compliance data - * Streams all compliance data related to Posts. + * Stream English Posts + * Streams all public English-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10185,10 +10269,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsCompliance(partition: number, options?: PostsComplianceStreamingOptions): Promise; + postsFirehoseEn(partition: number, options?: PostsFirehoseEnStreamingOptions): Promise; /** - * Stream Korean Posts - * Streams all public Korean-language Posts in real-time. + * Stream filtered Posts + * Streams Posts in real-time matching the active rule set. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10196,16 +10280,12 @@ declare class StreamClient { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehoseKo(partition: number, options?: PostsFirehoseKoStreamingOptions): Promise; + posts(options?: PostsStreamingOptions): Promise; /** - * Stream all Likes - * Streams all public Likes in real-time. + * Stream Users compliance data + * Streams all compliance data related to Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10219,10 +10299,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - likesFirehose(partition: number, options?: LikesFirehoseStreamingOptions): Promise; + usersCompliance(partition: number, options?: UsersComplianceStreamingOptions): Promise; /** - * Stream 10% sampled Posts - * Streams a 10% sample of public Posts in real-time. + * Stream all Posts + * Streams all public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10236,10 +10316,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsSample10(partition: number, options?: PostsSample10StreamingOptions): Promise; + postsFirehose(partition: number, options?: PostsFirehoseStreamingOptions): Promise; /** - * Stream Japanese Posts - * Streams all public Japanese-language Posts in real-time. + * Stream sampled Likes + * Streams a 10% sample of public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10253,10 +10333,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehoseJa(partition: number, options?: PostsFirehoseJaStreamingOptions): Promise; + likesSample10(partition: number, options?: LikesSample10StreamingOptions): Promise; /** - * Stream Users compliance data - * Streams all compliance data related to Users. + * Stream Post labels + * Streams all labeling events applied to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10264,13 +10344,16 @@ declare class StreamClient { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - usersCompliance(partition: number, options?: UsersComplianceStreamingOptions): Promise; + labelsCompliance(options?: LabelsComplianceStreamingOptions): Promise; + /** + * Get stream rule counts + * Retrieves the count of rules in the active rule set for the filtered stream. + * + * @returns Promise with the API response + */ + getRuleCounts(options?: GetRuleCountsStreamingOptions): Promise; /** * Get stream rules * Retrieves the active rule set or a subset of rules for the filtered stream. @@ -10285,164 +10368,100 @@ declare class StreamClient { * @returns Promise with the API response */ updateRules(body: any, options?: UpdateRulesStreamingOptions): Promise; - /** - * Get stream rule counts - * Retrieves the count of rules in the active rule set for the filtered stream. - * - * @returns Promise with the API response - */ - getRuleCounts(options?: GetRuleCountsStreamingOptions): Promise; } /** - * Models for webhooks operations + * Models for compliance operations */ /** - * Response for createStreamLink - * - * @public - */ -type CreateStreamLinkResponse = WebhookLinksCreateResponse; -/** - * Response for deleteStreamLink - * - * @public - */ -type DeleteStreamLinkResponse = WebhookLinksDeleteResponse; -/** - * Response for validate - * - * @public - */ -type ValidateResponse = WebhookConfigPutResponse; -/** - * Response for delete - * - * @public - */ -type DeleteResponse = WebhookConfigDeleteResponse; -/** - * Response for getStreamLinks + * Response for getJobs * * @public */ -type GetStreamLinksResponse = WebhookLinksGetResponse; +type GetJobsResponse = Get2ComplianceJobsResponse; /** - * Response for get + * Request for createJobs * * @public */ -type GetResponse = Get2WebhooksResponse; +type CreateJobsRequest = CreateComplianceJobRequest; /** - * Request for create + * Response for createJobs * * @public */ -type CreateRequest = WebhookConfigCreateRequest; +type CreateJobsResponse = CreateComplianceJobResponse; /** - * Response for create + * Response for getJobsById * * @public */ -type CreateResponse = WebhookConfigCreateResponse; +type GetJobsByIdResponse = Get2ComplianceJobsIdResponse; -type models_CreateRequest = CreateRequest; -type models_CreateResponse = CreateResponse; -type models_CreateStreamLinkResponse = CreateStreamLinkResponse; -type models_DeleteResponse = DeleteResponse; -type models_DeleteStreamLinkResponse = DeleteStreamLinkResponse; -type models_GetResponse = GetResponse; -type models_GetStreamLinksResponse = GetStreamLinksResponse; -type models_ValidateResponse = ValidateResponse; -declare namespace models { +type models$1_CreateJobsRequest = CreateJobsRequest; +type models$1_CreateJobsResponse = CreateJobsResponse; +type models$1_GetJobsByIdResponse = GetJobsByIdResponse; +type models$1_GetJobsResponse = GetJobsResponse; +declare namespace models$1 { export { - models_CreateRequest as CreateRequest, - models_CreateResponse as CreateResponse, - models_CreateStreamLinkResponse as CreateStreamLinkResponse, - models_DeleteResponse as DeleteResponse, - models_DeleteStreamLinkResponse as DeleteStreamLinkResponse, - models_GetResponse as GetResponse, - models_GetStreamLinksResponse as GetStreamLinksResponse, - models_ValidateResponse as ValidateResponse, + models$1_CreateJobsRequest as CreateJobsRequest, + models$1_CreateJobsResponse as CreateJobsResponse, + models$1_GetJobsByIdResponse as GetJobsByIdResponse, + models$1_GetJobsResponse as GetJobsResponse, }; } /** - * webhooks client for the X API. + * compliance client for the X API. * - * This module provides a client for interacting with the webhooks endpoints of the X API. + * This module provides a client for interacting with the compliance endpoints of the X API. */ /** - * Options for createStreamLink method - * - * @public - */ -interface CreateStreamLinkOptions { - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: string; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: string; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: string; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: string; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: string; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for get method + * Options for getJobs method * * @public */ -interface GetOptions { - /** A comma separated list of WebhookConfig fields to display. - * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */ - webhookConfigFields?: Array; +interface GetJobsOptions { + /** Status of Compliance Job to list. + * Also accepts: status or proper camelCase (e.g., status) */ + status?: string; + /** A comma separated list of ComplianceJob fields to display. + * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ + complianceJobFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for create method + * Options for getJobsById method * * @public */ -interface CreateOptions { - /** Request body */ - body?: CreateRequest; +interface GetJobsByIdOptions { + /** A comma separated list of ComplianceJob fields to display. + * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ + complianceJobFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for webhooks operations + * Client for compliance operations * - * This client provides methods for interacting with the webhooks endpoints + * This client provides methods for interacting with the compliance endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all webhooks related operations. + * parsing for all compliance related operations. * - * @category webhooks + * @category compliance */ -declare class WebhooksClient { +declare class ComplianceClient { private client; /** - * Creates a new webhooks client instance + * Creates a new compliance client instance * * @param client - The main X API client instance */ @@ -10453,84 +10472,116 @@ declare class WebhooksClient { */ private _normalizeOptions; /** - * Create stream link - * Creates a link to deliver FilteredStream events to the given webhook. + * Get Compliance Jobs + * Retrieves a list of Compliance Jobs filtered by job type and optional status. - * @param webhookId The webhook ID to link to your FilteredStream ruleset. + * @param type Type of Compliance Job to list. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createStreamLink(webhookId: string, options?: CreateStreamLinkOptions): Promise; + getJobs(type: string, options?: GetJobsOptions): Promise; /** - * Delete stream link - * Deletes a link from FilteredStream events to the given webhook. - - - * @param webhookId The webhook ID to link to your FilteredStream ruleset. + * Create Compliance Job + * Creates a new Compliance Job for the specified job type. + * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - deleteStreamLink(webhookId: string): Promise; + createJobs(body: CreateJobsRequest): Promise; /** - * Validate webhook - * Triggers a CRC check for a given webhook. + * Get Compliance Job by ID + * Retrieves details of a specific Compliance Job by its ID. - * @param webhookId The ID of the webhook to check. + * @param id The ID of the Compliance Job to retrieve. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - validate(webhookId: string): Promise; + getJobsById(id: string, options?: GetJobsByIdOptions): Promise; +} + +/** + * Models for usage operations + */ + +/** + * Response for get + * + * @public + */ +type GetResponse = Get2UsageTweetsResponse; + +type models_GetResponse = GetResponse; +declare namespace models { + export { + models_GetResponse as GetResponse, + }; +} + +/** + * usage client for the X API. + * + * This module provides a client for interacting with the usage endpoints of the X API. + */ + +/** + * Options for get method + * + * @public + */ +interface GetOptions { + /** The number of days for which you need usage for. + * Also accepts: days or proper camelCase (e.g., days) */ + days?: number; + /** A comma separated list of Usage fields to display. + * Also accepts: usage.fields or proper camelCase (e.g., usageFields) */ + usageFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for usage operations + * + * This client provides methods for interacting with the usage endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all usage related operations. + * + * @category usage + */ +declare class UsageClient { + private client; /** - * Delete webhook - * Deletes an existing webhook configuration. - - - * @param webhookId The ID of the webhook to delete. - - - - - * @returns {Promise} Promise resolving to the API response - */ - delete(webhookId: string): Promise; + * Creates a new usage client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); /** - * Get stream links - * Get a list of webhook links associated with a filtered stream ruleset. - - - - * @returns {Promise} Promise resolving to the API response - */ - getStreamLinks(): Promise; + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; /** - * Get webhook - * Get a list of webhook configs associated with a client app. + * Get usage + * Retrieves usage statistics for Posts over a specified number of days. * @returns {Promise} Promise resolving to the API response */ get(options?: GetOptions): Promise; - /** - * Create webhook - * Creates a new webhook configuration. - - - - * @returns {Promise} Promise resolving to the API response - */ - create(options?: CreateOptions): Promise; } /** @@ -10660,42 +10711,42 @@ declare class Client { readonly maxRetries: number; /** HTTP client for making requests */ readonly httpClient: HttpClient; - /** news client */ - readonly news: NewsClient; - /** users client */ - readonly users: UsersClient; - /** direct messages client */ - readonly directMessages: DirectMessagesClient; - /** community notes client */ - readonly communityNotes: CommunityNotesClient; - /** posts client */ - readonly posts: PostsClient; - /** trends client */ - readonly trends: TrendsClient; /** activity client */ readonly activity: ActivityClient; - /** usage client */ - readonly usage: UsageClient; - /** spaces client */ - readonly spaces: SpacesClient; - /** communities client */ - readonly communities: CommunitiesClient; + /** news client */ + readonly news: NewsClient; /** connections client */ readonly connections: ConnectionsClient; + /** account activity client */ + readonly accountActivity: AccountActivityClient; + /** spaces client */ + readonly spaces: SpacesClient; + /** trends client */ + readonly trends: TrendsClient; /** media client */ readonly media: MediaClient; + /** direct messages client */ + readonly directMessages: DirectMessagesClient; + /** posts client */ + readonly posts: PostsClient; /** lists client */ readonly lists: ListsClient; - /** compliance client */ - readonly compliance: ComplianceClient; + /** community notes client */ + readonly communityNotes: CommunityNotesClient; /** general client */ readonly general: GeneralClient; - /** account activity client */ - readonly accountActivity: AccountActivityClient; - /** stream client */ - readonly stream: StreamClient; /** webhooks client */ readonly webhooks: WebhooksClient; + /** users client */ + readonly users: UsersClient; + /** communities client */ + readonly communities: CommunitiesClient; + /** stream client */ + readonly stream: StreamClient; + /** compliance client */ + readonly compliance: ComplianceClient; + /** usage client */ + readonly usage: UsageClient; /** * Creates a new X API client instance * @@ -11303,4 +11354,4 @@ declare class EventPaginator extends Paginator { get events(): any[]; } -export { models$2 as AccountActivity, AccountActivityClient, models$b as Activity, ActivityClient, ApiError, ApiResponse, Client, ClientConfig, models$8 as Communities, CommunitiesClient, models$e as CommunityNotes, CommunityNotesClient, models$4 as Compliance, ComplianceClient, models$7 as Connections, ConnectionsClient, CryptoUtils, models$f as DirectMessages, DirectMessagesClient, EventPaginator, models$3 as General, GeneralClient, HttpClient, RequestOptions$1 as HttpClientRequestOptions, HttpResponse, models$5 as Lists, ListsClient, models$6 as Media, MediaClient, models$h as News, NewsClient, OAuth1, OAuth1AccessToken, OAuth1Config, OAuth1RequestToken, OAuth2, OAuth2Config, OAuth2Token, PaginatedResponse, PaginationMeta, Paginator, PostPaginator, models$d as Posts, PostsClient, RequestOptions, schemas as Schemas, models$9 as Spaces, SpacesClient, models$1 as Stream, StreamClient, StreamListener, models$c as Trends, TrendsClient, TweetStreamListener, models$a as Usage, UsageClient, UserPaginator, models$g as Users, UsersClient, models as Webhooks, WebhooksClient, generateCodeChallenge, generateCodeVerifier, generateNonce, generateTimestamp, hmacSha1, httpClient }; +export { models$e as AccountActivity, AccountActivityClient, models$h as Activity, ActivityClient, ApiError, ApiResponse, Client, ClientConfig, models$3 as Communities, CommunitiesClient, models$7 as CommunityNotes, CommunityNotesClient, models$1 as Compliance, ComplianceClient, models$f as Connections, ConnectionsClient, CryptoUtils, models$a as DirectMessages, DirectMessagesClient, EventPaginator, models$6 as General, GeneralClient, HttpClient, RequestOptions$1 as HttpClientRequestOptions, HttpResponse, models$8 as Lists, ListsClient, models$b as Media, MediaClient, models$g as News, NewsClient, OAuth1, OAuth1AccessToken, OAuth1Config, OAuth1RequestToken, OAuth2, OAuth2Config, OAuth2Token, PaginatedResponse, PaginationMeta, Paginator, PostPaginator, models$9 as Posts, PostsClient, RequestOptions, schemas as Schemas, models$d as Spaces, SpacesClient, models$2 as Stream, StreamClient, StreamListener, models$c as Trends, TrendsClient, TweetStreamListener, models as Usage, UsageClient, UserPaginator, models$4 as Users, UsersClient, models$5 as Webhooks, WebhooksClient, generateCodeChallenge, generateCodeVerifier, generateNonce, generateTimestamp, hmacSha1, httpClient }; diff --git a/xdk/typescript/dist/index.d.ts b/xdk/typescript/dist/index.d.ts index 38a252bc..9db29190 100644 --- a/xdk/typescript/dist/index.d.ts +++ b/xdk/typescript/dist/index.d.ts @@ -946,6 +946,15 @@ interface Get2NewsIdResponse { data?: News; /** none */ errors?: Array; } /** +Schema type for Get2NewsSearchResponse + * + * @public + */ +interface Get2NewsSearchResponse { + /** none */ data?: Array; + /** none */ errors?: Array; + /** none */ meta?: Record; +} /** Schema type for Get2NotesSearchNotesWrittenResponse * * @public @@ -3313,6 +3322,7 @@ type schemas_Get2MediaAnalyticsResponse = Get2MediaAnalyticsResponse; type schemas_Get2MediaMediaKeyResponse = Get2MediaMediaKeyResponse; type schemas_Get2MediaResponse = Get2MediaResponse; type schemas_Get2NewsIdResponse = Get2NewsIdResponse; +type schemas_Get2NewsSearchResponse = Get2NewsSearchResponse; type schemas_Get2NotesSearchNotesWrittenResponse = Get2NotesSearchNotesWrittenResponse; type schemas_Get2NotesSearchPostsEligibleForNotesResponse = Get2NotesSearchPostsEligibleForNotesResponse; type schemas_Get2SpacesByCreatorIdsResponse = Get2SpacesByCreatorIdsResponse; @@ -3705,6 +3715,7 @@ declare namespace schemas { schemas_Get2MediaMediaKeyResponse as Get2MediaMediaKeyResponse, schemas_Get2MediaResponse as Get2MediaResponse, schemas_Get2NewsIdResponse as Get2NewsIdResponse, + schemas_Get2NewsSearchResponse as Get2NewsSearchResponse, schemas_Get2NotesSearchNotesWrittenResponse as Get2NotesSearchNotesWrittenResponse, schemas_Get2NotesSearchPostsEligibleForNotesResponse as Get2NotesSearchPostsEligibleForNotesResponse, schemas_Get2SpacesByCreatorIdsResponse as Get2SpacesByCreatorIdsResponse, @@ -3984,6 +3995,197 @@ declare namespace schemas { }; } +/** + * Models for activity operations + */ + +/** + * Response for getSubscriptions + * + * @public + */ +type GetSubscriptionsResponse$1 = ActivitySubscriptionGetResponse; +/** + * Request for createSubscription + * + * @public + */ +type CreateSubscriptionRequest$1 = ActivitySubscriptionCreateRequest; +/** + * Response for createSubscription + * + * @public + */ +type CreateSubscriptionResponse$1 = ActivitySubscriptionCreateResponse; +/** + * Response for stream + * + * @public + */ +type StreamResponse = ActivityStreamingResponse; +/** + * Request for updateSubscription + * + * @public + */ +type UpdateSubscriptionRequest = ActivitySubscriptionUpdateRequest; +/** + * Response for updateSubscription + * + * @public + */ +type UpdateSubscriptionResponse = ActivitySubscriptionUpdateResponse; +/** + * Response for deleteSubscription + * + * @public + */ +type DeleteSubscriptionResponse$1 = ActivitySubscriptionDeleteResponse; + +type models$h_StreamResponse = StreamResponse; +type models$h_UpdateSubscriptionRequest = UpdateSubscriptionRequest; +type models$h_UpdateSubscriptionResponse = UpdateSubscriptionResponse; +declare namespace models$h { + export { + CreateSubscriptionRequest$1 as CreateSubscriptionRequest, + CreateSubscriptionResponse$1 as CreateSubscriptionResponse, + DeleteSubscriptionResponse$1 as DeleteSubscriptionResponse, + GetSubscriptionsResponse$1 as GetSubscriptionsResponse, + models$h_StreamResponse as StreamResponse, + models$h_UpdateSubscriptionRequest as UpdateSubscriptionRequest, + models$h_UpdateSubscriptionResponse as UpdateSubscriptionResponse, + }; +} + +/** + * activity client for the X API. + * + * This module provides a client for interacting with the activity endpoints of the X API. + */ + +/** + * Options for createSubscription method + * + * @public + */ +interface CreateSubscriptionOptions$1 { + /** Request body */ + body?: CreateSubscriptionRequest$1; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for stream method + * + * @public + */ +interface StreamOptions { + /** The number of minutes of backfill requested. + * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ + backfillMinutes?: number; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for updateSubscription method + * + * @public + */ +interface UpdateSubscriptionOptions { + /** Request body */ + body?: UpdateSubscriptionRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for activity operations + * + * This client provides methods for interacting with the activity endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all activity related operations. + * + * @category activity + */ +declare class ActivityClient { + private client; + /** + * Creates a new activity client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get X activity subscriptions + * Get a list of active subscriptions for XAA + + + + * @returns {Promise} Promise resolving to the API response + */ + getSubscriptions(): Promise; + /** + * Create X activity subscription + * Creates a subscription for an X activity event + + + + * @returns {Promise} Promise resolving to the API response + */ + createSubscription(options?: CreateSubscriptionOptions$1): Promise; + /** + * Activity Stream + * Stream of X Activities + + + + * @returns {Promise} Promise resolving to the API response + */ + stream(options?: StreamOptions): Promise; + /** + * Update X activity subscription + * Updates a subscription for an X activity event + + + * @param subscriptionId The ID of the subscription to update. + + + + + * @returns {Promise} Promise resolving to the API response + */ + updateSubscription(subscriptionId: string, options?: UpdateSubscriptionOptions): Promise; + /** + * Deletes X activity subscription + * Deletes a subscription for an X activity event + + + * @param subscriptionId The ID of the subscription to delete. + + + + + * @returns {Promise} Promise resolving to the API response + */ + deleteSubscription(subscriptionId: string): Promise; +} + /** * Models for news operations */ @@ -3994,10 +4196,17 @@ declare namespace schemas { * @public */ type GetResponse$2 = Get2NewsIdResponse; +/** + * Response for search + * + * @public + */ +type SearchResponse$3 = Get2NewsSearchResponse; -declare namespace models$h { +declare namespace models$g { export { GetResponse$2 as GetResponse, + SearchResponse$3 as SearchResponse, }; } @@ -4021,6 +4230,26 @@ interface GetOptions$2 { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for search method + * + * @public + */ +interface SearchOptions$3 { + /** The number of results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** The maximum age of the News story to search for. + * Also accepts: max_age_hours or proper camelCase (e.g., maxAgeHours) */ + maxAgeHours?: number; + /** A comma separated list of News fields to display. + * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ + newsFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** * Client for news operations * @@ -4056,432 +4285,368 @@ declare class NewsClient { * @returns {Promise} Promise resolving to the API response */ get(id: string, options?: GetOptions$2): Promise; + /** + * Search News + * Retrieves a list of News stories matching the specified search query. + + + + * @param query The search query. + + + + * @returns {Promise} Promise resolving to the API response + */ + search(query: string, options?: SearchOptions$3): Promise; } /** - * Models for users operations + * Models for connections operations */ /** - * Response for unlikePost + * Response for deleteAll * * @public */ -type UnlikePostResponse = UsersLikesDeleteResponse; +type DeleteAllResponse = KillAllConnectionsResponse; + +type models$f_DeleteAllResponse = DeleteAllResponse; +declare namespace models$f { + export { + models$f_DeleteAllResponse as DeleteAllResponse, + }; +} + /** - * Response for getOwnedLists + * connections client for the X API. * - * @public + * This module provides a client for interacting with the connections endpoints of the X API. */ -type GetOwnedListsResponse = Get2UsersIdOwnedListsResponse; + /** - * Response for getBlocking + * Client for connections operations * - * @public - */ -type GetBlockingResponse = Get2UsersIdBlockingResponse; -/** - * Response for deleteBookmark + * This client provides methods for interacting with the connections endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all connections related operations. * - * @public + * @category connections */ -type DeleteBookmarkResponse = BookmarkMutationResponse; -/** - * Response for getByUsername - * - * @public +declare class ConnectionsClient { + private client; + /** + * Creates a new connections client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Terminate all connections + * Terminates all active streaming connections for the authenticated application. + + + + * @returns {Promise} Promise resolving to the API response + */ + deleteAll(): Promise; +} + +/** + * Models for account activity operations */ -type GetByUsernameResponse = Get2UsersByUsernameUsernameResponse; + /** - * Response for unpinList + * Response for getSubscriptions * * @public */ -type UnpinListResponse = ListUnpinResponse; +type GetSubscriptionsResponse = SubscriptionsListGetResponse; /** - * Response for getPosts + * Response for validateSubscription * * @public */ -type GetPostsResponse$2 = Get2UsersIdTweetsResponse; +type ValidateSubscriptionResponse = SubscriptionsGetResponse; /** - * Response for getBookmarks + * Request for createSubscription * * @public */ -type GetBookmarksResponse = Get2UsersIdBookmarksResponse; +type CreateSubscriptionRequest = SubscriptionsCreateRequest; /** - * Request for createBookmark + * Response for createSubscription * * @public */ -type CreateBookmarkRequest = BookmarkAddRequest; +type CreateSubscriptionResponse = SubscriptionsCreateResponse; /** - * Response for createBookmark + * Response for getSubscriptionCount * * @public */ -type CreateBookmarkResponse = BookmarkMutationResponse; +type GetSubscriptionCountResponse = SubscriptionsCountGetResponse; /** - * Response for blockDms + * Response for deleteSubscription * * @public */ -type BlockDmsResponse = UsersDMBlockCreateResponse; +type DeleteSubscriptionResponse = SubscriptionsDeleteResponse; /** - * Response for unfollowList + * Response for createReplayJob * * @public */ -type UnfollowListResponse = ListFollowedResponse; +type CreateReplayJobResponse = ReplayJobCreateResponse; + +type models$e_CreateReplayJobResponse = CreateReplayJobResponse; +type models$e_CreateSubscriptionRequest = CreateSubscriptionRequest; +type models$e_CreateSubscriptionResponse = CreateSubscriptionResponse; +type models$e_DeleteSubscriptionResponse = DeleteSubscriptionResponse; +type models$e_GetSubscriptionCountResponse = GetSubscriptionCountResponse; +type models$e_GetSubscriptionsResponse = GetSubscriptionsResponse; +type models$e_ValidateSubscriptionResponse = ValidateSubscriptionResponse; +declare namespace models$e { + export { + models$e_CreateReplayJobResponse as CreateReplayJobResponse, + models$e_CreateSubscriptionRequest as CreateSubscriptionRequest, + models$e_CreateSubscriptionResponse as CreateSubscriptionResponse, + models$e_DeleteSubscriptionResponse as DeleteSubscriptionResponse, + models$e_GetSubscriptionCountResponse as GetSubscriptionCountResponse, + models$e_GetSubscriptionsResponse as GetSubscriptionsResponse, + models$e_ValidateSubscriptionResponse as ValidateSubscriptionResponse, + }; +} + /** - * Response for getMuting + * account activity client for the X API. * - * @public + * This module provides a client for interacting with the account activity endpoints of the X API. */ -type GetMutingResponse = Get2UsersIdMutingResponse; /** - * Response for muteUser + * Options for createSubscription method * * @public */ -type MuteUserResponse = MuteUserMutationResponse; +interface CreateSubscriptionOptions { + /** Request body */ + body?: CreateSubscriptionRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** - * Response for getById + * Client for account activity operations * - * @public + * This client provides methods for interacting with the account activity endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all account activity related operations. + * + * @category account activity */ -type GetByIdResponse$4 = Get2UsersIdResponse; +declare class AccountActivityClient { + private client; + /** + * Creates a new account activity client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get subscriptions + * Retrieves a list of all active subscriptions for a given webhook. + + + * @param webhookId The webhook ID to pull subscriptions for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getSubscriptions(webhookId: string): Promise; + /** + * Validate subscription + * Checks a user’s Account Activity subscription for a given webhook. + + + * @param webhookId The webhook ID to check subscription against. + + + + + * @returns {Promise} Promise resolving to the API response + */ + validateSubscription(webhookId: string): Promise; + /** + * Create subscription + * Creates an Account Activity subscription for the user and the given webhook. + + + * @param webhookId The webhook ID to check subscription against. + + + + + * @returns {Promise} Promise resolving to the API response + */ + createSubscription(webhookId: string, options?: CreateSubscriptionOptions): Promise; + /** + * Get subscription count + * Retrieves a count of currently active Account Activity subscriptions. + + + + * @returns {Promise} Promise resolving to the API response + */ + getSubscriptionCount(): Promise; + /** + * Delete subscription + * Deletes an Account Activity subscription for the given webhook and user ID. + + + * @param webhookId The webhook ID to check subscription against. + + + + * @param userId User ID to unsubscribe from. + + + + + * @returns {Promise} Promise resolving to the API response + */ + deleteSubscription(webhookId: string, userId: string): Promise; + /** + * Create replay job + * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook. + + + * @param webhookId The unique identifier for the webhook configuration. + + + + + * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. + + + + * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. + + + + * @returns {Promise} Promise resolving to the API response + */ + createReplayJob(webhookId: string, fromDate: string, toDate: string): Promise; +} + /** - * Response for getMe - * - * @public + * Models for spaces operations */ -type GetMeResponse = Get2UsersMeResponse; + /** - * Response for unrepostPost + * Response for getById * * @public */ -type UnrepostPostResponse = UsersRetweetsDeleteResponse; +type GetByIdResponse$4 = Get2SpacesIdResponse; /** - * Response for unmuteUser + * Response for getBuyers * * @public */ -type UnmuteUserResponse = MuteUserMutationResponse; +type GetBuyersResponse = Get2SpacesIdBuyersResponse; /** - * Response for search + * Response for getPosts * * @public */ -type SearchResponse$2 = Get2UsersSearchResponse; +type GetPostsResponse$2 = Get2SpacesIdTweetsResponse; /** - * Response for getPinnedLists + * Response for getByCreatorIds * * @public */ -type GetPinnedListsResponse = Get2UsersIdPinnedListsResponse; +type GetByCreatorIdsResponse = Get2SpacesByCreatorIdsResponse; /** - * Request for pinList + * Response for getByIds * * @public */ -type PinListRequest = ListPinnedRequest; +type GetByIdsResponse$2 = Get2SpacesResponse; /** - * Response for pinList + * Response for search * * @public */ -type PinListResponse = ListPinnedResponse; +type SearchResponse$2 = Get2SpacesSearchResponse; + +type models$d_GetBuyersResponse = GetBuyersResponse; +type models$d_GetByCreatorIdsResponse = GetByCreatorIdsResponse; +declare namespace models$d { + export { + models$d_GetBuyersResponse as GetBuyersResponse, + models$d_GetByCreatorIdsResponse as GetByCreatorIdsResponse, + GetByIdResponse$4 as GetByIdResponse, + GetByIdsResponse$2 as GetByIdsResponse, + GetPostsResponse$2 as GetPostsResponse, + SearchResponse$2 as SearchResponse, + }; +} + /** - * Response for getFollowedLists + * spaces client for the X API. * - * @public + * This module provides a client for interacting with the spaces endpoints of the X API. */ -type GetFollowedListsResponse = Get2UsersIdFollowedListsResponse; + /** - * Request for followList + * Options for getById method * * @public */ -type FollowListRequest = ListFollowedRequest; +interface GetByIdOptions$4 { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** - * Response for followList + * Options for getBuyers method * * @public */ -type FollowListResponse = ListFollowedResponse; -/** - * Request for likePost - * - * @public - */ -type LikePostRequest = UsersLikesCreateRequest; -/** - * Response for likePost - * - * @public - */ -type LikePostResponse = UsersLikesCreateResponse; -/** - * Response for getLikedPosts - * - * @public - */ -type GetLikedPostsResponse = Get2UsersIdLikedTweetsResponse; -/** - * Response for getByUsernames - * - * @public - */ -type GetByUsernamesResponse = Get2UsersByResponse; -/** - * Request for repostPost - * - * @public - */ -type RepostPostRequest = UsersRetweetsCreateRequest; -/** - * Response for repostPost - * - * @public - */ -type RepostPostResponse = UsersRetweetsCreateResponse; -/** - * Response for unfollowUser - * - * @public - */ -type UnfollowUserResponse = UsersFollowingDeleteResponse; -/** - * Response for getFollowers - * - * @public - */ -type GetFollowersResponse$1 = Get2UsersIdFollowersResponse; -/** - * Response for getByIds - * - * @public - */ -type GetByIdsResponse$2 = Get2UsersResponse; -/** - * Response for getBookmarksByFolderId - * - * @public - */ -type GetBookmarksByFolderIdResponse = BookmarkFolderPostsResponse; -/** - * Response for getBookmarkFolders - * - * @public - */ -type GetBookmarkFoldersResponse = BookmarkFoldersResponse; -/** - * Response for getFollowing - * - * @public - */ -type GetFollowingResponse = Get2UsersIdFollowingResponse; -/** - * Request for followUser - * - * @public - */ -type FollowUserRequest = UsersFollowingCreateRequest; -/** - * Response for followUser - * - * @public - */ -type FollowUserResponse = UsersFollowingCreateResponse; -/** - * Response for getTimeline - * - * @public - */ -type GetTimelineResponse = Get2UsersIdTimelinesReverseChronologicalResponse; -/** - * Response for unblockDms - * - * @public - */ -type UnblockDmsResponse = UsersDMUnBlockCreateResponse; -/** - * Response for getMentions - * - * @public - */ -type GetMentionsResponse = Get2UsersIdMentionsResponse; -/** - * Response for getListMemberships - * - * @public - */ -type GetListMembershipsResponse = Get2UsersIdListMembershipsResponse; -/** - * Response for getRepostsOfMe - * - * @public - */ -type GetRepostsOfMeResponse = Get2UsersRepostsOfMeResponse; - -type models$g_BlockDmsResponse = BlockDmsResponse; -type models$g_CreateBookmarkRequest = CreateBookmarkRequest; -type models$g_CreateBookmarkResponse = CreateBookmarkResponse; -type models$g_DeleteBookmarkResponse = DeleteBookmarkResponse; -type models$g_FollowListRequest = FollowListRequest; -type models$g_FollowListResponse = FollowListResponse; -type models$g_FollowUserRequest = FollowUserRequest; -type models$g_FollowUserResponse = FollowUserResponse; -type models$g_GetBlockingResponse = GetBlockingResponse; -type models$g_GetBookmarkFoldersResponse = GetBookmarkFoldersResponse; -type models$g_GetBookmarksByFolderIdResponse = GetBookmarksByFolderIdResponse; -type models$g_GetBookmarksResponse = GetBookmarksResponse; -type models$g_GetByUsernameResponse = GetByUsernameResponse; -type models$g_GetByUsernamesResponse = GetByUsernamesResponse; -type models$g_GetFollowedListsResponse = GetFollowedListsResponse; -type models$g_GetFollowingResponse = GetFollowingResponse; -type models$g_GetLikedPostsResponse = GetLikedPostsResponse; -type models$g_GetListMembershipsResponse = GetListMembershipsResponse; -type models$g_GetMeResponse = GetMeResponse; -type models$g_GetMentionsResponse = GetMentionsResponse; -type models$g_GetMutingResponse = GetMutingResponse; -type models$g_GetOwnedListsResponse = GetOwnedListsResponse; -type models$g_GetPinnedListsResponse = GetPinnedListsResponse; -type models$g_GetRepostsOfMeResponse = GetRepostsOfMeResponse; -type models$g_GetTimelineResponse = GetTimelineResponse; -type models$g_LikePostRequest = LikePostRequest; -type models$g_LikePostResponse = LikePostResponse; -type models$g_MuteUserRequest = MuteUserRequest; -type models$g_MuteUserResponse = MuteUserResponse; -type models$g_PinListRequest = PinListRequest; -type models$g_PinListResponse = PinListResponse; -type models$g_RepostPostRequest = RepostPostRequest; -type models$g_RepostPostResponse = RepostPostResponse; -type models$g_UnblockDmsResponse = UnblockDmsResponse; -type models$g_UnfollowListResponse = UnfollowListResponse; -type models$g_UnfollowUserResponse = UnfollowUserResponse; -type models$g_UnlikePostResponse = UnlikePostResponse; -type models$g_UnmuteUserResponse = UnmuteUserResponse; -type models$g_UnpinListResponse = UnpinListResponse; -type models$g_UnrepostPostResponse = UnrepostPostResponse; -declare namespace models$g { - export { - models$g_BlockDmsResponse as BlockDmsResponse, - models$g_CreateBookmarkRequest as CreateBookmarkRequest, - models$g_CreateBookmarkResponse as CreateBookmarkResponse, - models$g_DeleteBookmarkResponse as DeleteBookmarkResponse, - models$g_FollowListRequest as FollowListRequest, - models$g_FollowListResponse as FollowListResponse, - models$g_FollowUserRequest as FollowUserRequest, - models$g_FollowUserResponse as FollowUserResponse, - models$g_GetBlockingResponse as GetBlockingResponse, - models$g_GetBookmarkFoldersResponse as GetBookmarkFoldersResponse, - models$g_GetBookmarksByFolderIdResponse as GetBookmarksByFolderIdResponse, - models$g_GetBookmarksResponse as GetBookmarksResponse, - GetByIdResponse$4 as GetByIdResponse, - GetByIdsResponse$2 as GetByIdsResponse, - models$g_GetByUsernameResponse as GetByUsernameResponse, - models$g_GetByUsernamesResponse as GetByUsernamesResponse, - models$g_GetFollowedListsResponse as GetFollowedListsResponse, - GetFollowersResponse$1 as GetFollowersResponse, - models$g_GetFollowingResponse as GetFollowingResponse, - models$g_GetLikedPostsResponse as GetLikedPostsResponse, - models$g_GetListMembershipsResponse as GetListMembershipsResponse, - models$g_GetMeResponse as GetMeResponse, - models$g_GetMentionsResponse as GetMentionsResponse, - models$g_GetMutingResponse as GetMutingResponse, - models$g_GetOwnedListsResponse as GetOwnedListsResponse, - models$g_GetPinnedListsResponse as GetPinnedListsResponse, - GetPostsResponse$2 as GetPostsResponse, - models$g_GetRepostsOfMeResponse as GetRepostsOfMeResponse, - models$g_GetTimelineResponse as GetTimelineResponse, - models$g_LikePostRequest as LikePostRequest, - models$g_LikePostResponse as LikePostResponse, - models$g_MuteUserRequest as MuteUserRequest, - models$g_MuteUserResponse as MuteUserResponse, - models$g_PinListRequest as PinListRequest, - models$g_PinListResponse as PinListResponse, - models$g_RepostPostRequest as RepostPostRequest, - models$g_RepostPostResponse as RepostPostResponse, - SearchResponse$2 as SearchResponse, - models$g_UnblockDmsResponse as UnblockDmsResponse, - models$g_UnfollowListResponse as UnfollowListResponse, - models$g_UnfollowUserResponse as UnfollowUserResponse, - models$g_UnlikePostResponse as UnlikePostResponse, - models$g_UnmuteUserResponse as UnmuteUserResponse, - models$g_UnpinListResponse as UnpinListResponse, - models$g_UnrepostPostResponse as UnrepostPostResponse, - }; -} - -/** - * users client for the X API. - * - * This module provides a client for interacting with the users endpoints of the X API. - */ - -/** - * Options for getOwnedLists method - * - * @public - */ -interface GetOwnedListsOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; +interface GetBuyersOptions { /** This parameter is used to get a specified 'page' of results. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getBlocking method - * - * @public - */ -interface GetBlockingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByUsername method - * - * @public - */ -interface GetByUsernameOptions { /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; @@ -4502,27 +4667,9 @@ interface GetByUsernameOptions { * @public */ interface GetPostsOptions$2 { - /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of results. + /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The set of entities to exclude (e.g. 'replies' or 'retweets'). - * Also accepts: exclude or proper camelCase (e.g., exclude) */ - exclude?: Array; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -4547,558 +4694,624 @@ interface GetPostsOptions$2 { [key: string]: any; } /** - * Options for getBookmarks method + * Options for getByCreatorIds method * * @public */ -interface GetBookmarksOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +interface GetByCreatorIdsOptions { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getMuting method + * Options for getByIds method * * @public */ -interface GetMutingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; +interface GetByIdsOptions$2 { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for muteUser method + * Options for search method * * @public */ -interface MuteUserOptions { - /** Request body */ - body?: MuteUserRequest; +interface SearchOptions$2 { + /** The state of Spaces to search for. + * Also accepts: state or proper camelCase (e.g., state) */ + state?: string; + /** The number of results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getById method + * Client for spaces operations * - * @public + * This client provides methods for interacting with the spaces endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all spaces related operations. + * + * @category spaces */ -interface GetByIdOptions$4 { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; +declare class SpacesClient { + private client; + /** + * Creates a new spaces client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get space by ID + * Retrieves details of a specific space by its ID. + + + * @param id The ID of the Space to be retrieved. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getById(id: string, options?: GetByIdOptions$4): Promise; + /** + * Get Space ticket buyers + * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + + + * @param id The ID of the Space to be retrieved. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getBuyers(id: string, options?: GetBuyersOptions): Promise; + /** + * Get Space Posts + * Retrieves a list of Posts shared in a specific Space by its ID. + + + * @param id The ID of the Space to be retrieved. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getPosts(id: string, options?: GetPostsOptions$2): Promise; + /** + * Get Spaces by creator IDs + * Retrieves details of Spaces created by specified User IDs. + + + + * @param userIds The IDs of Users to search through. + + + + * @returns {Promise} Promise resolving to the API response + */ + getByCreatorIds(userIds: Array, options?: GetByCreatorIdsOptions): Promise; + /** + * Get Spaces by IDs + * Retrieves details of multiple Spaces by their IDs. + + + + * @param ids The list of Space IDs to return. + + + + * @returns {Promise} Promise resolving to the API response + */ + getByIds(ids: Array, options?: GetByIdsOptions$2): Promise; + /** + * Search Spaces + * Retrieves a list of Spaces matching the specified search query. + + + + * @param query The search query. + + + + * @returns {Promise} Promise resolving to the API response + */ + search(query: string, options?: SearchOptions$2): Promise; } + /** - * Options for getMe method + * Models for trends operations + */ + +/** + * Response for getPersonalized * * @public */ -interface GetMeOptions { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetPersonalizedResponse = Get2UsersPersonalizedTrendsResponse; /** - * Options for search method + * Response for getByWoeid * * @public */ -interface SearchOptions$2 { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; +type GetByWoeidResponse = Get2TrendsByWoeidWoeidResponse; +/** + * Response for getAi + * + * @public + */ +type GetAiResponse = Get2AiTrendsIdResponse; + +type models$c_GetAiResponse = GetAiResponse; +type models$c_GetByWoeidResponse = GetByWoeidResponse; +type models$c_GetPersonalizedResponse = GetPersonalizedResponse; +declare namespace models$c { + export { + models$c_GetAiResponse as GetAiResponse, + models$c_GetByWoeidResponse as GetByWoeidResponse, + models$c_GetPersonalizedResponse as GetPersonalizedResponse, + }; } + /** - * Options for getPinnedLists method + * trends client for the X API. + * + * This module provides a client for interacting with the trends endpoints of the X API. + */ + +/** + * Options for getPersonalized method * * @public */ -interface GetPinnedListsOptions { - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; +interface GetPersonalizedOptions { + /** A comma separated list of PersonalizedTrend fields to display. + * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */ + personalizedTrendFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getFollowedLists method + * Options for getByWoeid method * * @public */ -interface GetFollowedListsOptions { +interface GetByWoeidOptions { /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; + * Also accepts: max_trends or proper camelCase (e.g., maxTrends) */ + maxTrends?: number; + /** A comma separated list of Trend fields to display. + * Also accepts: trend.fields or proper camelCase (e.g., trendFields) */ + trendFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for followList method + * Options for getAi method * * @public */ -interface FollowListOptions { - /** Request body */ - body?: FollowListRequest; +interface GetAiOptions { + /** A comma separated list of News fields to display. + * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ + newsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for likePost method + * Client for trends operations * - * @public - */ -interface LikePostOptions { - /** Request body */ - body?: LikePostRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; + * This client provides methods for interacting with the trends endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all trends related operations. + * + * @category trends + */ +declare class TrendsClient { + private client; + /** + * Creates a new trends client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get personalized Trends + * Retrieves personalized trending topics for the authenticated user. + + + + * @returns {Promise} Promise resolving to the API response + */ + getPersonalized(options?: GetPersonalizedOptions): Promise; + /** + * Get Trends by WOEID + * Retrieves trending topics for a specific location identified by its WOEID. + + + * @param woeid The WOEID of the place to lookup a trend for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getByWoeid(woeid: number, options?: GetByWoeidOptions): Promise; + /** + * Get AI Trends by ID + * Retrieves an AI trend by its ID. + + + * @param id The ID of the ai trend. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getAi(id: string, options?: GetAiOptions): Promise; } + /** - * Options for getLikedPosts method + * Models for media operations + */ + +/** + * Response for getByKey * * @public */ -interface GetLikedPostsOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; +type GetByKeyResponse = Get2MediaMediaKeyResponse; +/** + * Request for createMetadata + * + * @public + */ +type CreateMetadataRequest = MetadataCreateRequest; +/** + * Response for createMetadata + * + * @public + */ +type CreateMetadataResponse = MetadataCreateResponse; +/** + * Response for finalizeUpload + * + * @public + */ +type FinalizeUploadResponse = MediaUploadResponse; +/** + * Request for appendUpload + * + * @public + */ +type AppendUploadRequest = MediaUploadAppendRequest; +/** + * Response for appendUpload + * + * @public + */ +type AppendUploadResponse = MediaUploadAppendResponse; +/** + * Request for initializeUpload + * + * @public + */ +type InitializeUploadRequest = MediaUploadConfigRequest; +/** + * Response for initializeUpload + * + * @public + */ +type InitializeUploadResponse = MediaUploadResponse; +/** + * Response for getByKeys + * + * @public + */ +type GetByKeysResponse = Get2MediaResponse; +/** + * Response for getUploadStatus + * + * @public + */ +type GetUploadStatusResponse = MediaUploadResponse; +/** + * Request for upload + * + * @public + */ +type UploadRequest = MediaUploadRequestOneShot; +/** + * Response for upload + * + * @public + */ +type UploadResponse = MediaUploadResponse; +/** + * Response for getAnalytics + * + * @public + */ +type GetAnalyticsResponse$1 = MediaAnalytics; +/** + * Request for createSubtitles + * + * @public + */ +type CreateSubtitlesRequest = SubtitlesCreateRequest; +/** + * Response for createSubtitles + * + * @public + */ +type CreateSubtitlesResponse = SubtitlesCreateResponse; +/** + * Request for deleteSubtitles + * + * @public + */ +type DeleteSubtitlesRequest = SubtitlesDeleteRequest; +/** + * Response for deleteSubtitles + * + * @public + */ +type DeleteSubtitlesResponse = SubtitlesDeleteResponse; + +type models$b_AppendUploadRequest = AppendUploadRequest; +type models$b_AppendUploadResponse = AppendUploadResponse; +type models$b_CreateMetadataRequest = CreateMetadataRequest; +type models$b_CreateMetadataResponse = CreateMetadataResponse; +type models$b_CreateSubtitlesRequest = CreateSubtitlesRequest; +type models$b_CreateSubtitlesResponse = CreateSubtitlesResponse; +type models$b_DeleteSubtitlesRequest = DeleteSubtitlesRequest; +type models$b_DeleteSubtitlesResponse = DeleteSubtitlesResponse; +type models$b_FinalizeUploadResponse = FinalizeUploadResponse; +type models$b_GetByKeyResponse = GetByKeyResponse; +type models$b_GetByKeysResponse = GetByKeysResponse; +type models$b_GetUploadStatusResponse = GetUploadStatusResponse; +type models$b_InitializeUploadRequest = InitializeUploadRequest; +type models$b_InitializeUploadResponse = InitializeUploadResponse; +type models$b_UploadRequest = UploadRequest; +type models$b_UploadResponse = UploadResponse; +declare namespace models$b { + export { + models$b_AppendUploadRequest as AppendUploadRequest, + models$b_AppendUploadResponse as AppendUploadResponse, + models$b_CreateMetadataRequest as CreateMetadataRequest, + models$b_CreateMetadataResponse as CreateMetadataResponse, + models$b_CreateSubtitlesRequest as CreateSubtitlesRequest, + models$b_CreateSubtitlesResponse as CreateSubtitlesResponse, + models$b_DeleteSubtitlesRequest as DeleteSubtitlesRequest, + models$b_DeleteSubtitlesResponse as DeleteSubtitlesResponse, + models$b_FinalizeUploadResponse as FinalizeUploadResponse, + GetAnalyticsResponse$1 as GetAnalyticsResponse, + models$b_GetByKeyResponse as GetByKeyResponse, + models$b_GetByKeysResponse as GetByKeysResponse, + models$b_GetUploadStatusResponse as GetUploadStatusResponse, + models$b_InitializeUploadRequest as InitializeUploadRequest, + models$b_InitializeUploadResponse as InitializeUploadResponse, + models$b_UploadRequest as UploadRequest, + models$b_UploadResponse as UploadResponse, + }; +} + +/** + * media client for the X API. + * + * This module provides a client for interacting with the media endpoints of the X API. + */ + +/** + * Options for getByKey method + * + * @public + */ +interface GetByKeyOptions { /** A comma separated list of Media fields to display. * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getByUsernames method + * Options for createMetadata method * * @public */ -interface GetByUsernamesOptions { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +interface CreateMetadataOptions { + /** Request body */ + body?: CreateMetadataRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for repostPost method + * Options for appendUpload method * * @public */ -interface RepostPostOptions { +interface AppendUploadOptions { /** Request body */ - body?: RepostPostRequest; + body?: AppendUploadRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getFollowers method + * Options for initializeUpload method * * @public */ -interface GetFollowersOptions$1 { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +interface InitializeUploadOptions { + /** Request body */ + body?: InitializeUploadRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getByIds method + * Options for getByKeys method * * @public */ -interface GetByIdsOptions$2 { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getBookmarkFolders method - * - * @public - */ -interface GetBookmarkFoldersOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; +interface GetByKeysOptions { + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getFollowing method + * Options for getUploadStatus method * * @public */ -interface GetFollowingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +interface GetUploadStatusOptions { + /** The command for the media upload request. + * Also accepts: command or proper camelCase (e.g., command) */ + command?: string; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for followUser method + * Options for upload method * * @public */ -interface FollowUserOptions { +interface UploadOptions { /** Request body */ - body?: FollowUserRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getTimeline method - * - * @public - */ -interface GetTimelineOptions { - /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The set of entities to exclude (e.g. 'replies' or 'retweets'). - * Also accepts: exclude or proper camelCase (e.g., exclude) */ - exclude?: Array; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + body?: UploadRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getMentions method + * Options for getAnalytics method * * @public */ -interface GetMentionsOptions { - /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; +interface GetAnalyticsOptions$1 { + /** A comma separated list of MediaAnalytics fields to display. + * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */ + mediaAnalyticsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getListMemberships method + * Options for createSubtitles method * * @public */ -interface GetListMembershipsOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; +interface CreateSubtitlesOptions { + /** Request body */ + body?: CreateSubtitlesRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getRepostsOfMe method + * Options for deleteSubtitles method * * @public */ -interface GetRepostsOfMeOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; +interface DeleteSubtitlesOptions { + /** Request body */ + body?: DeleteSubtitlesRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for users operations + * Client for media operations * - * This client provides methods for interacting with the users endpoints + * This client provides methods for interacting with the media endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all users related operations. + * parsing for all media related operations. * - * @category users + * @category media */ -declare class UsersClient { +declare class MediaClient { private client; /** - * Creates a new users client instance + * Creates a new media client instance * * @param client - The main X API client instance */ @@ -5109,527 +5322,140 @@ declare class UsersClient { */ private _normalizeOptions; /** - * Unlike Post - * Causes the authenticated user to Unlike a specific Post by its ID. + * Get Media by media key + * Retrieves details of a specific Media file by its media key. - * @param id The ID of the authenticated source User that is requesting to unlike the Post. + * @param mediaKey A single Media Key. - * @param tweetId The ID of the Post that the User is requesting to unlike. + * @returns {Promise} Promise resolving to the API response + */ + getByKey(mediaKey: string, options?: GetByKeyOptions): Promise; + /** + * Create Media metadata + * Creates metadata for a Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - unlikePost(id: string, tweetId: string): Promise; + createMetadata(options?: CreateMetadataOptions): Promise; /** - * Get owned Lists - * Retrieves a list of Lists owned by a specific User by their ID. + * Finalize Media upload + * Finalizes a Media upload request. - * @param id The ID of the User to lookup. + * @param id The media id of the targeted media to finalize. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getOwnedLists(id: string, options?: GetOwnedListsOptions): Promise; + finalizeUpload(id: string): Promise; /** - * Get blocking - * Retrieves a list of Users blocked by the specified User ID. + * Append Media upload + * Appends data to a Media upload request. - * @param id The ID of the authenticated source User for whom to return results. + * @param id The media identifier for the media to perform the append operation. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getBlocking(id: string, options?: GetBlockingOptions): Promise; + appendUpload(id: string, options?: AppendUploadOptions): Promise; /** - * Delete Bookmark - * Removes a Post from the authenticated user’s Bookmarks by its ID. + * Initialize media upload + * Initializes a media upload. - * @param id The ID of the authenticated source User whose bookmark is to be removed. + * @returns {Promise} Promise resolving to the API response + */ + initializeUpload(options?: InitializeUploadOptions): Promise; + /** + * Get Media by media keys + * Retrieves details of Media files by their media keys. - * @param tweetId The ID of the Post that the source User is removing from bookmarks. + * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response - */ - deleteBookmark(id: string, tweetId: string): Promise; - /** - * Get User by username - * Retrieves details of a specific User by their username. - - - * @param username A username. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getByUsername(username: string, options?: GetByUsernameOptions): Promise; - /** - * Unpin List - * Causes the authenticated user to unpin a specific List by its ID. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - * @param listId The ID of the List to unpin. - - - - - * @returns {Promise} Promise resolving to the API response - */ - unpinList(id: string, listId: string): Promise; - /** - * Get Posts - * Retrieves a list of posts authored by a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getPosts(id: string, options?: GetPostsOptions$2): Promise; - /** - * Get Bookmarks - * Retrieves a list of Posts bookmarked by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getBookmarks(id: string, options?: GetBookmarksOptions): Promise; - /** - * Create Bookmark - * Adds a post to the authenticated user’s bookmarks. - - - * @param id The ID of the authenticated source User for whom to add bookmarks. - - - - - * @param body Request body - - * @returns {Promise} Promise resolving to the API response - */ - createBookmark(id: string, body: CreateBookmarkRequest): Promise; - /** - * Block DMs - * Blocks direct messages to or from a specific User by their ID for the authenticated user. - - - * @param id The ID of the target User that the authenticated user requesting to block dms for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - blockDms(id: string): Promise; - /** - * Unfollow List - * Causes the authenticated user to unfollow a specific List by its ID. - - - * @param id The ID of the authenticated source User that will unfollow the List. - - - - * @param listId The ID of the List to unfollow. - - - - - * @returns {Promise} Promise resolving to the API response - */ - unfollowList(id: string, listId: string): Promise; - /** - * Get muting - * Retrieves a list of Users muted by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getMuting(id: string, options?: GetMutingOptions): Promise; - /** - * Mute User - * Causes the authenticated user to mute a specific User by their ID. - - - * @param id The ID of the authenticated source User that is requesting to mute the target User. - - - - - * @returns {Promise} Promise resolving to the API response - */ - muteUser(id: string, options?: MuteUserOptions): Promise; - /** - * Get User by ID - * Retrieves details of a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getById(id: string, options?: GetByIdOptions$4): Promise; - /** - * Get my User - * Retrieves details of the authenticated user. - - - - * @returns {Promise} Promise resolving to the API response - */ - getMe(options?: GetMeOptions): Promise; - /** - * Unrepost Post - * Causes the authenticated user to unrepost a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to repost the Post. - - - - * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. - - - - - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - unrepostPost(id: string, sourceTweetId: string): Promise; + getByKeys(mediaKeys: Array, options?: GetByKeysOptions): Promise; /** - * Unmute User - * Causes the authenticated user to unmute a specific user by their ID. - - - * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. - + * Get Media upload status + * Retrieves the status of a Media upload by its ID. - * @param targetUserId The ID of the User that the source User is requesting to unmute. + * @param mediaId Media id for the requested media upload status. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - unmuteUser(sourceUserId: string, targetUserId: string): Promise; + getUploadStatus(mediaId: any, options?: GetUploadStatusOptions): Promise; /** - * Search Users - * Retrieves a list of Users matching a search query. - - - - * @param query TThe the query string by which to query for users. + * Upload media + * Uploads a media file for use in posts or other content. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - search(query: any, options?: SearchOptions$2): Promise; + upload(options?: UploadOptions): Promise; /** - * Get pinned Lists - * Retrieves a list of Lists pinned by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - + * Get Media analytics + * Retrieves analytics data for media. - * @returns {Promise} Promise resolving to the API response - */ - getPinnedLists(id: string, options?: GetPinnedListsOptions): Promise; - /** - * Pin List - * Causes the authenticated user to pin a specific List by its ID. + * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @param id The ID of the authenticated source User that will pin the List. + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - * @param body Request body - * @returns {Promise} Promise resolving to the API response - */ - pinList(id: string, body: PinListRequest): Promise; - /** - * Get followed Lists - * Retrieves a list of Lists followed by a specific User by their ID. + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - * @param id The ID of the User to lookup. + * @param granularity The granularity for the search counts results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getFollowedLists(id: string, options?: GetFollowedListsOptions): Promise; + getAnalytics(mediaKeys: Array, endTime: string, startTime: string, granularity: string, options?: GetAnalyticsOptions$1): Promise; /** - * Follow List - * Causes the authenticated user to follow a specific List by its ID. - - - * @param id The ID of the authenticated source User that will follow the List. - + * Create Media subtitles + * Creates subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - followList(id: string, options?: FollowListOptions): Promise; + createSubtitles(options?: CreateSubtitlesOptions): Promise; /** - * Like Post - * Causes the authenticated user to Like a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to like the Post. - + * Delete Media subtitles + * Deletes subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - likePost(id: string, options?: LikePostOptions): Promise; - /** - * Get liked Posts - * Retrieves a list of Posts liked by a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getLikedPosts(id: string, options?: GetLikedPostsOptions): Promise; - /** - * Get Users by usernames - * Retrieves details of multiple Users by their usernames. - - - - * @param usernames A list of usernames, comma-separated. - - - - * @returns {Promise} Promise resolving to the API response - */ - getByUsernames(usernames: Array, options?: GetByUsernamesOptions): Promise; - /** - * Repost Post - * Causes the authenticated user to repost a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to repost the Post. - - - - - * @returns {Promise} Promise resolving to the API response - */ - repostPost(id: string, options?: RepostPostOptions): Promise; - /** - * Unfollow User - * Causes the authenticated user to unfollow a specific user by their ID. - - - * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. - - - - * @param targetUserId The ID of the User that the source User is requesting to unfollow. - - - - - * @returns {Promise} Promise resolving to the API response - */ - unfollowUser(sourceUserId: string, targetUserId: string): Promise; - /** - * Get followers - * Retrieves a list of Users who follow a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getFollowers(id: string, options?: GetFollowersOptions$1): Promise; - /** - * Get Users by IDs - * Retrieves details of multiple Users by their IDs. - - - - * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. - - - - * @returns {Promise} Promise resolving to the API response - */ - getByIds(ids: Array, options?: GetByIdsOptions$2): Promise; - /** - * Get Bookmarks by folder ID - * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getBookmarksByFolderId(id: string, folderId: string): Promise; - /** - * Get Bookmark folders - * Retrieves a list of Bookmark folders created by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getBookmarkFolders(id: string, options?: GetBookmarkFoldersOptions): Promise; - /** - * Get following - * Retrieves a list of Users followed by a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getFollowing(id: string, options?: GetFollowingOptions): Promise; - /** - * Follow User - * Causes the authenticated user to follow a specific user by their ID. - - - * @param id The ID of the authenticated source User that is requesting to follow the target User. - - - - - * @returns {Promise} Promise resolving to the API response - */ - followUser(id: string, options?: FollowUserOptions): Promise; - /** - * Get Timeline - * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. - - - * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getTimeline(id: string, options?: GetTimelineOptions): Promise; - /** - * Unblock DMs - * Unblocks direct messages to or from a specific User by their ID for the authenticated user. - - - * @param id The ID of the target User that the authenticated user requesting to unblock dms for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - unblockDms(id: string): Promise; - /** - * Get mentions - * Retrieves a list of Posts that mention a specific User by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getMentions(id: string, options?: GetMentionsOptions): Promise; - /** - * Get List memberships - * Retrieves a list of Lists that a specific User is a member of by their ID. - - - * @param id The ID of the User to lookup. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getListMemberships(id: string, options?: GetListMembershipsOptions): Promise; - /** - * Get Reposts of me - * Retrieves a list of Posts that repost content from the authenticated user. - - - - * @returns {Promise} Promise resolving to the API response - */ - getRepostsOfMe(options?: GetRepostsOfMeOptions): Promise; + deleteSubtitles(options?: DeleteSubtitlesOptions): Promise; } /** @@ -5637,96 +5463,96 @@ declare class UsersClient { */ /** - * Response for getEventsByParticipantId + * Request for createByParticipantId * * @public */ -type GetEventsByParticipantIdResponse = Get2DmConversationsWithParticipantIdDmEventsResponse; +type CreateByParticipantIdRequest = CreateMessageRequest; /** - * Request for createByConversationId + * Response for createByParticipantId * * @public */ -type CreateByConversationIdRequest = CreateMessageRequest; +type CreateByParticipantIdResponse = CreateDmEventResponse; /** - * Response for createByConversationId + * Response for getEvents * * @public */ -type CreateByConversationIdResponse = CreateDmEventResponse; +type GetEventsResponse = Get2DmEventsResponse; /** - * Request for createByParticipantId + * Response for getEventsByParticipantId * * @public */ -type CreateByParticipantIdRequest = CreateMessageRequest; +type GetEventsByParticipantIdResponse = Get2DmConversationsWithParticipantIdDmEventsResponse; /** - * Response for createByParticipantId + * Response for getEventsByConversationId * * @public */ -type CreateByParticipantIdResponse = CreateDmEventResponse; +type GetEventsByConversationIdResponse = Get2DmConversationsIdDmEventsResponse; /** - * Request for createConversation + * Response for getEventsById * * @public */ -type CreateConversationRequest = CreateDmConversationRequest; +type GetEventsByIdResponse = Get2DmEventsEventIdResponse; /** - * Response for createConversation + * Response for deleteEvents * * @public */ -type CreateConversationResponse = CreateDmEventResponse; +type DeleteEventsResponse = DeleteDmResponse; /** - * Response for getEventsById + * Request for createByConversationId * * @public */ -type GetEventsByIdResponse = Get2DmEventsEventIdResponse; +type CreateByConversationIdRequest = CreateMessageRequest; /** - * Response for deleteEvents + * Response for createByConversationId * * @public */ -type DeleteEventsResponse = DeleteDmResponse; +type CreateByConversationIdResponse = CreateDmEventResponse; /** - * Response for getEvents + * Request for createConversation * * @public */ -type GetEventsResponse = Get2DmEventsResponse; +type CreateConversationRequest = CreateDmConversationRequest; /** - * Response for getEventsByConversationId + * Response for createConversation * * @public */ -type GetEventsByConversationIdResponse = Get2DmConversationsIdDmEventsResponse; +type CreateConversationResponse = CreateDmEventResponse; -type models$f_CreateByConversationIdRequest = CreateByConversationIdRequest; -type models$f_CreateByConversationIdResponse = CreateByConversationIdResponse; -type models$f_CreateByParticipantIdRequest = CreateByParticipantIdRequest; -type models$f_CreateByParticipantIdResponse = CreateByParticipantIdResponse; -type models$f_CreateConversationRequest = CreateConversationRequest; -type models$f_CreateConversationResponse = CreateConversationResponse; -type models$f_DeleteEventsResponse = DeleteEventsResponse; -type models$f_GetEventsByConversationIdResponse = GetEventsByConversationIdResponse; -type models$f_GetEventsByIdResponse = GetEventsByIdResponse; -type models$f_GetEventsByParticipantIdResponse = GetEventsByParticipantIdResponse; -type models$f_GetEventsResponse = GetEventsResponse; -declare namespace models$f { +type models$a_CreateByConversationIdRequest = CreateByConversationIdRequest; +type models$a_CreateByConversationIdResponse = CreateByConversationIdResponse; +type models$a_CreateByParticipantIdRequest = CreateByParticipantIdRequest; +type models$a_CreateByParticipantIdResponse = CreateByParticipantIdResponse; +type models$a_CreateConversationRequest = CreateConversationRequest; +type models$a_CreateConversationResponse = CreateConversationResponse; +type models$a_DeleteEventsResponse = DeleteEventsResponse; +type models$a_GetEventsByConversationIdResponse = GetEventsByConversationIdResponse; +type models$a_GetEventsByIdResponse = GetEventsByIdResponse; +type models$a_GetEventsByParticipantIdResponse = GetEventsByParticipantIdResponse; +type models$a_GetEventsResponse = GetEventsResponse; +declare namespace models$a { export { - models$f_CreateByConversationIdRequest as CreateByConversationIdRequest, - models$f_CreateByConversationIdResponse as CreateByConversationIdResponse, - models$f_CreateByParticipantIdRequest as CreateByParticipantIdRequest, - models$f_CreateByParticipantIdResponse as CreateByParticipantIdResponse, - models$f_CreateConversationRequest as CreateConversationRequest, - models$f_CreateConversationResponse as CreateConversationResponse, - models$f_DeleteEventsResponse as DeleteEventsResponse, - models$f_GetEventsByConversationIdResponse as GetEventsByConversationIdResponse, - models$f_GetEventsByIdResponse as GetEventsByIdResponse, - models$f_GetEventsByParticipantIdResponse as GetEventsByParticipantIdResponse, - models$f_GetEventsResponse as GetEventsResponse, + models$a_CreateByConversationIdRequest as CreateByConversationIdRequest, + models$a_CreateByConversationIdResponse as CreateByConversationIdResponse, + models$a_CreateByParticipantIdRequest as CreateByParticipantIdRequest, + models$a_CreateByParticipantIdResponse as CreateByParticipantIdResponse, + models$a_CreateConversationRequest as CreateConversationRequest, + models$a_CreateConversationResponse as CreateConversationResponse, + models$a_DeleteEventsResponse as DeleteEventsResponse, + models$a_GetEventsByConversationIdResponse as GetEventsByConversationIdResponse, + models$a_GetEventsByIdResponse as GetEventsByIdResponse, + models$a_GetEventsByParticipantIdResponse as GetEventsByParticipantIdResponse, + models$a_GetEventsResponse as GetEventsResponse, }; } @@ -5737,11 +5563,24 @@ declare namespace models$f { */ /** - * Options for getEventsByParticipantId method + * Options for createByParticipantId method * * @public */ -interface GetEventsByParticipantIdOptions { +interface CreateByParticipantIdOptions { + /** Request body */ + body?: CreateByParticipantIdRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getEvents method + * + * @public + */ +interface GetEventsOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -5772,50 +5611,20 @@ interface GetEventsByParticipantIdOptions { [key: string]: any; } /** - * Options for createByConversationId method - * - * @public - */ -interface CreateByConversationIdOptions { - /** Request body */ - body?: CreateByConversationIdRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for createByParticipantId method - * - * @public - */ -interface CreateByParticipantIdOptions { - /** Request body */ - body?: CreateByParticipantIdRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for createConversation method - * - * @public - */ -interface CreateConversationOptions { - /** Request body */ - body?: CreateConversationRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getEventsById method + * Options for getEventsByParticipantId method * * @public */ -interface GetEventsByIdOptions { +interface GetEventsByParticipantIdOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** The set of event_types to include in the results. + * Also accepts: event_types or proper camelCase (e.g., eventTypes) */ + eventTypes?: Array; /** A comma separated list of DmEvent fields to display. * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */ dmEventFields?: Array; @@ -5837,11 +5646,11 @@ interface GetEventsByIdOptions { [key: string]: any; } /** - * Options for getEvents method + * Options for getEventsByConversationId method * * @public */ -interface GetEventsOptions { +interface GetEventsByConversationIdOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -5872,20 +5681,11 @@ interface GetEventsOptions { [key: string]: any; } /** - * Options for getEventsByConversationId method + * Options for getEventsById method * * @public */ -interface GetEventsByConversationIdOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The set of event_types to include in the results. - * Also accepts: event_types or proper camelCase (e.g., eventTypes) */ - eventTypes?: Array; +interface GetEventsByIdOptions { /** A comma separated list of DmEvent fields to display. * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */ dmEventFields?: Array; @@ -5906,6 +5706,32 @@ interface GetEventsByConversationIdOptions { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for createByConversationId method + * + * @public + */ +interface CreateByConversationIdOptions { + /** Request body */ + body?: CreateByConversationIdRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for createConversation method + * + * @public + */ +interface CreateConversationOptions { + /** Request body */ + body?: CreateConversationRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** * Client for direct messages operations * @@ -5929,53 +5755,53 @@ declare class DirectMessagesClient { */ private _normalizeOptions; /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. + * Create DM message by participant ID + * Sends a new direct message to a specific participant by their ID. - * @param participantId The ID of the participant user for the One to One DM conversation. + * @param participantId The ID of the recipient user that will receive the DM. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getEventsByParticipantId(participantId: string, options?: GetEventsByParticipantIdOptions): Promise; + createByParticipantId(participantId: string, options?: CreateByParticipantIdOptions): Promise; /** - * Create DM message by conversation ID - * Sends a new direct message to a specific conversation by its ID. - - - * @param dmConversationId The DM Conversation ID. - + * Get DM events + * Retrieves a list of recent direct message events across all conversations. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createByConversationId(dmConversationId: string, options?: CreateByConversationIdOptions): Promise; + getEvents(options?: GetEventsOptions): Promise; /** - * Create DM message by participant ID - * Sends a new direct message to a specific participant by their ID. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. - * @param participantId The ID of the recipient user that will receive the DM. + * @param participantId The ID of the participant user for the One to One DM conversation. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createByParticipantId(participantId: string, options?: CreateByParticipantIdOptions): Promise; + getEventsByParticipantId(participantId: string, options?: GetEventsByParticipantIdOptions): Promise; /** - * Create DM conversation - * Initiates a new direct message conversation with specified participants. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. + + * @param id The DM conversation ID. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ - createConversation(options?: CreateConversationOptions): Promise; + getEventsByConversationId(id: string, options?: GetEventsByConversationIdOptions): Promise; /** * Get DM event by ID * Retrieves details of a specific direct message event by its ID. @@ -6003,113 +5829,210 @@ declare class DirectMessagesClient { */ deleteEvents(eventId: string): Promise; /** - * Get DM events - * Retrieves a list of recent direct message events across all conversations. + * Create DM message by conversation ID + * Sends a new direct message to a specific conversation by its ID. + * @param dmConversationId The DM Conversation ID. - * @returns {Promise} Promise resolving to the API response - */ - getEvents(options?: GetEventsOptions): Promise; - /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. - * @param id The DM conversation ID. + * @returns {Promise} Promise resolving to the API response + */ + createByConversationId(dmConversationId: string, options?: CreateByConversationIdOptions): Promise; + /** + * Create DM conversation + * Initiates a new direct message conversation with specified participants. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getEventsByConversationId(id: string, options?: GetEventsByConversationIdOptions): Promise; + createConversation(options?: CreateConversationOptions): Promise; } /** - * Models for community notes operations + * Models for posts operations */ /** - * Response for delete + * Response for getInsights28hr * * @public */ -type DeleteResponse$3 = DeleteNoteResponse; +type GetInsights28hrResponse = Get2Insights28hrResponse; /** - * Response for searchEligiblePosts + * Response for getReposts * * @public */ -type SearchEligiblePostsResponse = Get2NotesSearchPostsEligibleForNotesResponse; +type GetRepostsResponse = Get2TweetsIdRetweetsResponse; /** - * Request for evaluate + * Response for searchAll * * @public */ -type EvaluateRequest = EvaluateNoteRequest; +type SearchAllResponse = Get2TweetsSearchAllResponse; /** - * Response for evaluate + * Response for getInsightsHistorical * * @public */ -type EvaluateResponse = EvaluateNoteResponse; +type GetInsightsHistoricalResponse = Get2InsightsHistoricalResponse; /** - * Response for searchWritten + * Response for getById * * @public */ -type SearchWrittenResponse = Get2NotesSearchNotesWrittenResponse; +type GetByIdResponse$3 = Get2TweetsIdResponse; +/** + * Response for delete + * + * @public + */ +type DeleteResponse$3 = TweetDeleteResponse; +/** + * Response for getAnalytics + * + * @public + */ +type GetAnalyticsResponse = Analytics; +/** + * Response for getByIds + * + * @public + */ +type GetByIdsResponse$1 = Get2TweetsResponse; /** * Request for create * * @public */ -type CreateRequest$3 = CreateNoteRequest; +type CreateRequest$3 = TweetCreateRequest; /** * Response for create * * @public */ -type CreateResponse$3 = CreateNoteResponse; +type CreateResponse$3 = TweetCreateResponse; +/** + * Response for getCountsRecent + * + * @public + */ +type GetCountsRecentResponse = Get2TweetsCountsRecentResponse; +/** + * Response for getCountsAll + * + * @public + */ +type GetCountsAllResponse = Get2TweetsCountsAllResponse; +/** + * Response for searchRecent + * + * @public + */ +type SearchRecentResponse = Get2TweetsSearchRecentResponse; +/** + * Request for hideReply + * + * @public + */ +type HideReplyRequest = TweetHideRequest; +/** + * Response for hideReply + * + * @public + */ +type HideReplyResponse = TweetHideResponse; +/** + * Response for getRepostedBy + * + * @public + */ +type GetRepostedByResponse = Get2TweetsIdRetweetedByResponse; +/** + * Response for getQuoted + * + * @public + */ +type GetQuotedResponse = Get2TweetsIdQuoteTweetsResponse; +/** + * Response for getLikingUsers + * + * @public + */ +type GetLikingUsersResponse = Get2TweetsIdLikingUsersResponse; -type models$e_EvaluateRequest = EvaluateRequest; -type models$e_EvaluateResponse = EvaluateResponse; -type models$e_SearchEligiblePostsResponse = SearchEligiblePostsResponse; -type models$e_SearchWrittenResponse = SearchWrittenResponse; -declare namespace models$e { +type models$9_GetAnalyticsResponse = GetAnalyticsResponse; +type models$9_GetCountsAllResponse = GetCountsAllResponse; +type models$9_GetCountsRecentResponse = GetCountsRecentResponse; +type models$9_GetInsights28hrResponse = GetInsights28hrResponse; +type models$9_GetInsightsHistoricalResponse = GetInsightsHistoricalResponse; +type models$9_GetLikingUsersResponse = GetLikingUsersResponse; +type models$9_GetQuotedResponse = GetQuotedResponse; +type models$9_GetRepostedByResponse = GetRepostedByResponse; +type models$9_GetRepostsResponse = GetRepostsResponse; +type models$9_HideReplyRequest = HideReplyRequest; +type models$9_HideReplyResponse = HideReplyResponse; +type models$9_SearchAllResponse = SearchAllResponse; +type models$9_SearchRecentResponse = SearchRecentResponse; +declare namespace models$9 { export { CreateRequest$3 as CreateRequest, CreateResponse$3 as CreateResponse, DeleteResponse$3 as DeleteResponse, - models$e_EvaluateRequest as EvaluateRequest, - models$e_EvaluateResponse as EvaluateResponse, - models$e_SearchEligiblePostsResponse as SearchEligiblePostsResponse, - models$e_SearchWrittenResponse as SearchWrittenResponse, + models$9_GetAnalyticsResponse as GetAnalyticsResponse, + GetByIdResponse$3 as GetByIdResponse, + GetByIdsResponse$1 as GetByIdsResponse, + models$9_GetCountsAllResponse as GetCountsAllResponse, + models$9_GetCountsRecentResponse as GetCountsRecentResponse, + models$9_GetInsights28hrResponse as GetInsights28hrResponse, + models$9_GetInsightsHistoricalResponse as GetInsightsHistoricalResponse, + models$9_GetLikingUsersResponse as GetLikingUsersResponse, + models$9_GetQuotedResponse as GetQuotedResponse, + models$9_GetRepostedByResponse as GetRepostedByResponse, + models$9_GetRepostsResponse as GetRepostsResponse, + models$9_HideReplyRequest as HideReplyRequest, + models$9_HideReplyResponse as HideReplyResponse, + models$9_SearchAllResponse as SearchAllResponse, + models$9_SearchRecentResponse as SearchRecentResponse, }; } /** - * community notes client for the X API. + * posts client for the X API. * - * This module provides a client for interacting with the community notes endpoints of the X API. + * This module provides a client for interacting with the posts endpoints of the X API. */ /** - * Options for searchEligiblePosts method + * Options for getInsights28hr method * * @public */ -interface SearchEligiblePostsOptions { - /** Pagination token to get next set of posts eligible for notes. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: string; - /** Max results to return. +interface GetInsights28hrOptions { + /** A comma separated list of Engagement fields to display. + * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ + engagementFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getReposts method + * + * @public + */ +interface GetRepostsOptions { + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. - * Also accepts: post_selection or proper camelCase (e.g., postSelection) */ - postSelection?: string; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -6134,329 +6057,146 @@ interface SearchEligiblePostsOptions { [key: string]: any; } /** - * Options for evaluate method + * Options for searchAll method * * @public */ -interface EvaluateOptions { - /** Request body */ - body?: EvaluateRequest; +interface SearchAllOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** Returns results with a Post ID less than (that is, older than) the specified ID. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of search results to be returned by a request. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** This order in which to return results. + * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ + sortOrder?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for searchWritten method + * Options for getInsightsHistorical method * * @public */ -interface SearchWrittenOptions { - /** Pagination token to get next set of posts eligible for notes. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: string; - /** Max results to return. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** A comma separated list of Note fields to display. - * Also accepts: note.fields or proper camelCase (e.g., noteFields) */ - noteFields?: Array; +interface GetInsightsHistoricalOptions { + /** A comma separated list of Engagement fields to display. + * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ + engagementFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for create method + * Options for getById method * * @public */ -interface CreateOptions$2 { - /** Request body */ - body?: CreateRequest$3; +interface GetByIdOptions$3 { + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for community notes operations - * - * This client provides methods for interacting with the community notes endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all community notes related operations. - * - * @category community notes - */ -declare class CommunityNotesClient { - private client; - /** - * Creates a new community notes client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; - /** - * Delete a Community Note - * Deletes a community note. - - - * @param id The community note id to delete. - - - - - * @returns {Promise} Promise resolving to the API response - */ - delete(id: string): Promise; - /** - * Search for Posts Eligible for Community Notes - * Returns all the posts that are eligible for community notes. - - - - * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. - - - - * @returns {Promise} Promise resolving to the API response - */ - searchEligiblePosts(testMode: boolean, options?: SearchEligiblePostsOptions): Promise; - /** - * Evaluate a Community Note - * Endpoint to evaluate a community note. - - - - * @returns {Promise} Promise resolving to the API response - */ - evaluate(options?: EvaluateOptions): Promise; - /** - * Search for Community Notes Written - * Returns all the community notes written by the user. - - - - * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. - - - - * @returns {Promise} Promise resolving to the API response - */ - searchWritten(testMode: boolean, options?: SearchWrittenOptions): Promise; - /** - * Create a Community Note - * Creates a community note endpoint for LLM use case. - - - - * @returns {Promise} Promise resolving to the API response - */ - create(options?: CreateOptions$2): Promise; -} - -/** - * Models for posts operations - */ - -/** - * Request for hideReply - * - * @public - */ -type HideReplyRequest = TweetHideRequest; -/** - * Response for hideReply - * - * @public - */ -type HideReplyResponse = TweetHideResponse; -/** - * Response for getAnalytics - * - * @public - */ -type GetAnalyticsResponse$1 = Analytics; -/** - * Response for getInsightsHistorical + * Options for getAnalytics method * * @public */ -type GetInsightsHistoricalResponse = Get2InsightsHistoricalResponse; +interface GetAnalyticsOptions { + /** A comma separated list of Analytics fields to display. + * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */ + analyticsFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** - * Response for getCountsRecent + * Options for getByIds method * * @public */ -type GetCountsRecentResponse = Get2TweetsCountsRecentResponse; +interface GetByIdsOptions$1 { + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** - * Response for getCountsAll - * - * @public - */ -type GetCountsAllResponse = Get2TweetsCountsAllResponse; -/** - * Response for getReposts - * - * @public - */ -type GetRepostsResponse = Get2TweetsIdRetweetsResponse; -/** - * Response for getById - * - * @public - */ -type GetByIdResponse$3 = Get2TweetsIdResponse; -/** - * Response for delete - * - * @public - */ -type DeleteResponse$2 = TweetDeleteResponse; -/** - * Response for getRepostedBy - * - * @public - */ -type GetRepostedByResponse = Get2TweetsIdRetweetedByResponse; -/** - * Response for getInsights28hr - * - * @public - */ -type GetInsights28hrResponse = Get2Insights28hrResponse; -/** - * Response for getByIds - * - * @public - */ -type GetByIdsResponse$1 = Get2TweetsResponse; -/** - * Request for create - * - * @public - */ -type CreateRequest$2 = TweetCreateRequest; -/** - * Response for create - * - * @public - */ -type CreateResponse$2 = TweetCreateResponse; -/** - * Response for getLikingUsers - * - * @public - */ -type GetLikingUsersResponse = Get2TweetsIdLikingUsersResponse; -/** - * Response for searchAll - * - * @public - */ -type SearchAllResponse = Get2TweetsSearchAllResponse; -/** - * Response for getQuoted - * - * @public - */ -type GetQuotedResponse = Get2TweetsIdQuoteTweetsResponse; -/** - * Response for searchRecent - * - * @public - */ -type SearchRecentResponse = Get2TweetsSearchRecentResponse; - -type models$d_GetCountsAllResponse = GetCountsAllResponse; -type models$d_GetCountsRecentResponse = GetCountsRecentResponse; -type models$d_GetInsights28hrResponse = GetInsights28hrResponse; -type models$d_GetInsightsHistoricalResponse = GetInsightsHistoricalResponse; -type models$d_GetLikingUsersResponse = GetLikingUsersResponse; -type models$d_GetQuotedResponse = GetQuotedResponse; -type models$d_GetRepostedByResponse = GetRepostedByResponse; -type models$d_GetRepostsResponse = GetRepostsResponse; -type models$d_HideReplyRequest = HideReplyRequest; -type models$d_HideReplyResponse = HideReplyResponse; -type models$d_SearchAllResponse = SearchAllResponse; -type models$d_SearchRecentResponse = SearchRecentResponse; -declare namespace models$d { - export { - CreateRequest$2 as CreateRequest, - CreateResponse$2 as CreateResponse, - DeleteResponse$2 as DeleteResponse, - GetAnalyticsResponse$1 as GetAnalyticsResponse, - GetByIdResponse$3 as GetByIdResponse, - GetByIdsResponse$1 as GetByIdsResponse, - models$d_GetCountsAllResponse as GetCountsAllResponse, - models$d_GetCountsRecentResponse as GetCountsRecentResponse, - models$d_GetInsights28hrResponse as GetInsights28hrResponse, - models$d_GetInsightsHistoricalResponse as GetInsightsHistoricalResponse, - models$d_GetLikingUsersResponse as GetLikingUsersResponse, - models$d_GetQuotedResponse as GetQuotedResponse, - models$d_GetRepostedByResponse as GetRepostedByResponse, - models$d_GetRepostsResponse as GetRepostsResponse, - models$d_HideReplyRequest as HideReplyRequest, - models$d_HideReplyResponse as HideReplyResponse, - models$d_SearchAllResponse as SearchAllResponse, - models$d_SearchRecentResponse as SearchRecentResponse, - }; -} - -/** - * posts client for the X API. - * - * This module provides a client for interacting with the posts endpoints of the X API. - */ - -/** - * Options for hideReply method - * - * @public - */ -interface HideReplyOptions { - /** Request body */ - body?: HideReplyRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getAnalytics method - * - * @public - */ -interface GetAnalyticsOptions$1 { - /** A comma separated list of Analytics fields to display. - * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */ - analyticsFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getInsightsHistorical method - * - * @public - */ -interface GetInsightsHistoricalOptions { - /** A comma separated list of Engagement fields to display. - * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ - engagementFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getCountsRecent method + * Options for getCountsRecent method * * @public */ @@ -6526,17 +6266,35 @@ interface GetCountsAllOptions { [key: string]: any; } /** - * Options for getReposts method + * Options for searchRecent method * * @public */ -interface GetRepostsOptions { - /** The maximum number of results. +interface SearchRecentOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** Returns results with a Post ID less than (that is, older than) the specified ID. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of search results to be returned by a request. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; + /** This order in which to return results. + * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ + sortOrder?: string; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -6561,29 +6319,13 @@ interface GetRepostsOptions { [key: string]: any; } /** - * Options for getById method + * Options for hideReply method * * @public */ -interface GetByIdOptions$3 { - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; +interface HideReplyOptions { + /** Request body */ + body?: HideReplyRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ @@ -6616,25 +6358,20 @@ interface GetRepostedByOptions { [key: string]: any; } /** - * Options for getInsights28hr method - * - * @public - */ -interface GetInsights28hrOptions { - /** A comma separated list of Engagement fields to display. - * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ - engagementFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByIds method + * Options for getQuoted method * * @public */ -interface GetByIdsOptions$1 { +interface GetQuotedOptions { + /** The maximum number of results to be returned. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** The set of entities to exclude (e.g. 'replies' or 'retweets'). + * Also accepts: exclude or proper camelCase (e.g., exclude) */ + exclude?: Array; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -6685,157 +6422,13 @@ interface GetLikingUsersOptions { [key: string]: any; } /** - * Options for searchAll method + * Client for posts operations * - * @public - */ -interface SearchAllOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** Returns results with a Post ID less than (that is, older than) the specified ID. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of search results to be returned by a request. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** This order in which to return results. - * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ - sortOrder?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getQuoted method - * - * @public - */ -interface GetQuotedOptions { - /** The maximum number of results to be returned. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The set of entities to exclude (e.g. 'replies' or 'retweets'). - * Also accepts: exclude or proper camelCase (e.g., exclude) */ - exclude?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for searchRecent method - * - * @public - */ -interface SearchRecentOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - /** Returns results with a Post ID less than (that is, older than) the specified ID. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - /** The maximum number of search results to be returned by a request. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** This order in which to return results. - * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ - sortOrder?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Client for posts operations - * - * This client provides methods for interacting with the posts endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all posts related operations. - * - * @category posts + * This client provides methods for interacting with the posts endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all posts related operations. + * + * @category posts */ declare class PostsClient { private client; @@ -6851,43 +6444,52 @@ declare class PostsClient { */ private _normalizeOptions; /** - * Hide reply - * Hides or unhides a reply to a conversation owned by the authenticated user. + * Get 28-hour Post insights + * Retrieves engagement metrics for specified Posts over the last 28 hours. - * @param tweetId The ID of the reply that you want to hide or unhide. + * @param tweetIds List of PostIds for 28hr metrics. - * @returns {Promise} Promise resolving to the API response - */ - hideReply(tweetId: string, options?: HideReplyOptions): Promise; - /** - * Get Post analytics - * Retrieves analytics data for specified Posts within a defined time range. + * @param granularity granularity of metrics response. - * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. + * @param requestedMetrics request metrics for historical request. - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + * @returns {Promise} Promise resolving to the API response + */ + getInsights28hr(tweetIds: Array, granularity: string, requestedMetrics: Array, options?: GetInsights28hrOptions): Promise; + /** + * Get Reposts + * Retrieves a list of Posts that repost a specific Post by its ID. + * @param id A single Post ID. - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - * @param granularity The granularity for the search counts results. + * @returns {Promise} Promise resolving to the API response + */ + getReposts(id: string, options?: GetRepostsOptions): Promise; + /** + * Search all Posts + * Retrieves Posts from the full archive matching a search query. - * @returns {Promise} Promise resolving to the API response + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. + + + + * @returns {Promise} Promise resolving to the API response */ - getAnalytics(ids: Array, endTime: string, startTime: string, granularity: string, options?: GetAnalyticsOptions$1): Promise; + searchAll(query: string, options?: SearchAllOptions): Promise; /** * Get historical Post insights * Retrieves historical engagement metrics for specified Posts within a defined time range. @@ -6917,45 +6519,6 @@ declare class PostsClient { * @returns {Promise} Promise resolving to the API response */ getInsightsHistorical(tweetIds: Array, endTime: string, startTime: string, granularity: string, requestedMetrics: Array, options?: GetInsightsHistoricalOptions): Promise; - /** - * Get count of recent Posts - * Retrieves the count of Posts from the last 7 days matching a search query. - - - - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - - - - * @returns {Promise} Promise resolving to the API response - */ - getCountsRecent(query: string, options?: GetCountsRecentOptions): Promise; - /** - * Get count of all Posts - * Retrieves the count of Posts matching a search query from the full archive. - - - - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - - - - * @returns {Promise} Promise resolving to the API response - */ - getCountsAll(query: string, options?: GetCountsAllOptions): Promise; - /** - * Get Reposts - * Retrieves a list of Posts that repost a specific Post by its ID. - - - * @param id A single Post ID. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getReposts(id: string, options?: GetRepostsOptions): Promise; /** * Get Post by ID * Retrieves details of a specific Post by its ID. @@ -6981,41 +6544,32 @@ declare class PostsClient { * @returns {Promise} Promise resolving to the API response */ - delete(id: string): Promise; + delete(id: string): Promise; /** - * Get Reposted by - * Retrieves a list of Users who reposted a specific Post by its ID. - - - * @param id A single Post ID. - + * Get Post analytics + * Retrieves analytics data for specified Posts within a defined time range. - * @returns {Promise} Promise resolving to the API response - */ - getRepostedBy(id: string, options?: GetRepostedByOptions): Promise; - /** - * Get 28-hour Post insights - * Retrieves engagement metrics for specified Posts over the last 28 hours. + * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. - * @param tweetIds List of PostIds for 28hr metrics. + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - * @param granularity granularity of metrics response. + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - * @param requestedMetrics request metrics for historical request. + * @param granularity The granularity for the search counts results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getInsights28hr(tweetIds: Array, granularity: string, requestedMetrics: Array, options?: GetInsights28hrOptions): Promise; + getAnalytics(ids: Array, endTime: string, startTime: string, granularity: string, options?: GetAnalyticsOptions): Promise; /** * Get Posts by IDs * Retrieves details of multiple Posts by their IDs. @@ -7039,23 +6593,23 @@ declare class PostsClient { * @returns {Promise} Promise resolving to the API response */ - create(body: CreateRequest$2): Promise; + create(body: CreateRequest$3): Promise; /** - * Get Liking Users - * Retrieves a list of Users who liked a specific Post by its ID. + * Get count of recent Posts + * Retrieves the count of Posts from the last 7 days matching a search query. - * @param id A single Post ID. + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getLikingUsers(id: string, options?: GetLikingUsersOptions): Promise; + getCountsRecent(query: string, options?: GetCountsRecentOptions): Promise; /** - * Search all Posts - * Retrieves Posts from the full archive matching a search query. + * Get count of all Posts + * Retrieves the count of Posts matching a search query from the full archive. @@ -7063,515 +6617,259 @@ declare class PostsClient { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - searchAll(query: string, options?: SearchAllOptions): Promise; + getCountsAll(query: string, options?: GetCountsAllOptions): Promise; /** - * Get Quoted Posts - * Retrieves a list of Posts that quote a specific Post by its ID. + * Search recent Posts + * Retrieves Posts from the last 7 days matching a search query. - * @param id A single Post ID. + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getQuoted(id: string, options?: GetQuotedOptions): Promise; + searchRecent(query: string, options?: SearchRecentOptions): Promise; /** - * Search recent Posts - * Retrieves Posts from the last 7 days matching a search query. + * Hide reply + * Hides or unhides a reply to a conversation owned by the authenticated user. + * @param tweetId The ID of the reply that you want to hide or unhide. - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - searchRecent(query: string, options?: SearchRecentOptions): Promise; -} - -/** - * Models for trends operations - */ - -/** - * Response for getAi - * - * @public - */ -type GetAiResponse = Get2AiTrendsIdResponse; -/** - * Response for getByWoeid - * - * @public - */ -type GetByWoeidResponse = Get2TrendsByWoeidWoeidResponse; -/** - * Response for getPersonalized - * - * @public - */ -type GetPersonalizedResponse = Get2UsersPersonalizedTrendsResponse; - -type models$c_GetAiResponse = GetAiResponse; -type models$c_GetByWoeidResponse = GetByWoeidResponse; -type models$c_GetPersonalizedResponse = GetPersonalizedResponse; -declare namespace models$c { - export { - models$c_GetAiResponse as GetAiResponse, - models$c_GetByWoeidResponse as GetByWoeidResponse, - models$c_GetPersonalizedResponse as GetPersonalizedResponse, - }; -} - -/** - * trends client for the X API. - * - * This module provides a client for interacting with the trends endpoints of the X API. - */ - -/** - * Options for getAi method - * - * @public - */ -interface GetAiOptions { - /** A comma separated list of News fields to display. - * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ - newsFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByWoeid method - * - * @public - */ -interface GetByWoeidOptions { - /** The maximum number of results. - * Also accepts: max_trends or proper camelCase (e.g., maxTrends) */ - maxTrends?: number; - /** A comma separated list of Trend fields to display. - * Also accepts: trend.fields or proper camelCase (e.g., trendFields) */ - trendFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getPersonalized method - * - * @public - */ -interface GetPersonalizedOptions { - /** A comma separated list of PersonalizedTrend fields to display. - * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */ - personalizedTrendFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Client for trends operations - * - * This client provides methods for interacting with the trends endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all trends related operations. - * - * @category trends - */ -declare class TrendsClient { - private client; - /** - * Creates a new trends client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; + hideReply(tweetId: string, options?: HideReplyOptions): Promise; /** - * Get AI Trends by ID - * Retrieves an AI trend by its ID. + * Get Reposted by + * Retrieves a list of Users who reposted a specific Post by its ID. - * @param id The ID of the ai trend. + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getAi(id: string, options?: GetAiOptions): Promise; + getRepostedBy(id: string, options?: GetRepostedByOptions): Promise; /** - * Get Trends by WOEID - * Retrieves trending topics for a specific location identified by its WOEID. + * Get Quoted Posts + * Retrieves a list of Posts that quote a specific Post by its ID. - * @param woeid The WOEID of the place to lookup a trend for. + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByWoeid(woeid: number, options?: GetByWoeidOptions): Promise; + getQuoted(id: string, options?: GetQuotedOptions): Promise; /** - * Get personalized Trends - * Retrieves personalized trending topics for the authenticated user. + * Get Liking Users + * Retrieves a list of Users who liked a specific Post by its ID. + + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ - getPersonalized(options?: GetPersonalizedOptions): Promise; + getLikingUsers(id: string, options?: GetLikingUsersOptions): Promise; } /** - * Models for activity operations + * Models for lists operations */ /** - * Response for getSubscriptions + * Response for getMembers * * @public */ -type GetSubscriptionsResponse$1 = ActivitySubscriptionGetResponse; +type GetMembersResponse = Get2ListsIdMembersResponse; /** - * Request for createSubscription + * Request for addMember * * @public */ -type CreateSubscriptionRequest$1 = ActivitySubscriptionCreateRequest; +type AddMemberRequest = ListAddUserRequest; /** - * Response for createSubscription + * Response for addMember * * @public */ -type CreateSubscriptionResponse$1 = ActivitySubscriptionCreateResponse; +type AddMemberResponse = ListMutateResponse; /** - * Request for updateSubscription + * Response for getFollowers * * @public */ -type UpdateSubscriptionRequest = ActivitySubscriptionUpdateRequest; +type GetFollowersResponse$1 = Get2ListsIdFollowersResponse; /** - * Response for updateSubscription + * Response for getPosts * * @public */ -type UpdateSubscriptionResponse = ActivitySubscriptionUpdateResponse; +type GetPostsResponse$1 = Get2ListsIdTweetsResponse; /** - * Response for deleteSubscription + * Response for removeMemberByUserId * * @public */ -type DeleteSubscriptionResponse$1 = ActivitySubscriptionDeleteResponse; +type RemoveMemberByUserIdResponse = ListMutateResponse; /** - * Response for stream + * Response for getById * * @public */ -type StreamResponse = ActivityStreamingResponse; +type GetByIdResponse$2 = Get2ListsIdResponse; +/** + * Request for update + * + * @public + */ +type UpdateRequest = ListUpdateRequest; +/** + * Response for update + * + * @public + */ +type UpdateResponse = ListUpdateResponse; +/** + * Response for delete + * + * @public + */ +type DeleteResponse$2 = ListDeleteResponse; +/** + * Request for create + * + * @public + */ +type CreateRequest$2 = ListCreateRequest; +/** + * Response for create + * + * @public + */ +type CreateResponse$2 = ListCreateResponse; -type models$b_StreamResponse = StreamResponse; -type models$b_UpdateSubscriptionRequest = UpdateSubscriptionRequest; -type models$b_UpdateSubscriptionResponse = UpdateSubscriptionResponse; -declare namespace models$b { +type models$8_AddMemberRequest = AddMemberRequest; +type models$8_AddMemberResponse = AddMemberResponse; +type models$8_GetMembersResponse = GetMembersResponse; +type models$8_RemoveMemberByUserIdResponse = RemoveMemberByUserIdResponse; +type models$8_UpdateRequest = UpdateRequest; +type models$8_UpdateResponse = UpdateResponse; +declare namespace models$8 { export { - CreateSubscriptionRequest$1 as CreateSubscriptionRequest, - CreateSubscriptionResponse$1 as CreateSubscriptionResponse, - DeleteSubscriptionResponse$1 as DeleteSubscriptionResponse, - GetSubscriptionsResponse$1 as GetSubscriptionsResponse, - models$b_StreamResponse as StreamResponse, - models$b_UpdateSubscriptionRequest as UpdateSubscriptionRequest, - models$b_UpdateSubscriptionResponse as UpdateSubscriptionResponse, + models$8_AddMemberRequest as AddMemberRequest, + models$8_AddMemberResponse as AddMemberResponse, + CreateRequest$2 as CreateRequest, + CreateResponse$2 as CreateResponse, + DeleteResponse$2 as DeleteResponse, + GetByIdResponse$2 as GetByIdResponse, + GetFollowersResponse$1 as GetFollowersResponse, + models$8_GetMembersResponse as GetMembersResponse, + GetPostsResponse$1 as GetPostsResponse, + models$8_RemoveMemberByUserIdResponse as RemoveMemberByUserIdResponse, + models$8_UpdateRequest as UpdateRequest, + models$8_UpdateResponse as UpdateResponse, }; } /** - * activity client for the X API. + * lists client for the X API. * - * This module provides a client for interacting with the activity endpoints of the X API. + * This module provides a client for interacting with the lists endpoints of the X API. */ /** - * Options for createSubscription method + * Options for getMembers method * * @public */ -interface CreateSubscriptionOptions$1 { - /** Request body */ - body?: CreateSubscriptionRequest$1; +interface GetMembersOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for updateSubscription method + * Options for addMember method * * @public */ -interface UpdateSubscriptionOptions { +interface AddMemberOptions { /** Request body */ - body?: UpdateSubscriptionRequest; + body?: AddMemberRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for stream method + * Options for getFollowers method * * @public */ -interface StreamOptions { - /** The number of minutes of backfill requested. - * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ - backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Client for activity operations - * - * This client provides methods for interacting with the activity endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all activity related operations. - * - * @category activity - */ -declare class ActivityClient { - private client; - /** - * Creates a new activity client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; - /** - * Get X activity subscriptions - * Get a list of active subscriptions for XAA - - - - * @returns {Promise} Promise resolving to the API response - */ - getSubscriptions(): Promise; - /** - * Create X activity subscription - * Creates a subscription for an X activity event - - - - * @returns {Promise} Promise resolving to the API response - */ - createSubscription(options?: CreateSubscriptionOptions$1): Promise; - /** - * Update X activity subscription - * Updates a subscription for an X activity event - - - * @param subscriptionId The ID of the subscription to update. - - - - - * @returns {Promise} Promise resolving to the API response - */ - updateSubscription(subscriptionId: string, options?: UpdateSubscriptionOptions): Promise; - /** - * Deletes X activity subscription - * Deletes a subscription for an X activity event - - - * @param subscriptionId The ID of the subscription to delete. - - - - - * @returns {Promise} Promise resolving to the API response - */ - deleteSubscription(subscriptionId: string): Promise; - /** - * Activity Stream - * Stream of X Activities - - - - * @returns {Promise} Promise resolving to the API response - */ - stream(options?: StreamOptions): Promise; -} - -/** - * Models for usage operations - */ - -/** - * Response for get - * - * @public - */ -type GetResponse$1 = Get2UsageTweetsResponse; - -declare namespace models$a { - export { - GetResponse$1 as GetResponse, - }; -} - -/** - * usage client for the X API. - * - * This module provides a client for interacting with the usage endpoints of the X API. - */ - -/** - * Options for get method - * - * @public - */ -interface GetOptions$1 { - /** The number of days for which you need usage for. - * Also accepts: days or proper camelCase (e.g., days) */ - days?: number; - /** A comma separated list of Usage fields to display. - * Also accepts: usage.fields or proper camelCase (e.g., usageFields) */ - usageFields?: Array; +interface GetFollowersOptions$1 { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } -/** - * Client for usage operations - * - * This client provides methods for interacting with the usage endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all usage related operations. - * - * @category usage - */ -declare class UsageClient { - private client; - /** - * Creates a new usage client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; - /** - * Get usage - * Retrieves usage statistics for Posts over a specified number of days. - - - - * @returns {Promise} Promise resolving to the API response - */ - get(options?: GetOptions$1): Promise; -} - -/** - * Models for spaces operations - */ - -/** - * Response for getPosts - * - * @public - */ -type GetPostsResponse$1 = Get2SpacesIdTweetsResponse; -/** - * Response for search - * - * @public - */ -type SearchResponse$1 = Get2SpacesSearchResponse; -/** - * Response for getById - * - * @public - */ -type GetByIdResponse$2 = Get2SpacesIdResponse; -/** - * Response for getByCreatorIds - * - * @public - */ -type GetByCreatorIdsResponse = Get2SpacesByCreatorIdsResponse; -/** - * Response for getBuyers - * - * @public - */ -type GetBuyersResponse = Get2SpacesIdBuyersResponse; -/** - * Response for getByIds - * - * @public - */ -type GetByIdsResponse = Get2SpacesResponse; - -type models$9_GetBuyersResponse = GetBuyersResponse; -type models$9_GetByCreatorIdsResponse = GetByCreatorIdsResponse; -type models$9_GetByIdsResponse = GetByIdsResponse; -declare namespace models$9 { - export { - models$9_GetBuyersResponse as GetBuyersResponse, - models$9_GetByCreatorIdsResponse as GetByCreatorIdsResponse, - GetByIdResponse$2 as GetByIdResponse, - models$9_GetByIdsResponse as GetByIdsResponse, - GetPostsResponse$1 as GetPostsResponse, - SearchResponse$1 as SearchResponse, - }; -} - -/** - * spaces client for the X API. - * - * This module provides a client for interacting with the spaces endpoints of the X API. - */ - /** * Options for getPosts method * * @public */ interface GetPostsOptions$1 { - /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -7596,142 +6894,64 @@ interface GetPostsOptions$1 { [key: string]: any; } /** - * Options for search method + * Options for getById method * * @public */ -interface SearchOptions$1 { - /** The state of Spaces to search for. - * Also accepts: state or proper camelCase (e.g., state) */ - state?: string; - /** The number of results to return. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; +interface GetByIdOptions$2 { + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getById method + * Options for update method * * @public */ -interface GetByIdOptions$2 { - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; +interface UpdateOptions { + /** Request body */ + body?: UpdateRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for getByCreatorIds method + * Options for create method * * @public */ -interface GetByCreatorIdsOptions { - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getBuyers method - * - * @public - */ -interface GetBuyersOptions { - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByIds method - * - * @public - */ -interface GetByIdsOptions { - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; +interface CreateOptions$2 { + /** Request body */ + body?: CreateRequest$2; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for spaces operations + * Client for lists operations * - * This client provides methods for interacting with the spaces endpoints + * This client provides methods for interacting with the lists endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all spaces related operations. + * parsing for all lists related operations. * - * @category spaces + * @category lists */ -declare class SpacesClient { +declare class ListsClient { private client; /** - * Creates a new spaces client instance + * Creates a new lists client instance * * @param client - The main X API client instance */ @@ -7742,11 +6962,50 @@ declare class SpacesClient { */ private _normalizeOptions; /** - * Get Space Posts - * Retrieves a list of Posts shared in a specific Space by its ID. + * Get List members + * Retrieves a list of Users who are members of a specific List by its ID. - * @param id The ID of the Space to be retrieved. + * @param id The ID of the List. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getMembers(id: string, options?: GetMembersOptions): Promise; + /** + * Add List member + * Adds a User to a specific List by its ID. + + + * @param id The ID of the List for which to add a member. + + + + + * @returns {Promise} Promise resolving to the API response + */ + addMember(id: string, options?: AddMemberOptions): Promise; + /** + * Get List followers + * Retrieves a list of Users who follow a specific List by its ID. + + + * @param id The ID of the List. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getFollowers(id: string, options?: GetFollowersOptions$1): Promise; + /** + * Get List Posts + * Retrieves a list of Posts associated with a specific List by its ID. + + + * @param id The ID of the List. @@ -7755,24 +7014,28 @@ declare class SpacesClient { */ getPosts(id: string, options?: GetPostsOptions$1): Promise; /** - * Search Spaces - * Retrieves a list of Spaces matching the specified search query. + * Remove List member + * Removes a User from a specific List by its ID and the User’s ID. + + * @param id The ID of the List to remove a member. - * @param query The search query. + * @param userId The ID of User that will be removed from the List. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ - search(query: string, options?: SearchOptions$1): Promise; + removeMemberByUserId(id: string, userId: string): Promise; /** - * Get space by ID - * Retrieves details of a specific space by its ID. + * Get List by ID + * Retrieves details of a specific List by its ID. - * @param id The ID of the Space to be retrieved. + * @param id The ID of the List. @@ -7781,130 +7044,211 @@ declare class SpacesClient { */ getById(id: string, options?: GetByIdOptions$2): Promise; /** - * Get Spaces by creator IDs - * Retrieves details of Spaces created by specified User IDs. + * Update List + * Updates the details of a specific List owned by the authenticated user by its ID. + * @param id The ID of the List to modify. - * @param userIds The IDs of Users to search through. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByCreatorIds(userIds: Array, options?: GetByCreatorIdsOptions): Promise; + update(id: string, options?: UpdateOptions): Promise; /** - * Get Space ticket buyers - * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + * Delete List + * Deletes a specific List owned by the authenticated user by its ID. - * @param id The ID of the Space to be retrieved. + * @param id The ID of the List to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getBuyers(id: string, options?: GetBuyersOptions): Promise; + delete(id: string): Promise; /** - * Get Spaces by IDs - * Retrieves details of multiple Spaces by their IDs. - - - - * @param ids The list of Space IDs to return. + * Create List + * Creates a new List for the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByIds(ids: Array, options?: GetByIdsOptions): Promise; + create(options?: CreateOptions$2): Promise; } /** - * Models for communities operations + * Models for community notes operations */ /** - * Response for getById + * Response for delete * * @public */ -type GetByIdResponse$1 = Get2CommunitiesIdResponse; +type DeleteResponse$1 = DeleteNoteResponse; /** - * Response for search + * Request for evaluate * * @public */ -type SearchResponse = Get2CommunitiesSearchResponse; +type EvaluateRequest = EvaluateNoteRequest; +/** + * Response for evaluate + * + * @public + */ +type EvaluateResponse = EvaluateNoteResponse; +/** + * Response for searchWritten + * + * @public + */ +type SearchWrittenResponse = Get2NotesSearchNotesWrittenResponse; +/** + * Request for create + * + * @public + */ +type CreateRequest$1 = CreateNoteRequest; +/** + * Response for create + * + * @public + */ +type CreateResponse$1 = CreateNoteResponse; +/** + * Response for searchEligiblePosts + * + * @public + */ +type SearchEligiblePostsResponse = Get2NotesSearchPostsEligibleForNotesResponse; -type models$8_SearchResponse = SearchResponse; -declare namespace models$8 { +type models$7_EvaluateRequest = EvaluateRequest; +type models$7_EvaluateResponse = EvaluateResponse; +type models$7_SearchEligiblePostsResponse = SearchEligiblePostsResponse; +type models$7_SearchWrittenResponse = SearchWrittenResponse; +declare namespace models$7 { export { - GetByIdResponse$1 as GetByIdResponse, - models$8_SearchResponse as SearchResponse, + CreateRequest$1 as CreateRequest, + CreateResponse$1 as CreateResponse, + DeleteResponse$1 as DeleteResponse, + models$7_EvaluateRequest as EvaluateRequest, + models$7_EvaluateResponse as EvaluateResponse, + models$7_SearchEligiblePostsResponse as SearchEligiblePostsResponse, + models$7_SearchWrittenResponse as SearchWrittenResponse, }; } /** - * communities client for the X API. + * community notes client for the X API. * - * This module provides a client for interacting with the communities endpoints of the X API. + * This module provides a client for interacting with the community notes endpoints of the X API. */ /** - * Options for getById method + * Options for evaluate method * * @public */ -interface GetByIdOptions$1 { - /** A comma separated list of Community fields to display. - * Also accepts: community.fields or proper camelCase (e.g., communityFields) */ - communityFields?: Array; +interface EvaluateOptions { + /** Request body */ + body?: EvaluateRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for search method + * Options for searchWritten method * * @public */ -interface SearchOptions { - /** The maximum number of search results to be returned by a request. +interface SearchWrittenOptions { + /** Pagination token to get next set of posts eligible for notes. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: string; + /** Max results to return. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Community fields to display. - * Also accepts: community.fields or proper camelCase (e.g., communityFields) */ - communityFields?: Array; + /** A comma separated list of Note fields to display. + * Also accepts: note.fields or proper camelCase (e.g., noteFields) */ + noteFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for communities operations - * - * This client provides methods for interacting with the communities endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all communities related operations. + * Options for create method * - * @category communities + * @public */ -declare class CommunitiesClient { - private client; - /** - * Creates a new communities client instance - * - * @param client - The main X API client instance - */ +interface CreateOptions$1 { + /** Request body */ + body?: CreateRequest$1; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for searchEligiblePosts method + * + * @public + */ +interface SearchEligiblePostsOptions { + /** Pagination token to get next set of posts eligible for notes. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: string; + /** Max results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. + * Also accepts: post_selection or proper camelCase (e.g., postSelection) */ + postSelection?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for community notes operations + * + * This client provides methods for interacting with the community notes endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all community notes related operations. + * + * @category community notes + */ +declare class CommunityNotesClient { + private client; + /** + * Creates a new community notes client instance + * + * @param client - The main X API client instance + */ constructor(client: Client); /** * Normalize options object to handle both camelCase and original API parameter names @@ -7912,70 +7256,97 @@ declare class CommunitiesClient { */ private _normalizeOptions; /** - * Get Community by ID - * Retrieves details of a specific Community by its ID. + * Delete a Community Note + * Deletes a community note. - * @param id The ID of the Community. + * @param id The community note id to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getById(id: string, options?: GetByIdOptions$1): Promise; + delete(id: string): Promise; /** - * Search Communities - * Retrieves a list of Communities matching the specified search query. + * Evaluate a Community Note + * Endpoint to evaluate a community note. - * @param query Query to search communities. + * @returns {Promise} Promise resolving to the API response + */ + evaluate(options?: EvaluateOptions): Promise; + /** + * Search for Community Notes Written + * Returns all the community notes written by the user. - * @returns {Promise} Promise resolving to the API response + * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. + + + + * @returns {Promise} Promise resolving to the API response */ - search(query: string, options?: SearchOptions): Promise; + searchWritten(testMode: boolean, options?: SearchWrittenOptions): Promise; + /** + * Create a Community Note + * Creates a community note endpoint for LLM use case. + + + + * @returns {Promise} Promise resolving to the API response + */ + create(options?: CreateOptions$1): Promise; + /** + * Search for Posts Eligible for Community Notes + * Returns all the posts that are eligible for community notes. + + + + * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. + + + + * @returns {Promise} Promise resolving to the API response + */ + searchEligiblePosts(testMode: boolean, options?: SearchEligiblePostsOptions): Promise; } /** - * Models for connections operations - */ - -/** - * Response for deleteAll + * Response for getOpenApiSpec * * @public */ -type DeleteAllResponse = KillAllConnectionsResponse; +type GetOpenApiSpecResponse = Record; -type models$7_DeleteAllResponse = DeleteAllResponse; -declare namespace models$7 { +type models$6_GetOpenApiSpecResponse = GetOpenApiSpecResponse; +declare namespace models$6 { export { - models$7_DeleteAllResponse as DeleteAllResponse, + models$6_GetOpenApiSpecResponse as GetOpenApiSpecResponse, }; } /** - * connections client for the X API. + * general client for the X API. * - * This module provides a client for interacting with the connections endpoints of the X API. + * This module provides a client for interacting with the general endpoints of the X API. */ /** - * Client for connections operations + * Client for general operations * - * This client provides methods for interacting with the connections endpoints + * This client provides methods for interacting with the general endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all connections related operations. + * parsing for all general related operations. * - * @category connections + * @category general */ -declare class ConnectionsClient { +declare class GeneralClient { private client; /** - * Creates a new connections client instance + * Creates a new general client instance * * @param client - The main X API client instance */ @@ -7986,315 +7357,164 @@ declare class ConnectionsClient { */ private _normalizeOptions; /** - * Terminate all connections - * Terminates all active streaming connections for the authenticated application. + * Get OpenAPI Spec. + * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - deleteAll(): Promise; + getOpenApiSpec(): Promise; } /** - * Models for media operations + * Models for webhooks operations */ /** - * Response for getAnalytics - * - * @public - */ -type GetAnalyticsResponse = MediaAnalytics; -/** - * Request for createSubtitles - * - * @public - */ -type CreateSubtitlesRequest = SubtitlesCreateRequest; -/** - * Response for createSubtitles - * - * @public - */ -type CreateSubtitlesResponse = SubtitlesCreateResponse; -/** - * Request for deleteSubtitles - * - * @public - */ -type DeleteSubtitlesRequest = SubtitlesDeleteRequest; -/** - * Response for deleteSubtitles - * - * @public - */ -type DeleteSubtitlesResponse = SubtitlesDeleteResponse; -/** - * Request for initializeUpload - * - * @public - */ -type InitializeUploadRequest = MediaUploadConfigRequest; -/** - * Response for initializeUpload - * - * @public - */ -type InitializeUploadResponse = MediaUploadResponse; -/** - * Response for getUploadStatus - * - * @public - */ -type GetUploadStatusResponse = MediaUploadResponse; -/** - * Request for upload - * - * @public - */ -type UploadRequest = MediaUploadRequestOneShot; -/** - * Response for upload + * Response for get * * @public */ -type UploadResponse = MediaUploadResponse; +type GetResponse$1 = Get2WebhooksResponse; /** - * Response for getByKey + * Request for create * * @public */ -type GetByKeyResponse = Get2MediaMediaKeyResponse; +type CreateRequest = WebhookConfigCreateRequest; /** - * Request for appendUpload + * Response for create * * @public */ -type AppendUploadRequest = MediaUploadAppendRequest; +type CreateResponse = WebhookConfigCreateResponse; /** - * Response for appendUpload + * Response for validate * * @public */ -type AppendUploadResponse = MediaUploadAppendResponse; +type ValidateResponse = WebhookConfigPutResponse; /** - * Response for getByKeys + * Response for delete * * @public */ -type GetByKeysResponse = Get2MediaResponse; +type DeleteResponse = WebhookConfigDeleteResponse; /** - * Response for finalizeUpload + * Response for createStreamLink * * @public */ -type FinalizeUploadResponse = MediaUploadResponse; +type CreateStreamLinkResponse = WebhookLinksCreateResponse; /** - * Request for createMetadata + * Response for deleteStreamLink * * @public */ -type CreateMetadataRequest = MetadataCreateRequest; +type DeleteStreamLinkResponse = WebhookLinksDeleteResponse; /** - * Response for createMetadata + * Response for getStreamLinks * * @public */ -type CreateMetadataResponse = MetadataCreateResponse; +type GetStreamLinksResponse = WebhookLinksGetResponse; -type models$6_AppendUploadRequest = AppendUploadRequest; -type models$6_AppendUploadResponse = AppendUploadResponse; -type models$6_CreateMetadataRequest = CreateMetadataRequest; -type models$6_CreateMetadataResponse = CreateMetadataResponse; -type models$6_CreateSubtitlesRequest = CreateSubtitlesRequest; -type models$6_CreateSubtitlesResponse = CreateSubtitlesResponse; -type models$6_DeleteSubtitlesRequest = DeleteSubtitlesRequest; -type models$6_DeleteSubtitlesResponse = DeleteSubtitlesResponse; -type models$6_FinalizeUploadResponse = FinalizeUploadResponse; -type models$6_GetAnalyticsResponse = GetAnalyticsResponse; -type models$6_GetByKeyResponse = GetByKeyResponse; -type models$6_GetByKeysResponse = GetByKeysResponse; -type models$6_GetUploadStatusResponse = GetUploadStatusResponse; -type models$6_InitializeUploadRequest = InitializeUploadRequest; -type models$6_InitializeUploadResponse = InitializeUploadResponse; -type models$6_UploadRequest = UploadRequest; -type models$6_UploadResponse = UploadResponse; -declare namespace models$6 { +type models$5_CreateRequest = CreateRequest; +type models$5_CreateResponse = CreateResponse; +type models$5_CreateStreamLinkResponse = CreateStreamLinkResponse; +type models$5_DeleteResponse = DeleteResponse; +type models$5_DeleteStreamLinkResponse = DeleteStreamLinkResponse; +type models$5_GetStreamLinksResponse = GetStreamLinksResponse; +type models$5_ValidateResponse = ValidateResponse; +declare namespace models$5 { export { - models$6_AppendUploadRequest as AppendUploadRequest, - models$6_AppendUploadResponse as AppendUploadResponse, - models$6_CreateMetadataRequest as CreateMetadataRequest, - models$6_CreateMetadataResponse as CreateMetadataResponse, - models$6_CreateSubtitlesRequest as CreateSubtitlesRequest, - models$6_CreateSubtitlesResponse as CreateSubtitlesResponse, - models$6_DeleteSubtitlesRequest as DeleteSubtitlesRequest, - models$6_DeleteSubtitlesResponse as DeleteSubtitlesResponse, - models$6_FinalizeUploadResponse as FinalizeUploadResponse, - models$6_GetAnalyticsResponse as GetAnalyticsResponse, - models$6_GetByKeyResponse as GetByKeyResponse, - models$6_GetByKeysResponse as GetByKeysResponse, - models$6_GetUploadStatusResponse as GetUploadStatusResponse, - models$6_InitializeUploadRequest as InitializeUploadRequest, - models$6_InitializeUploadResponse as InitializeUploadResponse, - models$6_UploadRequest as UploadRequest, - models$6_UploadResponse as UploadResponse, + models$5_CreateRequest as CreateRequest, + models$5_CreateResponse as CreateResponse, + models$5_CreateStreamLinkResponse as CreateStreamLinkResponse, + models$5_DeleteResponse as DeleteResponse, + models$5_DeleteStreamLinkResponse as DeleteStreamLinkResponse, + GetResponse$1 as GetResponse, + models$5_GetStreamLinksResponse as GetStreamLinksResponse, + models$5_ValidateResponse as ValidateResponse, }; } /** - * media client for the X API. + * webhooks client for the X API. * - * This module provides a client for interacting with the media endpoints of the X API. + * This module provides a client for interacting with the webhooks endpoints of the X API. */ /** - * Options for getAnalytics method + * Options for get method * * @public */ -interface GetAnalyticsOptions { - /** A comma separated list of MediaAnalytics fields to display. - * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */ - mediaAnalyticsFields?: Array; +interface GetOptions$1 { + /** A comma separated list of WebhookConfig fields to display. + * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */ + webhookConfigFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for createSubtitles method + * Options for create method * * @public */ -interface CreateSubtitlesOptions { +interface CreateOptions { /** Request body */ - body?: CreateSubtitlesRequest; + body?: CreateRequest; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for deleteSubtitles method - * - * @public - */ -interface DeleteSubtitlesOptions { - /** Request body */ - body?: DeleteSubtitlesRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for initializeUpload method - * - * @public - */ -interface InitializeUploadOptions { - /** Request body */ - body?: InitializeUploadRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getUploadStatus method - * - * @public - */ -interface GetUploadStatusOptions { - /** The command for the media upload request. - * Also accepts: command or proper camelCase (e.g., command) */ - command?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for upload method - * - * @public - */ -interface UploadOptions { - /** Request body */ - body?: UploadRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByKey method - * - * @public - */ -interface GetByKeyOptions { - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for appendUpload method - * - * @public - */ -interface AppendUploadOptions { - /** Request body */ - body?: AppendUploadRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getByKeys method + * Options for createStreamLink method * * @public */ -interface GetByKeysOptions { +interface CreateStreamLinkOptions { + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: string; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: string; /** A comma separated list of Media fields to display. * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for createMetadata method - * - * @public - */ -interface CreateMetadataOptions { - /** Request body */ - body?: CreateMetadataRequest; + mediaFields?: string; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: string; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: string; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: string; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for media operations + * Client for webhooks operations * - * This client provides methods for interacting with the media endpoints + * This client provides methods for interacting with the webhooks endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all media related operations. + * parsing for all webhooks related operations. * - * @category media + * @category webhooks */ -declare class MediaClient { +declare class WebhooksClient { private client; /** - * Creates a new media client instance + * Creates a new webhooks client instance * * @param client - The main X API client instance */ @@ -8305,829 +7525,1745 @@ declare class MediaClient { */ private _normalizeOptions; /** - * Get Media analytics - * Retrieves analytics data for media. - - - - * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - - - - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - - - - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - - - - * @param granularity The granularity for the search counts results. - - - - * @returns {Promise} Promise resolving to the API response - */ - getAnalytics(mediaKeys: Array, endTime: string, startTime: string, granularity: string, options?: GetAnalyticsOptions): Promise; - /** - * Create Media subtitles - * Creates subtitles for a specific Media file. - - - - * @returns {Promise} Promise resolving to the API response - */ - createSubtitles(options?: CreateSubtitlesOptions): Promise; - /** - * Delete Media subtitles - * Deletes subtitles for a specific Media file. - - - - * @returns {Promise} Promise resolving to the API response - */ - deleteSubtitles(options?: DeleteSubtitlesOptions): Promise; - /** - * Initialize media upload - * Initializes a media upload. - - - - * @returns {Promise} Promise resolving to the API response - */ - initializeUpload(options?: InitializeUploadOptions): Promise; - /** - * Get Media upload status - * Retrieves the status of a Media upload by its ID. - - - - * @param mediaId Media id for the requested media upload status. + * Get webhook + * Get a list of webhook configs associated with a client app. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getUploadStatus(mediaId: any, options?: GetUploadStatusOptions): Promise; + get(options?: GetOptions$1): Promise; /** - * Upload media - * Uploads a media file for use in posts or other content. + * Create webhook + * Creates a new webhook configuration. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - upload(options?: UploadOptions): Promise; + create(options?: CreateOptions): Promise; /** - * Get Media by media key - * Retrieves details of a specific Media file by its media key. + * Validate webhook + * Triggers a CRC check for a given webhook. - * @param mediaKey A single Media Key. + * @param webhookId The ID of the webhook to check. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByKey(mediaKey: string, options?: GetByKeyOptions): Promise; + validate(webhookId: string): Promise; /** - * Append Media upload - * Appends data to a Media upload request. + * Delete webhook + * Deletes an existing webhook configuration. - * @param id The media identifier for the media to perform the append operation. + * @param webhookId The ID of the webhook to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - appendUpload(id: string, options?: AppendUploadOptions): Promise; + delete(webhookId: string): Promise; /** - * Get Media by media keys - * Retrieves details of Media files by their media keys. + * Create stream link + * Creates a link to deliver FilteredStream events to the given webhook. + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getByKeys(mediaKeys: Array, options?: GetByKeysOptions): Promise; + createStreamLink(webhookId: string, options?: CreateStreamLinkOptions): Promise; /** - * Finalize Media upload - * Finalizes a Media upload request. + * Delete stream link + * Deletes a link from FilteredStream events to the given webhook. - * @param id The media id of the targeted media to finalize. + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - finalizeUpload(id: string): Promise; + deleteStreamLink(webhookId: string): Promise; /** - * Create Media metadata - * Creates metadata for a Media file. + * Get stream links + * Get a list of webhook links associated with a filtered stream ruleset. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createMetadata(options?: CreateMetadataOptions): Promise; + getStreamLinks(): Promise; } /** - * Models for lists operations + * Models for users operations */ /** - * Response for removeMemberByUserId + * Response for getByUsernames * * @public */ -type RemoveMemberByUserIdResponse = ListMutateResponse; +type GetByUsernamesResponse = Get2UsersByResponse; /** - * Response for getById + * Response for getListMemberships * * @public */ -type GetByIdResponse = Get2ListsIdResponse; +type GetListMembershipsResponse = Get2UsersIdListMembershipsResponse; /** - * Request for update + * Response for unfollowUser * * @public */ -type UpdateRequest = ListUpdateRequest; +type UnfollowUserResponse = UsersFollowingDeleteResponse; /** - * Response for update + * Response for unfollowList * * @public */ -type UpdateResponse = ListUpdateResponse; +type UnfollowListResponse = ListFollowedResponse; /** - * Response for delete + * Response for getByIds * * @public */ -type DeleteResponse$1 = ListDeleteResponse; +type GetByIdsResponse = Get2UsersResponse; /** - * Response for getMembers + * Request for likePost * * @public */ -type GetMembersResponse = Get2ListsIdMembersResponse; +type LikePostRequest = UsersLikesCreateRequest; /** - * Request for addMember + * Response for likePost * * @public */ -type AddMemberRequest = ListAddUserRequest; +type LikePostResponse = UsersLikesCreateResponse; /** - * Response for addMember + * Response for blockDms * * @public */ -type AddMemberResponse = ListMutateResponse; +type BlockDmsResponse = UsersDMBlockCreateResponse; /** - * Response for getFollowers + * Response for getPosts * * @public */ -type GetFollowersResponse = Get2ListsIdFollowersResponse; +type GetPostsResponse = Get2UsersIdTweetsResponse; /** - * Response for getPosts + * Response for getBookmarksByFolderId * * @public */ -type GetPostsResponse = Get2ListsIdTweetsResponse; +type GetBookmarksByFolderIdResponse = BookmarkFolderPostsResponse; /** - * Request for create + * Response for getMuting * * @public */ -type CreateRequest$1 = ListCreateRequest; +type GetMutingResponse = Get2UsersIdMutingResponse; + /** - * Response for create + * Response for muteUser * * @public */ -type CreateResponse$1 = ListCreateResponse; - -type models$5_AddMemberRequest = AddMemberRequest; -type models$5_AddMemberResponse = AddMemberResponse; -type models$5_GetByIdResponse = GetByIdResponse; -type models$5_GetFollowersResponse = GetFollowersResponse; -type models$5_GetMembersResponse = GetMembersResponse; -type models$5_GetPostsResponse = GetPostsResponse; -type models$5_RemoveMemberByUserIdResponse = RemoveMemberByUserIdResponse; -type models$5_UpdateRequest = UpdateRequest; -type models$5_UpdateResponse = UpdateResponse; -declare namespace models$5 { - export { - models$5_AddMemberRequest as AddMemberRequest, - models$5_AddMemberResponse as AddMemberResponse, - CreateRequest$1 as CreateRequest, - CreateResponse$1 as CreateResponse, - DeleteResponse$1 as DeleteResponse, - models$5_GetByIdResponse as GetByIdResponse, - models$5_GetFollowersResponse as GetFollowersResponse, - models$5_GetMembersResponse as GetMembersResponse, - models$5_GetPostsResponse as GetPostsResponse, - models$5_RemoveMemberByUserIdResponse as RemoveMemberByUserIdResponse, - models$5_UpdateRequest as UpdateRequest, - models$5_UpdateResponse as UpdateResponse, - }; -} - +type MuteUserResponse = MuteUserMutationResponse; /** - * lists client for the X API. + * Response for getOwnedLists * - * This module provides a client for interacting with the lists endpoints of the X API. + * @public */ - +type GetOwnedListsResponse = Get2UsersIdOwnedListsResponse; /** - * Options for getById method + * Response for unpinList * * @public */ -interface GetByIdOptions { - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type UnpinListResponse = ListUnpinResponse; /** - * Options for update method + * Response for getByUsername * * @public */ -interface UpdateOptions { - /** Request body */ - body?: UpdateRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetByUsernameResponse = Get2UsersByUsernameUsernameResponse; /** - * Options for getMembers method + * Response for getBlocking * * @public */ -interface GetMembersOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetBlockingResponse = Get2UsersIdBlockingResponse; /** - * Options for addMember method + * Response for getLikedPosts * * @public */ -interface AddMemberOptions { - /** Request body */ - body?: AddMemberRequest; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetLikedPostsResponse = Get2UsersIdLikedTweetsResponse; /** - * Options for getFollowers method + * Response for unlikePost * * @public */ -interface GetFollowersOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type UnlikePostResponse = UsersLikesDeleteResponse; /** - * Options for getPosts method + * Response for getFollowedLists * * @public */ -interface GetPostsOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type GetFollowedListsResponse = Get2UsersIdFollowedListsResponse; /** - * Options for create method + * Request for followList * * @public */ -interface CreateOptions$1 { - /** Request body */ - body?: CreateRequest$1; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +type FollowListRequest = ListFollowedRequest; /** - * Client for lists operations + * Response for followList * - * This client provides methods for interacting with the lists endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all lists related operations. + * @public + */ +type FollowListResponse = ListFollowedResponse; +/** + * Response for getTimeline * - * @category lists + * @public */ -declare class ListsClient { - private client; - /** - * Creates a new lists client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); +type GetTimelineResponse = Get2UsersIdTimelinesReverseChronologicalResponse; +/** + * Response for getPinnedLists + * + * @public + */ +type GetPinnedListsResponse = Get2UsersIdPinnedListsResponse; +/** + * Request for pinList + * + * @public + */ +type PinListRequest = ListPinnedRequest; +/** + * Response for pinList + * + * @public + */ +type PinListResponse = ListPinnedResponse; +/** + * Response for getRepostsOfMe + * + * @public + */ +type GetRepostsOfMeResponse = Get2UsersRepostsOfMeResponse; +/** + * Response for getFollowing + * + * @public + */ +type GetFollowingResponse = Get2UsersIdFollowingResponse; +/** + * Request for followUser + * + * @public + */ +type FollowUserRequest = UsersFollowingCreateRequest; +/** + * Response for followUser + * + * @public + */ +type FollowUserResponse = UsersFollowingCreateResponse; +/** + * Response for unblockDms + * + * @public + */ +type UnblockDmsResponse = UsersDMUnBlockCreateResponse; +/** + * Response for getMentions + * + * @public + */ +type GetMentionsResponse = Get2UsersIdMentionsResponse; +/** + * Response for getBookmarkFolders + * + * @public + */ +type GetBookmarkFoldersResponse = BookmarkFoldersResponse; +/** + * Response for unrepostPost + * + * @public + */ +type UnrepostPostResponse = UsersRetweetsDeleteResponse; +/** + * Response for deleteBookmark + * + * @public + */ +type DeleteBookmarkResponse = BookmarkMutationResponse; +/** + * Request for repostPost + * + * @public + */ +type RepostPostRequest = UsersRetweetsCreateRequest; +/** + * Response for repostPost + * + * @public + */ +type RepostPostResponse = UsersRetweetsCreateResponse; +/** + * Response for search + * + * @public + */ +type SearchResponse$1 = Get2UsersSearchResponse; +/** + * Response for getById + * + * @public + */ +type GetByIdResponse$1 = Get2UsersIdResponse; +/** + * Response for getBookmarks + * + * @public + */ +type GetBookmarksResponse = Get2UsersIdBookmarksResponse; +/** + * Request for createBookmark + * + * @public + */ +type CreateBookmarkRequest = BookmarkAddRequest; +/** + * Response for createBookmark + * + * @public + */ +type CreateBookmarkResponse = BookmarkMutationResponse; +/** + * Response for getFollowers + * + * @public + */ +type GetFollowersResponse = Get2UsersIdFollowersResponse; +/** + * Response for getMe + * + * @public + */ +type GetMeResponse = Get2UsersMeResponse; +/** + * Response for unmuteUser + * + * @public + */ +type UnmuteUserResponse = MuteUserMutationResponse; + +type models$4_BlockDmsResponse = BlockDmsResponse; +type models$4_CreateBookmarkRequest = CreateBookmarkRequest; +type models$4_CreateBookmarkResponse = CreateBookmarkResponse; +type models$4_DeleteBookmarkResponse = DeleteBookmarkResponse; +type models$4_FollowListRequest = FollowListRequest; +type models$4_FollowListResponse = FollowListResponse; +type models$4_FollowUserRequest = FollowUserRequest; +type models$4_FollowUserResponse = FollowUserResponse; +type models$4_GetBlockingResponse = GetBlockingResponse; +type models$4_GetBookmarkFoldersResponse = GetBookmarkFoldersResponse; +type models$4_GetBookmarksByFolderIdResponse = GetBookmarksByFolderIdResponse; +type models$4_GetBookmarksResponse = GetBookmarksResponse; +type models$4_GetByIdsResponse = GetByIdsResponse; +type models$4_GetByUsernameResponse = GetByUsernameResponse; +type models$4_GetByUsernamesResponse = GetByUsernamesResponse; +type models$4_GetFollowedListsResponse = GetFollowedListsResponse; +type models$4_GetFollowersResponse = GetFollowersResponse; +type models$4_GetFollowingResponse = GetFollowingResponse; +type models$4_GetLikedPostsResponse = GetLikedPostsResponse; +type models$4_GetListMembershipsResponse = GetListMembershipsResponse; +type models$4_GetMeResponse = GetMeResponse; +type models$4_GetMentionsResponse = GetMentionsResponse; +type models$4_GetMutingResponse = GetMutingResponse; +type models$4_GetOwnedListsResponse = GetOwnedListsResponse; +type models$4_GetPinnedListsResponse = GetPinnedListsResponse; +type models$4_GetPostsResponse = GetPostsResponse; +type models$4_GetRepostsOfMeResponse = GetRepostsOfMeResponse; +type models$4_GetTimelineResponse = GetTimelineResponse; +type models$4_LikePostRequest = LikePostRequest; +type models$4_LikePostResponse = LikePostResponse; +type models$4_MuteUserRequest = MuteUserRequest; +type models$4_MuteUserResponse = MuteUserResponse; +type models$4_PinListRequest = PinListRequest; +type models$4_PinListResponse = PinListResponse; +type models$4_RepostPostRequest = RepostPostRequest; +type models$4_RepostPostResponse = RepostPostResponse; +type models$4_UnblockDmsResponse = UnblockDmsResponse; +type models$4_UnfollowListResponse = UnfollowListResponse; +type models$4_UnfollowUserResponse = UnfollowUserResponse; +type models$4_UnlikePostResponse = UnlikePostResponse; +type models$4_UnmuteUserResponse = UnmuteUserResponse; +type models$4_UnpinListResponse = UnpinListResponse; +type models$4_UnrepostPostResponse = UnrepostPostResponse; +declare namespace models$4 { + export { + models$4_BlockDmsResponse as BlockDmsResponse, + models$4_CreateBookmarkRequest as CreateBookmarkRequest, + models$4_CreateBookmarkResponse as CreateBookmarkResponse, + models$4_DeleteBookmarkResponse as DeleteBookmarkResponse, + models$4_FollowListRequest as FollowListRequest, + models$4_FollowListResponse as FollowListResponse, + models$4_FollowUserRequest as FollowUserRequest, + models$4_FollowUserResponse as FollowUserResponse, + models$4_GetBlockingResponse as GetBlockingResponse, + models$4_GetBookmarkFoldersResponse as GetBookmarkFoldersResponse, + models$4_GetBookmarksByFolderIdResponse as GetBookmarksByFolderIdResponse, + models$4_GetBookmarksResponse as GetBookmarksResponse, + GetByIdResponse$1 as GetByIdResponse, + models$4_GetByIdsResponse as GetByIdsResponse, + models$4_GetByUsernameResponse as GetByUsernameResponse, + models$4_GetByUsernamesResponse as GetByUsernamesResponse, + models$4_GetFollowedListsResponse as GetFollowedListsResponse, + models$4_GetFollowersResponse as GetFollowersResponse, + models$4_GetFollowingResponse as GetFollowingResponse, + models$4_GetLikedPostsResponse as GetLikedPostsResponse, + models$4_GetListMembershipsResponse as GetListMembershipsResponse, + models$4_GetMeResponse as GetMeResponse, + models$4_GetMentionsResponse as GetMentionsResponse, + models$4_GetMutingResponse as GetMutingResponse, + models$4_GetOwnedListsResponse as GetOwnedListsResponse, + models$4_GetPinnedListsResponse as GetPinnedListsResponse, + models$4_GetPostsResponse as GetPostsResponse, + models$4_GetRepostsOfMeResponse as GetRepostsOfMeResponse, + models$4_GetTimelineResponse as GetTimelineResponse, + models$4_LikePostRequest as LikePostRequest, + models$4_LikePostResponse as LikePostResponse, + models$4_MuteUserRequest as MuteUserRequest, + models$4_MuteUserResponse as MuteUserResponse, + models$4_PinListRequest as PinListRequest, + models$4_PinListResponse as PinListResponse, + models$4_RepostPostRequest as RepostPostRequest, + models$4_RepostPostResponse as RepostPostResponse, + SearchResponse$1 as SearchResponse, + models$4_UnblockDmsResponse as UnblockDmsResponse, + models$4_UnfollowListResponse as UnfollowListResponse, + models$4_UnfollowUserResponse as UnfollowUserResponse, + models$4_UnlikePostResponse as UnlikePostResponse, + models$4_UnmuteUserResponse as UnmuteUserResponse, + models$4_UnpinListResponse as UnpinListResponse, + models$4_UnrepostPostResponse as UnrepostPostResponse, + }; +} + +/** + * users client for the X API. + * + * This module provides a client for interacting with the users endpoints of the X API. + */ + +/** + * Options for getByUsernames method + * + * @public + */ +interface GetByUsernamesOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getListMemberships method + * + * @public + */ +interface GetListMembershipsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getByIds method + * + * @public + */ +interface GetByIdsOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for likePost method + * + * @public + */ +interface LikePostOptions { + /** Request body */ + body?: LikePostRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getPosts method + * + * @public + */ +interface GetPostsOptions { + /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** The set of entities to exclude (e.g. 'replies' or 'retweets'). + * Also accepts: exclude or proper camelCase (e.g., exclude) */ + exclude?: Array; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getMuting method + * + * @public + */ +interface GetMutingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for muteUser method + * + * @public + */ +interface MuteUserOptions { + /** Request body */ + body?: MuteUserRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getOwnedLists method + * + * @public + */ +interface GetOwnedListsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getByUsername method + * + * @public + */ +interface GetByUsernameOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getBlocking method + * + * @public + */ +interface GetBlockingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getLikedPosts method + * + * @public + */ +interface GetLikedPostsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getFollowedLists method + * + * @public + */ +interface GetFollowedListsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for followList method + * + * @public + */ +interface FollowListOptions { + /** Request body */ + body?: FollowListRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getTimeline method + * + * @public + */ +interface GetTimelineOptions { + /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** The set of entities to exclude (e.g. 'replies' or 'retweets'). + * Also accepts: exclude or proper camelCase (e.g., exclude) */ + exclude?: Array; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getPinnedLists method + * + * @public + */ +interface GetPinnedListsOptions { + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getRepostsOfMe method + * + * @public + */ +interface GetRepostsOfMeOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getFollowing method + * + * @public + */ +interface GetFollowingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for followUser method + * + * @public + */ +interface FollowUserOptions { + /** Request body */ + body?: FollowUserRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getMentions method + * + * @public + */ +interface GetMentionsOptions { + /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getBookmarkFolders method + * + * @public + */ +interface GetBookmarkFoldersOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for repostPost method + * + * @public + */ +interface RepostPostOptions { + /** Request body */ + body?: RepostPostRequest; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for search method + * + * @public + */ +interface SearchOptions$1 { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getById method + * + * @public + */ +interface GetByIdOptions$1 { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getBookmarks method + * + * @public + */ +interface GetBookmarksOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getFollowers method + * + * @public + */ +interface GetFollowersOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getMe method + * + * @public + */ +interface GetMeOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for users operations + * + * This client provides methods for interacting with the users endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all users related operations. + * + * @category users + */ +declare class UsersClient { + private client; + /** + * Creates a new users client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; + /** + * Get Users by usernames + * Retrieves details of multiple Users by their usernames. + + + + * @param usernames A list of usernames, comma-separated. + + + + * @returns {Promise} Promise resolving to the API response + */ + getByUsernames(usernames: Array, options?: GetByUsernamesOptions): Promise; + /** + * Get List memberships + * Retrieves a list of Lists that a specific User is a member of by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getListMemberships(id: string, options?: GetListMembershipsOptions): Promise; + /** + * Unfollow User + * Causes the authenticated user to unfollow a specific user by their ID. + + + * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. + + + + * @param targetUserId The ID of the User that the source User is requesting to unfollow. + + + + + * @returns {Promise} Promise resolving to the API response + */ + unfollowUser(sourceUserId: string, targetUserId: string): Promise; + /** + * Unfollow List + * Causes the authenticated user to unfollow a specific List by its ID. + + + * @param id The ID of the authenticated source User that will unfollow the List. + + + + * @param listId The ID of the List to unfollow. + + + + + * @returns {Promise} Promise resolving to the API response + */ + unfollowList(id: string, listId: string): Promise; + /** + * Get Users by IDs + * Retrieves details of multiple Users by their IDs. + + + + * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. + + + + * @returns {Promise} Promise resolving to the API response + */ + getByIds(ids: Array, options?: GetByIdsOptions): Promise; + /** + * Like Post + * Causes the authenticated user to Like a specific Post by its ID. + + + * @param id The ID of the authenticated source User that is requesting to like the Post. + + + + + * @returns {Promise} Promise resolving to the API response + */ + likePost(id: string, options?: LikePostOptions): Promise; + /** + * Block DMs + * Blocks direct messages to or from a specific User by their ID for the authenticated user. + + + * @param id The ID of the target User that the authenticated user requesting to block dms for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + blockDms(id: string): Promise; + /** + * Get Posts + * Retrieves a list of posts authored by a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getPosts(id: string, options?: GetPostsOptions): Promise; + /** + * Get Bookmarks by folder ID + * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getBookmarksByFolderId(id: string, folderId: string): Promise; + /** + * Get muting + * Retrieves a list of Users muted by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getMuting(id: string, options?: GetMutingOptions): Promise; + /** + * Mute User + * Causes the authenticated user to mute a specific User by their ID. + + + * @param id The ID of the authenticated source User that is requesting to mute the target User. + + + + + * @returns {Promise} Promise resolving to the API response + */ + muteUser(id: string, options?: MuteUserOptions): Promise; + /** + * Get owned Lists + * Retrieves a list of Lists owned by a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getOwnedLists(id: string, options?: GetOwnedListsOptions): Promise; + /** + * Unpin List + * Causes the authenticated user to unpin a specific List by its ID. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + * @param listId The ID of the List to unpin. + + + + + * @returns {Promise} Promise resolving to the API response + */ + unpinList(id: string, listId: string): Promise; + /** + * Get User by username + * Retrieves details of a specific User by their username. + + + * @param username A username. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getByUsername(username: string, options?: GetByUsernameOptions): Promise; + /** + * Get blocking + * Retrieves a list of Users blocked by the specified User ID. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getBlocking(id: string, options?: GetBlockingOptions): Promise; + /** + * Get liked Posts + * Retrieves a list of Posts liked by a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getLikedPosts(id: string, options?: GetLikedPostsOptions): Promise; + /** + * Unlike Post + * Causes the authenticated user to Unlike a specific Post by its ID. + + + * @param id The ID of the authenticated source User that is requesting to unlike the Post. + + + + * @param tweetId The ID of the Post that the User is requesting to unlike. + + + + + * @returns {Promise} Promise resolving to the API response + */ + unlikePost(id: string, tweetId: string): Promise; + /** + * Get followed Lists + * Retrieves a list of Lists followed by a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getFollowedLists(id: string, options?: GetFollowedListsOptions): Promise; + /** + * Follow List + * Causes the authenticated user to follow a specific List by its ID. + + + * @param id The ID of the authenticated source User that will follow the List. + + + + + * @returns {Promise} Promise resolving to the API response + */ + followList(id: string, options?: FollowListOptions): Promise; + /** + * Get Timeline + * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. + + + * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getTimeline(id: string, options?: GetTimelineOptions): Promise; + /** + * Get pinned Lists + * Retrieves a list of Lists pinned by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getPinnedLists(id: string, options?: GetPinnedListsOptions): Promise; /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; + * Pin List + * Causes the authenticated user to pin a specific List by its ID. + + + * @param id The ID of the authenticated source User that will pin the List. + + + + + * @param body Request body + + * @returns {Promise} Promise resolving to the API response + */ + pinList(id: string, body: PinListRequest): Promise; /** - * Remove List member - * Removes a User from a specific List by its ID and the User’s ID. + * Get Reposts of me + * Retrieves a list of Posts that repost content from the authenticated user. - * @param id The ID of the List to remove a member. + * @returns {Promise} Promise resolving to the API response + */ + getRepostsOfMe(options?: GetRepostsOfMeOptions): Promise; + /** + * Get following + * Retrieves a list of Users followed by a specific User by their ID. - * @param userId The ID of User that will be removed from the List. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - removeMemberByUserId(id: string, userId: string): Promise; + getFollowing(id: string, options?: GetFollowingOptions): Promise; /** - * Get List by ID - * Retrieves details of a specific List by its ID. + * Follow User + * Causes the authenticated user to follow a specific user by their ID. - * @param id The ID of the List. + * @param id The ID of the authenticated source User that is requesting to follow the target User. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getById(id: string, options?: GetByIdOptions): Promise; + followUser(id: string, options?: FollowUserOptions): Promise; /** - * Update List - * Updates the details of a specific List owned by the authenticated user by its ID. + * Unblock DMs + * Unblocks direct messages to or from a specific User by their ID for the authenticated user. - * @param id The ID of the List to modify. + * @param id The ID of the target User that the authenticated user requesting to unblock dms for. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - update(id: string, options?: UpdateOptions): Promise; + unblockDms(id: string): Promise; /** - * Delete List - * Deletes a specific List owned by the authenticated user by its ID. + * Get mentions + * Retrieves a list of Posts that mention a specific User by their ID. - * @param id The ID of the List to delete. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - delete(id: string): Promise; + getMentions(id: string, options?: GetMentionsOptions): Promise; /** - * Get List members - * Retrieves a list of Users who are members of a specific List by its ID. + * Get Bookmark folders + * Retrieves a list of Bookmark folders created by the authenticated user. - * @param id The ID of the List. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getMembers(id: string, options?: GetMembersOptions): Promise; + getBookmarkFolders(id: string, options?: GetBookmarkFoldersOptions): Promise; /** - * Add List member - * Adds a User to a specific List by its ID. + * Unrepost Post + * Causes the authenticated user to unrepost a specific Post by its ID. - * @param id The ID of the List for which to add a member. + * @param id The ID of the authenticated source User that is requesting to repost the Post. + * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ - addMember(id: string, options?: AddMemberOptions): Promise; + unrepostPost(id: string, sourceTweetId: string): Promise; /** - * Get List followers - * Retrieves a list of Users who follow a specific List by its ID. + * Delete Bookmark + * Removes a Post from the authenticated user’s Bookmarks by its ID. - * @param id The ID of the List. + * @param id The ID of the authenticated source User whose bookmark is to be removed. + * @param tweetId The ID of the Post that the source User is removing from bookmarks. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ - getFollowers(id: string, options?: GetFollowersOptions): Promise; + deleteBookmark(id: string, tweetId: string): Promise; /** - * Get List Posts - * Retrieves a list of Posts associated with a specific List by its ID. + * Repost Post + * Causes the authenticated user to repost a specific Post by its ID. - * @param id The ID of the List. + * @param id The ID of the authenticated source User that is requesting to repost the Post. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getPosts(id: string, options?: GetPostsOptions): Promise; + repostPost(id: string, options?: RepostPostOptions): Promise; /** - * Create List - * Creates a new List for the authenticated user. + * Search Users + * Retrieves a list of Users matching a search query. - * @returns {Promise} Promise resolving to the API response + * @param query TThe the query string by which to query for users. + + + + * @returns {Promise} Promise resolving to the API response */ - create(options?: CreateOptions$1): Promise; -} - -/** - * Models for compliance operations - */ - -/** - * Response for getJobsById - * - * @public - */ -type GetJobsByIdResponse = Get2ComplianceJobsIdResponse; -/** - * Response for getJobs - * - * @public - */ -type GetJobsResponse = Get2ComplianceJobsResponse; -/** - * Request for createJobs - * - * @public - */ -type CreateJobsRequest = CreateComplianceJobRequest; -/** - * Response for createJobs - * - * @public - */ -type CreateJobsResponse = CreateComplianceJobResponse; - -type models$4_CreateJobsRequest = CreateJobsRequest; -type models$4_CreateJobsResponse = CreateJobsResponse; -type models$4_GetJobsByIdResponse = GetJobsByIdResponse; -type models$4_GetJobsResponse = GetJobsResponse; -declare namespace models$4 { - export { - models$4_CreateJobsRequest as CreateJobsRequest, - models$4_CreateJobsResponse as CreateJobsResponse, - models$4_GetJobsByIdResponse as GetJobsByIdResponse, - models$4_GetJobsResponse as GetJobsResponse, - }; -} - -/** - * compliance client for the X API. - * - * This module provides a client for interacting with the compliance endpoints of the X API. - */ - -/** - * Options for getJobsById method - * - * @public - */ -interface GetJobsByIdOptions { - /** A comma separated list of ComplianceJob fields to display. - * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ - complianceJobFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getJobs method - * - * @public - */ -interface GetJobsOptions { - /** Status of Compliance Job to list. - * Also accepts: status or proper camelCase (e.g., status) */ - status?: string; - /** A comma separated list of ComplianceJob fields to display. - * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ - complianceJobFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Client for compliance operations - * - * This client provides methods for interacting with the compliance endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all compliance related operations. - * - * @category compliance - */ -declare class ComplianceClient { - private client; + search(query: any, options?: SearchOptions$1): Promise; /** - * Creates a new compliance client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); + * Get User by ID + * Retrieves details of a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getById(id: string, options?: GetByIdOptions$1): Promise; /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; + * Get Bookmarks + * Retrieves a list of Posts bookmarked by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + getBookmarks(id: string, options?: GetBookmarksOptions): Promise; /** - * Get Compliance Job by ID - * Retrieves details of a specific Compliance Job by its ID. + * Create Bookmark + * Adds a post to the authenticated user’s bookmarks. - * @param id The ID of the Compliance Job to retrieve. + * @param id The ID of the authenticated source User for whom to add bookmarks. - * @returns {Promise} Promise resolving to the API response + * @param body Request body + + * @returns {Promise} Promise resolving to the API response */ - getJobsById(id: string, options?: GetJobsByIdOptions): Promise; + createBookmark(id: string, body: CreateBookmarkRequest): Promise; /** - * Get Compliance Jobs - * Retrieves a list of Compliance Jobs filtered by job type and optional status. + * Get followers + * Retrieves a list of Users who follow a specific User by their ID. + * @param id The ID of the User to lookup. - * @param type Type of Compliance Job to list. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - getJobs(type: string, options?: GetJobsOptions): Promise; + getFollowers(id: string, options?: GetFollowersOptions): Promise; /** - * Create Compliance Job - * Creates a new Compliance Job for the specified job type. - + * Get my User + * Retrieves details of the authenticated user. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createJobs(body: CreateJobsRequest): Promise; -} - -/** - * Response for getOpenApiSpec - * - * @public - */ -type GetOpenApiSpecResponse = Record; - -type models$3_GetOpenApiSpecResponse = GetOpenApiSpecResponse; -declare namespace models$3 { - export { - models$3_GetOpenApiSpecResponse as GetOpenApiSpecResponse, - }; -} - -/** - * general client for the X API. - * - * This module provides a client for interacting with the general endpoints of the X API. - */ - -/** - * Client for general operations - * - * This client provides methods for interacting with the general endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all general related operations. - * - * @category general - */ -declare class GeneralClient { - private client; - /** - * Creates a new general client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client); - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions; + getMe(options?: GetMeOptions): Promise; /** - * Get OpenAPI Spec. - * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) + * Unmute User + * Causes the authenticated user to unmute a specific user by their ID. + * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. - * @returns {Promise} Promise resolving to the API response + + + * @param targetUserId The ID of the User that the source User is requesting to unmute. + + + + + * @returns {Promise} Promise resolving to the API response */ - getOpenApiSpec(): Promise; + unmuteUser(sourceUserId: string, targetUserId: string): Promise; } /** - * Models for account activity operations + * Models for communities operations */ /** - * Response for validateSubscription - * - * @public - */ -type ValidateSubscriptionResponse = SubscriptionsGetResponse; -/** - * Request for createSubscription - * - * @public - */ -type CreateSubscriptionRequest = SubscriptionsCreateRequest; -/** - * Response for createSubscription - * - * @public - */ -type CreateSubscriptionResponse = SubscriptionsCreateResponse; -/** - * Response for getSubscriptionCount - * - * @public - */ -type GetSubscriptionCountResponse = SubscriptionsCountGetResponse; -/** - * Response for getSubscriptions - * - * @public - */ -type GetSubscriptionsResponse = SubscriptionsListGetResponse; -/** - * Response for createReplayJob + * Response for getById * * @public */ -type CreateReplayJobResponse = ReplayJobCreateResponse; +type GetByIdResponse = Get2CommunitiesIdResponse; /** - * Response for deleteSubscription + * Response for search * * @public */ -type DeleteSubscriptionResponse = SubscriptionsDeleteResponse; +type SearchResponse = Get2CommunitiesSearchResponse; -type models$2_CreateReplayJobResponse = CreateReplayJobResponse; -type models$2_CreateSubscriptionRequest = CreateSubscriptionRequest; -type models$2_CreateSubscriptionResponse = CreateSubscriptionResponse; -type models$2_DeleteSubscriptionResponse = DeleteSubscriptionResponse; -type models$2_GetSubscriptionCountResponse = GetSubscriptionCountResponse; -type models$2_GetSubscriptionsResponse = GetSubscriptionsResponse; -type models$2_ValidateSubscriptionResponse = ValidateSubscriptionResponse; -declare namespace models$2 { +type models$3_GetByIdResponse = GetByIdResponse; +type models$3_SearchResponse = SearchResponse; +declare namespace models$3 { export { - models$2_CreateReplayJobResponse as CreateReplayJobResponse, - models$2_CreateSubscriptionRequest as CreateSubscriptionRequest, - models$2_CreateSubscriptionResponse as CreateSubscriptionResponse, - models$2_DeleteSubscriptionResponse as DeleteSubscriptionResponse, - models$2_GetSubscriptionCountResponse as GetSubscriptionCountResponse, - models$2_GetSubscriptionsResponse as GetSubscriptionsResponse, - models$2_ValidateSubscriptionResponse as ValidateSubscriptionResponse, + models$3_GetByIdResponse as GetByIdResponse, + models$3_SearchResponse as SearchResponse, }; } /** - * account activity client for the X API. + * communities client for the X API. * - * This module provides a client for interacting with the account activity endpoints of the X API. + * This module provides a client for interacting with the communities endpoints of the X API. */ /** - * Options for createSubscription method + * Options for getById method * * @public */ -interface CreateSubscriptionOptions { - /** Request body */ - body?: CreateSubscriptionRequest; +interface GetByIdOptions { + /** A comma separated list of Community fields to display. + * Also accepts: community.fields or proper camelCase (e.g., communityFields) */ + communityFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for account activity operations + * Options for search method * - * This client provides methods for interacting with the account activity endpoints + * @public + */ +interface SearchOptions { + /** The maximum number of search results to be returned by a request. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of Community fields to display. + * Also accepts: community.fields or proper camelCase (e.g., communityFields) */ + communityFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for communities operations + * + * This client provides methods for interacting with the communities endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all account activity related operations. + * parsing for all communities related operations. * - * @category account activity + * @category communities */ -declare class AccountActivityClient { +declare class CommunitiesClient { private client; /** - * Creates a new account activity client instance + * Creates a new communities client instance * * @param client - The main X API client instance */ @@ -9138,91 +9274,31 @@ declare class AccountActivityClient { */ private _normalizeOptions; /** - * Validate subscription - * Checks a user’s Account Activity subscription for a given webhook. - - - * @param webhookId The webhook ID to check subscription against. - - - - - * @returns {Promise} Promise resolving to the API response - */ - validateSubscription(webhookId: string): Promise; - /** - * Create subscription - * Creates an Account Activity subscription for the user and the given webhook. - - - * @param webhookId The webhook ID to check subscription against. - - - - - * @returns {Promise} Promise resolving to the API response - */ - createSubscription(webhookId: string, options?: CreateSubscriptionOptions): Promise; - /** - * Get subscription count - * Retrieves a count of currently active Account Activity subscriptions. - - - - * @returns {Promise} Promise resolving to the API response - */ - getSubscriptionCount(): Promise; - /** - * Get subscriptions - * Retrieves a list of all active subscriptions for a given webhook. - - - * @param webhookId The webhook ID to pull subscriptions for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - getSubscriptions(webhookId: string): Promise; - /** - * Create replay job - * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook. - - - * @param webhookId The unique identifier for the webhook configuration. - - - - - * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. + * Get Community by ID + * Retrieves details of a specific Community by its ID. + * @param id The ID of the Community. - * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createReplayJob(webhookId: string, fromDate: string, toDate: string): Promise; + getById(id: string, options?: GetByIdOptions): Promise; /** - * Delete subscription - * Deletes an Account Activity subscription for the given webhook and user ID. - - - * @param webhookId The webhook ID to check subscription against. - + * Search Communities + * Retrieves a list of Communities matching the specified search query. - * @param userId User ID to unsubscribe from. + * @param query Query to search communities. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - deleteSubscription(webhookId: string, userId: string): Promise; + search(query: string, options?: SearchOptions): Promise; } interface StreamDataEvent { @@ -9331,146 +9407,146 @@ declare class EventDrivenStream { */ type PostsSampleResponse = StreamingTweetResponse; /** - * Response for postsFirehose + * Response for postsFirehosePt * * @public */ -type PostsFirehoseResponse = StreamingTweetResponse; +type PostsFirehosePtResponse = StreamingTweetResponse; /** - * Response for labelsCompliance + * Response for postsFirehoseJa * * @public */ -type LabelsComplianceResponse = TweetLabelStreamResponse; +type PostsFirehoseJaResponse = StreamingTweetResponse; /** - * Response for likesCompliance + * Response for postsSample10 * * @public */ -type LikesComplianceResponse = LikesComplianceStreamResponse; +type PostsSample10Response = Get2TweetsSample10StreamResponse; /** - * Response for likesSample10 + * Response for postsFirehoseKo * * @public */ -type LikesSample10Response = StreamingLikeResponseV2; +type PostsFirehoseKoResponse = StreamingTweetResponse; /** - * Response for postsFirehosePt + * Response for likesCompliance * * @public */ -type PostsFirehosePtResponse = StreamingTweetResponse; +type LikesComplianceResponse = LikesComplianceStreamResponse; /** - * Response for postsFirehoseEn + * Response for postsCompliance * * @public */ -type PostsFirehoseEnResponse = StreamingTweetResponse; +type PostsComplianceResponse = TweetComplianceStreamResponse; /** - * Response for posts + * Response for getRuleCounts * * @public */ -type PostsResponse = FilteredStreamingTweetResponse; +type GetRuleCountsResponse = Get2TweetsSearchStreamRulesCountsResponse; /** - * Response for getRules + * Response for likesFirehose * * @public */ -type GetRulesResponse = RulesLookupResponse; +type LikesFirehoseResponse = StreamingLikeResponseV2; /** - * Request for updateRules + * Response for postsFirehoseEn * * @public */ -type UpdateRulesRequest = AddOrDeleteRulesRequest; +type PostsFirehoseEnResponse = StreamingTweetResponse; /** - * Response for updateRules + * Response for posts * * @public */ -type UpdateRulesResponse = AddOrDeleteRulesResponse; +type PostsResponse = FilteredStreamingTweetResponse; /** - * Response for postsCompliance + * Response for usersCompliance * * @public */ -type PostsComplianceResponse = TweetComplianceStreamResponse; +type UsersComplianceResponse = UserComplianceStreamResponse; /** - * Response for postsFirehoseKo + * Response for postsFirehose * * @public */ -type PostsFirehoseKoResponse = StreamingTweetResponse; +type PostsFirehoseResponse = StreamingTweetResponse; /** - * Response for likesFirehose + * Response for likesSample10 * * @public */ -type LikesFirehoseResponse = StreamingLikeResponseV2; +type LikesSample10Response = StreamingLikeResponseV2; /** - * Response for postsSample10 + * Response for getRules * * @public */ -type PostsSample10Response = Get2TweetsSample10StreamResponse; +type GetRulesResponse = RulesLookupResponse; /** - * Response for postsFirehoseJa + * Request for updateRules * * @public */ -type PostsFirehoseJaResponse = StreamingTweetResponse; +type UpdateRulesRequest = AddOrDeleteRulesRequest; /** - * Response for getRuleCounts + * Response for updateRules * * @public */ -type GetRuleCountsResponse = Get2TweetsSearchStreamRulesCountsResponse; +type UpdateRulesResponse = AddOrDeleteRulesResponse; /** - * Response for usersCompliance + * Response for labelsCompliance * * @public */ -type UsersComplianceResponse = UserComplianceStreamResponse; +type LabelsComplianceResponse = TweetLabelStreamResponse; -type models$1_GetRuleCountsResponse = GetRuleCountsResponse; -type models$1_GetRulesResponse = GetRulesResponse; -type models$1_LabelsComplianceResponse = LabelsComplianceResponse; -type models$1_LikesComplianceResponse = LikesComplianceResponse; -type models$1_LikesFirehoseResponse = LikesFirehoseResponse; -type models$1_LikesSample10Response = LikesSample10Response; -type models$1_PostsComplianceResponse = PostsComplianceResponse; -type models$1_PostsFirehoseEnResponse = PostsFirehoseEnResponse; -type models$1_PostsFirehoseJaResponse = PostsFirehoseJaResponse; -type models$1_PostsFirehoseKoResponse = PostsFirehoseKoResponse; -type models$1_PostsFirehosePtResponse = PostsFirehosePtResponse; -type models$1_PostsFirehoseResponse = PostsFirehoseResponse; -type models$1_PostsResponse = PostsResponse; -type models$1_PostsSample10Response = PostsSample10Response; -type models$1_PostsSampleResponse = PostsSampleResponse; -type models$1_UpdateRulesRequest = UpdateRulesRequest; -type models$1_UpdateRulesResponse = UpdateRulesResponse; -type models$1_UsersComplianceResponse = UsersComplianceResponse; -declare namespace models$1 { +type models$2_GetRuleCountsResponse = GetRuleCountsResponse; +type models$2_GetRulesResponse = GetRulesResponse; +type models$2_LabelsComplianceResponse = LabelsComplianceResponse; +type models$2_LikesComplianceResponse = LikesComplianceResponse; +type models$2_LikesFirehoseResponse = LikesFirehoseResponse; +type models$2_LikesSample10Response = LikesSample10Response; +type models$2_PostsComplianceResponse = PostsComplianceResponse; +type models$2_PostsFirehoseEnResponse = PostsFirehoseEnResponse; +type models$2_PostsFirehoseJaResponse = PostsFirehoseJaResponse; +type models$2_PostsFirehoseKoResponse = PostsFirehoseKoResponse; +type models$2_PostsFirehosePtResponse = PostsFirehosePtResponse; +type models$2_PostsFirehoseResponse = PostsFirehoseResponse; +type models$2_PostsResponse = PostsResponse; +type models$2_PostsSample10Response = PostsSample10Response; +type models$2_PostsSampleResponse = PostsSampleResponse; +type models$2_UpdateRulesRequest = UpdateRulesRequest; +type models$2_UpdateRulesResponse = UpdateRulesResponse; +type models$2_UsersComplianceResponse = UsersComplianceResponse; +declare namespace models$2 { export { - models$1_GetRuleCountsResponse as GetRuleCountsResponse, - models$1_GetRulesResponse as GetRulesResponse, - models$1_LabelsComplianceResponse as LabelsComplianceResponse, - models$1_LikesComplianceResponse as LikesComplianceResponse, - models$1_LikesFirehoseResponse as LikesFirehoseResponse, - models$1_LikesSample10Response as LikesSample10Response, - models$1_PostsComplianceResponse as PostsComplianceResponse, - models$1_PostsFirehoseEnResponse as PostsFirehoseEnResponse, - models$1_PostsFirehoseJaResponse as PostsFirehoseJaResponse, - models$1_PostsFirehoseKoResponse as PostsFirehoseKoResponse, - models$1_PostsFirehosePtResponse as PostsFirehosePtResponse, - models$1_PostsFirehoseResponse as PostsFirehoseResponse, - models$1_PostsResponse as PostsResponse, - models$1_PostsSample10Response as PostsSample10Response, - models$1_PostsSampleResponse as PostsSampleResponse, - models$1_UpdateRulesRequest as UpdateRulesRequest, - models$1_UpdateRulesResponse as UpdateRulesResponse, - models$1_UsersComplianceResponse as UsersComplianceResponse, + models$2_GetRuleCountsResponse as GetRuleCountsResponse, + models$2_GetRulesResponse as GetRulesResponse, + models$2_LabelsComplianceResponse as LabelsComplianceResponse, + models$2_LikesComplianceResponse as LikesComplianceResponse, + models$2_LikesFirehoseResponse as LikesFirehoseResponse, + models$2_LikesSample10Response as LikesSample10Response, + models$2_PostsComplianceResponse as PostsComplianceResponse, + models$2_PostsFirehoseEnResponse as PostsFirehoseEnResponse, + models$2_PostsFirehoseJaResponse as PostsFirehoseJaResponse, + models$2_PostsFirehoseKoResponse as PostsFirehoseKoResponse, + models$2_PostsFirehosePtResponse as PostsFirehosePtResponse, + models$2_PostsFirehoseResponse as PostsFirehoseResponse, + models$2_PostsResponse as PostsResponse, + models$2_PostsSample10Response as PostsSample10Response, + models$2_PostsSampleResponse as PostsSampleResponse, + models$2_UpdateRulesRequest as UpdateRulesRequest, + models$2_UpdateRulesResponse as UpdateRulesResponse, + models$2_UsersComplianceResponse as UsersComplianceResponse, }; } @@ -9517,11 +9593,11 @@ interface PostsSampleStreamingOptions { [key: string]: any; } /** - * Options for postsFirehose method + * Options for postsFirehosePt method * * @public */ -interface PostsFirehoseStreamingOptions { +interface PostsFirehosePtStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -9559,80 +9635,38 @@ interface PostsFirehoseStreamingOptions { [key: string]: any; } /** - * Options for labelsCompliance method - * - * @public - */ -interface LabelsComplianceStreamingOptions { - /** The number of minutes of backfill requested. - * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ - backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for likesCompliance method - * - * @public - */ -interface LikesComplianceStreamingOptions { - /** The number of minutes of backfill requested. - * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ - backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for likesSample10 method + * Options for postsFirehoseJa method * * @public */ -interface LikesSample10StreamingOptions { +interface PostsFirehoseJaStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of LikeWithTweetAuthor fields to display. - * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ - likeWithTweetAuthorFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9643,11 +9677,11 @@ interface LikesSample10StreamingOptions { [key: string]: any; } /** - * Options for postsFirehosePt method + * Options for postsSample10 method * * @public */ -interface PostsFirehosePtStreamingOptions { +interface PostsSample10StreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -9685,11 +9719,11 @@ interface PostsFirehosePtStreamingOptions { [key: string]: any; } /** - * Options for postsFirehoseEn method + * Options for postsFirehoseKo method * * @public */ -interface PostsFirehoseEnStreamingOptions { +interface PostsFirehoseKoStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -9727,38 +9761,20 @@ interface PostsFirehoseEnStreamingOptions { [key: string]: any; } /** - * Options for posts method + * Options for likesCompliance method * * @public */ -interface PostsStreamingOptions { +interface LikesComplianceStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9769,20 +9785,20 @@ interface PostsStreamingOptions { [key: string]: any; } /** - * Options for getRules method + * Options for postsCompliance method * * @public */ -interface GetRulesStreamingOptions { - /** A comma-separated list of Rule IDs. - * Also accepts: ids or proper camelCase (e.g., ids) */ - ids?: Array; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This value is populated by passing the 'next_token' returned in a request to paginate through results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: string; +interface PostsComplianceStreamingOptions { + /** The number of minutes of backfill requested. + * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ + backfillMinutes?: number; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9793,17 +9809,14 @@ interface GetRulesStreamingOptions { [key: string]: any; } /** - * Options for updateRules method + * Options for getRuleCounts method * * @public */ -interface UpdateRulesStreamingOptions { - /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. - * Also accepts: dry_run or proper camelCase (e.g., dryRun) */ - dryRun?: boolean; - /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. - * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */ - deleteAll?: boolean; +interface GetRuleCountsStreamingOptions { + /** A comma separated list of RulesCount fields to display. + * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */ + rulesCountFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9814,20 +9827,74 @@ interface UpdateRulesStreamingOptions { [key: string]: any; } /** - * Options for postsCompliance method + * Options for likesFirehose method * * @public */ -interface PostsComplianceStreamingOptions { +interface LikesFirehoseStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** A comma separated list of LikeWithTweetAuthor fields to display. + * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ + likeWithTweetAuthorFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for postsFirehoseEn method + * + * @public + */ +interface PostsFirehoseEnStreamingOptions { + /** The number of minutes of backfill requested. + * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ + backfillMinutes?: number; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9838,15 +9905,15 @@ interface PostsComplianceStreamingOptions { [key: string]: any; } /** - * Options for postsFirehoseKo method + * Options for posts method * * @public */ -interface PostsFirehoseKoStreamingOptions { +interface PostsStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. @@ -9880,32 +9947,20 @@ interface PostsFirehoseKoStreamingOptions { [key: string]: any; } /** - * Options for likesFirehose method + * Options for usersCompliance method * * @public */ -interface LikesFirehoseStreamingOptions { +interface UsersComplianceStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of LikeWithTweetAuthor fields to display. - * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ - likeWithTweetAuthorFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -9916,11 +9971,11 @@ interface LikesFirehoseStreamingOptions { [key: string]: any; } /** - * Options for postsSample10 method + * Options for postsFirehose method * * @public */ -interface PostsSample10StreamingOptions { +interface PostsFirehoseStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -9958,38 +10013,32 @@ interface PostsSample10StreamingOptions { [key: string]: any; } /** - * Options for postsFirehoseJa method + * Options for likesSample10 method * * @public */ -interface PostsFirehoseJaStreamingOptions { +interface LikesSample10StreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of LikeWithTweetAuthor fields to display. + * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ + likeWithTweetAuthorFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -10000,14 +10049,20 @@ interface PostsFirehoseJaStreamingOptions { [key: string]: any; } /** - * Options for getRuleCounts method + * Options for getRules method * * @public */ -interface GetRuleCountsStreamingOptions { - /** A comma separated list of RulesCount fields to display. - * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */ - rulesCountFields?: Array; +interface GetRulesStreamingOptions { + /** A comma-separated list of Rule IDs. + * Also accepts: ids or proper camelCase (e.g., ids) */ + ids?: Array; + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This value is populated by passing the 'next_token' returned in a request to paginate through results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: string; /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -10018,18 +10073,39 @@ interface GetRuleCountsStreamingOptions { [key: string]: any; } /** - * Options for usersCompliance method + * Options for updateRules method * * @public */ -interface UsersComplianceStreamingOptions { +interface UpdateRulesStreamingOptions { + /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. + * Also accepts: dry_run or proper camelCase (e.g., dryRun) */ + dryRun?: boolean; + /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. + * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */ + deleteAll?: boolean; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for labelsCompliance method + * + * @public + */ +interface LabelsComplianceStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; /** Additional request options */ @@ -10063,8 +10139,8 @@ declare class StreamClient { */ postsSample(options?: PostsSampleStreamingOptions): Promise; /** - * Stream all Posts - * Streams all public Posts in real-time. + * Stream Portuguese Posts + * Streams all public Portuguese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10078,10 +10154,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehose(partition: number, options?: PostsFirehoseStreamingOptions): Promise; + postsFirehosePt(partition: number, options?: PostsFirehosePtStreamingOptions): Promise; /** - * Stream Post labels - * Streams all labeling events applied to Posts. + * Stream Japanese Posts + * Streams all public Japanese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10089,12 +10165,16 @@ declare class StreamClient { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - labelsCompliance(options?: LabelsComplianceStreamingOptions): Promise; + postsFirehoseJa(partition: number, options?: PostsFirehoseJaStreamingOptions): Promise; /** - * Stream Likes compliance data - * Streams all compliance data related to Likes for Users. + * Stream 10% sampled Posts + * Streams a 10% sample of public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10102,12 +10182,16 @@ declare class StreamClient { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - likesCompliance(options?: LikesComplianceStreamingOptions): Promise; + postsSample10(partition: number, options?: PostsSample10StreamingOptions): Promise; /** - * Stream sampled Likes - * Streams a 10% sample of public Likes in real-time. + * Stream Korean Posts + * Streams all public Korean-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10121,10 +10205,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - likesSample10(partition: number, options?: LikesSample10StreamingOptions): Promise; + postsFirehoseKo(partition: number, options?: PostsFirehoseKoStreamingOptions): Promise; /** - * Stream Portuguese Posts - * Streams all public Portuguese-language Posts in real-time. + * Stream Likes compliance data + * Streams all compliance data related to Likes for Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10132,16 +10216,12 @@ declare class StreamClient { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehosePt(partition: number, options?: PostsFirehosePtStreamingOptions): Promise; + likesCompliance(options?: LikesComplianceStreamingOptions): Promise; /** - * Stream English Posts - * Streams all public English-language Posts in real-time. + * Stream Posts compliance data + * Streams all compliance data related to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10155,10 +10235,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehoseEn(partition: number, options?: PostsFirehoseEnStreamingOptions): Promise; + postsCompliance(partition: number, options?: PostsComplianceStreamingOptions): Promise; /** - * Stream filtered Posts - * Streams Posts in real-time matching the active rule set. + * Stream all Likes + * Streams all public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10166,12 +10246,16 @@ declare class StreamClient { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - posts(options?: PostsStreamingOptions): Promise; + likesFirehose(partition: number, options?: LikesFirehoseStreamingOptions): Promise; /** - * Stream Posts compliance data - * Streams all compliance data related to Posts. + * Stream English Posts + * Streams all public English-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10185,10 +10269,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsCompliance(partition: number, options?: PostsComplianceStreamingOptions): Promise; + postsFirehoseEn(partition: number, options?: PostsFirehoseEnStreamingOptions): Promise; /** - * Stream Korean Posts - * Streams all public Korean-language Posts in real-time. + * Stream filtered Posts + * Streams Posts in real-time matching the active rule set. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10196,16 +10280,12 @@ declare class StreamClient { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehoseKo(partition: number, options?: PostsFirehoseKoStreamingOptions): Promise; + posts(options?: PostsStreamingOptions): Promise; /** - * Stream all Likes - * Streams all public Likes in real-time. + * Stream Users compliance data + * Streams all compliance data related to Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10219,10 +10299,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - likesFirehose(partition: number, options?: LikesFirehoseStreamingOptions): Promise; + usersCompliance(partition: number, options?: UsersComplianceStreamingOptions): Promise; /** - * Stream 10% sampled Posts - * Streams a 10% sample of public Posts in real-time. + * Stream all Posts + * Streams all public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10236,10 +10316,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsSample10(partition: number, options?: PostsSample10StreamingOptions): Promise; + postsFirehose(partition: number, options?: PostsFirehoseStreamingOptions): Promise; /** - * Stream Japanese Posts - * Streams all public Japanese-language Posts in real-time. + * Stream sampled Likes + * Streams a 10% sample of public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10253,10 +10333,10 @@ declare class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - postsFirehoseJa(partition: number, options?: PostsFirehoseJaStreamingOptions): Promise; + likesSample10(partition: number, options?: LikesSample10StreamingOptions): Promise; /** - * Stream Users compliance data - * Streams all compliance data related to Users. + * Stream Post labels + * Streams all labeling events applied to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -10264,13 +10344,16 @@ declare class StreamClient { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - usersCompliance(partition: number, options?: UsersComplianceStreamingOptions): Promise; + labelsCompliance(options?: LabelsComplianceStreamingOptions): Promise; + /** + * Get stream rule counts + * Retrieves the count of rules in the active rule set for the filtered stream. + * + * @returns Promise with the API response + */ + getRuleCounts(options?: GetRuleCountsStreamingOptions): Promise; /** * Get stream rules * Retrieves the active rule set or a subset of rules for the filtered stream. @@ -10285,164 +10368,100 @@ declare class StreamClient { * @returns Promise with the API response */ updateRules(body: any, options?: UpdateRulesStreamingOptions): Promise; - /** - * Get stream rule counts - * Retrieves the count of rules in the active rule set for the filtered stream. - * - * @returns Promise with the API response - */ - getRuleCounts(options?: GetRuleCountsStreamingOptions): Promise; } /** - * Models for webhooks operations + * Models for compliance operations */ /** - * Response for createStreamLink - * - * @public - */ -type CreateStreamLinkResponse = WebhookLinksCreateResponse; -/** - * Response for deleteStreamLink - * - * @public - */ -type DeleteStreamLinkResponse = WebhookLinksDeleteResponse; -/** - * Response for validate - * - * @public - */ -type ValidateResponse = WebhookConfigPutResponse; -/** - * Response for delete - * - * @public - */ -type DeleteResponse = WebhookConfigDeleteResponse; -/** - * Response for getStreamLinks + * Response for getJobs * * @public */ -type GetStreamLinksResponse = WebhookLinksGetResponse; +type GetJobsResponse = Get2ComplianceJobsResponse; /** - * Response for get + * Request for createJobs * * @public */ -type GetResponse = Get2WebhooksResponse; +type CreateJobsRequest = CreateComplianceJobRequest; /** - * Request for create + * Response for createJobs * * @public */ -type CreateRequest = WebhookConfigCreateRequest; +type CreateJobsResponse = CreateComplianceJobResponse; /** - * Response for create + * Response for getJobsById * * @public */ -type CreateResponse = WebhookConfigCreateResponse; +type GetJobsByIdResponse = Get2ComplianceJobsIdResponse; -type models_CreateRequest = CreateRequest; -type models_CreateResponse = CreateResponse; -type models_CreateStreamLinkResponse = CreateStreamLinkResponse; -type models_DeleteResponse = DeleteResponse; -type models_DeleteStreamLinkResponse = DeleteStreamLinkResponse; -type models_GetResponse = GetResponse; -type models_GetStreamLinksResponse = GetStreamLinksResponse; -type models_ValidateResponse = ValidateResponse; -declare namespace models { +type models$1_CreateJobsRequest = CreateJobsRequest; +type models$1_CreateJobsResponse = CreateJobsResponse; +type models$1_GetJobsByIdResponse = GetJobsByIdResponse; +type models$1_GetJobsResponse = GetJobsResponse; +declare namespace models$1 { export { - models_CreateRequest as CreateRequest, - models_CreateResponse as CreateResponse, - models_CreateStreamLinkResponse as CreateStreamLinkResponse, - models_DeleteResponse as DeleteResponse, - models_DeleteStreamLinkResponse as DeleteStreamLinkResponse, - models_GetResponse as GetResponse, - models_GetStreamLinksResponse as GetStreamLinksResponse, - models_ValidateResponse as ValidateResponse, + models$1_CreateJobsRequest as CreateJobsRequest, + models$1_CreateJobsResponse as CreateJobsResponse, + models$1_GetJobsByIdResponse as GetJobsByIdResponse, + models$1_GetJobsResponse as GetJobsResponse, }; } /** - * webhooks client for the X API. + * compliance client for the X API. * - * This module provides a client for interacting with the webhooks endpoints of the X API. + * This module provides a client for interacting with the compliance endpoints of the X API. */ /** - * Options for createStreamLink method - * - * @public - */ -interface CreateStreamLinkOptions { - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: string; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: string; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: string; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: string; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: string; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: string; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for get method + * Options for getJobs method * * @public */ -interface GetOptions { - /** A comma separated list of WebhookConfig fields to display. - * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */ - webhookConfigFields?: Array; +interface GetJobsOptions { + /** Status of Compliance Job to list. + * Also accepts: status or proper camelCase (e.g., status) */ + status?: string; + /** A comma separated list of ComplianceJob fields to display. + * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ + complianceJobFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Options for create method + * Options for getJobsById method * * @public */ -interface CreateOptions { - /** Request body */ - body?: CreateRequest; +interface GetJobsByIdOptions { + /** A comma separated list of ComplianceJob fields to display. + * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ + complianceJobFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } /** - * Client for webhooks operations + * Client for compliance operations * - * This client provides methods for interacting with the webhooks endpoints + * This client provides methods for interacting with the compliance endpoints * of the X API. It handles authentication, request formatting, and response - * parsing for all webhooks related operations. + * parsing for all compliance related operations. * - * @category webhooks + * @category compliance */ -declare class WebhooksClient { +declare class ComplianceClient { private client; /** - * Creates a new webhooks client instance + * Creates a new compliance client instance * * @param client - The main X API client instance */ @@ -10453,84 +10472,116 @@ declare class WebhooksClient { */ private _normalizeOptions; /** - * Create stream link - * Creates a link to deliver FilteredStream events to the given webhook. + * Get Compliance Jobs + * Retrieves a list of Compliance Jobs filtered by job type and optional status. - * @param webhookId The webhook ID to link to your FilteredStream ruleset. + * @param type Type of Compliance Job to list. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - createStreamLink(webhookId: string, options?: CreateStreamLinkOptions): Promise; + getJobs(type: string, options?: GetJobsOptions): Promise; /** - * Delete stream link - * Deletes a link from FilteredStream events to the given webhook. - - - * @param webhookId The webhook ID to link to your FilteredStream ruleset. + * Create Compliance Job + * Creates a new Compliance Job for the specified job type. + * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - deleteStreamLink(webhookId: string): Promise; + createJobs(body: CreateJobsRequest): Promise; /** - * Validate webhook - * Triggers a CRC check for a given webhook. + * Get Compliance Job by ID + * Retrieves details of a specific Compliance Job by its ID. - * @param webhookId The ID of the webhook to check. + * @param id The ID of the Compliance Job to retrieve. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ - validate(webhookId: string): Promise; + getJobsById(id: string, options?: GetJobsByIdOptions): Promise; +} + +/** + * Models for usage operations + */ + +/** + * Response for get + * + * @public + */ +type GetResponse = Get2UsageTweetsResponse; + +type models_GetResponse = GetResponse; +declare namespace models { + export { + models_GetResponse as GetResponse, + }; +} + +/** + * usage client for the X API. + * + * This module provides a client for interacting with the usage endpoints of the X API. + */ + +/** + * Options for get method + * + * @public + */ +interface GetOptions { + /** The number of days for which you need usage for. + * Also accepts: days or proper camelCase (e.g., days) */ + days?: number; + /** A comma separated list of Usage fields to display. + * Also accepts: usage.fields or proper camelCase (e.g., usageFields) */ + usageFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Client for usage operations + * + * This client provides methods for interacting with the usage endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all usage related operations. + * + * @category usage + */ +declare class UsageClient { + private client; /** - * Delete webhook - * Deletes an existing webhook configuration. - - - * @param webhookId The ID of the webhook to delete. - - - - - * @returns {Promise} Promise resolving to the API response - */ - delete(webhookId: string): Promise; + * Creates a new usage client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client); /** - * Get stream links - * Get a list of webhook links associated with a filtered stream ruleset. - - - - * @returns {Promise} Promise resolving to the API response - */ - getStreamLinks(): Promise; + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions; /** - * Get webhook - * Get a list of webhook configs associated with a client app. + * Get usage + * Retrieves usage statistics for Posts over a specified number of days. * @returns {Promise} Promise resolving to the API response */ get(options?: GetOptions): Promise; - /** - * Create webhook - * Creates a new webhook configuration. - - - - * @returns {Promise} Promise resolving to the API response - */ - create(options?: CreateOptions): Promise; } /** @@ -10660,42 +10711,42 @@ declare class Client { readonly maxRetries: number; /** HTTP client for making requests */ readonly httpClient: HttpClient; - /** news client */ - readonly news: NewsClient; - /** users client */ - readonly users: UsersClient; - /** direct messages client */ - readonly directMessages: DirectMessagesClient; - /** community notes client */ - readonly communityNotes: CommunityNotesClient; - /** posts client */ - readonly posts: PostsClient; - /** trends client */ - readonly trends: TrendsClient; /** activity client */ readonly activity: ActivityClient; - /** usage client */ - readonly usage: UsageClient; - /** spaces client */ - readonly spaces: SpacesClient; - /** communities client */ - readonly communities: CommunitiesClient; + /** news client */ + readonly news: NewsClient; /** connections client */ readonly connections: ConnectionsClient; + /** account activity client */ + readonly accountActivity: AccountActivityClient; + /** spaces client */ + readonly spaces: SpacesClient; + /** trends client */ + readonly trends: TrendsClient; /** media client */ readonly media: MediaClient; + /** direct messages client */ + readonly directMessages: DirectMessagesClient; + /** posts client */ + readonly posts: PostsClient; /** lists client */ readonly lists: ListsClient; - /** compliance client */ - readonly compliance: ComplianceClient; + /** community notes client */ + readonly communityNotes: CommunityNotesClient; /** general client */ readonly general: GeneralClient; - /** account activity client */ - readonly accountActivity: AccountActivityClient; - /** stream client */ - readonly stream: StreamClient; /** webhooks client */ readonly webhooks: WebhooksClient; + /** users client */ + readonly users: UsersClient; + /** communities client */ + readonly communities: CommunitiesClient; + /** stream client */ + readonly stream: StreamClient; + /** compliance client */ + readonly compliance: ComplianceClient; + /** usage client */ + readonly usage: UsageClient; /** * Creates a new X API client instance * @@ -11303,4 +11354,4 @@ declare class EventPaginator extends Paginator { get events(): any[]; } -export { models$2 as AccountActivity, AccountActivityClient, models$b as Activity, ActivityClient, ApiError, ApiResponse, Client, ClientConfig, models$8 as Communities, CommunitiesClient, models$e as CommunityNotes, CommunityNotesClient, models$4 as Compliance, ComplianceClient, models$7 as Connections, ConnectionsClient, CryptoUtils, models$f as DirectMessages, DirectMessagesClient, EventPaginator, models$3 as General, GeneralClient, HttpClient, RequestOptions$1 as HttpClientRequestOptions, HttpResponse, models$5 as Lists, ListsClient, models$6 as Media, MediaClient, models$h as News, NewsClient, OAuth1, OAuth1AccessToken, OAuth1Config, OAuth1RequestToken, OAuth2, OAuth2Config, OAuth2Token, PaginatedResponse, PaginationMeta, Paginator, PostPaginator, models$d as Posts, PostsClient, RequestOptions, schemas as Schemas, models$9 as Spaces, SpacesClient, models$1 as Stream, StreamClient, StreamListener, models$c as Trends, TrendsClient, TweetStreamListener, models$a as Usage, UsageClient, UserPaginator, models$g as Users, UsersClient, models as Webhooks, WebhooksClient, generateCodeChallenge, generateCodeVerifier, generateNonce, generateTimestamp, hmacSha1, httpClient }; +export { models$e as AccountActivity, AccountActivityClient, models$h as Activity, ActivityClient, ApiError, ApiResponse, Client, ClientConfig, models$3 as Communities, CommunitiesClient, models$7 as CommunityNotes, CommunityNotesClient, models$1 as Compliance, ComplianceClient, models$f as Connections, ConnectionsClient, CryptoUtils, models$a as DirectMessages, DirectMessagesClient, EventPaginator, models$6 as General, GeneralClient, HttpClient, RequestOptions$1 as HttpClientRequestOptions, HttpResponse, models$8 as Lists, ListsClient, models$b as Media, MediaClient, models$g as News, NewsClient, OAuth1, OAuth1AccessToken, OAuth1Config, OAuth1RequestToken, OAuth2, OAuth2Config, OAuth2Token, PaginatedResponse, PaginationMeta, Paginator, PostPaginator, models$9 as Posts, PostsClient, RequestOptions, schemas as Schemas, models$d as Spaces, SpacesClient, models$2 as Stream, StreamClient, StreamListener, models$c as Trends, TrendsClient, TweetStreamListener, models as Usage, UsageClient, UserPaginator, models$4 as Users, UsersClient, models$5 as Webhooks, WebhooksClient, generateCodeChallenge, generateCodeVerifier, generateNonce, generateTimestamp, hmacSha1, httpClient }; diff --git a/xdk/typescript/dist/index.js b/xdk/typescript/dist/index.js index e1435618..99b0647f 100644 --- a/xdk/typescript/dist/index.js +++ b/xdk/typescript/dist/index.js @@ -6634,11 +6634,11 @@ var HttpClient = class { }; var httpClient = new HttpClient(); -// src/news/client.ts -var NewsClient = class { +// src/activity/client.ts +var ActivityClient = class { client; /** - * Creates a new news client instance + * Creates a new activity client instance * * @param client - The main X API client instance */ @@ -6663,50 +6663,25 @@ var NewsClient = class { return normalized; } /** - * Get news stories by ID - * Retrieves news story by its ID. - - - * @param id The ID of the news story. - + * Get X activity subscriptions + * Get a list of active subscriptions for XAA - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async get(id, options = {}) { - const paramMappings = { - "news.fields": "newsFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - newsFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/news/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getSubscriptions() { + let path = "/2/activity/subscriptions"; const params = new URLSearchParams(); - if (newsFields !== void 0 && newsFields.length > 0) { - params.append("news.fields", newsFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "GET", @@ -6714,140 +6689,80 @@ var NewsClient = class { finalRequestOptions ); } -}; - -// src/news/models.ts -var models_exports = {}; - -// src/users/client.ts -var UsersClient = class { - client; - /** - * Creates a new users client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Unlike Post - * Causes the authenticated user to Unlike a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to unlike the Post. - - - - * @param tweetId The ID of the Post that the User is requesting to unlike. - + * Create X activity subscription + * Creates a subscription for an X activity event - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unlikePost(id, tweetId) { - let path = "/2/users/{id}/likes/{tweet_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + async createSubscription(options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/activity/subscriptions"; const params = new URLSearchParams(); const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["like.write", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get owned Lists - * Retrieves a list of Lists owned by a specific User by their ID. - - - * @param id The ID of the User to lookup. - + * Activity Stream + * Stream of X Activities - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getOwnedLists(id, options = {}) { + async stream(options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "list.fields": "listFields", - "user.fields": "userFields" + backfill_minutes: "backfillMinutes", + start_time: "startTime", + end_time: "endTime" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - listFields = [], - expansions = [], - userFields = [], + backfillMinutes = void 0, + startTime = void 0, + endTime = void 0, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/owned_lists"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/activity/stream"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (backfillMinutes !== void 0) { + params.append("backfill_minutes", String(backfillMinutes)); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] - }, - { - UserToken: [] } ], ...requestOptions @@ -6859,100 +6774,71 @@ var UsersClient = class { ); } /** - * Get blocking - * Retrieves a list of Users blocked by the specified User ID. + * Update X activity subscription + * Updates a subscription for an X activity event - * @param id The ID of the authenticated source User for whom to return results. + * @param subscriptionId The ID of the subscription to update. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBlocking(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async updateSubscription(subscriptionId, options = {}) { + const normalizedOptions = options || {}; const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], - expansions = [], - tweetFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/blocking"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/activity/subscriptions/{subscription_id}"; + path = path.replace( + "{subscription_id}", + encodeURIComponent(String(subscriptionId)) + ); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["block.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "PUT", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Delete Bookmark - * Removes a Post from the authenticated user’s Bookmarks by its ID. - - - * @param id The ID of the authenticated source User whose bookmark is to be removed. - + * Deletes X activity subscription + * Deletes a subscription for an X activity event - * @param tweetId The ID of the Post that the source User is removing from bookmarks. + * @param subscriptionId The ID of the subscription to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteBookmark(id, tweetId) { - let path = "/2/users/{id}/bookmarks/{tweet_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + async deleteSubscription(subscriptionId) { + let path = "/2/activity/subscriptions/{subscription_id}"; + path = path.replace( + "{subscription_id}", + encodeURIComponent(String(subscriptionId)) + ); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["bookmark.write", "tweet.read", "users.read"] + BearerToken: [] } ] // No optional parameters, using empty request options @@ -6963,45 +6849,69 @@ var UsersClient = class { finalRequestOptions ); } - /** - * Get User by username - * Retrieves details of a specific User by their username. - - - * @param username A username. +}; + +// src/activity/models.ts +var models_exports = {}; + +// src/news/client.ts +var NewsClient = class { + client; + /** + * Creates a new news client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get news stories by ID + * Retrieves news story by its ID. + * @param id The ID of the news story. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByUsername(username, options = {}) { + async get(id, options = {}) { const paramMappings = { - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "news.fields": "newsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - userFields = [], - expansions = [], - tweetFields = [], + newsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/by/username/{username}"; - path = path.replace("{username}", encodeURIComponent(String(username))); + let path = "/2/news/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (newsFields !== void 0 && newsFields.length > 0) { + params.append("news.fields", newsFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -7025,133 +6935,47 @@ var UsersClient = class { ); } /** - * Unpin List - * Causes the authenticated user to unpin a specific List by its ID. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - * @param listId The ID of the List to unpin. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async unpinList(id, listId) { - let path = "/2/users/{id}/pinned_lists/{list_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{list_id}", encodeURIComponent(String(listId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Get Posts - * Retrieves a list of posts authored by a specific User by their ID. + * Search News + * Retrieves a list of News stories matching the specified search query. - * @param id The ID of the User to lookup. + * @param query The search query. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPosts(id, options = {}) { + async search(query, options = {}) { const paramMappings = { - since_id: "sinceId", - until_id: "untilId", max_results: "maxResults", - pagination_token: "paginationToken", - start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + max_age_hours: "maxAgeHours", + "news.fields": "newsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - sinceId = void 0, - untilId = void 0, maxResults = void 0, - paginationToken = void 0, - exclude = [], - startTime = void 0, - endTime = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + maxAgeHours = void 0, + newsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/tweets"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/news/search"; const params = new URLSearchParams(); - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); + if (query !== void 0) { + params.append("query", String(query)); } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (exclude !== void 0 && exclude.length > 0) { - params.append("exclude", exclude.join(",")); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); + if (maxAgeHours !== void 0) { + params.append("max_age_hours", String(maxAgeHours)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (newsFields !== void 0 && newsFields.length > 0) { + params.append("news.fields", newsFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -7161,9 +6985,6 @@ var UsersClient = class { }, { OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] } ], ...requestOptions @@ -7174,143 +6995,153 @@ var UsersClient = class { finalRequestOptions ); } +}; + +// src/news/models.ts +var models_exports2 = {}; + +// src/connections/client.ts +var ConnectionsClient = class { + client; /** - * Get Bookmarks - * Retrieves a list of Posts bookmarked by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - + * Creates a new connections client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Terminate all connections + * Terminates all active streaming connections for the authenticated application. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBookmarks(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + async deleteAll() { + let path = "/2/connections/all"; + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + } + ] + // No optional parameters, using empty request options }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings + return this.client.request( + "DELETE", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions ); - const { - maxResults = void 0, - paginationToken = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/users/{id}/bookmarks"; - path = path.replace("{id}", encodeURIComponent(String(id))); - const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + } +}; + +// src/connections/models.ts +var models_exports3 = {}; + +// src/account_activity/client.ts +var AccountActivityClient = class { + client; + /** + * Creates a new account activity client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } } - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["bookmark.read", "tweet.read", "users.read"] - } - ], - ...requestOptions - }; - return this.client.request( - "GET", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); + return normalized; } /** - * Create Bookmark - * Adds a post to the authenticated user’s bookmarks. - + * Get subscriptions + * Retrieves a list of all active subscriptions for a given webhook. - * @param id The ID of the authenticated source User for whom to add bookmarks. + * @param webhookId The webhook ID to pull subscriptions for. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createBookmark(id, body) { - let path = "/2/users/{id}/bookmarks"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getSubscriptions(webhookId) { + let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["bookmark.write", "tweet.read", "users.read"] + BearerToken: [] } ] // No optional parameters, using empty request options }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Block DMs - * Blocks direct messages to or from a specific User by their ID for the authenticated user. + * Validate subscription + * Checks a user’s Account Activity subscription for a given webhook. - * @param id The ID of the target User that the authenticated user requesting to block dms for. + * @param webhookId The webhook ID to check subscription against. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async blockDms(id) { - let path = "/2/users/{id}/dm/block"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async validateSubscription(webhookId) { + let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.write", "tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "dm.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -7319,112 +7150,72 @@ var UsersClient = class { // No optional parameters, using empty request options }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Unfollow List - * Causes the authenticated user to unfollow a specific List by its ID. - - - * @param id The ID of the authenticated source User that will unfollow the List. - + * Create subscription + * Creates an Account Activity subscription for the user and the given webhook. - * @param listId The ID of the List to unfollow. + * @param webhookId The webhook ID to check subscription against. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unfollowList(id, listId) { - let path = "/2/users/{id}/followed_lists/{list_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{list_id}", encodeURIComponent(String(listId))); + async createSubscription(webhookId, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "dm.write", "tweet.read", "users.read"] }, { UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get muting - * Retrieves a list of Users muted by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - + * Get subscription count + * Retrieves a count of currently active Account Activity subscriptions. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMuting(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], - expansions = [], - tweetFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/users/{id}/muting"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getSubscriptionCount() { + let path = "/2/account_activity/subscriptions/count"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["mute.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "GET", @@ -7433,150 +7224,174 @@ var UsersClient = class { ); } /** - * Mute User - * Causes the authenticated user to mute a specific User by their ID. + * Delete subscription + * Deletes an Account Activity subscription for the given webhook and user ID. - * @param id The ID of the authenticated source User that is requesting to mute the target User. + * @param webhookId The webhook ID to check subscription against. + * @param userId User ID to unsubscribe from. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async muteUser(id, options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/users/{id}/muting"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async deleteSubscription(webhookId, userId) { + let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + path = path.replace("{user_id}", encodeURIComponent(String(userId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["mute.write", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get User by ID - * Retrieves details of a specific User by their ID. + * Create replay job + * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook. - * @param id The ID of the User to lookup. + * @param webhookId The unique identifier for the webhook configuration. - * @returns {Promise} Promise resolving to the API response + * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. + + + + * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { - const paramMappings = { - "user.fields": "userFields", - "tweet.fields": "tweetFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - userFields = [], - expansions = [], - tweetFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/users/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async createReplayJob(webhookId, fromDate, toDate) { + let path = "/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (fromDate !== void 0) { + params.append("from_date", String(fromDate)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (toDate !== void 0) { + params.append("to_date", String(toDate)); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/account_activity/models.ts +var models_exports4 = {}; + +// src/spaces/client.ts +var SpacesClient = class { + client; + /** + * Creates a new spaces client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } /** - * Get my User - * Retrieves details of the authenticated user. + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get space by ID + * Retrieves details of a specific space by its ID. + * @param id The ID of the Space to be retrieved. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMe(options = {}) { + async getById(id, options = {}) { const paramMappings = { + "space.fields": "spaceFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "topic.fields": "topicFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - userFields = [], + spaceFields = [], expansions = [], - tweetFields = [], + userFields = [], + topicFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/me"; + let path = "/2/spaces/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (spaceFields !== void 0 && spaceFields.length > 0) { + params.append("space.fields", spaceFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (topicFields !== void 0 && topicFields.length > 0) { + params.append("topic.fields", topicFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] + BearerToken: [] }, { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -7588,111 +7403,22 @@ var UsersClient = class { ); } /** - * Unrepost Post - * Causes the authenticated user to unrepost a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to repost the Post. - - - - * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async unrepostPost(id, sourceTweetId) { - let path = "/2/users/{id}/retweets/{source_tweet_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace( - "{source_tweet_id}", - encodeURIComponent(String(sourceTweetId)) - ); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Unmute User - * Causes the authenticated user to unmute a specific user by their ID. - - - * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. - - - - * @param targetUserId The ID of the User that the source User is requesting to unmute. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async unmuteUser(sourceUserId, targetUserId) { - let path = "/2/users/{source_user_id}/muting/{target_user_id}"; - path = path.replace( - "{source_user_id}", - encodeURIComponent(String(sourceUserId)) - ); - path = path.replace( - "{target_user_id}", - encodeURIComponent(String(targetUserId)) - ); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["mute.write", "tweet.read", "users.read"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Search Users - * Retrieves a list of Users matching a search query. + * Get Space ticket buyers + * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + * @param id The ID of the Space to be retrieved. - * @param query TThe the query string by which to query for users. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async search(query, options = {}) { + async getBuyers(id, options = {}) { const paramMappings = { + pagination_token: "paginationToken", max_results: "maxResults", - next_token: "nextToken", "user.fields": "userFields", "tweet.fields": "tweetFields" }; @@ -7701,24 +7427,22 @@ var UsersClient = class { paramMappings ); const { + paginationToken = void 0, maxResults = void 0, - nextToken = void 0, userFields = [], expansions = [], tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/search"; + let path = "/2/spaces/{id}/buyers"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } - if (nextToken !== void 0) { - params.append("next_token", String(nextToken)); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } @@ -7732,10 +7456,7 @@ var UsersClient = class { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -7747,53 +7468,73 @@ var UsersClient = class { ); } /** - * Get pinned Lists - * Retrieves a list of Lists pinned by the authenticated user. + * Get Space Posts + * Retrieves a list of Posts shared in a specific Space by its ID. - * @param id The ID of the authenticated source User for whom to return results. + * @param id The ID of the Space to be retrieved. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPinnedLists(id, options = {}) { + async getPosts(id, options = {}) { const paramMappings = { - "list.fields": "listFields", - "user.fields": "userFields" + max_results: "maxResults", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - listFields = [], + maxResults = void 0, + tweetFields = [], expansions = [], + mediaFields = [], + pollFields = [], userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/pinned_lists"; + let path = "/2/spaces/{id}/tweets"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + BearerToken: [] }, { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -7805,86 +7546,107 @@ var UsersClient = class { ); } /** - * Pin List - * Causes the authenticated user to pin a specific List by its ID. - + * Get Spaces by creator IDs + * Retrieves details of Spaces created by specified User IDs. - * @param id The ID of the authenticated source User that will pin the List. + * @param userIds The IDs of Users to search through. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async pinList(id, body) { - let path = "/2/users/{id}/pinned_lists"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getByCreatorIds(userIds, options = {}) { + const paramMappings = { + "space.fields": "spaceFields", + "user.fields": "userFields", + "topic.fields": "topicFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + spaceFields = [], + expansions = [], + userFields = [], + topicFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/spaces/by/creator_ids"; const params = new URLSearchParams(); + if (userIds !== void 0 && userIds.length > 0) { + params.append("user_ids", userIds.join(",")); + } + if (spaceFields !== void 0 && spaceFields.length > 0) { + params.append("space.fields", spaceFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (topicFields !== void 0 && topicFields.length > 0) { + params.append("topic.fields", topicFields.join(",")); + } const finalRequestOptions = { - body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + BearerToken: [] }, { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get followed Lists - * Retrieves a list of Lists followed by a specific User by their ID. + * Get Spaces by IDs + * Retrieves details of multiple Spaces by their IDs. - * @param id The ID of the User to lookup. + * @param ids The list of Space IDs to return. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowedLists(id, options = {}) { + async getByIds(ids, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "list.fields": "listFields", - "user.fields": "userFields" + "space.fields": "spaceFields", + "user.fields": "userFields", + "topic.fields": "topicFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - listFields = [], + spaceFields = [], expansions = [], userFields = [], + topicFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/followed_lists"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/spaces"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); } - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (spaceFields !== void 0 && spaceFields.length > 0) { + params.append("space.fields", spaceFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -7892,6 +7654,9 @@ var UsersClient = class { if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } + if (topicFields !== void 0 && topicFields.length > 0) { + params.append("topic.fields", topicFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ @@ -7899,10 +7664,7 @@ var UsersClient = class { BearerToken: [] }, { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -7914,74 +7676,146 @@ var UsersClient = class { ); } /** - * Follow List - * Causes the authenticated user to follow a specific List by its ID. + * Search Spaces + * Retrieves a list of Spaces matching the specified search query. - * @param id The ID of the authenticated source User that will follow the List. + * @param query The search query. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async followList(id, options = {}) { - const normalizedOptions = options || {}; + async search(query, options = {}) { + const paramMappings = { + max_results: "maxResults", + "space.fields": "spaceFields", + "user.fields": "userFields", + "topic.fields": "topicFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + state = void 0, + maxResults = void 0, + spaceFields = [], + expansions = [], + userFields = [], + topicFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/followed_lists"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/spaces/search"; const params = new URLSearchParams(); + if (query !== void 0) { + params.append("query", String(query)); + } + if (state !== void 0) { + params.append("state", String(state)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (spaceFields !== void 0 && spaceFields.length > 0) { + params.append("space.fields", spaceFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (topicFields !== void 0 && topicFields.length > 0) { + params.append("topic.fields", topicFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + BearerToken: [] }, { - UserToken: [] + OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/spaces/models.ts +var models_exports5 = {}; + +// src/trends/client.ts +var TrendsClient = class { + client; /** - * Like Post - * Causes the authenticated user to Like a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to like the Post. - + * Creates a new trends client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get personalized Trends + * Retrieves personalized trending topics for the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async likePost(id, options = {}) { - const normalizedOptions = options || {}; + async getPersonalized(options = {}) { + const paramMappings = { + "personalized_trend.fields": "personalizedTrendFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + personalizedTrendFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/likes"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/users/personalized_trends"; const params = new URLSearchParams(); + if (personalizedTrendFields !== void 0 && personalizedTrendFields.length > 0) { + params.append( + "personalized_trend.fields", + personalizedTrendFields.join(",") + ); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["like.write", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -7990,84 +7824,52 @@ var UsersClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get liked Posts - * Retrieves a list of Posts liked by a specific User by their ID. + * Get Trends by WOEID + * Retrieves trending topics for a specific location identified by its WOEID. - * @param id The ID of the User to lookup. + * @param woeid The WOEID of the place to lookup a trend for. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getLikedPosts(id, options = {}) { + async getByWoeid(woeid, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + max_trends: "maxTrends", + "trend.fields": "trendFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + maxTrends = void 0, + trendFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/liked_tweets"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/trends/by/woeid/{woeid}"; + path = path.replace("{woeid}", encodeURIComponent(String(woeid))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (maxTrends !== void 0) { + params.append("max_trends", String(maxTrends)); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (trendFields !== void 0 && trendFields.length > 0) { + params.append("trend.fields", trendFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["like.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } ], ...requestOptions @@ -8079,46 +7881,114 @@ var UsersClient = class { ); } /** - * Get Users by usernames - * Retrieves details of multiple Users by their usernames. + * Get AI Trends by ID + * Retrieves an AI trend by its ID. + * @param id The ID of the ai trend. - * @param usernames A list of usernames, comma-separated. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByUsernames(usernames, options = {}) { + async getAi(id, options = {}) { const paramMappings = { - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "news.fields": "newsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - userFields = [], - expansions = [], - tweetFields = [], + newsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/by"; + let path = "/2/ai_trends/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (usernames !== void 0 && usernames.length > 0) { - params.append("usernames", usernames.join(",")); + if (newsFields !== void 0 && newsFields.length > 0) { + params.append("news.fields", newsFields.join(",")); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } +}; + +// src/trends/models.ts +var models_exports6 = {}; + +// src/media/client.ts +var MediaClient = class { + client; + /** + * Creates a new media client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + return normalized; + } + /** + * Get Media by media key + * Retrieves details of a specific Media file by its media key. + + + * @param mediaKey A single Media Key. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getByKey(mediaKey, options = {}) { + const paramMappings = { + "media.fields": "mediaFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + mediaFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/media/{media_key}"; + path = path.replace("{media_key}", encodeURIComponent(String(mediaKey))); + const params = new URLSearchParams(); + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -8127,7 +7997,7 @@ var UsersClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -8142,33 +8012,28 @@ var UsersClient = class { ); } /** - * Repost Post - * Causes the authenticated user to repost a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to repost the Post. - + * Create Media metadata + * Creates metadata for a Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async repostPost(id, options = {}) { + async createMetadata(options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/retweets"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/metadata"; const params = new URLSearchParams(); const finalRequestOptions = { body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8183,38 +8048,27 @@ var UsersClient = class { ); } /** - * Unfollow User - * Causes the authenticated user to unfollow a specific user by their ID. - - - * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. - + * Finalize Media upload + * Finalizes a Media upload request. - * @param targetUserId The ID of the User that the source User is requesting to unfollow. + * @param id The media id of the targeted media to finalize. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unfollowUser(sourceUserId, targetUserId) { - let path = "/2/users/{source_user_id}/following/{target_user_id}"; - path = path.replace( - "{source_user_id}", - encodeURIComponent(String(sourceUserId)) - ); - path = path.replace( - "{target_user_id}", - encodeURIComponent(String(targetUserId)) - ); + async finalizeUpload(id) { + let path = "/2/media/upload/{id}/finalize"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["follows.write", "tweet.read", "users.read"] + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8223,69 +8077,75 @@ var UsersClient = class { // No optional parameters, using empty request options }; return this.client.request( - "DELETE", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get followers - * Retrieves a list of Users who follow a specific User by their ID. + * Append Media upload + * Appends data to a Media upload request. - * @param id The ID of the User to lookup. + * @param id The media identifier for the media to perform the append operation. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowers(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async appendUpload(id, options = {}) { + const normalizedOptions = options || {}; const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], - expansions = [], - tweetFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/followers"; + let path = "/2/media/upload/{id}/append"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["media.write"] }, { - OAuth2UserToken: ["follows.read", "tweet.read", "users.read"] + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "POST", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Initialize media upload + * Initializes a media upload. + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async initializeUpload(options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/media/upload/initialize"; + const params = new URLSearchParams(); + const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8294,52 +8154,43 @@ var UsersClient = class { ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Users by IDs - * Retrieves details of multiple Users by their IDs. + * Get Media by media keys + * Retrieves details of Media files by their media keys. - * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. + * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByIds(ids, options = {}) { + async getByKeys(mediaKeys, options = {}) { const paramMappings = { - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "media.fields": "mediaFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - userFields = [], - expansions = [], - tweetFields = [], + mediaFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users"; + let path = "/2/media"; const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (mediaKeys !== void 0 && mediaKeys.length > 0) { + params.append("media_keys", mediaKeys.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -8348,7 +8199,7 @@ var UsersClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -8363,35 +8214,47 @@ var UsersClient = class { ); } /** - * Get Bookmarks by folder ID - * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - + * Get Media upload status + * Retrieves the status of a Media upload by its ID. - * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. + * @param mediaId Media id for the requested media upload status. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBookmarksByFolderId(id, folderId) { - let path = "/2/users/{id}/bookmarks/folders/{folder_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{folder_id}", encodeURIComponent(String(folderId))); + async getUploadStatus(mediaId, options = {}) { + const paramMappings = {}; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + command = void 0, + requestOptions = {} + } = normalizedOptions; + let path = "/2/media/upload"; const params = new URLSearchParams(); + if (mediaId !== void 0) { + params.append("media_id", String(mediaId)); + } + if (command !== void 0) { + params.append("command", String(command)); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["bookmark.read", "tweet.read", "users.read"] + OAuth2UserToken: ["media.write"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( "GET", @@ -8400,114 +8263,100 @@ var UsersClient = class { ); } /** - * Get Bookmark folders - * Retrieves a list of Bookmark folders created by the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - + * Upload media + * Uploads a media file for use in posts or other content. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBookmarkFolders(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async upload(options = {}) { + const normalizedOptions = options || {}; const { - maxResults = void 0, - paginationToken = void 0, + body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/bookmarks/folders"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/upload"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["bookmark.read", "users.read"] + OAuth2UserToken: ["media.write"] + }, + { + UserToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get following - * Retrieves a list of Users followed by a specific User by their ID. + * Get Media analytics + * Retrieves analytics data for media. - * @param id The ID of the User to lookup. + * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + + + + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + + + + * @param granularity The granularity for the search counts results. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowing(id, options = {}) { + async getAnalytics(mediaKeys, endTime, startTime, granularity, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "media_analytics.fields": "mediaAnalyticsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], - expansions = [], - tweetFields = [], + mediaAnalyticsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/following"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/analytics"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); + if (mediaKeys !== void 0 && mediaKeys.length > 0) { + params.append("media_keys", mediaKeys.join(",")); } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (granularity !== void 0) { + params.append("granularity", String(granularity)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (mediaAnalyticsFields !== void 0 && mediaAnalyticsFields.length > 0) { + params.append("media_analytics.fields", mediaAnalyticsFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["follows.read", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -8522,33 +8371,28 @@ var UsersClient = class { ); } /** - * Follow User - * Causes the authenticated user to follow a specific user by their ID. - - - * @param id The ID of the authenticated source User that is requesting to follow the target User. - + * Create Media subtitles + * Creates subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async followUser(id, options = {}) { + async createSubtitles(options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/following"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/subtitles"; const params = new URLSearchParams(); const finalRequestOptions = { body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["follows.write", "tweet.read", "users.read"] + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8563,99 +8407,28 @@ var UsersClient = class { ); } /** - * Get Timeline - * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. - - - * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. - + * Delete Media subtitles + * Deletes subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getTimeline(id, options = {}) { - const paramMappings = { - since_id: "sinceId", - until_id: "untilId", - max_results: "maxResults", - pagination_token: "paginationToken", - start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async deleteSubtitles(options = {}) { + const normalizedOptions = options || {}; const { - sinceId = void 0, - untilId = void 0, - maxResults = void 0, - paginationToken = void 0, - exclude = [], - startTime = void 0, - endTime = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/timelines/reverse_chronological"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/media/subtitles"; const params = new URLSearchParams(); - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (exclude !== void 0 && exclude.length > 0) { - params.append("exclude", exclude.join(",")); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["media.write"] }, { UserToken: [] @@ -8664,29 +8437,71 @@ var UsersClient = class { ...requestOptions }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/media/models.ts +var models_exports7 = {}; + +// src/direct_messages/client.ts +var DirectMessagesClient = class { + client; /** - * Unblock DMs - * Unblocks direct messages to or from a specific User by their ID for the authenticated user. + * Creates a new direct messages client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Create DM message by participant ID + * Sends a new direct message to a specific participant by their ID. - * @param id The ID of the target User that the authenticated user requesting to unblock dms for. + * @param participantId The ID of the recipient user that will receive the DM. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unblockDms(id) { - let path = "/2/users/{id}/dm/unblock"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async createByParticipantId(participantId, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/dm_conversations/with/{participant_id}/messages"; + path = path.replace( + "{participant_id}", + encodeURIComponent(String(participantId)) + ); const params = new URLSearchParams(); const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { @@ -8695,8 +8510,8 @@ var UsersClient = class { { UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( "POST", @@ -8705,74 +8520,52 @@ var UsersClient = class { ); } /** - * Get mentions - * Retrieves a list of Posts that mention a specific User by their ID. - - - * @param id The ID of the User to lookup. - + * Get DM events + * Retrieves a list of recent direct message events across all conversations. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMentions(id, options = {}) { + async getEvents(options = {}) { const paramMappings = { - since_id: "sinceId", - until_id: "untilId", max_results: "maxResults", pagination_token: "paginationToken", - start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", + event_types: "eventTypes", + "dm_event.fields": "dmEventFields", "media.fields": "mediaFields", - "poll.fields": "pollFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - sinceId = void 0, - untilId = void 0, maxResults = void 0, paginationToken = void 0, - startTime = void 0, - endTime = void 0, - tweetFields = [], + eventTypes = [], + dmEventFields = [], expansions = [], mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/mentions"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/dm_events"; const params = new URLSearchParams(); - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); - } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); + if (eventTypes !== void 0 && eventTypes.length > 0) { + params.append("event_types", eventTypes.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (dmEventFields !== void 0 && dmEventFields.length > 0) { + params.append("dm_event.fields", dmEventFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -8780,23 +8573,17 @@ var UsersClient = class { if (mediaFields !== void 0 && mediaFields.length > 0) { params.append("media.fields", mediaFields.join(",")); } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -8811,24 +8598,27 @@ var UsersClient = class { ); } /** - * Get List memberships - * Retrieves a list of Lists that a specific User is a member of by their ID. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. - * @param id The ID of the User to lookup. + * @param participantId The ID of the participant user for the One to One DM conversation. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getListMemberships(id, options = {}) { + async getEventsByParticipantId(participantId, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - "list.fields": "listFields", - "user.fields": "userFields" + event_types: "eventTypes", + "dm_event.fields": "dmEventFields", + "media.fields": "mediaFields", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -8837,13 +8627,19 @@ var UsersClient = class { const { maxResults = void 0, paginationToken = void 0, - listFields = [], + eventTypes = [], + dmEventFields = [], expansions = [], + mediaFields = [], userFields = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/{id}/list_memberships"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/dm_conversations/with/{participant_id}/dm_events"; + path = path.replace( + "{participant_id}", + encodeURIComponent(String(participantId)) + ); const params = new URLSearchParams(); if (maxResults !== void 0) { params.append("max_results", String(maxResults)); @@ -8851,23 +8647,29 @@ var UsersClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (eventTypes !== void 0 && eventTypes.length > 0) { + params.append("event_types", eventTypes.join(",")); + } + if (dmEventFields !== void 0 && dmEventFields.length > 0) { + params.append("dm_event.fields", dmEventFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -8882,23 +8684,27 @@ var UsersClient = class { ); } /** - * Get Reposts of me - * Retrieves a list of Posts that repost content from the authenticated user. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. + + * @param id The DM conversation ID. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getRepostsOfMe(options = {}) { + async getEventsByConversationId(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - "tweet.fields": "tweetFields", + event_types: "eventTypes", + "dm_event.fields": "dmEventFields", "media.fields": "mediaFields", - "poll.fields": "pollFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -8907,15 +8713,16 @@ var UsersClient = class { const { maxResults = void 0, paginationToken = void 0, - tweetFields = [], + eventTypes = [], + dmEventFields = [], expansions = [], mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/reposts_of_me"; + let path = "/2/dm_conversations/{id}/dm_events"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { params.append("max_results", String(maxResults)); @@ -8923,8 +8730,11 @@ var UsersClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (eventTypes !== void 0 && eventTypes.length > 0) { + params.append("event_types", eventTypes.join(",")); + } + if (dmEventFields !== void 0 && dmEventFields.length > 0) { + params.append("dm_event.fields", dmEventFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -8932,20 +8742,17 @@ var UsersClient = class { if (mediaFields !== void 0 && mediaFields.length > 0) { params.append("media.fields", mediaFields.join(",")); } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["timeline.read", "tweet.read"] + OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -8959,57 +8766,21 @@ var UsersClient = class { finalRequestOptions ); } -}; - -// src/users/models.ts -var models_exports2 = {}; - -// src/direct_messages/client.ts -var DirectMessagesClient = class { - client; - /** - * Creates a new direct messages client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. + * Get DM event by ID + * Retrieves details of a specific direct message event by its ID. - * @param participantId The ID of the participant user for the One to One DM conversation. + * @param eventId dm event id. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getEventsByParticipantId(participantId, options = {}) { + async getEventsById(eventId, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - event_types: "eventTypes", "dm_event.fields": "dmEventFields", "media.fields": "mediaFields", "user.fields": "userFields", @@ -9020,9 +8791,6 @@ var DirectMessagesClient = class { paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - eventTypes = [], dmEventFields = [], expansions = [], mediaFields = [], @@ -9030,21 +8798,9 @@ var DirectMessagesClient = class { tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/dm_conversations/with/{participant_id}/dm_events"; - path = path.replace( - "{participant_id}", - encodeURIComponent(String(participantId)) - ); + let path = "/2/dm_events/{event_id}"; + path = path.replace("{event_id}", encodeURIComponent(String(eventId))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (eventTypes !== void 0 && eventTypes.length > 0) { - params.append("event_types", eventTypes.join(",")); - } if (dmEventFields !== void 0 && dmEventFields.length > 0) { params.append("dm_event.fields", dmEventFields.join(",")); } @@ -9079,72 +8835,63 @@ var DirectMessagesClient = class { ); } /** - * Create DM message by conversation ID - * Sends a new direct message to a specific conversation by its ID. + * Delete DM event + * Deletes a specific direct message event by its ID, if owned by the authenticated user. - * @param dmConversationId The DM Conversation ID. + * @param eventId The ID of the direct-message event to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createByConversationId(dmConversationId, options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/dm_conversations/{dm_conversation_id}/messages"; - path = path.replace( - "{dm_conversation_id}", - encodeURIComponent(String(dmConversationId)) - ); + async deleteEvents(eventId) { + let path = "/2/dm_events/{event_id}"; + path = path.replace("{event_id}", encodeURIComponent(String(eventId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.write", "tweet.read", "users.read"] + OAuth2UserToken: ["dm.read", "dm.write"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create DM message by participant ID - * Sends a new direct message to a specific participant by their ID. + * Create DM message by conversation ID + * Sends a new direct message to a specific conversation by its ID. - * @param participantId The ID of the recipient user that will receive the DM. + * @param dmConversationId The DM Conversation ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createByParticipantId(participantId, options = {}) { + async createByConversationId(dmConversationId, options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/dm_conversations/with/{participant_id}/messages"; + let path = "/2/dm_conversations/{dm_conversation_id}/messages"; path = path.replace( - "{participant_id}", - encodeURIComponent(String(participantId)) + "{dm_conversation_id}", + encodeURIComponent(String(dmConversationId)) ); const params = new URLSearchParams(); const finalRequestOptions = { @@ -9202,61 +8949,91 @@ var DirectMessagesClient = class { finalRequestOptions ); } +}; + +// src/direct_messages/models.ts +var models_exports8 = {}; + +// src/posts/client.ts +var PostsClient = class { + client; + /** + * Creates a new posts client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } /** - * Get DM event by ID - * Retrieves details of a specific direct message event by its ID. + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get 28-hour Post insights + * Retrieves engagement metrics for specified Posts over the last 28 hours. - * @param eventId dm event id. + * @param tweetIds List of PostIds for 28hr metrics. - * @returns {Promise} Promise resolving to the API response + * @param granularity granularity of metrics response. + + + + * @param requestedMetrics request metrics for historical request. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getEventsById(eventId, options = {}) { + async getInsights28hr(tweetIds, granularity, requestedMetrics, options = {}) { const paramMappings = { - "dm_event.fields": "dmEventFields", - "media.fields": "mediaFields", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "engagement.fields": "engagementFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - dmEventFields = [], - expansions = [], - mediaFields = [], - userFields = [], - tweetFields = [], + engagementFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/dm_events/{event_id}"; - path = path.replace("{event_id}", encodeURIComponent(String(eventId))); + let path = "/2/insights/28hr"; const params = new URLSearchParams(); - if (dmEventFields !== void 0 && dmEventFields.length > 0) { - params.append("dm_event.fields", dmEventFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (tweetIds !== void 0 && tweetIds.length > 0) { + params.append("tweet_ids", tweetIds.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); + if (granularity !== void 0) { + params.append("granularity", String(granularity)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (requestedMetrics !== void 0 && requestedMetrics.length > 0) { + params.append("requested_metrics", requestedMetrics.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (engagementFields !== void 0 && engagementFields.length > 0) { + params.append("engagement.fields", engagementFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -9271,58 +9048,27 @@ var DirectMessagesClient = class { ); } /** - * Delete DM event - * Deletes a specific direct message event by its ID, if owned by the authenticated user. + * Get Reposts + * Retrieves a list of Posts that repost a specific Post by its ID. - * @param eventId The ID of the direct-message event to delete. + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteEvents(eventId) { - let path = "/2/dm_events/{event_id}"; - path = path.replace("{event_id}", encodeURIComponent(String(eventId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["dm.read", "dm.write"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Get DM events - * Retrieves a list of recent direct message events across all conversations. - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getEvents(options = {}) { + async getReposts(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - event_types: "eventTypes", - "dm_event.fields": "dmEventFields", + "tweet.fields": "tweetFields", "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -9331,15 +9077,16 @@ var DirectMessagesClient = class { const { maxResults = void 0, paginationToken = void 0, - eventTypes = [], - dmEventFields = [], + tweetFields = [], expansions = [], mediaFields = [], + pollFields = [], userFields = [], - tweetFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/dm_events"; + let path = "/2/tweets/{id}/retweets"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { params.append("max_results", String(maxResults)); @@ -9347,11 +9094,8 @@ var DirectMessagesClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (eventTypes !== void 0 && eventTypes.length > 0) { - params.append("event_types", eventTypes.join(",")); - } - if (dmEventFields !== void 0 && dmEventFields.length > 0) { - params.append("dm_event.fields", dmEventFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -9359,17 +9103,23 @@ var DirectMessagesClient = class { if (mediaFields !== void 0 && mediaFields.length > 0) { params.append("media.fields", mediaFields.join(",")); } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -9384,57 +9134,86 @@ var DirectMessagesClient = class { ); } /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. + * Search all Posts + * Retrieves Posts from the full archive matching a search query. - * @param id The DM conversation ID. + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getEventsByConversationId(id, options = {}) { + async searchAll(query, options = {}) { const paramMappings = { + start_time: "startTime", + end_time: "endTime", + since_id: "sinceId", + until_id: "untilId", max_results: "maxResults", + next_token: "nextToken", pagination_token: "paginationToken", - event_types: "eventTypes", - "dm_event.fields": "dmEventFields", + sort_order: "sortOrder", + "tweet.fields": "tweetFields", "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { + startTime = void 0, + endTime = void 0, + sinceId = void 0, + untilId = void 0, maxResults = void 0, + nextToken = void 0, paginationToken = void 0, - eventTypes = [], - dmEventFields = [], + sortOrder = void 0, + tweetFields = [], expansions = [], mediaFields = [], + pollFields = [], userFields = [], - tweetFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/dm_conversations/{id}/dm_events"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/tweets/search/all"; const params = new URLSearchParams(); + if (query !== void 0) { + params.append("query", String(query)); + } + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); + } + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); + } + if (untilId !== void 0) { + params.append("until_id", String(untilId)); + } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } + if (nextToken !== void 0) { + params.append("next_token", String(nextToken)); + } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (eventTypes !== void 0 && eventTypes.length > 0) { - params.append("event_types", eventTypes.join(",")); + if (sortOrder !== void 0) { + params.append("sort_order", String(sortOrder)); } - if (dmEventFields !== void 0 && dmEventFields.length > 0) { - params.append("dm_event.fields", dmEventFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); @@ -9442,20 +9221,20 @@ var DirectMessagesClient = class { if (mediaFields !== void 0 && mediaFields.length > 0) { params.append("media.fields", mediaFields.join(",")); } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "tweet.read", "users.read"] - }, - { - UserToken: [] + BearerToken: [] } ], ...requestOptions @@ -9466,92 +9245,100 @@ var DirectMessagesClient = class { finalRequestOptions ); } -}; - -// src/direct_messages/models.ts -var models_exports3 = {}; - -// src/community_notes/client.ts -var CommunityNotesClient = class { - client; - /** - * Creates a new community notes client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Delete a Community Note - * Deletes a community note. + * Get historical Post insights + * Retrieves historical engagement metrics for specified Posts within a defined time range. - * @param id The community note id to delete. + * @param tweetIds List of PostIds for historical metrics. - * @returns {Promise} Promise resolving to the API response + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + + + + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + + + + * @param granularity granularity of metrics response. + + + + * @param requestedMetrics request metrics for historical request. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async delete(id) { - let path = "/2/notes/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async getInsightsHistorical(tweetIds, endTime, startTime, granularity, requestedMetrics, options = {}) { + const paramMappings = { + "engagement.fields": "engagementFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + engagementFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/insights/historical"; const params = new URLSearchParams(); + if (tweetIds !== void 0 && tweetIds.length > 0) { + params.append("tweet_ids", tweetIds.join(",")); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); + } + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (granularity !== void 0) { + params.append("granularity", String(granularity)); + } + if (requestedMetrics !== void 0 && requestedMetrics.length > 0) { + params.append("requested_metrics", requestedMetrics.join(",")); + } + if (engagementFields !== void 0 && engagementFields.length > 0) { + params.append("engagement.fields", engagementFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.write"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Search for Posts Eligible for Community Notes - * Returns all the posts that are eligible for community notes. + * Get Post by ID + * Retrieves details of a specific Post by its ID. + * @param id A single Post ID. - * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchEligiblePosts(testMode, options = {}) { + async getById(id, options = {}) { const paramMappings = { - pagination_token: "paginationToken", - max_results: "maxResults", - post_selection: "postSelection", "tweet.fields": "tweetFields", "media.fields": "mediaFields", "poll.fields": "pollFields", @@ -9563,9 +9350,6 @@ var CommunityNotesClient = class { paramMappings ); const { - paginationToken = void 0, - maxResults = void 0, - postSelection = void 0, tweetFields = [], expansions = [], mediaFields = [], @@ -9574,20 +9358,9 @@ var CommunityNotesClient = class { placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/notes/search/posts_eligible_for_notes"; + let path = "/2/tweets/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (testMode !== void 0) { - params.append("test_mode", String(testMode)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (postSelection !== void 0) { - params.append("post_selection", String(postSelection)); - } if (tweetFields !== void 0 && tweetFields.length > 0) { params.append("tweet.fields", tweetFields.join(",")); } @@ -9610,7 +9383,10 @@ var CommunityNotesClient = class { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -9625,89 +9401,99 @@ var CommunityNotesClient = class { ); } /** - * Evaluate a Community Note - * Endpoint to evaluate a community note. + * Delete Post + * Deletes a specific Post by its ID, if owned by the authenticated user. + + * @param id The ID of the Post to be deleted. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async evaluate(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/evaluate_note"; + async delete(id) { + let path = "/2/tweets/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.write"] + OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Search for Community Notes Written - * Returns all the community notes written by the user. + * Get Post analytics + * Retrieves analytics data for specified Posts within a defined time range. - * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. + * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + + + + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + + + + * @param granularity The granularity for the search counts results. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchWritten(testMode, options = {}) { + async getAnalytics(ids, endTime, startTime, granularity, options = {}) { const paramMappings = { - pagination_token: "paginationToken", - max_results: "maxResults", - "note.fields": "noteFields" + "analytics.fields": "analyticsFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - paginationToken = void 0, - maxResults = void 0, - noteFields = [], + analyticsFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/notes/search/notes_written"; + let path = "/2/tweets/analytics"; const params = new URLSearchParams(); - if (testMode !== void 0) { - params.append("test_mode", String(testMode)); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); } - if (noteFields !== void 0 && noteFields.length > 0) { - params.append("note.fields", noteFields.join(",")); + if (granularity !== void 0) { + params.append("granularity", String(granularity)); + } + if (analyticsFields !== void 0 && analyticsFields.length > 0) { + params.append("analytics.fields", analyticsFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -9722,28 +9508,70 @@ var CommunityNotesClient = class { ); } /** - * Create a Community Note - * Creates a community note endpoint for LLM use case. + * Get Posts by IDs + * Retrieves details of multiple Posts by their IDs. - * @returns {Promise} Promise resolving to the API response + * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async create(options = {}) { - const normalizedOptions = options || {}; + async getByIds(ids, options = {}) { + const paramMappings = { + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/notes"; + let path = "/2/tweets"; const params = new URLSearchParams(); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.write"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -9752,226 +9580,116 @@ var CommunityNotesClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } -}; - -// src/community_notes/models.ts -var models_exports4 = {}; - -// src/posts/client.ts -var PostsClient = class { - client; - /** - * Creates a new posts client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Hide reply - * Hides or unhides a reply to a conversation owned by the authenticated user. - - - * @param tweetId The ID of the reply that you want to hide or unhide. + * Create or Edit Post + * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided. + * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async hideReply(tweetId, options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/tweets/{tweet_id}/hidden"; - path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + async create(body) { + let path = "/2/tweets"; const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, + body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.moderate.write", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "PUT", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Post analytics - * Retrieves analytics data for specified Posts within a defined time range. - - - - * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. - - - - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - - - - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + * Get count of recent Posts + * Retrieves the count of Posts from the last 7 days matching a search query. - * @param granularity The granularity for the search counts results. + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getAnalytics(ids, endTime, startTime, granularity, options = {}) { + async getCountsRecent(query, options = {}) { const paramMappings = { - "analytics.fields": "analyticsFields" + start_time: "startTime", + end_time: "endTime", + since_id: "sinceId", + until_id: "untilId", + next_token: "nextToken", + pagination_token: "paginationToken", + "search_count.fields": "searchCountFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - analyticsFields = [], + startTime = void 0, + endTime = void 0, + sinceId = void 0, + untilId = void 0, + nextToken = void 0, + paginationToken = void 0, + granularity = void 0, + searchCountFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/analytics"; + let path = "/2/tweets/counts/recent"; const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); + if (query !== void 0) { + params.append("query", String(query)); } if (startTime !== void 0) { params.append("start_time", String(startTime)); } - if (granularity !== void 0) { - params.append("granularity", String(granularity)); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } - if (analyticsFields !== void 0 && analyticsFields.length > 0) { - params.append("analytics.fields", analyticsFields.join(",")); + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); } - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["tweet.read", "users.read"] - }, - { - UserToken: [] - } - ], - ...requestOptions - }; - return this.client.request( - "GET", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Get historical Post insights - * Retrieves historical engagement metrics for specified Posts within a defined time range. - - - - * @param tweetIds List of PostIds for historical metrics. - - - - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - - - - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - - - - * @param granularity granularity of metrics response. - - - - * @param requestedMetrics request metrics for historical request. - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getInsightsHistorical(tweetIds, endTime, startTime, granularity, requestedMetrics, options = {}) { - const paramMappings = { - "engagement.fields": "engagementFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - engagementFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/insights/historical"; - const params = new URLSearchParams(); - if (tweetIds !== void 0 && tweetIds.length > 0) { - params.append("tweet_ids", tweetIds.join(",")); + if (untilId !== void 0) { + params.append("until_id", String(untilId)); } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); + if (nextToken !== void 0) { + params.append("next_token", String(nextToken)); } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } if (granularity !== void 0) { params.append("granularity", String(granularity)); } - if (requestedMetrics !== void 0 && requestedMetrics.length > 0) { - params.append("requested_metrics", requestedMetrics.join(",")); - } - if (engagementFields !== void 0 && engagementFields.length > 0) { - params.append("engagement.fields", engagementFields.join(",")); + if (searchCountFields !== void 0 && searchCountFields.length > 0) { + params.append("search_count.fields", searchCountFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] - }, - { - UserToken: [] + BearerToken: [] } ], ...requestOptions @@ -9983,8 +9701,8 @@ var PostsClient = class { ); } /** - * Get count of recent Posts - * Retrieves the count of Posts from the last 7 days matching a search query. + * Get count of all Posts + * Retrieves the count of Posts matching a search query from the full archive. @@ -9992,10 +9710,10 @@ var PostsClient = class { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getCountsRecent(query, options = {}) { + async getCountsAll(query, options = {}) { const paramMappings = { start_time: "startTime", end_time: "endTime", @@ -10020,7 +9738,7 @@ var PostsClient = class { searchCountFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/counts/recent"; + let path = "/2/tweets/counts/all"; const params = new URLSearchParams(); if (query !== void 0) { params.append("query", String(query)); @@ -10065,8 +9783,8 @@ var PostsClient = class { ); } /** - * Get count of all Posts - * Retrieves the count of Posts matching a search query from the full archive. + * Search recent Posts + * Retrieves Posts from the last 7 days matching a search query. @@ -10074,18 +9792,24 @@ var PostsClient = class { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getCountsAll(query, options = {}) { + async searchRecent(query, options = {}) { const paramMappings = { start_time: "startTime", end_time: "endTime", since_id: "sinceId", until_id: "untilId", + max_results: "maxResults", next_token: "nextToken", pagination_token: "paginationToken", - "search_count.fields": "searchCountFields" + sort_order: "sortOrder", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -10096,13 +9820,19 @@ var PostsClient = class { endTime = void 0, sinceId = void 0, untilId = void 0, + maxResults = void 0, nextToken = void 0, paginationToken = void 0, - granularity = void 0, - searchCountFields = [], + sortOrder = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/counts/all"; + let path = "/2/tweets/search/recent"; const params = new URLSearchParams(); if (query !== void 0) { params.append("query", String(query)); @@ -10119,23 +9849,47 @@ var PostsClient = class { if (untilId !== void 0) { params.append("until_id", String(untilId)); } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } if (nextToken !== void 0) { params.append("next_token", String(nextToken)); } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (granularity !== void 0) { - params.append("granularity", String(granularity)); + if (sortOrder !== void 0) { + params.append("sort_order", String(sortOrder)); } - if (searchCountFields !== void 0 && searchCountFields.length > 0) { - params.append("search_count.fields", searchCountFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] } ], ...requestOptions @@ -10147,8 +9901,49 @@ var PostsClient = class { ); } /** - * Get Reposts - * Retrieves a list of Posts that repost a specific Post by its ID. + * Hide reply + * Hides or unhides a reply to a conversation owned by the authenticated user. + + + * @param tweetId The ID of the reply that you want to hide or unhide. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async hideReply(tweetId, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/tweets/{tweet_id}/hidden"; + path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + const params = new URLSearchParams(); + const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["tweet.moderate.write", "tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "PUT", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Get Reposted by + * Retrieves a list of Users who reposted a specific Post by its ID. * @param id A single Post ID. @@ -10156,18 +9951,15 @@ var PostsClient = class { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getReposts(id, options = {}) { + async getRepostedBy(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -10176,15 +9968,12 @@ var PostsClient = class { const { maxResults = void 0, paginationToken = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/{id}/retweets"; + let path = "/2/tweets/{id}/retweeted_by"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { @@ -10193,23 +9982,14 @@ var PostsClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -10233,8 +10013,8 @@ var PostsClient = class { ); } /** - * Get Post by ID - * Retrieves details of a specific Post by its ID. + * Get Quoted Posts + * Retrieves a list of Posts that quote a specific Post by its ID. * @param id A single Post ID. @@ -10242,11 +10022,13 @@ var PostsClient = class { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { + async getQuoted(id, options = {}) { const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", "tweet.fields": "tweetFields", "media.fields": "mediaFields", "poll.fields": "pollFields", @@ -10258,6 +10040,9 @@ var PostsClient = class { paramMappings ); const { + maxResults = void 0, + paginationToken = void 0, + exclude = [], tweetFields = [], expansions = [], mediaFields = [], @@ -10266,9 +10051,18 @@ var PostsClient = class { placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/{id}"; + let path = "/2/tweets/{id}/quote_tweets"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (exclude !== void 0 && exclude.length > 0) { + params.append("exclude", exclude.join(",")); + } if (tweetFields !== void 0 && tweetFields.length > 0) { params.append("tweet.fields", tweetFields.join(",")); } @@ -10309,54 +10103,120 @@ var PostsClient = class { ); } /** - * Delete Post - * Deletes a specific Post by its ID, if owned by the authenticated user. + * Get Liking Users + * Retrieves a list of Users who liked a specific Post by its ID. - * @param id The ID of the Post to be deleted. + * @param id A single Post ID. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async delete(id) { - let path = "/2/tweets/{id}"; + async getLikingUsers(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/tweets/{id}/liking_users"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + OAuth2UserToken: ["like.read", "tweet.read", "users.read"] }, { UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/posts/models.ts +var models_exports9 = {}; + +// src/lists/client.ts +var ListsClient = class { + client; + /** + * Creates a new lists client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } /** - * Get Reposted by - * Retrieves a list of Users who reposted a specific Post by its ID. + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get List members + * Retrieves a list of Users who are members of a specific List by its ID. - * @param id A single Post ID. + * @param id The ID of the List. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getRepostedBy(id, options = {}) { + async getMembers(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", @@ -10375,7 +10235,7 @@ var PostsClient = class { tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/{id}/retweeted_by"; + let path = "/2/lists/{id}/members"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { @@ -10400,7 +10260,7 @@ var PostsClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -10415,57 +10275,104 @@ var PostsClient = class { ); } /** - * Get 28-hour Post insights - * Retrieves engagement metrics for specified Posts over the last 28 hours. + * Add List member + * Adds a User to a specific List by its ID. + * @param id The ID of the List for which to add a member. - * @param tweetIds List of PostIds for 28hr metrics. - * @param granularity granularity of metrics response. + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async addMember(id, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/lists/{id}/members"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "POST", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Get List followers + * Retrieves a list of Users who follow a specific List by its ID. + * @param id The ID of the List. - * @param requestedMetrics request metrics for historical request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getInsights28hr(tweetIds, granularity, requestedMetrics, options = {}) { + async getFollowers(id, options = {}) { const paramMappings = { - "engagement.fields": "engagementFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - engagementFields = [], + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/insights/28hr"; + let path = "/2/lists/{id}/followers"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (tweetIds !== void 0 && tweetIds.length > 0) { - params.append("tweet_ids", tweetIds.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - if (granularity !== void 0) { - params.append("granularity", String(granularity)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } - if (requestedMetrics !== void 0 && requestedMetrics.length > 0) { - params.append("requested_metrics", requestedMetrics.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } - if (engagementFields !== void 0 && engagementFields.length > 0) { - params.append("engagement.fields", engagementFields.join(",")); + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -10480,20 +10387,22 @@ var PostsClient = class { ); } /** - * Get Posts by IDs - * Retrieves details of multiple Posts by their IDs. + * Get List Posts + * Retrieves a list of Posts associated with a specific List by its ID. + * @param id The ID of the List. - * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByIds(ids, options = {}) { + async getPosts(id, options = {}) { const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", "tweet.fields": "tweetFields", "media.fields": "mediaFields", "poll.fields": "pollFields", @@ -10505,6 +10414,8 @@ var PostsClient = class { paramMappings ); const { + maxResults = void 0, + paginationToken = void 0, tweetFields = [], expansions = [], mediaFields = [], @@ -10513,10 +10424,14 @@ var PostsClient = class { placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets"; + let path = "/2/lists/{id}/tweets"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } if (tweetFields !== void 0 && tweetFields.length > 0) { params.append("tweet.fields", tweetFields.join(",")); @@ -10543,7 +10458,7 @@ var PostsClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -10558,25 +10473,32 @@ var PostsClient = class { ); } /** - * Create or Edit Post - * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided. + * Remove List member + * Removes a User from a specific List by its ID and the User’s ID. + * @param id The ID of the List to remove a member. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + + * @param userId The ID of User that will be removed from the List. + + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async create(body) { - let path = "/2/tweets"; + async removeMemberByUserId(id, userId) { + let path = "/2/lists/{id}/members/{user_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{user_id}", encodeURIComponent(String(userId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -10585,66 +10507,59 @@ var PostsClient = class { // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Liking Users - * Retrieves a list of Users who liked a specific Post by its ID. + * Get List by ID + * Retrieves details of a specific List by its ID. - * @param id A single Post ID. + * @param id The ID of the List. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getLikingUsers(id, options = {}) { + async getById(id, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - userFields = [], + listFields = [], expansions = [], - tweetFields = [], + userFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/{id}/liking_users"; + let path = "/2/lists/{id}"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["like.read", "tweet.read", "users.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -10659,312 +10574,109 @@ var PostsClient = class { ); } /** - * Search all Posts - * Retrieves Posts from the full archive matching a search query. + * Update List + * Updates the details of a specific List owned by the authenticated user by its ID. + * @param id The ID of the List to modify. - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchAll(query, options = {}) { - const paramMappings = { - start_time: "startTime", - end_time: "endTime", - since_id: "sinceId", - until_id: "untilId", - max_results: "maxResults", - next_token: "nextToken", - pagination_token: "paginationToken", - sort_order: "sortOrder", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async update(id, options = {}) { + const normalizedOptions = options || {}; const { - startTime = void 0, - endTime = void 0, - sinceId = void 0, - untilId = void 0, - maxResults = void 0, - nextToken = void 0, - paginationToken = void 0, - sortOrder = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/all"; + let path = "/2/lists/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (nextToken !== void 0) { - params.append("next_token", String(nextToken)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (sortOrder !== void 0) { - params.append("sort_order", String(sortOrder)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + }, + { + UserToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "PUT", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Quoted Posts - * Retrieves a list of Posts that quote a specific Post by its ID. + * Delete List + * Deletes a specific List owned by the authenticated user by its ID. - * @param id A single Post ID. + * @param id The ID of the List to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getQuoted(id, options = {}) { - const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - maxResults = void 0, - paginationToken = void 0, - exclude = [], - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/tweets/{id}/quote_tweets"; + async delete(id) { + let path = "/2/lists/{id}"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (exclude !== void 0 && exclude.length > 0) { - params.append("exclude", exclude.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Search recent Posts - * Retrieves Posts from the last 7 days matching a search query. - - - - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. + * Create List + * Creates a new List for the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchRecent(query, options = {}) { - const paramMappings = { - start_time: "startTime", - end_time: "endTime", - since_id: "sinceId", - until_id: "untilId", - max_results: "maxResults", - next_token: "nextToken", - pagination_token: "paginationToken", - sort_order: "sortOrder", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async create(options = {}) { + const normalizedOptions = options || {}; const { - startTime = void 0, - endTime = void 0, - sinceId = void 0, - untilId = void 0, - maxResults = void 0, - nextToken = void 0, - paginationToken = void 0, - sortOrder = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/recent"; + let path = "/2/lists"; const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (sinceId !== void 0) { - params.append("since_id", String(sinceId)); - } - if (untilId !== void 0) { - params.append("until_id", String(untilId)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (nextToken !== void 0) { - params.append("next_token", String(nextToken)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (sortOrder !== void 0) { - params.append("sort_order", String(sortOrder)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: [ + "list.read", + "list.write", + "tweet.read", + "users.read" + ] }, { UserToken: [] @@ -10973,21 +10685,21 @@ var PostsClient = class { ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } }; -// src/posts/models.ts -var models_exports5 = {}; +// src/lists/models.ts +var models_exports10 = {}; -// src/trends/client.ts -var TrendsClient = class { +// src/community_notes/client.ts +var CommunityNotesClient = class { client; /** - * Creates a new trends client instance + * Creates a new community notes client instance * * @param client - The main X API client instance */ @@ -11012,136 +10724,124 @@ var TrendsClient = class { return normalized; } /** - * Get AI Trends by ID - * Retrieves an AI trend by its ID. + * Delete a Community Note + * Deletes a community note. - * @param id The ID of the ai trend. + * @param id The community note id to delete. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getAi(id, options = {}) { - const paramMappings = { - "news.fields": "newsFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - newsFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/ai_trends/{id}"; + async delete(id) { + let path = "/2/notes/{id}"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (newsFields !== void 0 && newsFields.length > 0) { - params.append("news.fields", newsFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.write"] + }, + { + UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Trends by WOEID - * Retrieves trending topics for a specific location identified by its WOEID. - - - * @param woeid The WOEID of the place to lookup a trend for. - + * Evaluate a Community Note + * Endpoint to evaluate a community note. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByWoeid(woeid, options = {}) { - const paramMappings = { - max_trends: "maxTrends", - "trend.fields": "trendFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async evaluate(options = {}) { + const normalizedOptions = options || {}; const { - maxTrends = void 0, - trendFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/trends/by/woeid/{woeid}"; - path = path.replace("{woeid}", encodeURIComponent(String(woeid))); + let path = "/2/evaluate_note"; const params = new URLSearchParams(); - if (maxTrends !== void 0) { - params.append("max_trends", String(maxTrends)); - } - if (trendFields !== void 0 && trendFields.length > 0) { - params.append("trend.fields", trendFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.write"] + }, + { + UserToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get personalized Trends - * Retrieves personalized trending topics for the authenticated user. + * Search for Community Notes Written + * Returns all the community notes written by the user. - * @returns {Promise} Promise resolving to the API response + * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPersonalized(options = {}) { + async searchWritten(testMode, options = {}) { const paramMappings = { - "personalized_trend.fields": "personalizedTrendFields" + pagination_token: "paginationToken", + max_results: "maxResults", + "note.fields": "noteFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - personalizedTrendFields = [], + paginationToken = void 0, + maxResults = void 0, + noteFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/users/personalized_trends"; + let path = "/2/notes/search/notes_written"; const params = new URLSearchParams(); - if (personalizedTrendFields !== void 0 && personalizedTrendFields.length > 0) { - params.append( - "personalized_trend.fields", - personalizedTrendFields.join(",") - ); + if (testMode !== void 0) { + params.append("test_mode", String(testMode)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (noteFields !== void 0 && noteFields.length > 0) { + params.append("note.fields", noteFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read"] }, { UserToken: [] @@ -11155,216 +10855,122 @@ var TrendsClient = class { finalRequestOptions ); } -}; - -// src/trends/models.ts -var models_exports6 = {}; - -// src/activity/client.ts -var ActivityClient = class { - client; - /** - * Creates a new activity client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Get X activity subscriptions - * Get a list of active subscriptions for XAA + * Create a Community Note + * Creates a community note endpoint for LLM use case. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getSubscriptions() { - let path = "/2/activity/subscriptions"; + async create(options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/notes"; const params = new URLSearchParams(); const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.write"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create X activity subscription - * Creates a subscription for an X activity event + * Search for Posts Eligible for Community Notes + * Returns all the posts that are eligible for community notes. - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async createSubscription(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/activity/subscriptions"; - const params = new URLSearchParams(); - const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ], - ...requestOptions - }; - return this.client.request( - "POST", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Update X activity subscription - * Updates a subscription for an X activity event - - - * @param subscriptionId The ID of the subscription to update. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async updateSubscription(subscriptionId, options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/activity/subscriptions/{subscription_id}"; - path = path.replace( - "{subscription_id}", - encodeURIComponent(String(subscriptionId)) - ); - const params = new URLSearchParams(); - const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ], - ...requestOptions - }; - return this.client.request( - "PUT", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Deletes X activity subscription - * Deletes a subscription for an X activity event - - - * @param subscriptionId The ID of the subscription to delete. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async deleteSubscription(subscriptionId) { - let path = "/2/activity/subscriptions/{subscription_id}"; - path = path.replace( - "{subscription_id}", - encodeURIComponent(String(subscriptionId)) - ); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Activity Stream - * Stream of X Activities + * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async stream(options = {}) { + async searchEligiblePosts(testMode, options = {}) { const paramMappings = { - backfill_minutes: "backfillMinutes", - start_time: "startTime", - end_time: "endTime" + pagination_token: "paginationToken", + max_results: "maxResults", + post_selection: "postSelection", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - backfillMinutes = void 0, - startTime = void 0, - endTime = void 0, + paginationToken = void 0, + maxResults = void 0, + postSelection = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/activity/stream"; + let path = "/2/notes/search/posts_eligible_for_notes"; const params = new URLSearchParams(); - if (backfillMinutes !== void 0) { - params.append("backfill_minutes", String(backfillMinutes)); + if (testMode !== void 0) { + params.append("test_mode", String(testMode)); } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (postSelection !== void 0) { + params.append("post_selection", String(postSelection)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.read"] + }, + { + UserToken: [] } ], ...requestOptions @@ -11377,14 +10983,14 @@ var ActivityClient = class { } }; -// src/activity/models.ts -var models_exports7 = {}; +// src/community_notes/models.ts +var models_exports11 = {}; -// src/usage/client.ts -var UsageClient = class { +// src/general/client.ts +var GeneralClient = class { client; /** - * Creates a new usage client instance + * Creates a new general client instance * * @param client - The main X API client instance */ @@ -11409,43 +11015,19 @@ var UsageClient = class { return normalized; } /** - * Get usage - * Retrieves usage statistics for Posts over a specified number of days. + * Get OpenAPI Spec. + * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async get(options = {}) { - const paramMappings = { - "usage.fields": "usageFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - days = void 0, - usageFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/usage/tweets"; + async getOpenApiSpec() { + let path = "/2/openapi.json"; const params = new URLSearchParams(); - if (days !== void 0) { - params.append("days", String(days)); - } - if (usageFields !== void 0 && usageFields.length > 0) { - params.append("usage.fields", usageFields.join(",")); - } const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ], - ...requestOptions + // No optional parameters, using empty request options }; return this.client.request( "GET", @@ -11455,14 +11037,14 @@ var UsageClient = class { } }; -// src/usage/models.ts -var models_exports8 = {}; +// src/general/models.ts +var models_exports12 = {}; -// src/spaces/client.ts -var SpacesClient = class { +// src/webhooks/client.ts +var WebhooksClient = class { client; /** - * Creates a new spaces client instance + * Creates a new webhooks client instance * * @param client - The main X API client instance */ @@ -11487,73 +11069,36 @@ var SpacesClient = class { return normalized; } /** - * Get Space Posts - * Retrieves a list of Posts shared in a specific Space by its ID. - - - * @param id The ID of the Space to be retrieved. - + * Get webhook + * Get a list of webhook configs associated with a client app. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPosts(id, options = {}) { + async get(options = {}) { const paramMappings = { - max_results: "maxResults", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + "webhook_config.fields": "webhookConfigFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], + webhookConfigFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/spaces/{id}/tweets"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/webhooks"; const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (webhookConfigFields !== void 0 && webhookConfigFields.length > 0) { + params.append("webhook_config.fields", webhookConfigFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } ], ...requestOptions @@ -11565,124 +11110,58 @@ var SpacesClient = class { ); } /** - * Search Spaces - * Retrieves a list of Spaces matching the specified search query. - - - - * @param query The search query. + * Create webhook + * Creates a new webhook configuration. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async search(query, options = {}) { - const paramMappings = { - max_results: "maxResults", - "space.fields": "spaceFields", - "user.fields": "userFields", - "topic.fields": "topicFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + async create(options = {}) { + const normalizedOptions = options || {}; const { - state = void 0, - maxResults = void 0, - spaceFields = [], - expansions = [], - userFields = [], - topicFields = [], + body, requestOptions = {} } = normalizedOptions; - let path = "/2/spaces/search"; + let path = "/2/webhooks"; const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); - } - if (state !== void 0) { - params.append("state", String(state)); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (spaceFields !== void 0 && spaceFields.length > 0) { - params.append("space.fields", spaceFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (topicFields !== void 0 && topicFields.length > 0) { - params.append("topic.fields", topicFields.join(",")); - } const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { BearerToken: [] }, { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] + UserToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get space by ID - * Retrieves details of a specific space by its ID. + * Validate webhook + * Triggers a CRC check for a given webhook. - * @param id The ID of the Space to be retrieved. + * @param webhookId The ID of the webhook to check. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { - const paramMappings = { - "space.fields": "spaceFields", - "user.fields": "userFields", - "topic.fields": "topicFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - spaceFields = [], - expansions = [], - userFields = [], - topicFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/spaces/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + async validate(webhookId) { + let path = "/2/webhooks/{webhook_id}"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); - if (spaceFields !== void 0 && spaceFields.length > 0) { - params.append("space.fields", spaceFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (topicFields !== void 0 && topicFields.length > 0) { - params.append("topic.fields", topicFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ @@ -11690,64 +11169,34 @@ var SpacesClient = class { BearerToken: [] }, { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] + UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "PUT", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Spaces by creator IDs - * Retrieves details of Spaces created by specified User IDs. + * Delete webhook + * Deletes an existing webhook configuration. + * @param webhookId The ID of the webhook to delete. - * @param userIds The IDs of Users to search through. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByCreatorIds(userIds, options = {}) { - const paramMappings = { - "space.fields": "spaceFields", - "user.fields": "userFields", - "topic.fields": "topicFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - spaceFields = [], - expansions = [], - userFields = [], - topicFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/spaces/by/creator_ids"; + async delete(webhookId) { + let path = "/2/webhooks/{webhook_id}"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); - if (userIds !== void 0 && userIds.length > 0) { - params.append("user_ids", userIds.join(",")); - } - if (spaceFields !== void 0 && spaceFields.length > 0) { - params.append("space.fields", spaceFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (topicFields !== void 0 && topicFields.length > 0) { - params.append("topic.fields", topicFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ @@ -11755,140 +11204,139 @@ var SpacesClient = class { BearerToken: [] }, { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] + UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Space ticket buyers - * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + * Create stream link + * Creates a link to deliver FilteredStream events to the given webhook. - * @param id The ID of the Space to be retrieved. + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBuyers(id, options = {}) { + async createStreamLink(webhookId, options = {}) { const paramMappings = { - pagination_token: "paginationToken", - max_results: "maxResults", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - paginationToken = void 0, - maxResults = void 0, - userFields = [], - expansions = [], - tweetFields = [], + tweetFields = void 0, + expansions = void 0, + mediaFields = void 0, + pollFields = void 0, + userFields = void 0, + placeFields = void 0, requestOptions = {} } = normalizedOptions; - let path = "/2/spaces/{id}/buyers"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/tweets/search/webhooks/{webhook_id}"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); const params = new URLSearchParams(); - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (tweetFields !== void 0) { + params.append("tweet.fields", String(tweetFields)); } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); + if (expansions !== void 0) { + params.append("expansions", String(expansions)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (mediaFields !== void 0) { + params.append("media.fields", String(mediaFields)); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (pollFields !== void 0) { + params.append("poll.fields", String(pollFields)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0) { + params.append("user.fields", String(userFields)); + } + if (placeFields !== void 0) { + params.append("place.fields", String(placeFields)); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] + BearerToken: [] } ], ...requestOptions }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Spaces by IDs - * Retrieves details of multiple Spaces by their IDs. + * Delete stream link + * Deletes a link from FilteredStream events to the given webhook. + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @param ids The list of Space IDs to return. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByIds(ids, options = {}) { - const paramMappings = { - "space.fields": "spaceFields", - "user.fields": "userFields", - "topic.fields": "topicFields" + async deleteStreamLink(webhookId) { + let path = "/2/tweets/search/webhooks/{webhook_id}"; + path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + } + ] + // No optional parameters, using empty request options }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings + return this.client.request( + "DELETE", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions ); - const { - spaceFields = [], - expansions = [], - userFields = [], - topicFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/spaces"; + } + /** + * Get stream links + * Get a list of webhook links associated with a filtered stream ruleset. + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getStreamLinks() { + let path = "/2/tweets/search/webhooks"; const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); - } - if (spaceFields !== void 0 && spaceFields.length > 0) { - params.append("space.fields", spaceFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (topicFields !== void 0 && topicFields.length > 0) { - params.append("topic.fields", topicFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - OAuth2UserToken: ["space.read", "tweet.read", "users.read"] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "GET", @@ -11898,14 +11346,14 @@ var SpacesClient = class { } }; -// src/spaces/models.ts -var models_exports9 = {}; +// src/webhooks/models.ts +var models_exports13 = {}; -// src/communities/client.ts -var CommunitiesClient = class { +// src/users/client.ts +var UsersClient = class { client; /** - * Creates a new communities client instance + * Creates a new users client instance * * @param client - The main X API client instance */ @@ -11930,35 +11378,46 @@ var CommunitiesClient = class { return normalized; } /** - * Get Community by ID - * Retrieves details of a specific Community by its ID. + * Get Users by usernames + * Retrieves details of multiple Users by their usernames. - * @param id The ID of the Community. + * @param usernames A list of usernames, comma-separated. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { + async getByUsernames(usernames, options = {}) { const paramMappings = { - "community.fields": "communityFields" + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - communityFields = [], + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/communities/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/users/by"; const params = new URLSearchParams(); - if (communityFields !== void 0 && communityFields.length > 0) { - params.append("community.fields", communityFields.join(",")); + if (usernames !== void 0 && usernames.length > 0) { + params.append("usernames", usernames.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -11967,7 +11426,7 @@ var CommunitiesClient = class { BearerToken: [] }, { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -11982,24 +11441,24 @@ var CommunitiesClient = class { ); } /** - * Search Communities - * Retrieves a list of Communities matching the specified search query. + * Get List memberships + * Retrieves a list of Lists that a specific User is a member of by their ID. + * @param id The ID of the User to lookup. - * @param query Query to search communities. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async search(query, options = {}) { + async getListMemberships(id, options = {}) { const paramMappings = { max_results: "maxResults", - next_token: "nextToken", pagination_token: "paginationToken", - "community.fields": "communityFields" + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -12007,33 +11466,38 @@ var CommunitiesClient = class { ); const { maxResults = void 0, - nextToken = void 0, paginationToken = void 0, - communityFields = [], + listFields = [], + expansions = [], + userFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/communities/search"; + let path = "/2/users/{id}/list_memberships"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (query !== void 0) { - params.append("query", String(query)); - } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } - if (nextToken !== void 0) { - params.append("next_token", String(nextToken)); - } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (communityFields !== void 0 && communityFields.length > 0) { - params.append("community.fields", communityFields.join(",")); + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read", "users.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12047,56 +11511,42 @@ var CommunitiesClient = class { finalRequestOptions ); } -}; - -// src/communities/models.ts -var models_exports10 = {}; - -// src/connections/client.ts -var ConnectionsClient = class { - client; - /** - * Creates a new connections client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Terminate all connections - * Terminates all active streaming connections for the authenticated application. + * Unfollow User + * Causes the authenticated user to unfollow a specific user by their ID. + * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. - * @returns {Promise} Promise resolving to the API response + + + * @param targetUserId The ID of the User that the source User is requesting to unfollow. + + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteAll() { - let path = "/2/connections/all"; + async unfollowUser(sourceUserId, targetUserId) { + let path = "/2/users/{source_user_id}/following/{target_user_id}"; + path = path.replace( + "{source_user_id}", + encodeURIComponent(String(sourceUserId)) + ); + path = path.replace( + "{target_user_id}", + encodeURIComponent(String(targetUserId)) + ); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["follows.write", "tweet.read", "users.read"] + }, + { + UserToken: [] } ] // No optional parameters, using empty request options @@ -12107,134 +11557,96 @@ var ConnectionsClient = class { finalRequestOptions ); } -}; - -// src/connections/models.ts -var models_exports11 = {}; - -// src/media/client.ts -var MediaClient = class { - client; - /** - * Creates a new media client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Get Media analytics - * Retrieves analytics data for media. - + * Unfollow List + * Causes the authenticated user to unfollow a specific List by its ID. - * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. + * @param id The ID of the authenticated source User that will unfollow the List. - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + * @param listId The ID of the List to unfollow. - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - - - * @param granularity The granularity for the search counts results. - - - - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getAnalytics(mediaKeys, endTime, startTime, granularity, options = {}) { - const paramMappings = { - "media_analytics.fields": "mediaAnalyticsFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - mediaAnalyticsFields = [], - requestOptions = {} - } = normalizedOptions; - let path = "/2/media/analytics"; + async unfollowList(id, listId) { + let path = "/2/users/{id}/followed_lists/{list_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{list_id}", encodeURIComponent(String(listId))); const params = new URLSearchParams(); - if (mediaKeys !== void 0 && mediaKeys.length > 0) { - params.append("media_keys", mediaKeys.join(",")); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (granularity !== void 0) { - params.append("granularity", String(granularity)); - } - if (mediaAnalyticsFields !== void 0 && mediaAnalyticsFields.length > 0) { - params.append("media_analytics.fields", mediaAnalyticsFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["tweet.read"] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create Media subtitles - * Creates subtitles for a specific Media file. + * Get Users by IDs + * Retrieves details of multiple Users by their IDs. - * @returns {Promise} Promise resolving to the API response + * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createSubtitles(options = {}) { - const normalizedOptions = options || {}; + async getByIds(ids, options = {}) { + const paramMappings = { + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media/subtitles"; + let path = "/2/users"; const params = new URLSearchParams(); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -12243,34 +11655,39 @@ var MediaClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Delete Media subtitles - * Deletes subtitles for a specific Media file. + * Like Post + * Causes the authenticated user to Like a specific Post by its ID. + + * @param id The ID of the authenticated source User that is requesting to like the Post. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteSubtitles(options = {}) { + async likePost(id, options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/media/subtitles"; + let path = "/2/users/{id}/likes"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + OAuth2UserToken: ["like.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -12279,40 +11696,39 @@ var MediaClient = class { ...requestOptions }; return this.client.request( - "DELETE", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Initialize media upload - * Initializes a media upload. + * Block DMs + * Blocks direct messages to or from a specific User by their ID for the authenticated user. + * @param id The ID of the target User that the authenticated user requesting to block dms for. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async initializeUpload(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/media/upload/initialize"; + async blockDms(id) { + let path = "/2/users/{id}/dm/block"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + OAuth2UserToken: ["dm.write", "tweet.read", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "POST", @@ -12321,41 +11737,102 @@ var MediaClient = class { ); } /** - * Get Media upload status - * Retrieves the status of a Media upload by its ID. + * Get Posts + * Retrieves a list of posts authored by a specific User by their ID. + * @param id The ID of the User to lookup. - * @param mediaId Media id for the requested media upload status. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getUploadStatus(mediaId, options = {}) { - const paramMappings = {}; + async getPosts(id, options = {}) { + const paramMappings = { + since_id: "sinceId", + until_id: "untilId", + max_results: "maxResults", + pagination_token: "paginationToken", + start_time: "startTime", + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - command = void 0, + sinceId = void 0, + untilId = void 0, + maxResults = void 0, + paginationToken = void 0, + exclude = [], + startTime = void 0, + endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media/upload"; + let path = "/2/users/{id}/tweets"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (mediaId !== void 0) { - params.append("media_id", String(mediaId)); + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); } - if (command !== void 0) { - params.append("command", String(command)); + if (untilId !== void 0) { + params.append("until_id", String(untilId)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (exclude !== void 0 && exclude.length > 0) { + params.append("exclude", exclude.join(",")); + } + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -12370,80 +11847,97 @@ var MediaClient = class { ); } /** - * Upload media - * Uploads a media file for use in posts or other content. + * Get Bookmarks by folder ID + * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + + + * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. + + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async upload(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/media/upload"; + async getBookmarksByFolderId(id, folderId) { + let path = "/2/users/{id}/bookmarks/folders/{folder_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{folder_id}", encodeURIComponent(String(folderId))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] - }, - { - UserToken: [] + OAuth2UserToken: ["bookmark.read", "tweet.read", "users.read"] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get Media by media key - * Retrieves details of a specific Media file by its media key. + * Get muting + * Retrieves a list of Users muted by the authenticated user. - * @param mediaKey A single Media Key. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByKey(mediaKey, options = {}) { + async getMuting(id, options = {}) { const paramMappings = { - "media.fields": "mediaFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - mediaFields = [], + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media/{media_key}"; - path = path.replace("{media_key}", encodeURIComponent(String(mediaKey))); + let path = "/2/users/{id}/muting"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["tweet.read"] + OAuth2UserToken: ["mute.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12458,25 +11952,25 @@ var MediaClient = class { ); } /** - * Append Media upload - * Appends data to a Media upload request. + * Mute User + * Causes the authenticated user to mute a specific User by their ID. - * @param id The media identifier for the media to perform the append operation. + * @param id The ID of the authenticated source User that is requesting to mute the target User. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async appendUpload(id, options = {}) { + async muteUser(id, options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/media/upload/{id}/append"; + let path = "/2/users/{id}/muting"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { @@ -12484,7 +11978,7 @@ var MediaClient = class { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + OAuth2UserToken: ["mute.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -12499,37 +11993,54 @@ var MediaClient = class { ); } /** - * Get Media by media keys - * Retrieves details of Media files by their media keys. + * Get owned Lists + * Retrieves a list of Lists owned by a specific User by their ID. + * @param id The ID of the User to lookup. - * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByKeys(mediaKeys, options = {}) { + async getOwnedLists(id, options = {}) { const paramMappings = { - "media.fields": "mediaFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - mediaFields = [], + maxResults = void 0, + paginationToken = void 0, + listFields = [], + expansions = [], + userFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media"; + let path = "/2/users/{id}/owned_lists"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (mediaKeys !== void 0 && mediaKeys.length > 0) { - params.append("media_keys", mediaKeys.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -12538,7 +12049,7 @@ var MediaClient = class { BearerToken: [] }, { - OAuth2UserToken: ["tweet.read"] + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12553,27 +12064,32 @@ var MediaClient = class { ); } /** - * Finalize Media upload - * Finalizes a Media upload request. + * Unpin List + * Causes the authenticated user to unpin a specific List by its ID. - * @param id The media id of the targeted media to finalize. + * @param id The ID of the authenticated source User for whom to return results. + * @param listId The ID of the List to unpin. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async finalizeUpload(id) { - let path = "/2/media/upload/{id}/finalize"; + async unpinList(id, listId) { + let path = "/2/users/{id}/pinned_lists/{list_id}"; path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{list_id}", encodeURIComponent(String(listId))); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -12582,34 +12098,59 @@ var MediaClient = class { // No optional parameters, using empty request options }; return this.client.request( - "POST", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create Media metadata - * Creates metadata for a Media file. + * Get User by username + * Retrieves details of a specific User by their username. + + * @param username A username. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createMetadata(options = {}) { - const normalizedOptions = options || {}; + async getByUsername(username, options = {}) { + const paramMappings = { + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/media/metadata"; + let path = "/2/users/by/username/{username}"; + path = path.replace("{username}", encodeURIComponent(String(username))); const params = new URLSearchParams(); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["media.write"] + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -12618,132 +12159,66 @@ var MediaClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } -}; - -// src/media/models.ts -var models_exports12 = {}; - -// src/lists/client.ts -var ListsClient = class { - client; - /** - * Creates a new lists client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Remove List member - * Removes a User from a specific List by its ID and the User’s ID. - - - * @param id The ID of the List to remove a member. - + * Get blocking + * Retrieves a list of Users blocked by the specified User ID. - * @param userId The ID of User that will be removed from the List. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async removeMemberByUserId(id, userId) { - let path = "/2/lists/{id}/members/{user_id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); - path = path.replace("{user_id}", encodeURIComponent(String(userId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options + async getBlocking(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Get List by ID - * Retrieves details of a specific List by its ID. - - - * @param id The ID of the List. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getById(id, options = {}) { - const paramMappings = { - "list.fields": "listFields", - "user.fields": "userFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings ); const { - listFields = [], - expansions = [], + maxResults = void 0, + paginationToken = void 0, userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}"; + let path = "/2/users/{id}/blocking"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (listFields !== void 0 && listFields.length > 0) { - params.append("list.fields", listFields.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + OAuth2UserToken: ["block.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12758,33 +12233,75 @@ var ListsClient = class { ); } /** - * Update List - * Updates the details of a specific List owned by the authenticated user by its ID. + * Get liked Posts + * Retrieves a list of Posts liked by a specific User by their ID. - * @param id The ID of the List to modify. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async update(id, options = {}) { - const normalizedOptions = options || {}; + async getLikedPosts(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + maxResults = void 0, + paginationToken = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}"; + let path = "/2/users/{id}/liked_tweets"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + OAuth2UserToken: ["like.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -12793,33 +12310,38 @@ var ListsClient = class { ...requestOptions }; return this.client.request( - "PUT", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Delete List - * Deletes a specific List owned by the authenticated user by its ID. + * Unlike Post + * Causes the authenticated user to Unlike a specific Post by its ID. - * @param id The ID of the List to delete. + * @param id The ID of the authenticated source User that is requesting to unlike the Post. + * @param tweetId The ID of the Post that the User is requesting to unlike. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async delete(id) { - let path = "/2/lists/{id}"; + async unlikePost(id, tweetId) { + let path = "/2/users/{id}/likes/{tweet_id}"; path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["list.write", "tweet.read", "users.read"] + OAuth2UserToken: ["like.write", "tweet.read", "users.read"] }, { UserToken: [] @@ -12834,24 +12356,24 @@ var ListsClient = class { ); } /** - * Get List members - * Retrieves a list of Users who are members of a specific List by its ID. + * Get followed Lists + * Retrieves a list of Lists followed by a specific User by their ID. - * @param id The ID of the List. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMembers(id, options = {}) { + async getFollowedLists(id, options = {}) { const paramMappings = { max_results: "maxResults", pagination_token: "paginationToken", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -12860,12 +12382,12 @@ var ListsClient = class { const { maxResults = void 0, paginationToken = void 0, - userFields = [], + listFields = [], expansions = [], - tweetFields = [], + userFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}/members"; + let path = "/2/users/{id}/followed_lists"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); if (maxResults !== void 0) { @@ -12874,14 +12396,14 @@ var ListsClient = class { if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -12905,25 +12427,25 @@ var ListsClient = class { ); } /** - * Add List member - * Adds a User to a specific List by its ID. + * Follow List + * Causes the authenticated user to follow a specific List by its ID. - * @param id The ID of the List for which to add a member. + * @param id The ID of the authenticated source User that will follow the List. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async addMember(id, options = {}) { + async followList(id, options = {}) { const normalizedOptions = options || {}; const { body, requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}/members"; + let path = "/2/users/{id}/followed_lists"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { @@ -12946,63 +12468,99 @@ var ListsClient = class { ); } /** - * Get List followers - * Retrieves a list of Users who follow a specific List by its ID. + * Get Timeline + * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. - * @param id The ID of the List. + * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowers(id, options = {}) { + async getTimeline(id, options = {}) { const paramMappings = { + since_id: "sinceId", + until_id: "untilId", max_results: "maxResults", pagination_token: "paginationToken", + start_time: "startTime", + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { + sinceId = void 0, + untilId = void 0, maxResults = void 0, paginationToken = void 0, - userFields = [], - expansions = [], + exclude = [], + startTime = void 0, + endTime = void 0, tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}/followers"; + let path = "/2/users/{id}/timelines/reverse_chronological"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); + } + if (untilId !== void 0) { + params.append("until_id", String(untilId)); + } if (maxResults !== void 0) { params.append("max_results", String(maxResults)); } if (paginationToken !== void 0) { params.append("pagination_token", String(paginationToken)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (exclude !== void 0 && exclude.length > 0) { + params.append("exclude", exclude.join(",")); } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } if (tweetFields !== void 0 && tweetFields.length > 0) { params.append("tweet.fields", tweetFields.join(",")); } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] - }, - { - OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + OAuth2UserToken: ["tweet.read", "users.read"] }, { UserToken: [] @@ -13017,76 +12575,48 @@ var ListsClient = class { ); } /** - * Get List Posts - * Retrieves a list of Posts associated with a specific List by its ID. + * Get pinned Lists + * Retrieves a list of Lists pinned by the authenticated user. - * @param id The ID of the List. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPosts(id, options = {}) { + async getPinnedLists(id, options = {}) { const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + "list.fields": "listFields", + "user.fields": "userFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - maxResults = void 0, - paginationToken = void 0, - tweetFields = [], + listFields = [], expansions = [], - mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/lists/{id}/tweets"; + let path = "/2/users/{id}/pinned_lists"; path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (listFields !== void 0 && listFields.length > 0) { + params.append("list.fields", listFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ - { - BearerToken: [] - }, { OAuth2UserToken: ["list.read", "tweet.read", "users.read"] }, @@ -13103,39 +12633,36 @@ var ListsClient = class { ); } /** - * Create List - * Creates a new List for the authenticated user. + * Pin List + * Causes the authenticated user to pin a specific List by its ID. + + * @param id The ID of the authenticated source User that will pin the List. - * @returns {Promise} Promise resolving to the API response + + + * @param body Request body + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async create(options = {}) { - const normalizedOptions = options || {}; - const { - body, - requestOptions = {} - } = normalizedOptions; - let path = "/2/lists"; + async pinList(id, body) { + let path = "/2/users/{id}/pinned_lists"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, + body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: [ - "list.read", - "list.write", - "tweet.read", - "users.read" - ] + OAuth2UserToken: ["list.write", "tweet.read", "users.read"] }, { UserToken: [] } - ], - ...requestOptions + ] + // No optional parameters, using empty request options }; return this.client.request( "POST", @@ -13143,75 +12670,74 @@ var ListsClient = class { finalRequestOptions ); } -}; - -// src/lists/models.ts -var models_exports13 = {}; - -// src/compliance/client.ts -var ComplianceClient = class { - client; - /** - * Creates a new compliance client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } /** - * Get Compliance Job by ID - * Retrieves details of a specific Compliance Job by its ID. - - - * @param id The ID of the Compliance Job to retrieve. - + * Get Reposts of me + * Retrieves a list of Posts that repost content from the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getJobsById(id, options = {}) { + async getRepostsOfMe(options = {}) { const paramMappings = { - "compliance_job.fields": "complianceJobFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - complianceJobFields = [], + maxResults = void 0, + paginationToken = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/compliance/jobs/{id}"; - path = path.replace("{id}", encodeURIComponent(String(id))); + let path = "/2/users/reposts_of_me"; const params = new URLSearchParams(); - if (complianceJobFields !== void 0 && complianceJobFields.length > 0) { - params.append("compliance_job.fields", complianceJobFields.join(",")); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["timeline.read", "tweet.read"] + }, + { + UserToken: [] } ], ...requestOptions @@ -13223,47 +12749,66 @@ var ComplianceClient = class { ); } /** - * Get Compliance Jobs - * Retrieves a list of Compliance Jobs filtered by job type and optional status. + * Get following + * Retrieves a list of Users followed by a specific User by their ID. + * @param id The ID of the User to lookup. - * @param type Type of Compliance Job to list. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getJobs(type, options = {}) { + async getFollowing(id, options = {}) { const paramMappings = { - "compliance_job.fields": "complianceJobFields" + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - status = void 0, - complianceJobFields = [], + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/compliance/jobs"; + let path = "/2/users/{id}/following"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (type !== void 0) { - params.append("type", String(type)); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - if (status !== void 0) { - params.append("status", String(status)); + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } - if (complianceJobFields !== void 0 && complianceJobFields.length > 0) { - params.append("compliance_job.fields", complianceJobFields.join(",")); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] + }, + { + OAuth2UserToken: ["follows.read", "tweet.read", "users.read"] + }, + { + UserToken: [] } ], ...requestOptions @@ -13275,28 +12820,39 @@ var ComplianceClient = class { ); } /** - * Create Compliance Job - * Creates a new Compliance Job for the specified job type. + * Follow User + * Causes the authenticated user to follow a specific user by their ID. + * @param id The ID of the authenticated source User that is requesting to follow the target User. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createJobs(body) { - let path = "/2/compliance/jobs"; + async followUser(id, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/following"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { - body: JSON.stringify(body || {}), + body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["follows.write", "tweet.read", "users.read"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( "POST", @@ -13304,53 +12860,443 @@ var ComplianceClient = class { finalRequestOptions ); } -}; - -// src/compliance/models.ts -var models_exports14 = {}; - -// src/general/client.ts -var GeneralClient = class { - client; /** - * Creates a new general client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; + * Unblock DMs + * Unblocks direct messages to or from a specific User by their ID for the authenticated user. + + + * @param id The ID of the target User that the authenticated user requesting to unblock dms for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async unblockDms(id) { + let path = "/2/users/{id}/dm/unblock"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["dm.write", "tweet.read", "users.read"] + }, + { + UserToken: [] + } + ] + // No optional parameters, using empty request options + }; + return this.client.request( + "POST", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Get mentions + * Retrieves a list of Posts that mention a specific User by their ID. + + + * @param id The ID of the User to lookup. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getMentions(id, options = {}) { + const paramMappings = { + since_id: "sinceId", + until_id: "untilId", + max_results: "maxResults", + pagination_token: "paginationToken", + start_time: "startTime", + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + sinceId = void 0, + untilId = void 0, + maxResults = void 0, + paginationToken = void 0, + startTime = void 0, + endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/mentions"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + if (sinceId !== void 0) { + params.append("since_id", String(sinceId)); + } + if (untilId !== void 0) { + params.append("until_id", String(untilId)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (startTime !== void 0) { + params.append("start_time", String(startTime)); + } + if (endTime !== void 0) { + params.append("end_time", String(endTime)); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Get Bookmark folders + * Retrieves a list of Bookmark folders created by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getBookmarkFolders(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + paginationToken = void 0, + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/bookmarks/folders"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["bookmark.read", "users.read"] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Unrepost Post + * Causes the authenticated user to unrepost a specific Post by its ID. + + + * @param id The ID of the authenticated source User that is requesting to repost the Post. + + + + * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async unrepostPost(id, sourceTweetId) { + let path = "/2/users/{id}/retweets/{source_tweet_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace( + "{source_tweet_id}", + encodeURIComponent(String(sourceTweetId)) + ); + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + }, + { + UserToken: [] + } + ] + // No optional parameters, using empty request options + }; + return this.client.request( + "DELETE", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Delete Bookmark + * Removes a Post from the authenticated user’s Bookmarks by its ID. + + + * @param id The ID of the authenticated source User whose bookmark is to be removed. + + + + * @param tweetId The ID of the Post that the source User is removing from bookmarks. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async deleteBookmark(id, tweetId) { + let path = "/2/users/{id}/bookmarks/{tweet_id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); + path = path.replace("{tweet_id}", encodeURIComponent(String(tweetId))); + const params = new URLSearchParams(); + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["bookmark.write", "tweet.read", "users.read"] + } + ] + // No optional parameters, using empty request options + }; + return this.client.request( + "DELETE", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); + } + /** + * Repost Post + * Causes the authenticated user to repost a specific Post by its ID. + + + * @param id The ID of the authenticated source User that is requesting to repost the Post. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async repostPost(id, options = {}) { + const normalizedOptions = options || {}; + const { + body, + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/retweets"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + const finalRequestOptions = { + body: body ? JSON.stringify(body) : void 0, + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["tweet.read", "tweet.write", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "POST", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); } /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + * Search Users + * Retrieves a list of Users matching a search query. + + + + * @param query TThe the query string by which to query for users. + + + + * @returns {Promise} Promise resolving to the API response */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; + // Overload 1: Default behavior (unwrapped response) + async search(query, options = {}) { + const paramMappings = { + max_results: "maxResults", + next_token: "nextToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + nextToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/search"; + const params = new URLSearchParams(); + if (query !== void 0) { + params.append("query", String(query)); } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - return normalized; + if (nextToken !== void 0) { + params.append("next_token", String(nextToken)); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); } /** - * Get OpenAPI Spec. - * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) + * Get User by ID + * Retrieves details of a specific User by their ID. + + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getOpenApiSpec() { - let path = "/2/openapi.json"; + async getById(id, options = {}) { + const paramMappings = { + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + userFields = [], + expansions = [], + tweetFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { - // No optional parameters, using empty request options + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [] + }, + { + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] + } + ], + ...requestOptions }; return this.client.request( "GET", @@ -13358,102 +13304,179 @@ var GeneralClient = class { finalRequestOptions ); } -}; - -// src/general/models.ts -var models_exports15 = {}; - -// src/account_activity/client.ts -var AccountActivityClient = class { - client; - /** - * Creates a new account activity client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + * Get Bookmarks + * Retrieves a list of Posts bookmarked by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; + // Overload 1: Default behavior (unwrapped response) + async getBookmarks(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + paginationToken = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/{id}/bookmarks"; + path = path.replace("{id}", encodeURIComponent(String(id))); + const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } - return normalized; + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } + const finalRequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ["bookmark.read", "tweet.read", "users.read"] + } + ], + ...requestOptions + }; + return this.client.request( + "GET", + path + (params.toString() ? `?${params.toString()}` : ""), + finalRequestOptions + ); } /** - * Validate subscription - * Checks a user’s Account Activity subscription for a given webhook. + * Create Bookmark + * Adds a post to the authenticated user’s bookmarks. - * @param webhookId The webhook ID to check subscription against. + * @param id The ID of the authenticated source User for whom to add bookmarks. - * @returns {Promise} Promise resolving to the API response + * @param body Request body + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async validateSubscription(webhookId) { - let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + async createBookmark(id, body) { + let path = "/2/users/{id}/bookmarks"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); const finalRequestOptions = { + body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "dm.write", "tweet.read", "users.read"] - }, - { - UserToken: [] + OAuth2UserToken: ["bookmark.write", "tweet.read", "users.read"] } ] // No optional parameters, using empty request options }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Create subscription - * Creates an Account Activity subscription for the user and the given webhook. + * Get followers + * Retrieves a list of Users who follow a specific User by their ID. - * @param webhookId The webhook ID to check subscription against. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createSubscription(webhookId, options = {}) { - const normalizedOptions = options || {}; + async getFollowers(id, options = {}) { + const paramMappings = { + max_results: "maxResults", + pagination_token: "paginationToken", + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + maxResults = void 0, + paginationToken = void 0, + userFields = [], + expansions = [], + tweetFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + let path = "/2/users/{id}/followers"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ["dm.read", "dm.write", "tweet.read", "users.read"] + BearerToken: [] + }, + { + OAuth2UserToken: ["follows.read", "tweet.read", "users.read"] }, { UserToken: [] @@ -13462,31 +13485,57 @@ var AccountActivityClient = class { ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get subscription count - * Retrieves a count of currently active Account Activity subscriptions. + * Get my User + * Retrieves details of the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getSubscriptionCount() { - let path = "/2/account_activity/subscriptions/count"; + async getMe(options = {}) { + const paramMappings = { + "user.fields": "userFields", + "tweet.fields": "tweetFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + userFields = [], + expansions = [], + tweetFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/users/me"; const params = new URLSearchParams(); + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( "GET", @@ -13495,124 +13544,206 @@ var AccountActivityClient = class { ); } /** - * Get subscriptions - * Retrieves a list of all active subscriptions for a given webhook. + * Unmute User + * Causes the authenticated user to unmute a specific user by their ID. - * @param webhookId The webhook ID to pull subscriptions for. + * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. + * @param targetUserId The ID of the User that the source User is requesting to unmute. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getSubscriptions(webhookId) { - let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + async unmuteUser(sourceUserId, targetUserId) { + let path = "/2/users/{source_user_id}/muting/{target_user_id}"; + path = path.replace( + "{source_user_id}", + encodeURIComponent(String(sourceUserId)) + ); + path = path.replace( + "{target_user_id}", + encodeURIComponent(String(targetUserId)) + ); const params = new URLSearchParams(); const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["mute.write", "tweet.read", "users.read"] + }, + { + UserToken: [] } ] // No optional parameters, using empty request options }; return this.client.request( - "GET", + "DELETE", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/users/models.ts +var models_exports14 = {}; + +// src/communities/client.ts +var CommunitiesClient = class { + client; /** - * Create replay job - * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook. - - - * @param webhookId The unique identifier for the webhook configuration. - - - - - * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. + * Creates a new communities client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get Community by ID + * Retrieves details of a specific Community by its ID. + * @param id The ID of the Community. - * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createReplayJob(webhookId, fromDate, toDate) { - let path = "/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + async getById(id, options = {}) { + const paramMappings = { + "community.fields": "communityFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + communityFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/communities/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (fromDate !== void 0) { - params.append("from_date", String(fromDate)); - } - if (toDate !== void 0) { - params.append("to_date", String(toDate)); + if (communityFields !== void 0 && communityFields.length > 0) { + params.append("community.fields", communityFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] + }, + { + OAuth2UserToken: ["list.read", "tweet.read", "users.read"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Delete subscription - * Deletes an Account Activity subscription for the given webhook and user ID. - - - * @param webhookId The webhook ID to check subscription against. - + * Search Communities + * Retrieves a list of Communities matching the specified search query. - * @param userId User ID to unsubscribe from. + * @param query Query to search communities. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteSubscription(webhookId, userId) { - let path = "/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); - path = path.replace("{user_id}", encodeURIComponent(String(userId))); + async search(query, options = {}) { + const paramMappings = { + max_results: "maxResults", + next_token: "nextToken", + pagination_token: "paginationToken", + "community.fields": "communityFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + maxResults = void 0, + nextToken = void 0, + paginationToken = void 0, + communityFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/communities/search"; const params = new URLSearchParams(); + if (query !== void 0) { + params.append("query", String(query)); + } + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (nextToken !== void 0) { + params.append("next_token", String(nextToken)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); + } + if (communityFields !== void 0 && communityFields.length > 0) { + params.append("community.fields", communityFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [] + OAuth2UserToken: ["tweet.read", "users.read"] + }, + { + UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } }; -// src/account_activity/models.ts -var models_exports16 = {}; +// src/communities/models.ts +var models_exports15 = {}; // src/stream/event_driven_stream.ts var StreamEvent = { @@ -13990,8 +14121,8 @@ var StreamClient = class { return eventStream; } /** - * Stream all Posts - * Streams all public Posts in real-time. + * Stream Portuguese Posts + * Streams all public Portuguese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14005,10 +14136,10 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehose(partition, options = {}) { + async postsFirehosePt(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehose"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehosePt"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", @@ -14037,7 +14168,7 @@ var StreamClient = class { signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/firehose/stream"; + let path = "/2/tweets/firehose/stream/lang/pt"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14099,8 +14230,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Post labels - * Streams all labeling events applied to Posts. + * Stream Japanese Posts + * Streams all public Japanese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14108,16 +14239,25 @@ var StreamClient = class { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - async labelsCompliance(options = {}) { + async postsFirehoseJa(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "labelsCompliance"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseJa"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime" + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14127,21 +14267,48 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/label/stream"; + let path = "/2/tweets/firehose/stream/lang/ja"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } + if (partition !== void 0) { + params.append("partition", String(partition)); + } if (startTime !== void 0) { params.append("start_time", String(startTime)); } if (endTime !== void 0) { params.append("end_time", String(endTime)); } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14172,8 +14339,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Likes compliance data - * Streams all compliance data related to Likes for Users. + * Stream 10% sampled Posts + * Streams a 10% sample of public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14181,16 +14348,25 @@ var StreamClient = class { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - async likesCompliance(options = {}) { + async postsSample10(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "likesCompliance"); + this.client.validateAuthentication(requiredAuthTypes, "postsSample10"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime" + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14200,21 +14376,48 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/likes/compliance/stream"; + let path = "/2/tweets/sample10/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } + if (partition !== void 0) { + params.append("partition", String(partition)); + } if (startTime !== void 0) { params.append("start_time", String(startTime)); } if (endTime !== void 0) { params.append("end_time", String(endTime)); } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14245,8 +14448,8 @@ var StreamClient = class { return eventStream; } /** - * Stream sampled Likes - * Streams a 10% sample of public Likes in real-time. + * Stream Korean Posts + * Streams all public Korean-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14260,17 +14463,19 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async likesSample10(partition, options = {}) { + async postsFirehoseKo(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "likesSample10"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseKo"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", end_time: "endTime", - "like_with_tweet_author.fields": "likeWithTweetAuthorFields", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", "user.fields": "userFields", - "tweet.fields": "tweetFields" + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14280,15 +14485,17 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - likeWithTweetAuthorFields = [], + tweetFields = [], expansions = [], + mediaFields = [], + pollFields = [], userFields = [], - tweetFields = [], + placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/likes/sample10/stream"; + let path = "/2/tweets/firehose/stream/lang/ko"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14302,20 +14509,23 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (likeWithTweetAuthorFields !== void 0 && likeWithTweetAuthorFields.length > 0) { - params.append( - "like_with_tweet_author.fields", - likeWithTweetAuthorFields.join(",") - ); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { @@ -14347,8 +14557,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Portuguese Posts - * Streams all public Portuguese-language Posts in real-time. + * Stream Likes compliance data + * Streams all compliance data related to Likes for Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14356,25 +14566,16 @@ var StreamClient = class { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehosePt(partition, options = {}) { + async likesCompliance(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehosePt"); + this.client.validateAuthentication(requiredAuthTypes, "likesCompliance"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + end_time: "endTime" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14383,48 +14584,21 @@ var StreamClient = class { const { backfillMinutes = void 0, startTime = void 0, - endTime = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], - headers = {}, - signal, - requestOptions = {} - } = normalizedOptions; - let path = "/2/tweets/firehose/stream/lang/pt"; - const params = new URLSearchParams(); - if (backfillMinutes !== void 0) { - params.append("backfill_minutes", String(backfillMinutes)); - } - if (partition !== void 0) { - params.append("partition", String(partition)); - } - if (startTime !== void 0) { - params.append("start_time", String(startTime)); - } - if (endTime !== void 0) { - params.append("end_time", String(endTime)); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); + endTime = void 0, + headers = {}, + signal, + requestOptions = {} + } = normalizedOptions; + let path = "/2/likes/compliance/stream"; + const params = new URLSearchParams(); + if (backfillMinutes !== void 0) { + params.append("backfill_minutes", String(backfillMinutes)); } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); + if (startTime !== void 0) { + params.append("start_time", String(startTime)); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (endTime !== void 0) { + params.append("end_time", String(endTime)); } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { @@ -14456,8 +14630,8 @@ var StreamClient = class { return eventStream; } /** - * Stream English Posts - * Streams all public English-language Posts in real-time. + * Stream Posts compliance data + * Streams all compliance data related to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14471,19 +14645,14 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehoseEn(partition, options = {}) { + async postsCompliance(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseEn"); + this.client.validateAuthentication(requiredAuthTypes, "postsCompliance"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" + end_time: "endTime" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14493,17 +14662,11 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - tweetFields = [], - expansions = [], - mediaFields = [], - pollFields = [], - userFields = [], - placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/firehose/stream/lang/en"; + let path = "/2/tweets/compliance/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14517,24 +14680,6 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); - } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14565,8 +14710,8 @@ var StreamClient = class { return eventStream; } /** - * Stream filtered Posts - * Streams Posts in real-time matching the active rule set. + * Stream all Likes + * Streams all public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14574,21 +14719,23 @@ var StreamClient = class { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - async posts(options = {}) { + async likesFirehose(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "posts"); + this.client.validateAuthentication(requiredAuthTypes, "likesFirehose"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", + "like_with_tweet_author.fields": "likeWithTweetAuthorFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14598,44 +14745,42 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - tweetFields = [], + likeWithTweetAuthorFields = [], expansions = [], - mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + tweetFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/stream"; + let path = "/2/likes/firehose/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } + if (partition !== void 0) { + params.append("partition", String(partition)); + } if (startTime !== void 0) { params.append("start_time", String(startTime)); } if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (likeWithTweetAuthorFields !== void 0 && likeWithTweetAuthorFields.length > 0) { + params.append( + "like_with_tweet_author.fields", + likeWithTweetAuthorFields.join(",") + ); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { @@ -14667,8 +14812,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Posts compliance data - * Streams all compliance data related to Posts. + * Stream English Posts + * Streams all public English-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14682,14 +14827,19 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsCompliance(partition, options = {}) { + async postsFirehoseEn(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsCompliance"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseEn"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime" + end_time: "endTime", + "tweet.fields": "tweetFields", + "media.fields": "mediaFields", + "poll.fields": "pollFields", + "user.fields": "userFields", + "place.fields": "placeFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14699,11 +14849,17 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, + tweetFields = [], + expansions = [], + mediaFields = [], + pollFields = [], + userFields = [], + placeFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/compliance/stream"; + let path = "/2/tweets/firehose/stream/lang/en"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14717,6 +14873,24 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); + } + if (expansions !== void 0 && expansions.length > 0) { + params.append("expansions", expansions.join(",")); + } + if (mediaFields !== void 0 && mediaFields.length > 0) { + params.append("media.fields", mediaFields.join(",")); + } + if (pollFields !== void 0 && pollFields.length > 0) { + params.append("poll.fields", pollFields.join(",")); + } + if (userFields !== void 0 && userFields.length > 0) { + params.append("user.fields", userFields.join(",")); + } + if (placeFields !== void 0 && placeFields.length > 0) { + params.append("place.fields", placeFields.join(",")); + } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14747,8 +14921,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Korean Posts - * Streams all public Korean-language Posts in real-time. + * Stream filtered Posts + * Streams Posts in real-time matching the active rule set. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14756,16 +14930,12 @@ var StreamClient = class { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehoseKo(partition, options = {}) { + async posts(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseKo"); + this.client.validateAuthentication(requiredAuthTypes, "posts"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", @@ -14794,14 +14964,11 @@ var StreamClient = class { signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/firehose/stream/lang/ko"; + let path = "/2/tweets/search/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } - if (partition !== void 0) { - params.append("partition", String(partition)); - } if (startTime !== void 0) { params.append("start_time", String(startTime)); } @@ -14856,8 +15023,8 @@ var StreamClient = class { return eventStream; } /** - * Stream all Likes - * Streams all public Likes in real-time. + * Stream Users compliance data + * Streams all compliance data related to Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14871,17 +15038,14 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async likesFirehose(partition, options = {}) { + async usersCompliance(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "likesFirehose"); + this.client.validateAuthentication(requiredAuthTypes, "usersCompliance"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", - end_time: "endTime", - "like_with_tweet_author.fields": "likeWithTweetAuthorFields", - "user.fields": "userFields", - "tweet.fields": "tweetFields" + end_time: "endTime" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -14891,15 +15055,11 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - likeWithTweetAuthorFields = [], - expansions = [], - userFields = [], - tweetFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/likes/firehose/stream"; + let path = "/2/users/compliance/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -14913,21 +15073,6 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (likeWithTweetAuthorFields !== void 0 && likeWithTweetAuthorFields.length > 0) { - params.append( - "like_with_tweet_author.fields", - likeWithTweetAuthorFields.join(",") - ); - } - if (expansions !== void 0 && expansions.length > 0) { - params.append("expansions", expansions.join(",")); - } - if (userFields !== void 0 && userFields.length > 0) { - params.append("user.fields", userFields.join(",")); - } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); - } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { headers: { @@ -14958,8 +15103,8 @@ var StreamClient = class { return eventStream; } /** - * Stream 10% sampled Posts - * Streams a 10% sample of public Posts in real-time. + * Stream all Posts + * Streams all public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -14973,10 +15118,10 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsSample10(partition, options = {}) { + async postsFirehose(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsSample10"); + this.client.validateAuthentication(requiredAuthTypes, "postsFirehose"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", @@ -15005,7 +15150,7 @@ var StreamClient = class { signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/sample10/stream"; + let path = "/2/tweets/firehose/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -15067,8 +15212,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Japanese Posts - * Streams all public Japanese-language Posts in real-time. + * Stream sampled Likes + * Streams a 10% sample of public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -15082,19 +15227,17 @@ var StreamClient = class { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehoseJa(partition, options = {}) { + async likesSample10(partition, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "postsFirehoseJa"); + this.client.validateAuthentication(requiredAuthTypes, "likesSample10"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", end_time: "endTime", - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", + "like_with_tweet_author.fields": "likeWithTweetAuthorFields", "user.fields": "userFields", - "place.fields": "placeFields" + "tweet.fields": "tweetFields" }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -15104,17 +15247,15 @@ var StreamClient = class { backfillMinutes = void 0, startTime = void 0, endTime = void 0, - tweetFields = [], + likeWithTweetAuthorFields = [], expansions = [], - mediaFields = [], - pollFields = [], userFields = [], - placeFields = [], + tweetFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/firehose/stream/lang/ja"; + let path = "/2/likes/sample10/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); @@ -15128,23 +15269,20 @@ var StreamClient = class { if (endTime !== void 0) { params.append("end_time", String(endTime)); } - if (tweetFields !== void 0 && tweetFields.length > 0) { - params.append("tweet.fields", tweetFields.join(",")); + if (likeWithTweetAuthorFields !== void 0 && likeWithTweetAuthorFields.length > 0) { + params.append( + "like_with_tweet_author.fields", + likeWithTweetAuthorFields.join(",") + ); } if (expansions !== void 0 && expansions.length > 0) { params.append("expansions", expansions.join(",")); } - if (mediaFields !== void 0 && mediaFields.length > 0) { - params.append("media.fields", mediaFields.join(",")); - } - if (pollFields !== void 0 && pollFields.length > 0) { - params.append("poll.fields", pollFields.join(",")); - } if (userFields !== void 0 && userFields.length > 0) { params.append("user.fields", userFields.join(",")); } - if (placeFields !== void 0 && placeFields.length > 0) { - params.append("place.fields", placeFields.join(",")); + if (tweetFields !== void 0 && tweetFields.length > 0) { + params.append("tweet.fields", tweetFields.join(",")); } const url = path + (params.toString() ? `?${params.toString()}` : ""); const response = await this.client.request("GET", url, { @@ -15176,8 +15314,8 @@ var StreamClient = class { return eventStream; } /** - * Stream Users compliance data - * Streams all compliance data related to Users. + * Stream Post labels + * Streams all labeling events applied to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -15185,16 +15323,12 @@ var StreamClient = class { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - async usersCompliance(partition, options = {}) { + async labelsCompliance(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "usersCompliance"); + this.client.validateAuthentication(requiredAuthTypes, "labelsCompliance"); const paramMappings = { backfill_minutes: "backfillMinutes", start_time: "startTime", @@ -15212,14 +15346,11 @@ var StreamClient = class { signal, requestOptions = {} } = normalizedOptions; - let path = "/2/users/compliance/stream"; + let path = "/2/tweets/label/stream"; const params = new URLSearchParams(); if (backfillMinutes !== void 0) { params.append("backfill_minutes", String(backfillMinutes)); } - if (partition !== void 0) { - params.append("partition", String(partition)); - } if (startTime !== void 0) { params.append("start_time", String(startTime)); } @@ -15256,41 +15387,32 @@ var StreamClient = class { return eventStream; } /** - * Get stream rules - * Retrieves the active rule set or a subset of rules for the filtered stream. + * Get stream rule counts + * Retrieves the count of rules in the active rule set for the filtered stream. * * @returns Promise with the API response */ - async getRules(options = {}) { + async getRuleCounts(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "getRules"); + this.client.validateAuthentication(requiredAuthTypes, "getRuleCounts"); const paramMappings = { - max_results: "maxResults", - pagination_token: "paginationToken" + "rules_count.fields": "rulesCountFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - ids = [], - maxResults = void 0, - paginationToken = void 0, + rulesCountFields = [], headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/stream/rules"; + let path = "/2/tweets/search/stream/rules/counts"; const params = new URLSearchParams(); - if (ids !== void 0 && ids.length > 0) { - params.append("ids", ids.join(",")); - } - if (maxResults !== void 0) { - params.append("max_results", String(maxResults)); - } - if (paginationToken !== void 0) { - params.append("pagination_token", String(paginationToken)); + if (rulesCountFields !== void 0 && rulesCountFields.length > 0) { + params.append("rules_count.fields", rulesCountFields.join(",")); } const finalRequestOptions = { headers: { @@ -15307,37 +15429,41 @@ var StreamClient = class { ); } /** - * Update stream rules - * Adds or deletes rules from the active rule set for the filtered stream. + * Get stream rules + * Retrieves the active rule set or a subset of rules for the filtered stream. * * @returns Promise with the API response */ - async updateRules(body, options = {}) { + async getRules(options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "updateRules"); + this.client.validateAuthentication(requiredAuthTypes, "getRules"); const paramMappings = { - dry_run: "dryRun", - delete_all: "deleteAll" + max_results: "maxResults", + pagination_token: "paginationToken" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - dryRun = void 0, - deleteAll = void 0, + ids = [], + maxResults = void 0, + paginationToken = void 0, headers = {}, signal, requestOptions = {} } = normalizedOptions; let path = "/2/tweets/search/stream/rules"; const params = new URLSearchParams(); - if (dryRun !== void 0) { - params.append("dry_run", String(dryRun)); + if (ids !== void 0 && ids.length > 0) { + params.append("ids", ids.join(",")); } - if (deleteAll !== void 0) { - params.append("delete_all", String(deleteAll)); + if (maxResults !== void 0) { + params.append("max_results", String(maxResults)); + } + if (paginationToken !== void 0) { + params.append("pagination_token", String(paginationToken)); } const finalRequestOptions = { headers: { @@ -15345,272 +15471,160 @@ var StreamClient = class { ...headers }, signal, - body: JSON.stringify(body), ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get stream rule counts - * Retrieves the count of rules in the active rule set for the filtered stream. + * Update stream rules + * Adds or deletes rules from the active rule set for the filtered stream. * * @returns Promise with the API response */ - async getRuleCounts(options = {}) { + async updateRules(body, options = {}) { const requiredAuthTypes = []; requiredAuthTypes.push("BearerToken"); - this.client.validateAuthentication(requiredAuthTypes, "getRuleCounts"); + this.client.validateAuthentication(requiredAuthTypes, "updateRules"); const paramMappings = { - "rules_count.fields": "rulesCountFields" + dry_run: "dryRun", + delete_all: "deleteAll" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - rulesCountFields = [], + dryRun = void 0, + deleteAll = void 0, headers = {}, signal, requestOptions = {} } = normalizedOptions; - let path = "/2/tweets/search/stream/rules/counts"; + let path = "/2/tweets/search/stream/rules"; const params = new URLSearchParams(); - if (rulesCountFields !== void 0 && rulesCountFields.length > 0) { - params.append("rules_count.fields", rulesCountFields.join(",")); + if (dryRun !== void 0) { + params.append("dry_run", String(dryRun)); + } + if (deleteAll !== void 0) { + params.append("delete_all", String(deleteAll)); } const finalRequestOptions = { headers: { "Content-Type": "application/json", ...headers }, - signal, - ...requestOptions - }; - return this.client.request( - "GET", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } -}; - -// src/webhooks/client.ts -var WebhooksClient = class { - client; - /** - * Creates a new webhooks client instance - * - * @param client - The main X API client instance - */ - constructor(client) { - this.client = client; - } - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - _normalizeOptions(options, paramMappings) { - if (!options || typeof options !== "object") { - return options; - } - const normalized = { ...options }; - for (const [originalName, camelName] of Object.entries(paramMappings)) { - if (originalName in normalized && !(camelName in normalized)) { - normalized[camelName] = normalized[originalName]; - delete normalized[originalName]; - } - } - return normalized; - } - /** - * Create stream link - * Creates a link to deliver FilteredStream events to the given webhook. - - - * @param webhookId The webhook ID to link to your FilteredStream ruleset. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async createStreamLink(webhookId, options = {}) { - const paramMappings = { - "tweet.fields": "tweetFields", - "media.fields": "mediaFields", - "poll.fields": "pollFields", - "user.fields": "userFields", - "place.fields": "placeFields" - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - const { - tweetFields = void 0, - expansions = void 0, - mediaFields = void 0, - pollFields = void 0, - userFields = void 0, - placeFields = void 0, - requestOptions = {} - } = normalizedOptions; - let path = "/2/tweets/search/webhooks/{webhook_id}"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); - const params = new URLSearchParams(); - if (tweetFields !== void 0) { - params.append("tweet.fields", String(tweetFields)); - } - if (expansions !== void 0) { - params.append("expansions", String(expansions)); - } - if (mediaFields !== void 0) { - params.append("media.fields", String(mediaFields)); - } - if (pollFields !== void 0) { - params.append("poll.fields", String(pollFields)); - } - if (userFields !== void 0) { - params.append("user.fields", String(userFields)); - } - if (placeFields !== void 0) { - params.append("place.fields", String(placeFields)); - } - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ], - ...requestOptions - }; - return this.client.request( - "POST", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Delete stream link - * Deletes a link from FilteredStream events to the given webhook. - - - * @param webhookId The webhook ID to link to your FilteredStream ruleset. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async deleteStreamLink(webhookId) { - let path = "/2/tweets/search/webhooks/{webhook_id}"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - } - ] - // No optional parameters, using empty request options - }; - return this.client.request( - "DELETE", - path + (params.toString() ? `?${params.toString()}` : ""), - finalRequestOptions - ); - } - /** - * Validate webhook - * Triggers a CRC check for a given webhook. - - - * @param webhookId The ID of the webhook to check. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async validate(webhookId) { - let path = "/2/webhooks/{webhook_id}"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); - const params = new URLSearchParams(); - const finalRequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [] - }, - { - UserToken: [] - } - ] - // No optional parameters, using empty request options + signal, + body: JSON.stringify(body), + ...requestOptions }; return this.client.request( - "PUT", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } +}; + +// src/compliance/client.ts +var ComplianceClient = class { + client; /** - * Delete webhook - * Deletes an existing webhook configuration. + * Creates a new compliance client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get Compliance Jobs + * Retrieves a list of Compliance Jobs filtered by job type and optional status. - * @param webhookId The ID of the webhook to delete. + * @param type Type of Compliance Job to list. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async delete(webhookId) { - let path = "/2/webhooks/{webhook_id}"; - path = path.replace("{webhook_id}", encodeURIComponent(String(webhookId))); + async getJobs(type, options = {}) { + const paramMappings = { + "compliance_job.fields": "complianceJobFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + const { + status = void 0, + complianceJobFields = [], + requestOptions = {} + } = normalizedOptions; + let path = "/2/compliance/jobs"; const params = new URLSearchParams(); + if (type !== void 0) { + params.append("type", String(type)); + } + if (status !== void 0) { + params.append("status", String(status)); + } + if (complianceJobFields !== void 0 && complianceJobFields.length > 0) { + params.append("compliance_job.fields", complianceJobFields.join(",")); + } const finalRequestOptions = { // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - UserToken: [] } - ] - // No optional parameters, using empty request options + ], + ...requestOptions }; return this.client.request( - "DELETE", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get stream links - * Get a list of webhook links associated with a filtered stream ruleset. + * Create Compliance Job + * Creates a new Compliance Job for the specified job type. - * @returns {Promise} Promise resolving to the API response + * @param body Request body + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getStreamLinks() { - let path = "/2/tweets/search/webhooks"; + async createJobs(body) { + let path = "/2/compliance/jobs"; const params = new URLSearchParams(); const finalRequestOptions = { + body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { @@ -15620,36 +15634,41 @@ var WebhooksClient = class { // No optional parameters, using empty request options }; return this.client.request( - "GET", + "POST", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } /** - * Get webhook - * Get a list of webhook configs associated with a client app. + * Get Compliance Job by ID + * Retrieves details of a specific Compliance Job by its ID. + + * @param id The ID of the Compliance Job to retrieve. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async get(options = {}) { + async getJobsById(id, options = {}) { const paramMappings = { - "webhook_config.fields": "webhookConfigFields" + "compliance_job.fields": "complianceJobFields" }; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings ); const { - webhookConfigFields = [], + complianceJobFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/webhooks"; + let path = "/2/compliance/jobs/{id}"; + path = path.replace("{id}", encodeURIComponent(String(id))); const params = new URLSearchParams(); - if (webhookConfigFields !== void 0 && webhookConfigFields.length > 0) { - params.append("webhook_config.fields", webhookConfigFields.join(",")); + if (complianceJobFields !== void 0 && complianceJobFields.length > 0) { + params.append("compliance_job.fields", complianceJobFields.join(",")); } const finalRequestOptions = { // Pass security requirements for smart auth selection @@ -15666,45 +15685,87 @@ var WebhooksClient = class { finalRequestOptions ); } +}; + +// src/compliance/models.ts +var models_exports16 = {}; + +// src/usage/client.ts +var UsageClient = class { + client; /** - * Create webhook - * Creates a new webhook configuration. + * Creates a new usage client instance + * + * @param client - The main X API client instance + */ + constructor(client) { + this.client = client; + } + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + _normalizeOptions(options, paramMappings) { + if (!options || typeof options !== "object") { + return options; + } + const normalized = { ...options }; + for (const [originalName, camelName] of Object.entries(paramMappings)) { + if (originalName in normalized && !(camelName in normalized)) { + normalized[camelName] = normalized[originalName]; + delete normalized[originalName]; + } + } + return normalized; + } + /** + * Get usage + * Retrieves usage statistics for Posts over a specified number of days. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async create(options = {}) { - const normalizedOptions = options || {}; + async get(options = {}) { + const paramMappings = { + "usage.fields": "usageFields" + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); const { - body, + days = void 0, + usageFields = [], requestOptions = {} } = normalizedOptions; - let path = "/2/webhooks"; + let path = "/2/usage/tweets"; const params = new URLSearchParams(); + if (days !== void 0) { + params.append("days", String(days)); + } + if (usageFields !== void 0 && usageFields.length > 0) { + params.append("usage.fields", usageFields.join(",")); + } const finalRequestOptions = { - body: body ? JSON.stringify(body) : void 0, // Pass security requirements for smart auth selection security: [ { BearerToken: [] - }, - { - UserToken: [] } ], ...requestOptions }; return this.client.request( - "POST", + "GET", path + (params.toString() ? `?${params.toString()}` : ""), finalRequestOptions ); } }; -// src/webhooks/models.ts +// src/usage/models.ts var models_exports17 = {}; // src/client.ts @@ -15741,42 +15802,42 @@ var Client = class { maxRetries; /** HTTP client for making requests */ httpClient = httpClient; - /** news client */ - news; - /** users client */ - users; - /** direct messages client */ - directMessages; - /** community notes client */ - communityNotes; - /** posts client */ - posts; - /** trends client */ - trends; /** activity client */ activity; - /** usage client */ - usage; - /** spaces client */ - spaces; - /** communities client */ - communities; + /** news client */ + news; /** connections client */ connections; + /** account activity client */ + accountActivity; + /** spaces client */ + spaces; + /** trends client */ + trends; /** media client */ media; + /** direct messages client */ + directMessages; + /** posts client */ + posts; /** lists client */ lists; - /** compliance client */ - compliance; + /** community notes client */ + communityNotes; /** general client */ general; - /** account activity client */ - accountActivity; - /** stream client */ - stream; /** webhooks client */ webhooks; + /** users client */ + users; + /** communities client */ + communities; + /** stream client */ + stream; + /** compliance client */ + compliance; + /** usage client */ + usage; /** * Creates a new X API client instance * @@ -15821,24 +15882,24 @@ var Client = class { ...config.headers || {} }; this.headers = httpClient.createHeaders(defaultHeaders); - this.news = new NewsClient(this); - this.users = new UsersClient(this); - this.directMessages = new DirectMessagesClient(this); - this.communityNotes = new CommunityNotesClient(this); - this.posts = new PostsClient(this); - this.trends = new TrendsClient(this); this.activity = new ActivityClient(this); - this.usage = new UsageClient(this); - this.spaces = new SpacesClient(this); - this.communities = new CommunitiesClient(this); + this.news = new NewsClient(this); this.connections = new ConnectionsClient(this); + this.accountActivity = new AccountActivityClient(this); + this.spaces = new SpacesClient(this); + this.trends = new TrendsClient(this); this.media = new MediaClient(this); + this.directMessages = new DirectMessagesClient(this); + this.posts = new PostsClient(this); this.lists = new ListsClient(this); - this.compliance = new ComplianceClient(this); + this.communityNotes = new CommunityNotesClient(this); this.general = new GeneralClient(this); - this.accountActivity = new AccountActivityClient(this); - this.stream = new StreamClient(this); this.webhooks = new WebhooksClient(this); + this.users = new UsersClient(this); + this.communities = new CommunitiesClient(this); + this.stream = new StreamClient(this); + this.compliance = new ComplianceClient(this); + this.usage = new UsageClient(this); } /** * Make an authenticated request to the X API @@ -16920,6 +16981,6 @@ node-domexception/index.js: (*! node-domexception. MIT License. Jimmy Wärting *) */ -export { models_exports16 as AccountActivity, AccountActivityClient, models_exports7 as Activity, ActivityClient, ApiError, Client, models_exports10 as Communities, CommunitiesClient, models_exports4 as CommunityNotes, CommunityNotesClient, models_exports14 as Compliance, ComplianceClient, models_exports11 as Connections, ConnectionsClient, CryptoUtils, models_exports3 as DirectMessages, DirectMessagesClient, EventPaginator, models_exports15 as General, GeneralClient, HttpClient, models_exports13 as Lists, ListsClient, models_exports12 as Media, MediaClient, models_exports as News, NewsClient, OAuth1, OAuth2, Paginator, PostPaginator, models_exports5 as Posts, PostsClient, schemas_exports as Schemas, models_exports9 as Spaces, SpacesClient, models_exports18 as Stream, StreamClient, models_exports6 as Trends, TrendsClient, models_exports8 as Usage, UsageClient, UserPaginator, models_exports2 as Users, UsersClient, models_exports17 as Webhooks, WebhooksClient, generateCodeChallenge, generateCodeVerifier, generateNonce, generateTimestamp, hmacSha1, httpClient }; +export { models_exports4 as AccountActivity, AccountActivityClient, models_exports as Activity, ActivityClient, ApiError, Client, models_exports15 as Communities, CommunitiesClient, models_exports11 as CommunityNotes, CommunityNotesClient, models_exports16 as Compliance, ComplianceClient, models_exports3 as Connections, ConnectionsClient, CryptoUtils, models_exports8 as DirectMessages, DirectMessagesClient, EventPaginator, models_exports12 as General, GeneralClient, HttpClient, models_exports10 as Lists, ListsClient, models_exports7 as Media, MediaClient, models_exports2 as News, NewsClient, OAuth1, OAuth2, Paginator, PostPaginator, models_exports9 as Posts, PostsClient, schemas_exports as Schemas, models_exports5 as Spaces, SpacesClient, models_exports18 as Stream, StreamClient, models_exports6 as Trends, TrendsClient, models_exports17 as Usage, UsageClient, UserPaginator, models_exports14 as Users, UsersClient, models_exports13 as Webhooks, WebhooksClient, generateCodeChallenge, generateCodeVerifier, generateNonce, generateTimestamp, hmacSha1, httpClient }; //# sourceMappingURL=out.js.map //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/xdk/typescript/dist/index.js.map b/xdk/typescript/dist/index.js.map index 9d214fbc..0140c51b 100644 --- a/xdk/typescript/dist/index.js.map +++ b/xdk/typescript/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../node_modules/data-uri-to-buffer/src/index.ts","../node_modules/web-streams-polyfill/src/utils.ts","../node_modules/web-streams-polyfill/src/lib/helpers/miscellaneous.ts","../node_modules/web-streams-polyfill/src/lib/helpers/webidl.ts","../node_modules/web-streams-polyfill/src/lib/simple-queue.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/internal-methods.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/generic-reader.ts","../node_modules/web-streams-polyfill/src/stub/number-isfinite.ts","../node_modules/web-streams-polyfill/src/stub/math-trunc.ts","../node_modules/web-streams-polyfill/src/lib/validators/basic.ts","../node_modules/web-streams-polyfill/src/lib/validators/readable-stream.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/default-reader.ts","../node_modules/web-streams-polyfill/src/target/es2018/stub/async-iterator-prototype.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/async-iterator.ts","../node_modules/web-streams-polyfill/src/stub/number-isnan.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/ecmascript.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/miscellaneous.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/queue-with-sizes.ts","../node_modules/web-streams-polyfill/src/lib/helpers/array-buffer-view.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/byte-stream-controller.ts","../node_modules/web-streams-polyfill/src/lib/validators/reader-options.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/byob-reader.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/underlying-sink.ts","../node_modules/web-streams-polyfill/src/lib/validators/writable-stream.ts","../node_modules/web-streams-polyfill/src/lib/abort-signal.ts","../node_modules/web-streams-polyfill/src/lib/writable-stream.ts","../node_modules/web-streams-polyfill/src/globals.ts","../node_modules/web-streams-polyfill/src/stub/dom-exception.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/pipe.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/default-controller.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/tee.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/readable-stream-like.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/from.ts","../node_modules/web-streams-polyfill/src/lib/validators/underlying-source.ts","../node_modules/web-streams-polyfill/src/lib/validators/iterator-options.ts","../node_modules/web-streams-polyfill/src/lib/validators/pipe-options.ts","../node_modules/web-streams-polyfill/src/lib/validators/readable-writable-pair.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream.ts","../node_modules/web-streams-polyfill/src/lib/validators/queuing-strategy-init.ts","../node_modules/web-streams-polyfill/src/lib/byte-length-queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/count-queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/transformer.ts","../node_modules/web-streams-polyfill/src/lib/transform-stream.ts","../node_modules/fetch-blob/streams.cjs","../node_modules/fetch-blob/index.js","../node_modules/fetch-blob/file.js","../node_modules/formdata-polyfill/esm.min.js","../node_modules/node-fetch/src/errors/base.js","../node_modules/node-fetch/src/errors/fetch-error.js","../node_modules/node-fetch/src/utils/is.js","../node_modules/node-domexception/index.js","../node_modules/fetch-blob/from.js","../node_modules/node-fetch/src/utils/multipart-parser.js","../node_modules/node-fetch/src/body.js","../node_modules/node-fetch/src/headers.js","../node_modules/node-fetch/src/utils/is-redirect.js","../node_modules/node-fetch/src/response.js","../node_modules/node-fetch/src/utils/get-search.js","../node_modules/node-fetch/src/utils/referrer.js","../node_modules/node-fetch/src/request.js","../node_modules/node-fetch/src/errors/abort-error.js","../node_modules/node-fetch/src/index.js","../src/http-client.ts","../src/news/client.ts","../src/news/models.ts","../src/users/client.ts","../src/users/models.ts","../src/direct_messages/client.ts","../src/direct_messages/models.ts","../src/community_notes/client.ts","../src/community_notes/models.ts","../src/posts/client.ts","../src/posts/models.ts","../src/trends/client.ts","../src/trends/models.ts","../src/activity/client.ts","../src/activity/models.ts","../src/usage/client.ts","../src/usage/models.ts","../src/spaces/client.ts","../src/spaces/models.ts","../src/communities/client.ts","../src/communities/models.ts","../src/connections/client.ts","../src/connections/models.ts","../src/media/client.ts","../src/media/models.ts","../src/lists/client.ts","../src/lists/models.ts","../src/compliance/client.ts","../src/compliance/models.ts","../src/general/client.ts","../src/general/models.ts","../src/account_activity/client.ts","../src/account_activity/models.ts","../src/stream/event_driven_stream.ts","../src/stream/stream_client.ts","../src/webhooks/client.ts","../src/webhooks/models.ts","../src/client.ts","../src/crypto_utils.ts","../src/oauth2_auth.ts","../src/oauth1_auth.ts","../src/schemas.ts","../src/stream/models.ts","../src/paginator.ts","../src/index.ts"],"names":["i","noop","x","_a","F","e","queueMicrotask","r","isAbortSignal","streamBrandCheckException","defaultControllerBrandCheckException","DOMException","ReadableStream","POOL_SIZE","process","Blob","clone","size","File","f","FormData","m","stat","Body","clear","Buffer","toFormData","types","Headers","INTERNALS","deprecate","fetch","http","Stream","PassThrough","response","s","models_exports","crypto"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaM,SAAU,gBAAgB,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,IAAI,QAAe;AACf,WAAO,KAAK;AAAA,EAChB;AACJ;AAOO,IAAM,iBAAN,cAA6B,UAAe;AAAA,EAC/C,IAAI,SAAgB;AAChB,WAAO,KAAK;AAAA,EAChB;AACJ;;;ACjWA,IAAI,OAAO,YAAY,eAAe,QAAQ,YAAY,QAAQ,SAAS,MAAM;AAE/E,MAAI,OAAO,WAAW,UAAU,eAAe,OAAO,WAAW,YAAY,aAAa;AACxF,QAAI;AAEF,UAAI,OAAO,WAAW,UAAU,cAAc,OAAO,WAAW,YAAY,YAAY;AAAA,MAExF,OAAO;AAEL,cAAM,YAAY;AAClB,cAAM,EAAE,SAAS,YAAY,IAAI;AAEjC,YAAI,OAAO,WAAW,UAAU,aAAa;AAC3C,UAAC,WAAmB,QAAQ,UAAU,WAAW;AAAA,QACnD;AACA,YAAI,OAAO,WAAW,YAAY,aAAa;AAC7C,UAAC,WAAmB,UAAU;AAAA,QAChC;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AAEd,cAAQ;AAAA,QACN;AAAA,MAGF;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["export interface MimeBuffer extends Buffer {\n\ttype: string;\n\ttypeFull: string;\n\tcharset: string;\n}\n\n/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @param {String} uri Data URI to turn into a Buffer instance\n * @returns {Buffer} Buffer instance from Data URI\n * @api public\n */\nexport function dataUriToBuffer(uri: string): MimeBuffer {\n\tif (!/^data:/i.test(uri)) {\n\t\tthrow new TypeError(\n\t\t\t'`uri` does not appear to be a Data URI (must begin with \"data:\")'\n\t\t);\n\t}\n\n\t// strip newlines\n\turi = uri.replace(/\\r?\\n/g, '');\n\n\t// split the URI up into the \"metadata\" and the \"data\" portions\n\tconst firstComma = uri.indexOf(',');\n\tif (firstComma === -1 || firstComma <= 4) {\n\t\tthrow new TypeError('malformed data: URI');\n\t}\n\n\t// remove the \"data:\" scheme and parse the metadata\n\tconst meta = uri.substring(5, firstComma).split(';');\n\n\tlet charset = '';\n\tlet base64 = false;\n\tconst type = meta[0] || 'text/plain';\n\tlet typeFull = type;\n\tfor (let i = 1; i < meta.length; i++) {\n\t\tif (meta[i] === 'base64') {\n\t\t\tbase64 = true;\n\t\t} else if(meta[i]) {\n\t\t\ttypeFull += `;${ meta[i]}`;\n\t\t\tif (meta[i].indexOf('charset=') === 0) {\n\t\t\t\tcharset = meta[i].substring(8);\n\t\t\t}\n\t\t}\n\t}\n\t// defaults to US-ASCII only if type is not provided\n\tif (!meta[0] && !charset.length) {\n\t\ttypeFull += ';charset=US-ASCII';\n\t\tcharset = 'US-ASCII';\n\t}\n\n\t// get the encoded data portion and decode URI-encoded chars\n\tconst encoding = base64 ? 'base64' : 'ascii';\n\tconst data = unescape(uri.substring(firstComma + 1));\n\tconst buffer = Buffer.from(data, encoding) as MimeBuffer;\n\n\t// set `.type` and `.typeFull` properties to MIME type\n\tbuffer.type = type;\n\tbuffer.typeFull = typeFull;\n\n\t// set the `.charset` property\n\tbuffer.charset = charset;\n\n\treturn buffer;\n}\n\nexport default dataUriToBuffer;\n","export function noop(): undefined {\n return undefined;\n}\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n\nexport function setFunctionName(fn: Function, name: string): void {\n try {\n Object.defineProperty(fn, 'name', {\n value: name,\n configurable: true\n });\n } catch {\n // This property is non-configurable in older browsers, so ignore if this throws.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility\n }\n}\n","import { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\n// https://webidl.spec.whatwg.org/#a-new-promise\nexport function newPromise(executor: (\n resolve: (value: T | PromiseLike) => void,\n reject: (reason?: any) => void\n) => void): Promise {\n return new originalPromise(executor);\n}\n\n// https://webidl.spec.whatwg.org/#a-promise-resolved-with\nexport function promiseResolvedWith(value: T | PromiseLike): Promise {\n return newPromise(resolve => resolve(value));\n}\n\n// https://webidl.spec.whatwg.org/#a-promise-rejected-with\nexport function promiseRejectedWith(reason: any): Promise {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen(\n promise: Promise,\n onFulfilled?: (value: T) => TResult1 | PromiseLike,\n onRejected?: (reason: any) => TResult2 | PromiseLike): Promise {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise;\n}\n\n// Bluebird logs a warning when a promise is created within a fulfillment handler, but then isn't returned\n// from that handler. To prevent this, return null instead of void from all handlers.\n// http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-created-in-a-handler-but-was-not-returned-from-it\nexport function uponPromise(\n promise: Promise,\n onFulfilled?: (value: T) => null | PromiseLike,\n onRejected?: (reason: any) => null | PromiseLike): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment(promise: Promise, onFulfilled: (value: T) => null | PromiseLike): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise, onRejected: (reason: any) => null | PromiseLike): void {\n uponPromise(promise, undefined, onRejected);\n}\n\nexport function transformPromiseWith(\n promise: Promise,\n fulfillmentHandler?: (value: T) => TResult1 | PromiseLike,\n rejectionHandler?: (reason: any) => TResult2 | PromiseLike): Promise {\n return PerformPromiseThen(promise, fulfillmentHandler, rejectionHandler);\n}\n\nexport function setPromiseIsHandledToTrue(promise: Promise): void {\n PerformPromiseThen(promise, undefined, rethrowAssertionErrorRejection);\n}\n\nlet _queueMicrotask: (callback: () => void) => void = callback => {\n if (typeof queueMicrotask === 'function') {\n _queueMicrotask = queueMicrotask;\n } else {\n const resolvedPromise = promiseResolvedWith(undefined);\n _queueMicrotask = cb => PerformPromiseThen(resolvedPromise, cb);\n }\n return _queueMicrotask(callback);\n};\n\nexport { _queueMicrotask as queueMicrotask };\n\nexport function reflectCall(F: (this: T, ...fnArgs: A) => R, V: T, args: A): R {\n if (typeof F !== 'function') {\n throw new TypeError('Argument is not a function');\n }\n return Function.prototype.apply.call(F, V, args);\n}\n\nexport function promiseCall(F: (this: T, ...fnArgs: A) => R | PromiseLike,\n V: T,\n args: A): Promise {\n assert(typeof F === 'function');\n assert(V !== undefined);\n assert(Array.isArray(args));\n try {\n return promiseResolvedWith(reflectCall(F, V, args));\n } catch (value) {\n return promiseRejectedWith(value);\n }\n}\n","import assert from '../stub/assert';\n\n// Original from Chromium\n// https://chromium.googlesource.com/chromium/src/+/0aee4434a4dba42a42abaea9bfbc0cd196a63bc1/third_party/blink/renderer/core/streams/SimpleQueue.js\n\nconst QUEUE_MAX_ARRAY_SIZE = 16384;\n\ninterface Node {\n _elements: T[];\n _next: Node | undefined;\n}\n\n/**\n * Simple queue structure.\n *\n * Avoids scalability issues with using a packed array directly by using\n * multiple arrays in a linked list and keeping the array size bounded.\n */\nexport class SimpleQueue {\n private _front: Node;\n private _back: Node;\n private _cursor = 0;\n private _size = 0;\n\n constructor() {\n // _front and _back are always defined.\n this._front = {\n _elements: [],\n _next: undefined\n };\n this._back = this._front;\n // The cursor is used to avoid calling Array.shift().\n // It contains the index of the front element of the array inside the\n // front-most node. It is always in the range [0, QUEUE_MAX_ARRAY_SIZE).\n this._cursor = 0;\n // When there is only one node, size === elements.length - cursor.\n this._size = 0;\n }\n\n get length(): number {\n return this._size;\n }\n\n // For exception safety, this method is structured in order:\n // 1. Read state\n // 2. Calculate required state mutations\n // 3. Perform state mutations\n push(element: T): void {\n const oldBack = this._back;\n let newBack = oldBack;\n assert(oldBack._next === undefined);\n if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) {\n newBack = {\n _elements: [],\n _next: undefined\n };\n }\n\n // push() is the mutation most likely to throw an exception, so it\n // goes first.\n oldBack._elements.push(element);\n if (newBack !== oldBack) {\n this._back = newBack;\n oldBack._next = newBack;\n }\n ++this._size;\n }\n\n // Like push(), shift() follows the read -> calculate -> mutate pattern for\n // exception safety.\n shift(): T {\n assert(this._size > 0); // must not be called on an empty queue\n\n const oldFront = this._front;\n let newFront = oldFront;\n const oldCursor = this._cursor;\n let newCursor = oldCursor + 1;\n\n const elements = oldFront._elements;\n const element = elements[oldCursor];\n\n if (newCursor === QUEUE_MAX_ARRAY_SIZE) {\n assert(elements.length === QUEUE_MAX_ARRAY_SIZE);\n assert(oldFront._next !== undefined);\n newFront = oldFront._next!;\n newCursor = 0;\n }\n\n // No mutations before this point.\n --this._size;\n this._cursor = newCursor;\n if (oldFront !== newFront) {\n this._front = newFront;\n }\n\n // Permit shifted element to be garbage collected.\n elements[oldCursor] = undefined!;\n\n return element;\n }\n\n // The tricky thing about forEach() is that it can be called\n // re-entrantly. The queue may be mutated inside the callback. It is easy to\n // see that push() within the callback has no negative effects since the end\n // of the queue is checked for on every iteration. If shift() is called\n // repeatedly within the callback then the next iteration may return an\n // element that has been removed. In this case the callback will be called\n // with undefined values until we either \"catch up\" with elements that still\n // exist or reach the back of the queue.\n forEach(callback: (element: T) => void): void {\n let i = this._cursor;\n let node = this._front;\n let elements = node._elements;\n while (i !== elements.length || node._next !== undefined) {\n if (i === elements.length) {\n assert(node._next !== undefined);\n assert(i === QUEUE_MAX_ARRAY_SIZE);\n node = node._next!;\n elements = node._elements;\n i = 0;\n if (elements.length === 0) {\n break;\n }\n }\n callback(elements[i]);\n ++i;\n }\n }\n\n // Return the element that would be returned if shift() was called now,\n // without modifying the queue.\n peek(): T {\n assert(this._size > 0); // must not be called on an empty queue\n\n const front = this._front;\n const cursor = this._cursor;\n return front._elements[cursor];\n }\n}\n","export const AbortSteps = Symbol('[[AbortSteps]]');\nexport const ErrorSteps = Symbol('[[ErrorSteps]]');\nexport const CancelSteps = Symbol('[[CancelSteps]]');\nexport const PullSteps = Symbol('[[PullSteps]]');\nexport const ReleaseSteps = Symbol('[[ReleaseSteps]]');\n","import assert from '../../stub/assert';\nimport { ReadableStream, ReadableStreamCancel, type ReadableStreamReader } from '../readable-stream';\nimport { newPromise, setPromiseIsHandledToTrue } from '../helpers/webidl';\nimport { ReleaseSteps } from '../abstract-ops/internal-methods';\n\nexport function ReadableStreamReaderGenericInitialize(reader: ReadableStreamReader, stream: ReadableStream) {\n reader._ownerReadableStream = stream;\n stream._reader = reader;\n\n if (stream._state === 'readable') {\n defaultReaderClosedPromiseInitialize(reader);\n } else if (stream._state === 'closed') {\n defaultReaderClosedPromiseInitializeAsResolved(reader);\n } else {\n assert(stream._state === 'errored');\n\n defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);\n }\n}\n\n// A client of ReadableStreamDefaultReader and ReadableStreamBYOBReader may use these functions directly to bypass state\n// check.\n\nexport function ReadableStreamReaderGenericCancel(reader: ReadableStreamReader, reason: any): Promise {\n const stream = reader._ownerReadableStream;\n assert(stream !== undefined);\n return ReadableStreamCancel(stream, reason);\n}\n\nexport function ReadableStreamReaderGenericRelease(reader: ReadableStreamReader) {\n const stream = reader._ownerReadableStream;\n assert(stream !== undefined);\n assert(stream._reader === reader);\n\n if (stream._state === 'readable') {\n defaultReaderClosedPromiseReject(\n reader,\n new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));\n } else {\n defaultReaderClosedPromiseResetToRejected(\n reader,\n new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));\n }\n\n stream._readableStreamController[ReleaseSteps]();\n\n stream._reader = undefined;\n reader._ownerReadableStream = undefined!;\n}\n\n// Helper functions for the readers.\n\nexport function readerLockException(name: string): TypeError {\n return new TypeError('Cannot ' + name + ' a stream using a released reader');\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nexport function defaultReaderClosedPromiseInitialize(reader: ReadableStreamReader) {\n reader._closedPromise = newPromise((resolve, reject) => {\n reader._closedPromise_resolve = resolve;\n reader._closedPromise_reject = reject;\n });\n}\n\nexport function defaultReaderClosedPromiseInitializeAsRejected(reader: ReadableStreamReader, reason: any) {\n defaultReaderClosedPromiseInitialize(reader);\n defaultReaderClosedPromiseReject(reader, reason);\n}\n\nexport function defaultReaderClosedPromiseInitializeAsResolved(reader: ReadableStreamReader) {\n defaultReaderClosedPromiseInitialize(reader);\n defaultReaderClosedPromiseResolve(reader);\n}\n\nexport function defaultReaderClosedPromiseReject(reader: ReadableStreamReader, reason: any) {\n if (reader._closedPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(reader._closedPromise);\n reader._closedPromise_reject(reason);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n\nexport function defaultReaderClosedPromiseResetToRejected(reader: ReadableStreamReader, reason: any) {\n assert(reader._closedPromise_resolve === undefined);\n assert(reader._closedPromise_reject === undefined);\n\n defaultReaderClosedPromiseInitializeAsRejected(reader, reason);\n}\n\nexport function defaultReaderClosedPromiseResolve(reader: ReadableStreamReader) {\n if (reader._closedPromise_resolve === undefined) {\n return;\n }\n\n reader._closedPromise_resolve(undefined);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite#Polyfill\nconst NumberIsFinite: typeof Number.isFinite = Number.isFinite || function (x) {\n return typeof x === 'number' && isFinite(x);\n};\n\nexport default NumberIsFinite;\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc#Polyfill\nconst MathTrunc: typeof Math.trunc = Math.trunc || function (v) {\n return v < 0 ? Math.ceil(v) : Math.floor(v);\n};\n\nexport default MathTrunc;\n","import NumberIsFinite from '../../stub/number-isfinite';\nimport MathTrunc from '../../stub/math-trunc';\n\n// https://heycam.github.io/webidl/#idl-dictionaries\nexport function isDictionary(x: any): x is object | null {\n return typeof x === 'object' || typeof x === 'function';\n}\n\nexport function assertDictionary(obj: unknown,\n context: string): asserts obj is object | null | undefined {\n if (obj !== undefined && !isDictionary(obj)) {\n throw new TypeError(`${context} is not an object.`);\n }\n}\n\nexport type AnyFunction = (...args: any[]) => any;\n\n// https://heycam.github.io/webidl/#idl-callback-functions\nexport function assertFunction(x: unknown, context: string): asserts x is AnyFunction {\n if (typeof x !== 'function') {\n throw new TypeError(`${context} is not a function.`);\n }\n}\n\n// https://heycam.github.io/webidl/#idl-object\nexport function isObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport function assertObject(x: unknown,\n context: string): asserts x is object {\n if (!isObject(x)) {\n throw new TypeError(`${context} is not an object.`);\n }\n}\n\nexport function assertRequiredArgument(x: T | undefined,\n position: number,\n context: string): asserts x is T {\n if (x === undefined) {\n throw new TypeError(`Parameter ${position} is required in '${context}'.`);\n }\n}\n\nexport function assertRequiredField(x: T | undefined,\n field: string,\n context: string): asserts x is T {\n if (x === undefined) {\n throw new TypeError(`${field} is required in '${context}'.`);\n }\n}\n\n// https://heycam.github.io/webidl/#idl-unrestricted-double\nexport function convertUnrestrictedDouble(value: unknown): number {\n return Number(value);\n}\n\nfunction censorNegativeZero(x: number): number {\n return x === 0 ? 0 : x;\n}\n\nfunction integerPart(x: number): number {\n return censorNegativeZero(MathTrunc(x));\n}\n\n// https://heycam.github.io/webidl/#idl-unsigned-long-long\nexport function convertUnsignedLongLongWithEnforceRange(value: unknown, context: string): number {\n const lowerBound = 0;\n const upperBound = Number.MAX_SAFE_INTEGER;\n\n let x = Number(value);\n x = censorNegativeZero(x);\n\n if (!NumberIsFinite(x)) {\n throw new TypeError(`${context} is not a finite number`);\n }\n\n x = integerPart(x);\n\n if (x < lowerBound || x > upperBound) {\n throw new TypeError(`${context} is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`);\n }\n\n if (!NumberIsFinite(x) || x === 0) {\n return 0;\n }\n\n // TODO Use BigInt if supported?\n // let xBigInt = BigInt(integerPart(x));\n // xBigInt = BigInt.asUintN(64, xBigInt);\n // return Number(xBigInt);\n\n return x;\n}\n","import { IsReadableStream, ReadableStream } from '../readable-stream';\n\nexport function assertReadableStream(x: unknown, context: string): asserts x is ReadableStream {\n if (!IsReadableStream(x)) {\n throw new TypeError(`${context} is not a ReadableStream.`);\n }\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport {\n ReadableStreamReaderGenericCancel,\n ReadableStreamReaderGenericInitialize,\n ReadableStreamReaderGenericRelease,\n readerLockException\n} from './generic-reader';\nimport { IsReadableStreamLocked, ReadableStream } from '../readable-stream';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { PullSteps } from '../abstract-ops/internal-methods';\nimport { newPromise, promiseRejectedWith } from '../helpers/webidl';\nimport { assertRequiredArgument } from '../validators/basic';\nimport { assertReadableStream } from '../validators/readable-stream';\n\n/**\n * A result returned by {@link ReadableStreamDefaultReader.read}.\n *\n * @public\n */\nexport type ReadableStreamDefaultReadResult = {\n done: false;\n value: T;\n} | {\n done: true;\n value?: undefined;\n}\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamDefaultReader(stream: ReadableStream): ReadableStreamDefaultReader {\n return new ReadableStreamDefaultReader(stream);\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamAddReadRequest(stream: ReadableStream,\n readRequest: ReadRequest): void {\n assert(IsReadableStreamDefaultReader(stream._reader));\n assert(stream._state === 'readable');\n\n (stream._reader! as ReadableStreamDefaultReader)._readRequests.push(readRequest);\n}\n\nexport function ReadableStreamFulfillReadRequest(stream: ReadableStream, chunk: R | undefined, done: boolean) {\n const reader = stream._reader as ReadableStreamDefaultReader;\n\n assert(reader._readRequests.length > 0);\n\n const readRequest = reader._readRequests.shift()!;\n if (done) {\n readRequest._closeSteps();\n } else {\n readRequest._chunkSteps(chunk!);\n }\n}\n\nexport function ReadableStreamGetNumReadRequests(stream: ReadableStream): number {\n return (stream._reader as ReadableStreamDefaultReader)._readRequests.length;\n}\n\nexport function ReadableStreamHasDefaultReader(stream: ReadableStream): boolean {\n const reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (!IsReadableStreamDefaultReader(reader)) {\n return false;\n }\n\n return true;\n}\n\n// Readers\n\nexport interface ReadRequest {\n _chunkSteps(chunk: R): void;\n\n _closeSteps(): void;\n\n _errorSteps(e: any): void;\n}\n\n/**\n * A default reader vended by a {@link ReadableStream}.\n *\n * @public\n */\nexport class ReadableStreamDefaultReader {\n /** @internal */\n _ownerReadableStream!: ReadableStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _readRequests: SimpleQueue>;\n\n constructor(stream: ReadableStream) {\n assertRequiredArgument(stream, 1, 'ReadableStreamDefaultReader');\n assertReadableStream(stream, 'First parameter');\n\n if (IsReadableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readRequests = new SimpleQueue();\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed,\n * or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n\n /**\n * Returns a promise that allows access to the next chunk from the stream's internal queue, if available.\n *\n * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.\n */\n read(): Promise> {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('read'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('read from'));\n }\n\n let resolvePromise!: (result: ReadableStreamDefaultReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => resolvePromise({ value: chunk, done: false }),\n _closeSteps: () => resolvePromise({ value: undefined, done: true }),\n _errorSteps: e => rejectPromise(e)\n };\n ReadableStreamDefaultReaderRead(this, readRequest);\n return promise;\n }\n\n /**\n * Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.\n * If the associated stream is errored when the lock is released, the reader will appear errored in the same way\n * from now on; otherwise, the reader will appear closed.\n *\n * A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by\n * the reader's {@link ReadableStreamDefaultReader.read | read()} method has not yet been settled. Attempting to\n * do so will throw a `TypeError` and leave the reader locked to the stream.\n */\n releaseLock(): void {\n if (!IsReadableStreamDefaultReader(this)) {\n throw defaultReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n ReadableStreamDefaultReaderRelease(this);\n }\n}\n\nObject.defineProperties(ReadableStreamDefaultReader.prototype, {\n cancel: { enumerable: true },\n read: { enumerable: true },\n releaseLock: { enumerable: true },\n closed: { enumerable: true }\n});\nsetFunctionName(ReadableStreamDefaultReader.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStreamDefaultReader.prototype.read, 'read');\nsetFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, 'releaseLock');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamDefaultReader.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamDefaultReader',\n configurable: true\n });\n}\n\n// Abstract operations for the readers.\n\nexport function IsReadableStreamDefaultReader(x: any): x is ReadableStreamDefaultReader {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {\n return false;\n }\n\n return x instanceof ReadableStreamDefaultReader;\n}\n\nexport function ReadableStreamDefaultReaderRead(reader: ReadableStreamDefaultReader,\n readRequest: ReadRequest): void {\n const stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n readRequest._closeSteps();\n } else if (stream._state === 'errored') {\n readRequest._errorSteps(stream._storedError);\n } else {\n assert(stream._state === 'readable');\n stream._readableStreamController[PullSteps](readRequest as ReadRequest);\n }\n}\n\nexport function ReadableStreamDefaultReaderRelease(reader: ReadableStreamDefaultReader) {\n ReadableStreamReaderGenericRelease(reader);\n const e = new TypeError('Reader was released');\n ReadableStreamDefaultReaderErrorReadRequests(reader, e);\n}\n\nexport function ReadableStreamDefaultReaderErrorReadRequests(reader: ReadableStreamDefaultReader, e: any) {\n const readRequests = reader._readRequests;\n reader._readRequests = new SimpleQueue();\n readRequests.forEach(readRequest => {\n readRequest._errorSteps(e);\n });\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nfunction defaultReaderBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamDefaultReader.prototype.${name} can only be used on a ReadableStreamDefaultReader`);\n}\n","/// \n\n/* eslint-disable @typescript-eslint/no-empty-function */\nexport const AsyncIteratorPrototype: AsyncIterable =\n Object.getPrototypeOf(Object.getPrototypeOf(async function* (): AsyncIterableIterator {}).prototype);\n","/// \n\nimport { ReadableStream } from '../readable-stream';\nimport {\n AcquireReadableStreamDefaultReader,\n ReadableStreamDefaultReader,\n ReadableStreamDefaultReaderRead,\n type ReadableStreamDefaultReadResult,\n type ReadRequest\n} from './default-reader';\nimport { ReadableStreamReaderGenericCancel, ReadableStreamReaderGenericRelease } from './generic-reader';\nimport assert from '../../stub/assert';\nimport { AsyncIteratorPrototype } from '@@target/stub/async-iterator-prototype';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n queueMicrotask,\n transformPromiseWith\n} from '../helpers/webidl';\n\n/**\n * An async iterator returned by {@link ReadableStream.values}.\n *\n * @public\n */\nexport interface ReadableStreamAsyncIterator extends AsyncIterableIterator {\n next(): Promise>;\n\n return(value?: any): Promise>;\n}\n\nexport class ReadableStreamAsyncIteratorImpl {\n private readonly _reader: ReadableStreamDefaultReader;\n private readonly _preventCancel: boolean;\n private _ongoingPromise: Promise> | undefined = undefined;\n private _isFinished = false;\n\n constructor(reader: ReadableStreamDefaultReader, preventCancel: boolean) {\n this._reader = reader;\n this._preventCancel = preventCancel;\n }\n\n next(): Promise> {\n const nextSteps = () => this._nextSteps();\n this._ongoingPromise = this._ongoingPromise ?\n transformPromiseWith(this._ongoingPromise, nextSteps, nextSteps) :\n nextSteps();\n return this._ongoingPromise;\n }\n\n return(value: any): Promise> {\n const returnSteps = () => this._returnSteps(value);\n return this._ongoingPromise ?\n transformPromiseWith(this._ongoingPromise, returnSteps, returnSteps) :\n returnSteps();\n }\n\n private _nextSteps(): Promise> {\n if (this._isFinished) {\n return Promise.resolve({ value: undefined, done: true });\n }\n\n const reader = this._reader;\n assert(reader._ownerReadableStream !== undefined);\n\n let resolvePromise!: (result: ReadableStreamDefaultReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => {\n this._ongoingPromise = undefined;\n // This needs to be delayed by one microtask, otherwise we stop pulling too early which breaks a test.\n // FIXME Is this a bug in the specification, or in the test?\n queueMicrotask(() => resolvePromise({ value: chunk, done: false }));\n },\n _closeSteps: () => {\n this._ongoingPromise = undefined;\n this._isFinished = true;\n ReadableStreamReaderGenericRelease(reader);\n resolvePromise({ value: undefined, done: true });\n },\n _errorSteps: reason => {\n this._ongoingPromise = undefined;\n this._isFinished = true;\n ReadableStreamReaderGenericRelease(reader);\n rejectPromise(reason);\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n return promise;\n }\n\n private _returnSteps(value: any): Promise> {\n if (this._isFinished) {\n return Promise.resolve({ value, done: true });\n }\n this._isFinished = true;\n\n const reader = this._reader;\n assert(reader._ownerReadableStream !== undefined);\n assert(reader._readRequests.length === 0);\n\n if (!this._preventCancel) {\n const result = ReadableStreamReaderGenericCancel(reader, value);\n ReadableStreamReaderGenericRelease(reader);\n return transformPromiseWith(result, () => ({ value, done: true }));\n }\n\n ReadableStreamReaderGenericRelease(reader);\n return promiseResolvedWith({ value, done: true });\n }\n}\n\ninterface ReadableStreamAsyncIteratorInstance extends ReadableStreamAsyncIterator {\n /** @interal */\n _asyncIteratorImpl: ReadableStreamAsyncIteratorImpl;\n\n next(): Promise>;\n\n return(value?: any): Promise>;\n}\n\nconst ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIteratorInstance = {\n next(this: ReadableStreamAsyncIteratorInstance): Promise> {\n if (!IsReadableStreamAsyncIterator(this)) {\n return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next'));\n }\n return this._asyncIteratorImpl.next();\n },\n\n return(this: ReadableStreamAsyncIteratorInstance, value: any): Promise> {\n if (!IsReadableStreamAsyncIterator(this)) {\n return promiseRejectedWith(streamAsyncIteratorBrandCheckException('return'));\n }\n return this._asyncIteratorImpl.return(value);\n }\n} as any;\nObject.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamAsyncIterator(stream: ReadableStream,\n preventCancel: boolean): ReadableStreamAsyncIterator {\n const reader = AcquireReadableStreamDefaultReader(stream);\n const impl = new ReadableStreamAsyncIteratorImpl(reader, preventCancel);\n const iterator: ReadableStreamAsyncIteratorInstance = Object.create(ReadableStreamAsyncIteratorPrototype);\n iterator._asyncIteratorImpl = impl;\n return iterator;\n}\n\nfunction IsReadableStreamAsyncIterator(x: any): x is ReadableStreamAsyncIterator {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_asyncIteratorImpl')) {\n return false;\n }\n\n try {\n // noinspection SuspiciousTypeOfGuard\n return (x as ReadableStreamAsyncIteratorInstance)._asyncIteratorImpl instanceof\n ReadableStreamAsyncIteratorImpl;\n } catch {\n return false;\n }\n}\n\n// Helper functions for the ReadableStream.\n\nfunction streamAsyncIteratorBrandCheckException(name: string): TypeError {\n return new TypeError(`ReadableStreamAsyncIterator.${name} can only be used on a ReadableSteamAsyncIterator`);\n}\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#Polyfill\nconst NumberIsNaN: typeof Number.isNaN = Number.isNaN || function (x) {\n // eslint-disable-next-line no-self-compare\n return x !== x;\n};\n\nexport default NumberIsNaN;\n","import { reflectCall } from 'lib/helpers/webidl';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport assert from '../../stub/assert';\n\ndeclare global {\n interface ArrayBuffer {\n readonly detached: boolean;\n\n transfer(): ArrayBuffer;\n }\n\n function structuredClone(value: T, options: { transfer: ArrayBuffer[] }): T;\n}\n\nexport function CreateArrayFromList(elements: T): T {\n // We use arrays to represent lists, so this is basically a no-op.\n // Do a slice though just in case we happen to depend on the unique-ness.\n return elements.slice() as T;\n}\n\nexport function CopyDataBlockBytes(dest: ArrayBuffer,\n destOffset: number,\n src: ArrayBuffer,\n srcOffset: number,\n n: number) {\n new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);\n}\n\nexport let TransferArrayBuffer = (O: ArrayBuffer): ArrayBuffer => {\n if (typeof O.transfer === 'function') {\n TransferArrayBuffer = buffer => buffer.transfer();\n } else if (typeof structuredClone === 'function') {\n TransferArrayBuffer = buffer => structuredClone(buffer, { transfer: [buffer] });\n } else {\n // Not implemented correctly\n TransferArrayBuffer = buffer => buffer;\n }\n return TransferArrayBuffer(O);\n};\n\nexport function CanTransferArrayBuffer(O: ArrayBuffer): boolean {\n return !IsDetachedBuffer(O);\n}\n\nexport let IsDetachedBuffer = (O: ArrayBuffer): boolean => {\n if (typeof O.detached === 'boolean') {\n IsDetachedBuffer = buffer => buffer.detached;\n } else {\n // Not implemented correctly\n IsDetachedBuffer = buffer => buffer.byteLength === 0;\n }\n return IsDetachedBuffer(O);\n};\n\nexport function ArrayBufferSlice(buffer: ArrayBuffer, begin: number, end: number): ArrayBuffer {\n // ArrayBuffer.prototype.slice is not available on IE10\n // https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice\n if (buffer.slice) {\n return buffer.slice(begin, end);\n }\n const length = end - begin;\n const slice = new ArrayBuffer(length);\n CopyDataBlockBytes(slice, 0, buffer, begin, length);\n return slice;\n}\n\nexport type MethodName = {\n [P in keyof T]: T[P] extends Function | undefined ? P : never;\n}[keyof T];\n\nexport function GetMethod>(receiver: T, prop: K): T[K] | undefined {\n const func = receiver[prop];\n if (func === undefined || func === null) {\n return undefined;\n }\n if (typeof func !== 'function') {\n throw new TypeError(`${String(prop)} is not a function`);\n }\n return func;\n}\n\nexport interface SyncIteratorRecord {\n iterator: Iterator,\n nextMethod: Iterator['next'],\n done: boolean;\n}\n\nexport interface AsyncIteratorRecord {\n iterator: AsyncIterator,\n nextMethod: AsyncIterator['next'],\n done: boolean;\n}\n\nexport type SyncOrAsyncIteratorRecord = SyncIteratorRecord | AsyncIteratorRecord;\n\nexport function CreateAsyncFromSyncIterator(syncIteratorRecord: SyncIteratorRecord): AsyncIteratorRecord {\n // Instead of re-implementing CreateAsyncFromSyncIterator and %AsyncFromSyncIteratorPrototype%,\n // we use yield* inside an async generator function to achieve the same result.\n\n // Wrap the sync iterator inside a sync iterable, so we can use it with yield*.\n const syncIterable = {\n [Symbol.iterator]: () => syncIteratorRecord.iterator\n };\n // Create an async generator function and immediately invoke it.\n const asyncIterator = (async function* () {\n return yield* syncIterable;\n }());\n // Return as an async iterator record.\n const nextMethod = asyncIterator.next;\n return { iterator: asyncIterator, nextMethod, done: false };\n}\n\n// Aligns with core-js/modules/es.symbol.async-iterator.js\nexport const SymbolAsyncIterator: (typeof Symbol)['asyncIterator'] =\n Symbol.asyncIterator ??\n Symbol.for?.('Symbol.asyncIterator') ??\n '@@asyncIterator';\n\nexport type SyncOrAsyncIterable = Iterable | AsyncIterable;\nexport type SyncOrAsyncIteratorMethod = () => (Iterator | AsyncIterator);\n\nfunction GetIterator(\n obj: SyncOrAsyncIterable,\n hint: 'async',\n method?: SyncOrAsyncIteratorMethod\n): AsyncIteratorRecord;\nfunction GetIterator(\n obj: Iterable,\n hint: 'sync',\n method?: SyncOrAsyncIteratorMethod\n): SyncIteratorRecord;\nfunction GetIterator(\n obj: SyncOrAsyncIterable,\n hint = 'sync',\n method?: SyncOrAsyncIteratorMethod\n): SyncOrAsyncIteratorRecord {\n assert(hint === 'sync' || hint === 'async');\n if (method === undefined) {\n if (hint === 'async') {\n method = GetMethod(obj as AsyncIterable, SymbolAsyncIterator);\n if (method === undefined) {\n const syncMethod = GetMethod(obj as Iterable, Symbol.iterator);\n const syncIteratorRecord = GetIterator(obj as Iterable, 'sync', syncMethod);\n return CreateAsyncFromSyncIterator(syncIteratorRecord);\n }\n } else {\n method = GetMethod(obj as Iterable, Symbol.iterator);\n }\n }\n if (method === undefined) {\n throw new TypeError('The object is not iterable');\n }\n const iterator = reflectCall(method, obj, []);\n if (!typeIsObject(iterator)) {\n throw new TypeError('The iterator method must return an object');\n }\n const nextMethod = iterator.next;\n return { iterator, nextMethod, done: false } as SyncOrAsyncIteratorRecord;\n}\n\nexport { GetIterator };\n\nexport function IteratorNext(iteratorRecord: AsyncIteratorRecord): Promise> {\n const result = reflectCall(iteratorRecord.nextMethod, iteratorRecord.iterator, []);\n if (!typeIsObject(result)) {\n throw new TypeError('The iterator.next() method must return an object');\n }\n return result;\n}\n\nexport function IteratorComplete(\n iterResult: IteratorResult\n): iterResult is IteratorReturnResult {\n assert(typeIsObject(iterResult));\n return Boolean(iterResult.done);\n}\n\nexport function IteratorValue(iterResult: IteratorYieldResult): T {\n assert(typeIsObject(iterResult));\n return iterResult.value;\n}\n","import NumberIsNaN from '../../stub/number-isnan';\nimport { ArrayBufferSlice } from './ecmascript';\nimport type { NonShared } from '../helpers/array-buffer-view';\n\nexport function IsNonNegativeNumber(v: number): boolean {\n if (typeof v !== 'number') {\n return false;\n }\n\n if (NumberIsNaN(v)) {\n return false;\n }\n\n if (v < 0) {\n return false;\n }\n\n return true;\n}\n\nexport function CloneAsUint8Array(O: NonShared): NonShared {\n const buffer = ArrayBufferSlice(O.buffer, O.byteOffset, O.byteOffset + O.byteLength);\n return new Uint8Array(buffer) as NonShared;\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport { IsNonNegativeNumber } from './miscellaneous';\n\nexport interface QueueContainer {\n _queue: SimpleQueue;\n _queueTotalSize: number;\n}\n\nexport interface QueuePair {\n value: T;\n size: number;\n}\n\nexport function DequeueValue(container: QueueContainer>): T {\n assert('_queue' in container && '_queueTotalSize' in container);\n assert(container._queue.length > 0);\n\n const pair = container._queue.shift()!;\n container._queueTotalSize -= pair.size;\n if (container._queueTotalSize < 0) {\n container._queueTotalSize = 0;\n }\n\n return pair.value;\n}\n\nexport function EnqueueValueWithSize(container: QueueContainer>, value: T, size: number) {\n assert('_queue' in container && '_queueTotalSize' in container);\n\n if (!IsNonNegativeNumber(size) || size === Infinity) {\n throw new RangeError('Size must be a finite, non-NaN, non-negative number.');\n }\n\n container._queue.push({ value, size });\n container._queueTotalSize += size;\n}\n\nexport function PeekQueueValue(container: QueueContainer>): T {\n assert('_queue' in container && '_queueTotalSize' in container);\n assert(container._queue.length > 0);\n\n const pair = container._queue.peek();\n return pair.value;\n}\n\nexport function ResetQueue(container: QueueContainer) {\n assert('_queue' in container && '_queueTotalSize' in container);\n\n container._queue = new SimpleQueue();\n container._queueTotalSize = 0;\n}\n","export type TypedArray =\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Float32Array\n | Float64Array;\n\nexport type NonShared = T & {\n buffer: ArrayBuffer;\n}\n\nexport interface ArrayBufferViewConstructor {\n new(buffer: ArrayBuffer, byteOffset: number, length?: number): T;\n\n readonly prototype: T;\n}\n\nexport interface TypedArrayConstructor extends ArrayBufferViewConstructor {\n readonly BYTES_PER_ELEMENT: number;\n}\n\nexport type DataViewConstructor = ArrayBufferViewConstructor;\n\nfunction isDataViewConstructor(ctor: Function): ctor is DataViewConstructor {\n return ctor === DataView;\n}\n\nexport function isDataView(view: ArrayBufferView): view is DataView {\n return isDataViewConstructor(view.constructor);\n}\n\nexport function arrayBufferViewElementSize(ctor: ArrayBufferViewConstructor): number {\n if (isDataViewConstructor(ctor)) {\n return 1;\n }\n return (ctor as unknown as TypedArrayConstructor).BYTES_PER_ELEMENT;\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport { ResetQueue } from '../abstract-ops/queue-with-sizes';\nimport {\n IsReadableStreamDefaultReader,\n ReadableStreamAddReadRequest,\n ReadableStreamFulfillReadRequest,\n ReadableStreamGetNumReadRequests,\n ReadableStreamHasDefaultReader,\n type ReadRequest\n} from './default-reader';\nimport {\n ReadableStreamAddReadIntoRequest,\n ReadableStreamFulfillReadIntoRequest,\n ReadableStreamGetNumReadIntoRequests,\n ReadableStreamHasBYOBReader,\n type ReadIntoRequest\n} from './byob-reader';\nimport NumberIsInteger from '../../stub/number-isinteger';\nimport {\n IsReadableStreamLocked,\n type ReadableByteStream,\n ReadableStreamClose,\n ReadableStreamError\n} from '../readable-stream';\nimport type { ValidatedUnderlyingByteSource } from './underlying-source';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport {\n ArrayBufferSlice,\n CanTransferArrayBuffer,\n CopyDataBlockBytes,\n IsDetachedBuffer,\n TransferArrayBuffer\n} from '../abstract-ops/ecmascript';\nimport { CancelSteps, PullSteps, ReleaseSteps } from '../abstract-ops/internal-methods';\nimport { promiseResolvedWith, uponPromise } from '../helpers/webidl';\nimport { assertRequiredArgument, convertUnsignedLongLongWithEnforceRange } from '../validators/basic';\nimport {\n type ArrayBufferViewConstructor,\n arrayBufferViewElementSize,\n type NonShared,\n type TypedArrayConstructor\n} from '../helpers/array-buffer-view';\n\n/**\n * A pull-into request in a {@link ReadableByteStreamController}.\n *\n * @public\n */\nexport class ReadableStreamBYOBRequest {\n /** @internal */\n _associatedReadableByteStreamController!: ReadableByteStreamController;\n /** @internal */\n _view!: NonShared | null;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the view for writing in to, or `null` if the BYOB request has already been responded to.\n */\n get view(): ArrayBufferView | null {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('view');\n }\n\n return this._view;\n }\n\n /**\n * Indicates to the associated readable byte stream that `bytesWritten` bytes were written into\n * {@link ReadableStreamBYOBRequest.view | view}, causing the result be surfaced to the consumer.\n *\n * After this method is called, {@link ReadableStreamBYOBRequest.view | view} will be transferred and no longer\n * modifiable.\n */\n respond(bytesWritten: number): void;\n respond(bytesWritten: number | undefined): void {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('respond');\n }\n assertRequiredArgument(bytesWritten, 1, 'respond');\n bytesWritten = convertUnsignedLongLongWithEnforceRange(bytesWritten, 'First parameter');\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n if (IsDetachedBuffer(this._view!.buffer)) {\n throw new TypeError(`The BYOB request's buffer has been detached and so cannot be used as a response`);\n }\n\n assert(this._view!.byteLength > 0);\n assert(this._view!.buffer.byteLength > 0);\n\n ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);\n }\n\n /**\n * Indicates to the associated readable byte stream that instead of writing into\n * {@link ReadableStreamBYOBRequest.view | view}, the underlying byte source is providing a new `ArrayBufferView`,\n * which will be given to the consumer of the readable byte stream.\n *\n * After this method is called, `view` will be transferred and no longer modifiable.\n */\n respondWithNewView(view: ArrayBufferView): void;\n respondWithNewView(view: NonShared): void {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('respondWithNewView');\n }\n assertRequiredArgument(view, 1, 'respondWithNewView');\n\n if (!ArrayBuffer.isView(view)) {\n throw new TypeError('You can only respond with array buffer views');\n }\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n if (IsDetachedBuffer(view.buffer)) {\n throw new TypeError('The given view\\'s buffer has been detached and so cannot be used as a response');\n }\n\n ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);\n }\n}\n\nObject.defineProperties(ReadableStreamBYOBRequest.prototype, {\n respond: { enumerable: true },\n respondWithNewView: { enumerable: true },\n view: { enumerable: true }\n});\nsetFunctionName(ReadableStreamBYOBRequest.prototype.respond, 'respond');\nsetFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, 'respondWithNewView');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamBYOBRequest.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamBYOBRequest',\n configurable: true\n });\n}\n\ninterface ByteQueueElement {\n buffer: ArrayBuffer;\n byteOffset: number;\n byteLength: number;\n}\n\ntype PullIntoDescriptor = NonShared> =\n DefaultPullIntoDescriptor\n | BYOBPullIntoDescriptor;\n\ninterface DefaultPullIntoDescriptor {\n buffer: ArrayBuffer;\n bufferByteLength: number;\n byteOffset: number;\n byteLength: number;\n bytesFilled: number;\n minimumFill: number;\n elementSize: number;\n viewConstructor: TypedArrayConstructor;\n readerType: 'default' | 'none';\n}\n\ninterface BYOBPullIntoDescriptor = NonShared> {\n buffer: ArrayBuffer;\n bufferByteLength: number;\n byteOffset: number;\n byteLength: number;\n bytesFilled: number;\n minimumFill: number;\n elementSize: number;\n viewConstructor: ArrayBufferViewConstructor;\n readerType: 'byob' | 'none';\n}\n\n/**\n * Allows control of a {@link ReadableStream | readable byte stream}'s state and internal queue.\n *\n * @public\n */\nexport class ReadableByteStreamController {\n /** @internal */\n _controlledReadableByteStream!: ReadableByteStream;\n /** @internal */\n _queue!: SimpleQueue;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _closeRequested!: boolean;\n /** @internal */\n _pullAgain!: boolean;\n /** @internal */\n _pulling !: boolean;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _pullAlgorithm!: () => Promise;\n /** @internal */\n _cancelAlgorithm!: (reason: any) => Promise;\n /** @internal */\n _autoAllocateChunkSize: number | undefined;\n /** @internal */\n _byobRequest: ReadableStreamBYOBRequest | null;\n /** @internal */\n _pendingPullIntos!: SimpleQueue;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the current BYOB pull request, or `null` if there isn't one.\n */\n get byobRequest(): ReadableStreamBYOBRequest | null {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('byobRequest');\n }\n\n return ReadableByteStreamControllerGetBYOBRequest(this);\n }\n\n /**\n * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is\n * over-full. An underlying byte source ought to use this information to determine when and how to apply backpressure.\n */\n get desiredSize(): number | null {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('desiredSize');\n }\n\n return ReadableByteStreamControllerGetDesiredSize(this);\n }\n\n /**\n * Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from\n * the stream, but once those are read, the stream will become closed.\n */\n close(): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('close');\n }\n\n if (this._closeRequested) {\n throw new TypeError('The stream has already been closed; do not close it again!');\n }\n\n const state = this._controlledReadableByteStream._state;\n if (state !== 'readable') {\n throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be closed`);\n }\n\n ReadableByteStreamControllerClose(this);\n }\n\n /**\n * Enqueues the given chunk chunk in the controlled readable stream.\n * The chunk has to be an `ArrayBufferView` instance, or else a `TypeError` will be thrown.\n */\n enqueue(chunk: ArrayBufferView): void;\n enqueue(chunk: NonShared): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('enqueue');\n }\n\n assertRequiredArgument(chunk, 1, 'enqueue');\n if (!ArrayBuffer.isView(chunk)) {\n throw new TypeError('chunk must be an array buffer view');\n }\n if (chunk.byteLength === 0) {\n throw new TypeError('chunk must have non-zero byteLength');\n }\n if (chunk.buffer.byteLength === 0) {\n throw new TypeError(`chunk's buffer must have non-zero byteLength`);\n }\n\n if (this._closeRequested) {\n throw new TypeError('stream is closed or draining');\n }\n\n const state = this._controlledReadableByteStream._state;\n if (state !== 'readable') {\n throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be enqueued to`);\n }\n\n ReadableByteStreamControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.\n */\n error(e: any = undefined): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('error');\n }\n\n ReadableByteStreamControllerError(this, e);\n }\n\n /** @internal */\n [CancelSteps](reason: any): Promise {\n ReadableByteStreamControllerClearPendingPullIntos(this);\n\n ResetQueue(this);\n\n const result = this._cancelAlgorithm(reason);\n ReadableByteStreamControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [PullSteps](readRequest: ReadRequest>): void {\n const stream = this._controlledReadableByteStream;\n assert(ReadableStreamHasDefaultReader(stream));\n\n if (this._queueTotalSize > 0) {\n assert(ReadableStreamGetNumReadRequests(stream) === 0);\n\n ReadableByteStreamControllerFillReadRequestFromQueue(this, readRequest);\n return;\n }\n\n const autoAllocateChunkSize = this._autoAllocateChunkSize;\n if (autoAllocateChunkSize !== undefined) {\n let buffer: ArrayBuffer;\n try {\n buffer = new ArrayBuffer(autoAllocateChunkSize);\n } catch (bufferE) {\n readRequest._errorSteps(bufferE);\n return;\n }\n\n const pullIntoDescriptor: DefaultPullIntoDescriptor = {\n buffer,\n bufferByteLength: autoAllocateChunkSize,\n byteOffset: 0,\n byteLength: autoAllocateChunkSize,\n bytesFilled: 0,\n minimumFill: 1,\n elementSize: 1,\n viewConstructor: Uint8Array,\n readerType: 'default'\n };\n\n this._pendingPullIntos.push(pullIntoDescriptor);\n }\n\n ReadableStreamAddReadRequest(stream, readRequest);\n ReadableByteStreamControllerCallPullIfNeeded(this);\n }\n\n /** @internal */\n [ReleaseSteps](): void {\n if (this._pendingPullIntos.length > 0) {\n const firstPullInto = this._pendingPullIntos.peek();\n firstPullInto.readerType = 'none';\n\n this._pendingPullIntos = new SimpleQueue();\n this._pendingPullIntos.push(firstPullInto);\n }\n }\n}\n\nObject.defineProperties(ReadableByteStreamController.prototype, {\n close: { enumerable: true },\n enqueue: { enumerable: true },\n error: { enumerable: true },\n byobRequest: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(ReadableByteStreamController.prototype.close, 'close');\nsetFunctionName(ReadableByteStreamController.prototype.enqueue, 'enqueue');\nsetFunctionName(ReadableByteStreamController.prototype.error, 'error');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableByteStreamController.prototype, Symbol.toStringTag, {\n value: 'ReadableByteStreamController',\n configurable: true\n });\n}\n\n// Abstract operations for the ReadableByteStreamController.\n\nexport function IsReadableByteStreamController(x: any): x is ReadableByteStreamController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableByteStream')) {\n return false;\n }\n\n return x instanceof ReadableByteStreamController;\n}\n\nfunction IsReadableStreamBYOBRequest(x: any): x is ReadableStreamBYOBRequest {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {\n return false;\n }\n\n return x instanceof ReadableStreamBYOBRequest;\n}\n\nfunction ReadableByteStreamControllerCallPullIfNeeded(controller: ReadableByteStreamController): void {\n const shouldPull = ReadableByteStreamControllerShouldCallPull(controller);\n if (!shouldPull) {\n return;\n }\n\n if (controller._pulling) {\n controller._pullAgain = true;\n return;\n }\n\n assert(!controller._pullAgain);\n\n controller._pulling = true;\n\n // TODO: Test controller argument\n const pullPromise = controller._pullAlgorithm();\n uponPromise(\n pullPromise,\n () => {\n controller._pulling = false;\n\n if (controller._pullAgain) {\n controller._pullAgain = false;\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n\n return null;\n },\n e => {\n ReadableByteStreamControllerError(controller, e);\n return null;\n }\n );\n}\n\nfunction ReadableByteStreamControllerClearPendingPullIntos(controller: ReadableByteStreamController) {\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n controller._pendingPullIntos = new SimpleQueue();\n}\n\nfunction ReadableByteStreamControllerCommitPullIntoDescriptor>(\n stream: ReadableByteStream,\n pullIntoDescriptor: PullIntoDescriptor\n) {\n assert(stream._state !== 'errored');\n assert(pullIntoDescriptor.readerType !== 'none');\n\n let done = false;\n if (stream._state === 'closed') {\n assert(pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize === 0);\n done = true;\n }\n\n const filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n if (pullIntoDescriptor.readerType === 'default') {\n ReadableStreamFulfillReadRequest(stream, filledView as unknown as NonShared, done);\n } else {\n assert(pullIntoDescriptor.readerType === 'byob');\n ReadableStreamFulfillReadIntoRequest(stream, filledView, done);\n }\n}\n\nfunction ReadableByteStreamControllerConvertPullIntoDescriptor>(\n pullIntoDescriptor: PullIntoDescriptor\n): T {\n const bytesFilled = pullIntoDescriptor.bytesFilled;\n const elementSize = pullIntoDescriptor.elementSize;\n\n assert(bytesFilled <= pullIntoDescriptor.byteLength);\n assert(bytesFilled % elementSize === 0);\n\n return new pullIntoDescriptor.viewConstructor(\n pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize) as T;\n}\n\nfunction ReadableByteStreamControllerEnqueueChunkToQueue(controller: ReadableByteStreamController,\n buffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number) {\n controller._queue.push({ buffer, byteOffset, byteLength });\n controller._queueTotalSize += byteLength;\n}\n\nfunction ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller: ReadableByteStreamController,\n buffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number) {\n let clonedChunk;\n try {\n clonedChunk = ArrayBufferSlice(buffer, byteOffset, byteOffset + byteLength);\n } catch (cloneE) {\n ReadableByteStreamControllerError(controller, cloneE);\n throw cloneE;\n }\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, clonedChunk, 0, byteLength);\n}\n\nfunction ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller: ReadableByteStreamController,\n firstDescriptor: PullIntoDescriptor) {\n assert(firstDescriptor.readerType === 'none');\n if (firstDescriptor.bytesFilled > 0) {\n ReadableByteStreamControllerEnqueueClonedChunkToQueue(\n controller,\n firstDescriptor.buffer,\n firstDescriptor.byteOffset,\n firstDescriptor.bytesFilled\n );\n }\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n}\n\nfunction ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller: ReadableByteStreamController,\n pullIntoDescriptor: PullIntoDescriptor) {\n const maxBytesToCopy = Math.min(controller._queueTotalSize,\n pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);\n const maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;\n\n let totalBytesToCopyRemaining = maxBytesToCopy;\n let ready = false;\n assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill);\n const remainderBytes = maxBytesFilled % pullIntoDescriptor.elementSize;\n const maxAlignedBytes = maxBytesFilled - remainderBytes;\n // A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head\n // of the queue, so the underlying source can keep filling it.\n if (maxAlignedBytes >= pullIntoDescriptor.minimumFill) {\n totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;\n ready = true;\n }\n\n const queue = controller._queue;\n\n while (totalBytesToCopyRemaining > 0) {\n const headOfQueue = queue.peek();\n\n const bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);\n\n const destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n CopyDataBlockBytes(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);\n\n if (headOfQueue.byteLength === bytesToCopy) {\n queue.shift();\n } else {\n headOfQueue.byteOffset += bytesToCopy;\n headOfQueue.byteLength -= bytesToCopy;\n }\n controller._queueTotalSize -= bytesToCopy;\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);\n\n totalBytesToCopyRemaining -= bytesToCopy;\n }\n\n if (!ready) {\n assert(controller._queueTotalSize === 0);\n assert(pullIntoDescriptor.bytesFilled > 0);\n assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill);\n }\n\n return ready;\n}\n\nfunction ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller: ReadableByteStreamController,\n size: number,\n pullIntoDescriptor: PullIntoDescriptor) {\n assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos.peek() === pullIntoDescriptor);\n assert(controller._byobRequest === null);\n pullIntoDescriptor.bytesFilled += size;\n}\n\nfunction ReadableByteStreamControllerHandleQueueDrain(controller: ReadableByteStreamController) {\n assert(controller._controlledReadableByteStream._state === 'readable');\n\n if (controller._queueTotalSize === 0 && controller._closeRequested) {\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamClose(controller._controlledReadableByteStream);\n } else {\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n}\n\nfunction ReadableByteStreamControllerInvalidateBYOBRequest(controller: ReadableByteStreamController) {\n if (controller._byobRequest === null) {\n return;\n }\n\n controller._byobRequest._associatedReadableByteStreamController = undefined!;\n controller._byobRequest._view = null!;\n controller._byobRequest = null;\n}\n\nfunction ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller: ReadableByteStreamController) {\n assert(!controller._closeRequested);\n\n while (controller._pendingPullIntos.length > 0) {\n if (controller._queueTotalSize === 0) {\n return;\n }\n\n const pullIntoDescriptor = controller._pendingPullIntos.peek();\n assert(pullIntoDescriptor.readerType !== 'none');\n\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor)) {\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n ReadableByteStreamControllerCommitPullIntoDescriptor(\n controller._controlledReadableByteStream,\n pullIntoDescriptor\n );\n }\n }\n}\n\nfunction ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller: ReadableByteStreamController) {\n const reader = controller._controlledReadableByteStream._reader;\n assert(IsReadableStreamDefaultReader(reader));\n while (reader._readRequests.length > 0) {\n if (controller._queueTotalSize === 0) {\n return;\n }\n const readRequest = reader._readRequests.shift();\n ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest);\n }\n}\n\nexport function ReadableByteStreamControllerPullInto>(\n controller: ReadableByteStreamController,\n view: T,\n min: number,\n readIntoRequest: ReadIntoRequest\n): void {\n const stream = controller._controlledReadableByteStream;\n\n const ctor = view.constructor as ArrayBufferViewConstructor;\n const elementSize = arrayBufferViewElementSize(ctor);\n\n const { byteOffset, byteLength } = view;\n\n const minimumFill = min * elementSize;\n assert(minimumFill >= elementSize && minimumFill <= byteLength);\n assert(minimumFill % elementSize === 0);\n\n let buffer: ArrayBuffer;\n try {\n buffer = TransferArrayBuffer(view.buffer);\n } catch (e) {\n readIntoRequest._errorSteps(e);\n return;\n }\n\n const pullIntoDescriptor: BYOBPullIntoDescriptor = {\n buffer,\n bufferByteLength: buffer.byteLength,\n byteOffset,\n byteLength,\n bytesFilled: 0,\n minimumFill,\n elementSize,\n viewConstructor: ctor,\n readerType: 'byob'\n };\n\n if (controller._pendingPullIntos.length > 0) {\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n // No ReadableByteStreamControllerCallPullIfNeeded() call since:\n // - No change happens on desiredSize\n // - The source has already been notified of that there's at least 1 pending read(view)\n\n ReadableStreamAddReadIntoRequest(stream, readIntoRequest);\n return;\n }\n\n if (stream._state === 'closed') {\n const emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);\n readIntoRequest._closeSteps(emptyView);\n return;\n }\n\n if (controller._queueTotalSize > 0) {\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor)) {\n const filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n\n ReadableByteStreamControllerHandleQueueDrain(controller);\n\n readIntoRequest._chunkSteps(filledView);\n return;\n }\n\n if (controller._closeRequested) {\n const e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n readIntoRequest._errorSteps(e);\n return;\n }\n }\n\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n ReadableStreamAddReadIntoRequest(stream, readIntoRequest);\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nfunction ReadableByteStreamControllerRespondInClosedState(controller: ReadableByteStreamController,\n firstDescriptor: PullIntoDescriptor) {\n assert(firstDescriptor.bytesFilled % firstDescriptor.elementSize === 0);\n\n if (firstDescriptor.readerType === 'none') {\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n }\n\n const stream = controller._controlledReadableByteStream;\n if (ReadableStreamHasBYOBReader(stream)) {\n while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n const pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);\n ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);\n }\n }\n}\n\nfunction ReadableByteStreamControllerRespondInReadableState(controller: ReadableByteStreamController,\n bytesWritten: number,\n pullIntoDescriptor: PullIntoDescriptor) {\n assert(pullIntoDescriptor.bytesFilled + bytesWritten <= pullIntoDescriptor.byteLength);\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);\n\n if (pullIntoDescriptor.readerType === 'none') {\n ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, pullIntoDescriptor);\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n return;\n }\n\n if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill) {\n // A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head\n // of the queue, so the underlying source can keep filling it.\n return;\n }\n\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;\n if (remainderSize > 0) {\n const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n ReadableByteStreamControllerEnqueueClonedChunkToQueue(\n controller,\n pullIntoDescriptor.buffer,\n end - remainderSize,\n remainderSize\n );\n }\n\n pullIntoDescriptor.bytesFilled -= remainderSize;\n ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);\n\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n}\n\nfunction ReadableByteStreamControllerRespondInternal(controller: ReadableByteStreamController, bytesWritten: number) {\n const firstDescriptor = controller._pendingPullIntos.peek();\n assert(CanTransferArrayBuffer(firstDescriptor.buffer));\n\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n\n const state = controller._controlledReadableByteStream._state;\n if (state === 'closed') {\n assert(bytesWritten === 0);\n ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);\n } else {\n assert(state === 'readable');\n assert(bytesWritten > 0);\n ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);\n }\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nfunction ReadableByteStreamControllerShiftPendingPullInto(\n controller: ReadableByteStreamController\n): PullIntoDescriptor {\n assert(controller._byobRequest === null);\n const descriptor = controller._pendingPullIntos.shift()!;\n return descriptor;\n}\n\nfunction ReadableByteStreamControllerShouldCallPull(controller: ReadableByteStreamController): boolean {\n const stream = controller._controlledReadableByteStream;\n\n if (stream._state !== 'readable') {\n return false;\n }\n\n if (controller._closeRequested) {\n return false;\n }\n\n if (!controller._started) {\n return false;\n }\n\n if (ReadableStreamHasDefaultReader(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n if (ReadableStreamHasBYOBReader(stream) && ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n return true;\n }\n\n const desiredSize = ReadableByteStreamControllerGetDesiredSize(controller);\n assert(desiredSize !== null);\n if (desiredSize! > 0) {\n return true;\n }\n\n return false;\n}\n\nfunction ReadableByteStreamControllerClearAlgorithms(controller: ReadableByteStreamController) {\n controller._pullAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n}\n\n// A client of ReadableByteStreamController may use these functions directly to bypass state check.\n\nexport function ReadableByteStreamControllerClose(controller: ReadableByteStreamController) {\n const stream = controller._controlledReadableByteStream;\n\n if (controller._closeRequested || stream._state !== 'readable') {\n return;\n }\n\n if (controller._queueTotalSize > 0) {\n controller._closeRequested = true;\n\n return;\n }\n\n if (controller._pendingPullIntos.length > 0) {\n const firstPendingPullInto = controller._pendingPullIntos.peek();\n if (firstPendingPullInto.bytesFilled % firstPendingPullInto.elementSize !== 0) {\n const e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n throw e;\n }\n }\n\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamClose(stream);\n}\n\nexport function ReadableByteStreamControllerEnqueue(\n controller: ReadableByteStreamController,\n chunk: NonShared\n) {\n const stream = controller._controlledReadableByteStream;\n\n if (controller._closeRequested || stream._state !== 'readable') {\n return;\n }\n\n const { buffer, byteOffset, byteLength } = chunk;\n if (IsDetachedBuffer(buffer)) {\n throw new TypeError('chunk\\'s buffer is detached and so cannot be enqueued');\n }\n const transferredBuffer = TransferArrayBuffer(buffer);\n\n if (controller._pendingPullIntos.length > 0) {\n const firstPendingPullInto = controller._pendingPullIntos.peek();\n if (IsDetachedBuffer(firstPendingPullInto.buffer)) {\n throw new TypeError(\n 'The BYOB request\\'s buffer has been detached and so cannot be filled with an enqueued chunk'\n );\n }\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);\n if (firstPendingPullInto.readerType === 'none') {\n ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto);\n }\n }\n\n if (ReadableStreamHasDefaultReader(stream)) {\n ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller);\n if (ReadableStreamGetNumReadRequests(stream) === 0) {\n assert(controller._pendingPullIntos.length === 0);\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n } else {\n assert(controller._queue.length === 0);\n if (controller._pendingPullIntos.length > 0) {\n assert(controller._pendingPullIntos.peek().readerType === 'default');\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n }\n const transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);\n ReadableStreamFulfillReadRequest(stream, transferredView as NonShared, false);\n }\n } else if (ReadableStreamHasBYOBReader(stream)) {\n // TODO: Ideally in this branch detaching should happen only if the buffer is not consumed fully.\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n } else {\n assert(!IsReadableStreamLocked(stream));\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n }\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nexport function ReadableByteStreamControllerError(controller: ReadableByteStreamController, e: any) {\n const stream = controller._controlledReadableByteStream;\n\n if (stream._state !== 'readable') {\n return;\n }\n\n ReadableByteStreamControllerClearPendingPullIntos(controller);\n\n ResetQueue(controller);\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamError(stream, e);\n}\n\nexport function ReadableByteStreamControllerFillReadRequestFromQueue(\n controller: ReadableByteStreamController,\n readRequest: ReadRequest>\n) {\n assert(controller._queueTotalSize > 0);\n\n const entry = controller._queue.shift();\n controller._queueTotalSize -= entry.byteLength;\n\n ReadableByteStreamControllerHandleQueueDrain(controller);\n\n const view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);\n readRequest._chunkSteps(view as NonShared);\n}\n\nexport function ReadableByteStreamControllerGetBYOBRequest(\n controller: ReadableByteStreamController\n): ReadableStreamBYOBRequest | null {\n if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {\n const firstDescriptor = controller._pendingPullIntos.peek();\n const view = new Uint8Array(firstDescriptor.buffer,\n firstDescriptor.byteOffset + firstDescriptor.bytesFilled,\n firstDescriptor.byteLength - firstDescriptor.bytesFilled);\n\n const byobRequest: ReadableStreamBYOBRequest = Object.create(ReadableStreamBYOBRequest.prototype);\n SetUpReadableStreamBYOBRequest(byobRequest, controller, view as NonShared);\n controller._byobRequest = byobRequest;\n }\n return controller._byobRequest;\n}\n\nfunction ReadableByteStreamControllerGetDesiredSize(controller: ReadableByteStreamController): number | null {\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nexport function ReadableByteStreamControllerRespond(controller: ReadableByteStreamController, bytesWritten: number) {\n assert(controller._pendingPullIntos.length > 0);\n\n const firstDescriptor = controller._pendingPullIntos.peek();\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'closed') {\n if (bytesWritten !== 0) {\n throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');\n }\n } else {\n assert(state === 'readable');\n if (bytesWritten === 0) {\n throw new TypeError('bytesWritten must be greater than 0 when calling respond() on a readable stream');\n }\n if (firstDescriptor.bytesFilled + bytesWritten > firstDescriptor.byteLength) {\n throw new RangeError('bytesWritten out of range');\n }\n }\n\n firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);\n\n ReadableByteStreamControllerRespondInternal(controller, bytesWritten);\n}\n\nexport function ReadableByteStreamControllerRespondWithNewView(controller: ReadableByteStreamController,\n view: NonShared) {\n assert(controller._pendingPullIntos.length > 0);\n assert(!IsDetachedBuffer(view.buffer));\n\n const firstDescriptor = controller._pendingPullIntos.peek();\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'closed') {\n if (view.byteLength !== 0) {\n throw new TypeError('The view\\'s length must be 0 when calling respondWithNewView() on a closed stream');\n }\n } else {\n assert(state === 'readable');\n if (view.byteLength === 0) {\n throw new TypeError(\n 'The view\\'s length must be greater than 0 when calling respondWithNewView() on a readable stream'\n );\n }\n }\n\n if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {\n throw new RangeError('The region specified by view does not match byobRequest');\n }\n if (firstDescriptor.bufferByteLength !== view.buffer.byteLength) {\n throw new RangeError('The buffer of view has different capacity than byobRequest');\n }\n if (firstDescriptor.bytesFilled + view.byteLength > firstDescriptor.byteLength) {\n throw new RangeError('The region specified by view is larger than byobRequest');\n }\n\n const viewByteLength = view.byteLength;\n firstDescriptor.buffer = TransferArrayBuffer(view.buffer);\n ReadableByteStreamControllerRespondInternal(controller, viewByteLength);\n}\n\nexport function SetUpReadableByteStreamController(stream: ReadableByteStream,\n controller: ReadableByteStreamController,\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n autoAllocateChunkSize: number | undefined) {\n assert(stream._readableStreamController === undefined);\n if (autoAllocateChunkSize !== undefined) {\n assert(NumberIsInteger(autoAllocateChunkSize));\n assert(autoAllocateChunkSize > 0);\n }\n\n controller._controlledReadableByteStream = stream;\n\n controller._pullAgain = false;\n controller._pulling = false;\n\n controller._byobRequest = null;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n controller._queue = controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._closeRequested = false;\n controller._started = false;\n\n controller._strategyHWM = highWaterMark;\n\n controller._pullAlgorithm = pullAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n controller._autoAllocateChunkSize = autoAllocateChunkSize;\n\n controller._pendingPullIntos = new SimpleQueue();\n\n stream._readableStreamController = controller;\n\n const startResult = startAlgorithm();\n uponPromise(\n promiseResolvedWith(startResult),\n () => {\n controller._started = true;\n\n assert(!controller._pulling);\n assert(!controller._pullAgain);\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n return null;\n },\n r => {\n ReadableByteStreamControllerError(controller, r);\n return null;\n }\n );\n}\n\nexport function SetUpReadableByteStreamControllerFromUnderlyingSource(\n stream: ReadableByteStream,\n underlyingByteSource: ValidatedUnderlyingByteSource,\n highWaterMark: number\n) {\n const controller: ReadableByteStreamController = Object.create(ReadableByteStreamController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let pullAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (underlyingByteSource.start !== undefined) {\n startAlgorithm = () => underlyingByteSource.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingByteSource.pull !== undefined) {\n pullAlgorithm = () => underlyingByteSource.pull!(controller);\n } else {\n pullAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingByteSource.cancel !== undefined) {\n cancelAlgorithm = reason => underlyingByteSource.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n const autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;\n if (autoAllocateChunkSize === 0) {\n throw new TypeError('autoAllocateChunkSize must be greater than 0');\n }\n\n SetUpReadableByteStreamController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize\n );\n}\n\nfunction SetUpReadableStreamBYOBRequest(request: ReadableStreamBYOBRequest,\n controller: ReadableByteStreamController,\n view: NonShared) {\n assert(IsReadableByteStreamController(controller));\n assert(typeof view === 'object');\n assert(ArrayBuffer.isView(view));\n assert(!IsDetachedBuffer(view.buffer));\n request._associatedReadableByteStreamController = controller;\n request._view = view;\n}\n\n// Helper functions for the ReadableStreamBYOBRequest.\n\nfunction byobRequestBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamBYOBRequest.prototype.${name} can only be used on a ReadableStreamBYOBRequest`);\n}\n\n// Helper functions for the ReadableByteStreamController.\n\nfunction byteStreamControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableByteStreamController.prototype.${name} can only be used on a ReadableByteStreamController`);\n}\n","import { assertDictionary, convertUnsignedLongLongWithEnforceRange } from './basic';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ReadableStreamGetReaderOptions,\n ValidatedReadableStreamBYOBReaderReadOptions\n} from '../readable-stream/reader-options';\n\nexport function convertReaderOptions(options: ReadableStreamGetReaderOptions | null | undefined,\n context: string): ReadableStreamGetReaderOptions {\n assertDictionary(options, context);\n const mode = options?.mode;\n return {\n mode: mode === undefined ? undefined : convertReadableStreamReaderMode(mode, `${context} has member 'mode' that`)\n };\n}\n\nfunction convertReadableStreamReaderMode(mode: string, context: string): 'byob' {\n mode = `${mode}`;\n if (mode !== 'byob') {\n throw new TypeError(`${context} '${mode}' is not a valid enumeration value for ReadableStreamReaderMode`);\n }\n return mode;\n}\n\nexport function convertByobReadOptions(\n options: ReadableStreamBYOBReaderReadOptions | null | undefined,\n context: string\n): ValidatedReadableStreamBYOBReaderReadOptions {\n assertDictionary(options, context);\n const min = options?.min ?? 1;\n return {\n min: convertUnsignedLongLongWithEnforceRange(\n min,\n `${context} has member 'min' that`\n )\n };\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport {\n ReadableStreamReaderGenericCancel,\n ReadableStreamReaderGenericInitialize,\n ReadableStreamReaderGenericRelease,\n readerLockException\n} from './generic-reader';\nimport { IsReadableStreamLocked, type ReadableByteStream, type ReadableStream } from '../readable-stream';\nimport {\n IsReadableByteStreamController,\n ReadableByteStreamController,\n ReadableByteStreamControllerPullInto\n} from './byte-stream-controller';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { newPromise, promiseRejectedWith } from '../helpers/webidl';\nimport { assertRequiredArgument } from '../validators/basic';\nimport { assertReadableStream } from '../validators/readable-stream';\nimport { IsDetachedBuffer } from '../abstract-ops/ecmascript';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ValidatedReadableStreamBYOBReaderReadOptions\n} from './reader-options';\nimport { convertByobReadOptions } from '../validators/reader-options';\nimport { isDataView, type NonShared, type TypedArray } from '../helpers/array-buffer-view';\n\n/**\n * A result returned by {@link ReadableStreamBYOBReader.read}.\n *\n * @public\n */\nexport type ReadableStreamBYOBReadResult = {\n done: false;\n value: T;\n} | {\n done: true;\n value: T | undefined;\n};\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamBYOBReader(stream: ReadableByteStream): ReadableStreamBYOBReader {\n return new ReadableStreamBYOBReader(stream as ReadableStream);\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamAddReadIntoRequest>(\n stream: ReadableByteStream,\n readIntoRequest: ReadIntoRequest\n): void {\n assert(IsReadableStreamBYOBReader(stream._reader));\n assert(stream._state === 'readable' || stream._state === 'closed');\n\n (stream._reader! as ReadableStreamBYOBReader)._readIntoRequests.push(readIntoRequest);\n}\n\nexport function ReadableStreamFulfillReadIntoRequest(stream: ReadableByteStream,\n chunk: ArrayBufferView,\n done: boolean) {\n const reader = stream._reader as ReadableStreamBYOBReader;\n\n assert(reader._readIntoRequests.length > 0);\n\n const readIntoRequest = reader._readIntoRequests.shift()!;\n if (done) {\n readIntoRequest._closeSteps(chunk);\n } else {\n readIntoRequest._chunkSteps(chunk);\n }\n}\n\nexport function ReadableStreamGetNumReadIntoRequests(stream: ReadableByteStream): number {\n return (stream._reader as ReadableStreamBYOBReader)._readIntoRequests.length;\n}\n\nexport function ReadableStreamHasBYOBReader(stream: ReadableByteStream): boolean {\n const reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (!IsReadableStreamBYOBReader(reader)) {\n return false;\n }\n\n return true;\n}\n\n// Readers\n\nexport interface ReadIntoRequest> {\n _chunkSteps(chunk: T): void;\n\n _closeSteps(chunk: T | undefined): void;\n\n _errorSteps(e: any): void;\n}\n\n/**\n * A BYOB reader vended by a {@link ReadableStream}.\n *\n * @public\n */\nexport class ReadableStreamBYOBReader {\n /** @internal */\n _ownerReadableStream!: ReadableByteStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _readIntoRequests: SimpleQueue>;\n\n constructor(stream: ReadableStream) {\n assertRequiredArgument(stream, 1, 'ReadableStreamBYOBReader');\n assertReadableStream(stream, 'First parameter');\n\n if (IsReadableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n if (!IsReadableByteStreamController(stream._readableStreamController)) {\n throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' +\n 'source');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readIntoRequests = new SimpleQueue();\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or\n * the reader's lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n\n /**\n * Attempts to reads bytes into view, and returns a promise resolved with the result.\n *\n * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.\n */\n read(\n view: T,\n options?: ReadableStreamBYOBReaderReadOptions\n ): Promise>;\n read>(\n view: T,\n rawOptions: ReadableStreamBYOBReaderReadOptions | null | undefined = {}\n ): Promise> {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('read'));\n }\n\n if (!ArrayBuffer.isView(view)) {\n return promiseRejectedWith(new TypeError('view must be an array buffer view'));\n }\n if (view.byteLength === 0) {\n return promiseRejectedWith(new TypeError('view must have non-zero byteLength'));\n }\n if (view.buffer.byteLength === 0) {\n return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`));\n }\n if (IsDetachedBuffer(view.buffer)) {\n return promiseRejectedWith(new TypeError('view\\'s buffer has been detached'));\n }\n\n let options: ValidatedReadableStreamBYOBReaderReadOptions;\n try {\n options = convertByobReadOptions(rawOptions, 'options');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const min = options.min;\n if (min === 0) {\n return promiseRejectedWith(new TypeError('options.min must be greater than 0'));\n }\n if (!isDataView(view)) {\n if (min > (view as unknown as TypedArray).length) {\n return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\\'s length'));\n }\n } else if (min > view.byteLength) {\n return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\\'s byteLength'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('read from'));\n }\n\n let resolvePromise!: (result: ReadableStreamBYOBReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readIntoRequest: ReadIntoRequest = {\n _chunkSteps: chunk => resolvePromise({ value: chunk, done: false }),\n _closeSteps: chunk => resolvePromise({ value: chunk, done: true }),\n _errorSteps: e => rejectPromise(e)\n };\n ReadableStreamBYOBReaderRead(this, view, min, readIntoRequest);\n return promise;\n }\n\n /**\n * Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.\n * If the associated stream is errored when the lock is released, the reader will appear errored in the same way\n * from now on; otherwise, the reader will appear closed.\n *\n * A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by\n * the reader's {@link ReadableStreamBYOBReader.read | read()} method has not yet been settled. Attempting to\n * do so will throw a `TypeError` and leave the reader locked to the stream.\n */\n releaseLock(): void {\n if (!IsReadableStreamBYOBReader(this)) {\n throw byobReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n ReadableStreamBYOBReaderRelease(this);\n }\n}\n\nObject.defineProperties(ReadableStreamBYOBReader.prototype, {\n cancel: { enumerable: true },\n read: { enumerable: true },\n releaseLock: { enumerable: true },\n closed: { enumerable: true }\n});\nsetFunctionName(ReadableStreamBYOBReader.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStreamBYOBReader.prototype.read, 'read');\nsetFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, 'releaseLock');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamBYOBReader.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamBYOBReader',\n configurable: true\n });\n}\n\n// Abstract operations for the readers.\n\nexport function IsReadableStreamBYOBReader(x: any): x is ReadableStreamBYOBReader {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {\n return false;\n }\n\n return x instanceof ReadableStreamBYOBReader;\n}\n\nexport function ReadableStreamBYOBReaderRead>(\n reader: ReadableStreamBYOBReader,\n view: T,\n min: number,\n readIntoRequest: ReadIntoRequest\n): void {\n const stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'errored') {\n readIntoRequest._errorSteps(stream._storedError);\n } else {\n ReadableByteStreamControllerPullInto(\n stream._readableStreamController as ReadableByteStreamController,\n view,\n min,\n readIntoRequest\n );\n }\n}\n\nexport function ReadableStreamBYOBReaderRelease(reader: ReadableStreamBYOBReader) {\n ReadableStreamReaderGenericRelease(reader);\n const e = new TypeError('Reader was released');\n ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);\n}\n\nexport function ReadableStreamBYOBReaderErrorReadIntoRequests(reader: ReadableStreamBYOBReader, e: any) {\n const readIntoRequests = reader._readIntoRequests;\n reader._readIntoRequests = new SimpleQueue();\n readIntoRequests.forEach(readIntoRequest => {\n readIntoRequest._errorSteps(e);\n });\n}\n\n// Helper functions for the ReadableStreamBYOBReader.\n\nfunction byobReaderBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamBYOBReader.prototype.${name} can only be used on a ReadableStreamBYOBReader`);\n}\n","import type { QueuingStrategy, QueuingStrategySizeCallback } from '../queuing-strategy';\nimport NumberIsNaN from '../../stub/number-isnan';\n\nexport function ExtractHighWaterMark(strategy: QueuingStrategy, defaultHWM: number): number {\n const { highWaterMark } = strategy;\n\n if (highWaterMark === undefined) {\n return defaultHWM;\n }\n\n if (NumberIsNaN(highWaterMark) || highWaterMark < 0) {\n throw new RangeError('Invalid highWaterMark');\n }\n\n return highWaterMark;\n}\n\nexport function ExtractSizeAlgorithm(strategy: QueuingStrategy): QueuingStrategySizeCallback {\n const { size } = strategy;\n\n if (!size) {\n return () => 1;\n }\n\n return size;\n}\n","import type { QueuingStrategy, QueuingStrategySizeCallback } from '../queuing-strategy';\nimport { assertDictionary, assertFunction, convertUnrestrictedDouble } from './basic';\n\nexport function convertQueuingStrategy(init: QueuingStrategy | null | undefined,\n context: string): QueuingStrategy {\n assertDictionary(init, context);\n const highWaterMark = init?.highWaterMark;\n const size = init?.size;\n return {\n highWaterMark: highWaterMark === undefined ? undefined : convertUnrestrictedDouble(highWaterMark),\n size: size === undefined ? undefined : convertQueuingStrategySize(size, `${context} has member 'size' that`)\n };\n}\n\nfunction convertQueuingStrategySize(fn: QueuingStrategySizeCallback,\n context: string): QueuingStrategySizeCallback {\n assertFunction(fn, context);\n return chunk => convertUnrestrictedDouble(fn(chunk));\n}\n","import { assertDictionary, assertFunction } from './basic';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\nimport type {\n UnderlyingSink,\n UnderlyingSinkAbortCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n ValidatedUnderlyingSink\n} from '../writable-stream/underlying-sink';\nimport { WritableStreamDefaultController } from '../writable-stream';\n\nexport function convertUnderlyingSink(original: UnderlyingSink | null,\n context: string): ValidatedUnderlyingSink {\n assertDictionary(original, context);\n const abort = original?.abort;\n const close = original?.close;\n const start = original?.start;\n const type = original?.type;\n const write = original?.write;\n return {\n abort: abort === undefined ?\n undefined :\n convertUnderlyingSinkAbortCallback(abort, original!, `${context} has member 'abort' that`),\n close: close === undefined ?\n undefined :\n convertUnderlyingSinkCloseCallback(close, original!, `${context} has member 'close' that`),\n start: start === undefined ?\n undefined :\n convertUnderlyingSinkStartCallback(start, original!, `${context} has member 'start' that`),\n write: write === undefined ?\n undefined :\n convertUnderlyingSinkWriteCallback(write, original!, `${context} has member 'write' that`),\n type\n };\n}\n\nfunction convertUnderlyingSinkAbortCallback(\n fn: UnderlyingSinkAbortCallback,\n original: UnderlyingSink,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n\nfunction convertUnderlyingSinkCloseCallback(\n fn: UnderlyingSinkCloseCallback,\n original: UnderlyingSink,\n context: string\n): () => Promise {\n assertFunction(fn, context);\n return () => promiseCall(fn, original, []);\n}\n\nfunction convertUnderlyingSinkStartCallback(\n fn: UnderlyingSinkStartCallback,\n original: UnderlyingSink,\n context: string\n): UnderlyingSinkStartCallback {\n assertFunction(fn, context);\n return (controller: WritableStreamDefaultController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertUnderlyingSinkWriteCallback(\n fn: UnderlyingSinkWriteCallback,\n original: UnderlyingSink,\n context: string\n): (chunk: W, controller: WritableStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (chunk: W, controller: WritableStreamDefaultController) => promiseCall(fn, original, [chunk, controller]);\n}\n","import { IsWritableStream, WritableStream } from '../writable-stream';\n\nexport function assertWritableStream(x: unknown, context: string): asserts x is WritableStream {\n if (!IsWritableStream(x)) {\n throw new TypeError(`${context} is not a WritableStream.`);\n }\n}\n","/**\n * A signal object that allows you to communicate with a request and abort it if required\n * via its associated `AbortController` object.\n *\n * @remarks\n * This interface is compatible with the `AbortSignal` interface defined in TypeScript's DOM types.\n * It is redefined here, so it can be polyfilled without a DOM, for example with\n * {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.\n *\n * @public\n */\nexport interface AbortSignal {\n /**\n * Whether the request is aborted.\n */\n readonly aborted: boolean;\n\n /**\n * If aborted, returns the reason for aborting.\n */\n readonly reason?: any;\n\n /**\n * Add an event listener to be triggered when this signal becomes aborted.\n */\n addEventListener(type: 'abort', listener: () => void): void;\n\n /**\n * Remove an event listener that was previously added with {@link AbortSignal.addEventListener}.\n */\n removeEventListener(type: 'abort', listener: () => void): void;\n}\n\nexport function isAbortSignal(value: unknown): value is AbortSignal {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n try {\n return typeof (value as AbortSignal).aborted === 'boolean';\n } catch {\n // AbortSignal.prototype.aborted throws if its brand check fails\n return false;\n }\n}\n\n/**\n * A controller object that allows you to abort an `AbortSignal` when desired.\n *\n * @remarks\n * This interface is compatible with the `AbortController` interface defined in TypeScript's DOM types.\n * It is redefined here, so it can be polyfilled without a DOM, for example with\n * {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.\n *\n * @internal\n */\nexport interface AbortController {\n readonly signal: AbortSignal;\n\n abort(reason?: any): void;\n}\n\ninterface AbortControllerConstructor {\n new(): AbortController;\n}\n\nconst supportsAbortController = typeof (AbortController as any) === 'function';\n\n/**\n * Construct a new AbortController, if supported by the platform.\n *\n * @internal\n */\nexport function createAbortController(): AbortController | undefined {\n if (supportsAbortController) {\n return new (AbortController as AbortControllerConstructor)();\n }\n return undefined;\n}\n","import assert from '../stub/assert';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n uponPromise\n} from './helpers/webidl';\nimport {\n DequeueValue,\n EnqueueValueWithSize,\n PeekQueueValue,\n type QueuePair,\n ResetQueue\n} from './abstract-ops/queue-with-sizes';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { SimpleQueue } from './simple-queue';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { AbortSteps, ErrorSteps } from './abstract-ops/internal-methods';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport type {\n UnderlyingSink,\n UnderlyingSinkAbortCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n ValidatedUnderlyingSink\n} from './writable-stream/underlying-sink';\nimport { assertObject, assertRequiredArgument } from './validators/basic';\nimport { convertUnderlyingSink } from './validators/underlying-sink';\nimport { assertWritableStream } from './validators/writable-stream';\nimport { type AbortController, type AbortSignal, createAbortController } from './abort-signal';\n\ntype WritableStreamState = 'writable' | 'closed' | 'erroring' | 'errored';\n\ninterface WriteOrCloseRequest {\n _resolve: (value?: undefined) => void;\n _reject: (reason: any) => void;\n}\n\ntype WriteRequest = WriteOrCloseRequest;\ntype CloseRequest = WriteOrCloseRequest;\n\ninterface PendingAbortRequest {\n _promise: Promise;\n _resolve: (value?: undefined) => void;\n _reject: (reason: any) => void;\n _reason: any;\n _wasAlreadyErroring: boolean;\n}\n\n/**\n * A writable stream represents a destination for data, into which you can write.\n *\n * @public\n */\nclass WritableStream {\n /** @internal */\n _state!: WritableStreamState;\n /** @internal */\n _storedError: any;\n /** @internal */\n _writer: WritableStreamDefaultWriter | undefined;\n /** @internal */\n _writableStreamController!: WritableStreamDefaultController;\n /** @internal */\n _writeRequests!: SimpleQueue;\n /** @internal */\n _inFlightWriteRequest: WriteRequest | undefined;\n /** @internal */\n _closeRequest: CloseRequest | undefined;\n /** @internal */\n _inFlightCloseRequest: CloseRequest | undefined;\n /** @internal */\n _pendingAbortRequest: PendingAbortRequest | undefined;\n /** @internal */\n _backpressure!: boolean;\n\n constructor(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy);\n constructor(rawUnderlyingSink: UnderlyingSink | null | undefined = {},\n rawStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawUnderlyingSink === undefined) {\n rawUnderlyingSink = null;\n } else {\n assertObject(rawUnderlyingSink, 'First parameter');\n }\n\n const strategy = convertQueuingStrategy(rawStrategy, 'Second parameter');\n const underlyingSink = convertUnderlyingSink(rawUnderlyingSink, 'First parameter');\n\n InitializeWritableStream(this);\n\n const type = underlyingSink.type;\n if (type !== undefined) {\n throw new RangeError('Invalid type is specified');\n }\n\n const sizeAlgorithm = ExtractSizeAlgorithm(strategy);\n const highWaterMark = ExtractHighWaterMark(strategy, 1);\n\n SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, highWaterMark, sizeAlgorithm);\n }\n\n /**\n * Returns whether or not the writable stream is locked to a writer.\n */\n get locked(): boolean {\n if (!IsWritableStream(this)) {\n throw streamBrandCheckException('locked');\n }\n\n return IsWritableStreamLocked(this);\n }\n\n /**\n * Aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be\n * immediately moved to an errored state, with any queued-up writes discarded. This will also execute any abort\n * mechanism of the underlying sink.\n *\n * The returned promise will fulfill if the stream shuts down successfully, or reject if the underlying sink signaled\n * that there was an error doing so. Additionally, it will reject with a `TypeError` (without attempting to cancel\n * the stream) if the stream is currently locked.\n */\n abort(reason: any = undefined): Promise {\n if (!IsWritableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('abort'));\n }\n\n if (IsWritableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));\n }\n\n return WritableStreamAbort(this, reason);\n }\n\n /**\n * Closes the stream. The underlying sink will finish processing any previously-written chunks, before invoking its\n * close behavior. During this time any further attempts to write will fail (without erroring the stream).\n *\n * The method returns a promise that will fulfill if all remaining chunks are successfully written and the stream\n * successfully closes, or rejects if an error is encountered during this process. Additionally, it will reject with\n * a `TypeError` (without attempting to cancel the stream) if the stream is currently locked.\n */\n close() {\n if (!IsWritableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('close'));\n }\n\n if (IsWritableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));\n }\n\n if (WritableStreamCloseQueuedOrInFlight(this)) {\n return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));\n }\n\n return WritableStreamClose(this);\n }\n\n /**\n * Creates a {@link WritableStreamDefaultWriter | writer} and locks the stream to the new writer. While the stream\n * is locked, no other writer can be acquired until this one is released.\n *\n * This functionality is especially useful for creating abstractions that desire the ability to write to a stream\n * without interruption or interleaving. By getting a writer for the stream, you can ensure nobody else can write at\n * the same time, which would cause the resulting written data to be unpredictable and probably useless.\n */\n getWriter(): WritableStreamDefaultWriter {\n if (!IsWritableStream(this)) {\n throw streamBrandCheckException('getWriter');\n }\n\n return AcquireWritableStreamDefaultWriter(this);\n }\n}\n\nObject.defineProperties(WritableStream.prototype, {\n abort: { enumerable: true },\n close: { enumerable: true },\n getWriter: { enumerable: true },\n locked: { enumerable: true }\n});\nsetFunctionName(WritableStream.prototype.abort, 'abort');\nsetFunctionName(WritableStream.prototype.close, 'close');\nsetFunctionName(WritableStream.prototype.getWriter, 'getWriter');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStream.prototype, Symbol.toStringTag, {\n value: 'WritableStream',\n configurable: true\n });\n}\n\nexport {\n AcquireWritableStreamDefaultWriter,\n CreateWritableStream,\n IsWritableStream,\n IsWritableStreamLocked,\n WritableStream,\n WritableStreamAbort,\n WritableStreamDefaultControllerErrorIfNeeded,\n WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite,\n WritableStreamCloseQueuedOrInFlight\n};\n\nexport type {\n UnderlyingSink,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkAbortCallback\n};\n\n// Abstract operations for the WritableStream.\n\nfunction AcquireWritableStreamDefaultWriter(stream: WritableStream): WritableStreamDefaultWriter {\n return new WritableStreamDefaultWriter(stream);\n}\n\n// Throws if and only if startAlgorithm throws.\nfunction CreateWritableStream(startAlgorithm: () => void | PromiseLike,\n writeAlgorithm: (chunk: W) => Promise,\n closeAlgorithm: () => Promise,\n abortAlgorithm: (reason: any) => Promise,\n highWaterMark = 1,\n sizeAlgorithm: QueuingStrategySizeCallback = () => 1) {\n assert(IsNonNegativeNumber(highWaterMark));\n\n const stream: WritableStream = Object.create(WritableStream.prototype);\n InitializeWritableStream(stream);\n\n const controller: WritableStreamDefaultController = Object.create(WritableStreamDefaultController.prototype);\n\n SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm,\n abortAlgorithm, highWaterMark, sizeAlgorithm);\n return stream;\n}\n\nfunction InitializeWritableStream(stream: WritableStream) {\n stream._state = 'writable';\n\n // The error that will be reported by new method calls once the state becomes errored. Only set when [[state]] is\n // 'erroring' or 'errored'. May be set to an undefined value.\n stream._storedError = undefined;\n\n stream._writer = undefined;\n\n // Initialize to undefined first because the constructor of the controller checks this\n // variable to validate the caller.\n stream._writableStreamController = undefined!;\n\n // This queue is placed here instead of the writer class in order to allow for passing a writer to the next data\n // producer without waiting for the queued writes to finish.\n stream._writeRequests = new SimpleQueue();\n\n // Write requests are removed from _writeRequests when write() is called on the underlying sink. This prevents\n // them from being erroneously rejected on error. If a write() call is in-flight, the request is stored here.\n stream._inFlightWriteRequest = undefined;\n\n // The promise that was returned from writer.close(). Stored here because it may be fulfilled after the writer\n // has been detached.\n stream._closeRequest = undefined;\n\n // Close request is removed from _closeRequest when close() is called on the underlying sink. This prevents it\n // from being erroneously rejected on error. If a close() call is in-flight, the request is stored here.\n stream._inFlightCloseRequest = undefined;\n\n // The promise that was returned from writer.abort(). This may also be fulfilled after the writer has detached.\n stream._pendingAbortRequest = undefined;\n\n // The backpressure signal set by the controller.\n stream._backpressure = false;\n}\n\nfunction IsWritableStream(x: unknown): x is WritableStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {\n return false;\n }\n\n return x instanceof WritableStream;\n}\n\nfunction IsWritableStreamLocked(stream: WritableStream): boolean {\n assert(IsWritableStream(stream));\n\n if (stream._writer === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamAbort(stream: WritableStream, reason: any): Promise {\n if (stream._state === 'closed' || stream._state === 'errored') {\n return promiseResolvedWith(undefined);\n }\n stream._writableStreamController._abortReason = reason;\n stream._writableStreamController._abortController?.abort(reason);\n\n // TypeScript narrows the type of `stream._state` down to 'writable' | 'erroring',\n // but it doesn't know that signaling abort runs author code that might have changed the state.\n // Widen the type again by casting to WritableStreamState.\n const state = stream._state as WritableStreamState;\n\n if (state === 'closed' || state === 'errored') {\n return promiseResolvedWith(undefined);\n }\n if (stream._pendingAbortRequest !== undefined) {\n return stream._pendingAbortRequest._promise;\n }\n\n assert(state === 'writable' || state === 'erroring');\n\n let wasAlreadyErroring = false;\n if (state === 'erroring') {\n wasAlreadyErroring = true;\n // reason will not be used, so don't keep a reference to it.\n reason = undefined;\n }\n\n const promise = newPromise((resolve, reject) => {\n stream._pendingAbortRequest = {\n _promise: undefined!,\n _resolve: resolve,\n _reject: reject,\n _reason: reason,\n _wasAlreadyErroring: wasAlreadyErroring\n };\n });\n stream._pendingAbortRequest!._promise = promise;\n\n if (!wasAlreadyErroring) {\n WritableStreamStartErroring(stream, reason);\n }\n\n return promise;\n}\n\nfunction WritableStreamClose(stream: WritableStream): Promise {\n const state = stream._state;\n if (state === 'closed' || state === 'errored') {\n return promiseRejectedWith(new TypeError(\n `The stream (in ${state} state) is not in the writable state and cannot be closed`));\n }\n\n assert(state === 'writable' || state === 'erroring');\n assert(!WritableStreamCloseQueuedOrInFlight(stream));\n\n const promise = newPromise((resolve, reject) => {\n const closeRequest: CloseRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._closeRequest = closeRequest;\n });\n\n const writer = stream._writer;\n if (writer !== undefined && stream._backpressure && state === 'writable') {\n defaultWriterReadyPromiseResolve(writer);\n }\n\n WritableStreamDefaultControllerClose(stream._writableStreamController);\n\n return promise;\n}\n\n// WritableStream API exposed for controllers.\n\nfunction WritableStreamAddWriteRequest(stream: WritableStream): Promise {\n assert(IsWritableStreamLocked(stream));\n assert(stream._state === 'writable');\n\n const promise = newPromise((resolve, reject) => {\n const writeRequest: WriteRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._writeRequests.push(writeRequest);\n });\n\n return promise;\n}\n\nfunction WritableStreamDealWithRejection(stream: WritableStream, error: any) {\n const state = stream._state;\n\n if (state === 'writable') {\n WritableStreamStartErroring(stream, error);\n return;\n }\n\n assert(state === 'erroring');\n WritableStreamFinishErroring(stream);\n}\n\nfunction WritableStreamStartErroring(stream: WritableStream, reason: any) {\n assert(stream._storedError === undefined);\n assert(stream._state === 'writable');\n\n const controller = stream._writableStreamController;\n assert(controller !== undefined);\n\n stream._state = 'erroring';\n stream._storedError = reason;\n const writer = stream._writer;\n if (writer !== undefined) {\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);\n }\n\n if (!WritableStreamHasOperationMarkedInFlight(stream) && controller._started) {\n WritableStreamFinishErroring(stream);\n }\n}\n\nfunction WritableStreamFinishErroring(stream: WritableStream) {\n assert(stream._state === 'erroring');\n assert(!WritableStreamHasOperationMarkedInFlight(stream));\n stream._state = 'errored';\n stream._writableStreamController[ErrorSteps]();\n\n const storedError = stream._storedError;\n stream._writeRequests.forEach(writeRequest => {\n writeRequest._reject(storedError);\n });\n stream._writeRequests = new SimpleQueue();\n\n if (stream._pendingAbortRequest === undefined) {\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n const abortRequest = stream._pendingAbortRequest;\n stream._pendingAbortRequest = undefined;\n\n if (abortRequest._wasAlreadyErroring) {\n abortRequest._reject(storedError);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n const promise = stream._writableStreamController[AbortSteps](abortRequest._reason);\n uponPromise(\n promise,\n () => {\n abortRequest._resolve();\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return null;\n },\n (reason: any) => {\n abortRequest._reject(reason);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return null;\n });\n}\n\nfunction WritableStreamFinishInFlightWrite(stream: WritableStream) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest!._resolve(undefined);\n stream._inFlightWriteRequest = undefined;\n}\n\nfunction WritableStreamFinishInFlightWriteWithError(stream: WritableStream, error: any) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest!._reject(error);\n stream._inFlightWriteRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n WritableStreamDealWithRejection(stream, error);\n}\n\nfunction WritableStreamFinishInFlightClose(stream: WritableStream) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest!._resolve(undefined);\n stream._inFlightCloseRequest = undefined;\n\n const state = stream._state;\n\n assert(state === 'writable' || state === 'erroring');\n\n if (state === 'erroring') {\n // The error was too late to do anything, so it is ignored.\n stream._storedError = undefined;\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._resolve();\n stream._pendingAbortRequest = undefined;\n }\n }\n\n stream._state = 'closed';\n\n const writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseResolve(writer);\n }\n\n assert(stream._pendingAbortRequest === undefined);\n assert(stream._storedError === undefined);\n}\n\nfunction WritableStreamFinishInFlightCloseWithError(stream: WritableStream, error: any) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest!._reject(error);\n stream._inFlightCloseRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n // Never execute sink abort() after sink close().\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._reject(error);\n stream._pendingAbortRequest = undefined;\n }\n WritableStreamDealWithRejection(stream, error);\n}\n\n// TODO(ricea): Fix alphabetical order.\nfunction WritableStreamCloseQueuedOrInFlight(stream: WritableStream): boolean {\n if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamHasOperationMarkedInFlight(stream: WritableStream): boolean {\n if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamMarkCloseRequestInFlight(stream: WritableStream) {\n assert(stream._inFlightCloseRequest === undefined);\n assert(stream._closeRequest !== undefined);\n stream._inFlightCloseRequest = stream._closeRequest;\n stream._closeRequest = undefined;\n}\n\nfunction WritableStreamMarkFirstWriteRequestInFlight(stream: WritableStream) {\n assert(stream._inFlightWriteRequest === undefined);\n assert(stream._writeRequests.length !== 0);\n stream._inFlightWriteRequest = stream._writeRequests.shift();\n}\n\nfunction WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream: WritableStream) {\n assert(stream._state === 'errored');\n if (stream._closeRequest !== undefined) {\n assert(stream._inFlightCloseRequest === undefined);\n\n stream._closeRequest._reject(stream._storedError);\n stream._closeRequest = undefined;\n }\n const writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseReject(writer, stream._storedError);\n }\n}\n\nfunction WritableStreamUpdateBackpressure(stream: WritableStream, backpressure: boolean) {\n assert(stream._state === 'writable');\n assert(!WritableStreamCloseQueuedOrInFlight(stream));\n\n const writer = stream._writer;\n if (writer !== undefined && backpressure !== stream._backpressure) {\n if (backpressure) {\n defaultWriterReadyPromiseReset(writer);\n } else {\n assert(!backpressure);\n\n defaultWriterReadyPromiseResolve(writer);\n }\n }\n\n stream._backpressure = backpressure;\n}\n\n/**\n * A default writer vended by a {@link WritableStream}.\n *\n * @public\n */\nexport class WritableStreamDefaultWriter {\n /** @internal */\n _ownerWritableStream: WritableStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _closedPromiseState!: 'pending' | 'resolved' | 'rejected';\n /** @internal */\n _readyPromise!: Promise;\n /** @internal */\n _readyPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _readyPromise_reject?: (reason: any) => void;\n /** @internal */\n _readyPromiseState!: 'pending' | 'fulfilled' | 'rejected';\n\n constructor(stream: WritableStream) {\n assertRequiredArgument(stream, 1, 'WritableStreamDefaultWriter');\n assertWritableStream(stream, 'First parameter');\n\n if (IsWritableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive writing by another writer');\n }\n\n this._ownerWritableStream = stream;\n stream._writer = this;\n\n const state = stream._state;\n\n if (state === 'writable') {\n if (!WritableStreamCloseQueuedOrInFlight(stream) && stream._backpressure) {\n defaultWriterReadyPromiseInitialize(this);\n } else {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n }\n\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'erroring') {\n defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'closed') {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n defaultWriterClosedPromiseInitializeAsResolved(this);\n } else {\n assert(state === 'errored');\n\n const storedError = stream._storedError;\n defaultWriterReadyPromiseInitializeAsRejected(this, storedError);\n defaultWriterClosedPromiseInitializeAsRejected(this, storedError);\n }\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or\n * the writer’s lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * Returns the desired size to fill the stream’s internal queue. It can be negative, if the queue is over-full.\n * A producer can use this information to determine the right amount of data to write.\n *\n * It will be `null` if the stream cannot be successfully written to (due to either being errored, or having an abort\n * queued up). It will return zero if the stream is closed. And the getter will throw an exception if invoked when\n * the writer’s lock is released.\n */\n get desiredSize(): number | null {\n if (!IsWritableStreamDefaultWriter(this)) {\n throw defaultWriterBrandCheckException('desiredSize');\n }\n\n if (this._ownerWritableStream === undefined) {\n throw defaultWriterLockException('desiredSize');\n }\n\n return WritableStreamDefaultWriterGetDesiredSize(this);\n }\n\n /**\n * Returns a promise that will be fulfilled when the desired size to fill the stream’s internal queue transitions\n * from non-positive to positive, signaling that it is no longer applying backpressure. Once the desired size dips\n * back to zero or below, the getter will return a new promise that stays pending until the next transition.\n *\n * If the stream becomes errored or aborted, or the writer’s lock is released, the returned promise will become\n * rejected.\n */\n get ready(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('ready'));\n }\n\n return this._readyPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link WritableStream.abort | stream.abort(reason)}.\n */\n abort(reason: any = undefined): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('abort'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('abort'));\n }\n\n return WritableStreamDefaultWriterAbort(this, reason);\n }\n\n /**\n * If the reader is active, behaves the same as {@link WritableStream.close | stream.close()}.\n */\n close(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('close'));\n }\n\n const stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('close'));\n }\n\n if (WritableStreamCloseQueuedOrInFlight(stream)) {\n return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));\n }\n\n return WritableStreamDefaultWriterClose(this);\n }\n\n /**\n * Releases the writer’s lock on the corresponding stream. After the lock is released, the writer is no longer active.\n * If the associated stream is errored when the lock is released, the writer will appear errored in the same way from\n * now on; otherwise, the writer will appear closed.\n *\n * Note that the lock can still be released even if some ongoing writes have not yet finished (i.e. even if the\n * promises returned from previous calls to {@link WritableStreamDefaultWriter.write | write()} have not yet settled).\n * It’s not necessary to hold the lock on the writer for the duration of the write; the lock instead simply prevents\n * other producers from writing in an interleaved manner.\n */\n releaseLock(): void {\n if (!IsWritableStreamDefaultWriter(this)) {\n throw defaultWriterBrandCheckException('releaseLock');\n }\n\n const stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return;\n }\n\n assert(stream._writer !== undefined);\n\n WritableStreamDefaultWriterRelease(this);\n }\n\n /**\n * Writes the given chunk to the writable stream, by waiting until any previous writes have finished successfully,\n * and then sending the chunk to the underlying sink's {@link UnderlyingSink.write | write()} method. It will return\n * a promise that fulfills with undefined upon a successful write, or rejects if the write fails or stream becomes\n * errored before the writing process is initiated.\n *\n * Note that what \"success\" means is up to the underlying sink; it might indicate simply that the chunk has been\n * accepted, and not necessarily that it is safely saved to its ultimate destination.\n */\n write(chunk: W): Promise;\n write(chunk: W = undefined!): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('write'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('write to'));\n }\n\n return WritableStreamDefaultWriterWrite(this, chunk);\n }\n}\n\nObject.defineProperties(WritableStreamDefaultWriter.prototype, {\n abort: { enumerable: true },\n close: { enumerable: true },\n releaseLock: { enumerable: true },\n write: { enumerable: true },\n closed: { enumerable: true },\n desiredSize: { enumerable: true },\n ready: { enumerable: true }\n});\nsetFunctionName(WritableStreamDefaultWriter.prototype.abort, 'abort');\nsetFunctionName(WritableStreamDefaultWriter.prototype.close, 'close');\nsetFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, 'releaseLock');\nsetFunctionName(WritableStreamDefaultWriter.prototype.write, 'write');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStreamDefaultWriter.prototype, Symbol.toStringTag, {\n value: 'WritableStreamDefaultWriter',\n configurable: true\n });\n}\n\n// Abstract operations for the WritableStreamDefaultWriter.\n\nfunction IsWritableStreamDefaultWriter(x: any): x is WritableStreamDefaultWriter {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {\n return false;\n }\n\n return x instanceof WritableStreamDefaultWriter;\n}\n\n// A client of WritableStreamDefaultWriter may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultWriterAbort(writer: WritableStreamDefaultWriter, reason: any) {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n return WritableStreamAbort(stream, reason);\n}\n\nfunction WritableStreamDefaultWriterClose(writer: WritableStreamDefaultWriter): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n return WritableStreamClose(stream);\n}\n\nfunction WritableStreamDefaultWriterCloseWithErrorPropagation(writer: WritableStreamDefaultWriter): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n const state = stream._state;\n if (WritableStreamCloseQueuedOrInFlight(stream) || state === 'closed') {\n return promiseResolvedWith(undefined);\n }\n\n if (state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n\n assert(state === 'writable' || state === 'erroring');\n\n return WritableStreamDefaultWriterClose(writer);\n}\n\nfunction WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer: WritableStreamDefaultWriter, error: any) {\n if (writer._closedPromiseState === 'pending') {\n defaultWriterClosedPromiseReject(writer, error);\n } else {\n defaultWriterClosedPromiseResetToRejected(writer, error);\n }\n}\n\nfunction WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer: WritableStreamDefaultWriter, error: any) {\n if (writer._readyPromiseState === 'pending') {\n defaultWriterReadyPromiseReject(writer, error);\n } else {\n defaultWriterReadyPromiseResetToRejected(writer, error);\n }\n}\n\nfunction WritableStreamDefaultWriterGetDesiredSize(writer: WritableStreamDefaultWriter): number | null {\n const stream = writer._ownerWritableStream;\n const state = stream._state;\n\n if (state === 'errored' || state === 'erroring') {\n return null;\n }\n\n if (state === 'closed') {\n return 0;\n }\n\n return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);\n}\n\nfunction WritableStreamDefaultWriterRelease(writer: WritableStreamDefaultWriter) {\n const stream = writer._ownerWritableStream;\n assert(stream !== undefined);\n assert(stream._writer === writer);\n\n const releasedError = new TypeError(\n `Writer was released and can no longer be used to monitor the stream's closedness`);\n\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);\n\n // The state transitions to \"errored\" before the sink abort() method runs, but the writer.closed promise is not\n // rejected until afterwards. This means that simply testing state will not work.\n WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);\n\n stream._writer = undefined;\n writer._ownerWritableStream = undefined!;\n}\n\nfunction WritableStreamDefaultWriterWrite(writer: WritableStreamDefaultWriter, chunk: W): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n const controller = stream._writableStreamController;\n\n const chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);\n\n if (stream !== writer._ownerWritableStream) {\n return promiseRejectedWith(defaultWriterLockException('write to'));\n }\n\n const state = stream._state;\n if (state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n if (WritableStreamCloseQueuedOrInFlight(stream) || state === 'closed') {\n return promiseRejectedWith(new TypeError('The stream is closing or closed and cannot be written to'));\n }\n if (state === 'erroring') {\n return promiseRejectedWith(stream._storedError);\n }\n\n assert(state === 'writable');\n\n const promise = WritableStreamAddWriteRequest(stream);\n\n WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);\n\n return promise;\n}\n\nconst closeSentinel: unique symbol = {} as any;\n\ntype QueueRecord = W | typeof closeSentinel;\n\n/**\n * Allows control of a {@link WritableStream | writable stream}'s state and internal queue.\n *\n * @public\n */\nexport class WritableStreamDefaultController {\n /** @internal */\n _controlledWritableStream!: WritableStream;\n /** @internal */\n _queue!: SimpleQueue>>;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _abortReason: any;\n /** @internal */\n _abortController: AbortController | undefined;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _strategySizeAlgorithm!: QueuingStrategySizeCallback;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _writeAlgorithm!: (chunk: W) => Promise;\n /** @internal */\n _closeAlgorithm!: () => Promise;\n /** @internal */\n _abortAlgorithm!: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.\n *\n * @deprecated\n * This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.\n * Use {@link WritableStreamDefaultController.signal}'s `reason` instead.\n */\n get abortReason(): any {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('abortReason');\n }\n return this._abortReason;\n }\n\n /**\n * An `AbortSignal` that can be used to abort the pending write or close operation when the stream is aborted.\n */\n get signal(): AbortSignal {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('signal');\n }\n if (this._abortController === undefined) {\n // Older browsers or older Node versions may not support `AbortController` or `AbortSignal`.\n // We don't want to bundle and ship an `AbortController` polyfill together with our polyfill,\n // so instead we only implement support for `signal` if we find a global `AbortController` constructor.\n throw new TypeError('WritableStreamDefaultController.prototype.signal is not supported');\n }\n return this._abortController.signal;\n }\n\n /**\n * Closes the controlled writable stream, making all future interactions with it fail with the given error `e`.\n *\n * This method is rarely used, since usually it suffices to return a rejected promise from one of the underlying\n * sink's methods. However, it can be useful for suddenly shutting down a stream in response to an event outside the\n * normal lifecycle of interactions with the underlying sink.\n */\n error(e: any = undefined): void {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n const state = this._controlledWritableStream._state;\n if (state !== 'writable') {\n // The stream is closed, errored or will be soon. The sink can't do anything useful if it gets an error here, so\n // just treat it as a no-op.\n return;\n }\n\n WritableStreamDefaultControllerError(this, e);\n }\n\n /** @internal */\n [AbortSteps](reason: any): Promise {\n const result = this._abortAlgorithm(reason);\n WritableStreamDefaultControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [ErrorSteps]() {\n ResetQueue(this);\n }\n}\n\nObject.defineProperties(WritableStreamDefaultController.prototype, {\n abortReason: { enumerable: true },\n signal: { enumerable: true },\n error: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'WritableStreamDefaultController',\n configurable: true\n });\n}\n\n// Abstract operations implementing interface required by the WritableStream.\n\nfunction IsWritableStreamDefaultController(x: any): x is WritableStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledWritableStream')) {\n return false;\n }\n\n return x instanceof WritableStreamDefaultController;\n}\n\nfunction SetUpWritableStreamDefaultController(stream: WritableStream,\n controller: WritableStreamDefaultController,\n startAlgorithm: () => void | PromiseLike,\n writeAlgorithm: (chunk: W) => Promise,\n closeAlgorithm: () => Promise,\n abortAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n assert(IsWritableStream(stream));\n assert(stream._writableStreamController === undefined);\n\n controller._controlledWritableStream = stream;\n stream._writableStreamController = controller;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n controller._queue = undefined!;\n controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._abortReason = undefined;\n controller._abortController = createAbortController();\n controller._started = false;\n\n controller._strategySizeAlgorithm = sizeAlgorithm;\n controller._strategyHWM = highWaterMark;\n\n controller._writeAlgorithm = writeAlgorithm;\n controller._closeAlgorithm = closeAlgorithm;\n controller._abortAlgorithm = abortAlgorithm;\n\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n\n const startResult = startAlgorithm();\n const startPromise = promiseResolvedWith(startResult);\n uponPromise(\n startPromise,\n () => {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n controller._started = true;\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n return null;\n },\n r => {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n controller._started = true;\n WritableStreamDealWithRejection(stream, r);\n return null;\n }\n );\n}\n\nfunction SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream: WritableStream,\n underlyingSink: ValidatedUnderlyingSink,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n const controller = Object.create(WritableStreamDefaultController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let writeAlgorithm: (chunk: W) => Promise;\n let closeAlgorithm: () => Promise;\n let abortAlgorithm: (reason: any) => Promise;\n\n if (underlyingSink.start !== undefined) {\n startAlgorithm = () => underlyingSink.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingSink.write !== undefined) {\n writeAlgorithm = chunk => underlyingSink.write!(chunk, controller);\n } else {\n writeAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSink.close !== undefined) {\n closeAlgorithm = () => underlyingSink.close!();\n } else {\n closeAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSink.abort !== undefined) {\n abortAlgorithm = reason => underlyingSink.abort!(reason);\n } else {\n abortAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpWritableStreamDefaultController(\n stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm\n );\n}\n\n// ClearAlgorithms may be called twice. Erroring the same stream in multiple ways will often result in redundant calls.\nfunction WritableStreamDefaultControllerClearAlgorithms(controller: WritableStreamDefaultController) {\n controller._writeAlgorithm = undefined!;\n controller._closeAlgorithm = undefined!;\n controller._abortAlgorithm = undefined!;\n controller._strategySizeAlgorithm = undefined!;\n}\n\nfunction WritableStreamDefaultControllerClose(controller: WritableStreamDefaultController) {\n EnqueueValueWithSize(controller, closeSentinel, 0);\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\nfunction WritableStreamDefaultControllerGetChunkSize(controller: WritableStreamDefaultController,\n chunk: W): number {\n try {\n return controller._strategySizeAlgorithm(chunk);\n } catch (chunkSizeE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);\n return 1;\n }\n}\n\nfunction WritableStreamDefaultControllerGetDesiredSize(controller: WritableStreamDefaultController): number {\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nfunction WritableStreamDefaultControllerWrite(controller: WritableStreamDefaultController,\n chunk: W,\n chunkSize: number) {\n try {\n EnqueueValueWithSize(controller, chunk, chunkSize);\n } catch (enqueueE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);\n return;\n }\n\n const stream = controller._controlledWritableStream;\n if (!WritableStreamCloseQueuedOrInFlight(stream) && stream._state === 'writable') {\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\n// Abstract operations for the WritableStreamDefaultController.\n\nfunction WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller: WritableStreamDefaultController) {\n const stream = controller._controlledWritableStream;\n\n if (!controller._started) {\n return;\n }\n\n if (stream._inFlightWriteRequest !== undefined) {\n return;\n }\n\n const state = stream._state;\n assert(state !== 'closed' && state !== 'errored');\n if (state === 'erroring') {\n WritableStreamFinishErroring(stream);\n return;\n }\n\n if (controller._queue.length === 0) {\n return;\n }\n\n const value = PeekQueueValue(controller);\n if (value === closeSentinel) {\n WritableStreamDefaultControllerProcessClose(controller);\n } else {\n WritableStreamDefaultControllerProcessWrite(controller, value);\n }\n}\n\nfunction WritableStreamDefaultControllerErrorIfNeeded(controller: WritableStreamDefaultController, error: any) {\n if (controller._controlledWritableStream._state === 'writable') {\n WritableStreamDefaultControllerError(controller, error);\n }\n}\n\nfunction WritableStreamDefaultControllerProcessClose(controller: WritableStreamDefaultController) {\n const stream = controller._controlledWritableStream;\n\n WritableStreamMarkCloseRequestInFlight(stream);\n\n DequeueValue(controller);\n assert(controller._queue.length === 0);\n\n const sinkClosePromise = controller._closeAlgorithm();\n WritableStreamDefaultControllerClearAlgorithms(controller);\n uponPromise(\n sinkClosePromise,\n () => {\n WritableStreamFinishInFlightClose(stream);\n return null;\n },\n reason => {\n WritableStreamFinishInFlightCloseWithError(stream, reason);\n return null;\n }\n );\n}\n\nfunction WritableStreamDefaultControllerProcessWrite(controller: WritableStreamDefaultController, chunk: W) {\n const stream = controller._controlledWritableStream;\n\n WritableStreamMarkFirstWriteRequestInFlight(stream);\n\n const sinkWritePromise = controller._writeAlgorithm(chunk);\n uponPromise(\n sinkWritePromise,\n () => {\n WritableStreamFinishInFlightWrite(stream);\n\n const state = stream._state;\n assert(state === 'writable' || state === 'erroring');\n\n DequeueValue(controller);\n\n if (!WritableStreamCloseQueuedOrInFlight(stream) && state === 'writable') {\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n return null;\n },\n reason => {\n if (stream._state === 'writable') {\n WritableStreamDefaultControllerClearAlgorithms(controller);\n }\n WritableStreamFinishInFlightWriteWithError(stream, reason);\n return null;\n }\n );\n}\n\nfunction WritableStreamDefaultControllerGetBackpressure(controller: WritableStreamDefaultController): boolean {\n const desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);\n return desiredSize <= 0;\n}\n\n// A client of WritableStreamDefaultController may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultControllerError(controller: WritableStreamDefaultController, error: any) {\n const stream = controller._controlledWritableStream;\n\n assert(stream._state === 'writable');\n\n WritableStreamDefaultControllerClearAlgorithms(controller);\n WritableStreamStartErroring(stream, error);\n}\n\n// Helper functions for the WritableStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`);\n}\n\n// Helper functions for the WritableStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `WritableStreamDefaultController.prototype.${name} can only be used on a WritableStreamDefaultController`);\n}\n\n\n// Helper functions for the WritableStreamDefaultWriter.\n\nfunction defaultWriterBrandCheckException(name: string): TypeError {\n return new TypeError(\n `WritableStreamDefaultWriter.prototype.${name} can only be used on a WritableStreamDefaultWriter`);\n}\n\nfunction defaultWriterLockException(name: string): TypeError {\n return new TypeError('Cannot ' + name + ' a stream using a released writer');\n}\n\nfunction defaultWriterClosedPromiseInitialize(writer: WritableStreamDefaultWriter) {\n writer._closedPromise = newPromise((resolve, reject) => {\n writer._closedPromise_resolve = resolve;\n writer._closedPromise_reject = reject;\n writer._closedPromiseState = 'pending';\n });\n}\n\nfunction defaultWriterClosedPromiseInitializeAsRejected(writer: WritableStreamDefaultWriter, reason: any) {\n defaultWriterClosedPromiseInitialize(writer);\n defaultWriterClosedPromiseReject(writer, reason);\n}\n\nfunction defaultWriterClosedPromiseInitializeAsResolved(writer: WritableStreamDefaultWriter) {\n defaultWriterClosedPromiseInitialize(writer);\n defaultWriterClosedPromiseResolve(writer);\n}\n\nfunction defaultWriterClosedPromiseReject(writer: WritableStreamDefaultWriter, reason: any) {\n if (writer._closedPromise_reject === undefined) {\n return;\n }\n assert(writer._closedPromiseState === 'pending');\n\n setPromiseIsHandledToTrue(writer._closedPromise);\n writer._closedPromise_reject(reason);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'rejected';\n}\n\nfunction defaultWriterClosedPromiseResetToRejected(writer: WritableStreamDefaultWriter, reason: any) {\n assert(writer._closedPromise_resolve === undefined);\n assert(writer._closedPromise_reject === undefined);\n assert(writer._closedPromiseState !== 'pending');\n\n defaultWriterClosedPromiseInitializeAsRejected(writer, reason);\n}\n\nfunction defaultWriterClosedPromiseResolve(writer: WritableStreamDefaultWriter) {\n if (writer._closedPromise_resolve === undefined) {\n return;\n }\n assert(writer._closedPromiseState === 'pending');\n\n writer._closedPromise_resolve(undefined);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'resolved';\n}\n\nfunction defaultWriterReadyPromiseInitialize(writer: WritableStreamDefaultWriter) {\n writer._readyPromise = newPromise((resolve, reject) => {\n writer._readyPromise_resolve = resolve;\n writer._readyPromise_reject = reject;\n });\n writer._readyPromiseState = 'pending';\n}\n\nfunction defaultWriterReadyPromiseInitializeAsRejected(writer: WritableStreamDefaultWriter, reason: any) {\n defaultWriterReadyPromiseInitialize(writer);\n defaultWriterReadyPromiseReject(writer, reason);\n}\n\nfunction defaultWriterReadyPromiseInitializeAsResolved(writer: WritableStreamDefaultWriter) {\n defaultWriterReadyPromiseInitialize(writer);\n defaultWriterReadyPromiseResolve(writer);\n}\n\nfunction defaultWriterReadyPromiseReject(writer: WritableStreamDefaultWriter, reason: any) {\n if (writer._readyPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(writer._readyPromise);\n writer._readyPromise_reject(reason);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'rejected';\n}\n\nfunction defaultWriterReadyPromiseReset(writer: WritableStreamDefaultWriter) {\n assert(writer._readyPromise_resolve === undefined);\n assert(writer._readyPromise_reject === undefined);\n\n defaultWriterReadyPromiseInitialize(writer);\n}\n\nfunction defaultWriterReadyPromiseResetToRejected(writer: WritableStreamDefaultWriter, reason: any) {\n assert(writer._readyPromise_resolve === undefined);\n assert(writer._readyPromise_reject === undefined);\n\n defaultWriterReadyPromiseInitializeAsRejected(writer, reason);\n}\n\nfunction defaultWriterReadyPromiseResolve(writer: WritableStreamDefaultWriter) {\n if (writer._readyPromise_resolve === undefined) {\n return;\n }\n\n writer._readyPromise_resolve(undefined);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'fulfilled';\n}\n","/// \n\nfunction getGlobals(): typeof globalThis | undefined {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n } else if (typeof self !== 'undefined') {\n return self;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","/// \nimport { globals } from '../globals';\nimport { setFunctionName } from '../lib/helpers/miscellaneous';\n\ninterface DOMException extends Error {\n name: string;\n message: string;\n}\n\ntype DOMExceptionConstructor = new (message?: string, name?: string) => DOMException;\n\nfunction isDOMExceptionConstructor(ctor: unknown): ctor is DOMExceptionConstructor {\n if (!(typeof ctor === 'function' || typeof ctor === 'object')) {\n return false;\n }\n if ((ctor as DOMExceptionConstructor).name !== 'DOMException') {\n return false;\n }\n try {\n new (ctor as DOMExceptionConstructor)();\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Support:\n * - Web browsers\n * - Node 18 and higher (https://github.com/nodejs/node/commit/e4b1fb5e6422c1ff151234bb9de792d45dd88d87)\n */\nfunction getFromGlobal(): DOMExceptionConstructor | undefined {\n const ctor = globals?.DOMException;\n return isDOMExceptionConstructor(ctor) ? ctor : undefined;\n}\n\n/**\n * Support:\n * - All platforms\n */\nfunction createPolyfill(): DOMExceptionConstructor {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const ctor = function DOMException(this: DOMException, message?: string, name?: string) {\n this.message = message || '';\n this.name = name || 'Error';\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n } as any;\n setFunctionName(ctor, 'DOMException');\n ctor.prototype = Object.create(Error.prototype);\n Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });\n return ctor;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nconst DOMException: DOMExceptionConstructor = getFromGlobal() || createPolyfill();\n\nexport { DOMException };\n","import { IsReadableStream, IsReadableStreamLocked, ReadableStream, ReadableStreamCancel } from '../readable-stream';\nimport { AcquireReadableStreamDefaultReader, ReadableStreamDefaultReaderRead } from './default-reader';\nimport { ReadableStreamReaderGenericRelease } from './generic-reader';\nimport {\n AcquireWritableStreamDefaultWriter,\n IsWritableStream,\n IsWritableStreamLocked,\n WritableStream,\n WritableStreamAbort,\n WritableStreamCloseQueuedOrInFlight,\n WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite\n} from '../writable-stream';\nimport assert from '../../stub/assert';\nimport {\n newPromise,\n PerformPromiseThen,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n uponFulfillment,\n uponPromise,\n uponRejection\n} from '../helpers/webidl';\nimport { noop } from '../../utils';\nimport { type AbortSignal, isAbortSignal } from '../abort-signal';\nimport { DOMException } from '../../stub/dom-exception';\n\nexport function ReadableStreamPipeTo(source: ReadableStream,\n dest: WritableStream,\n preventClose: boolean,\n preventAbort: boolean,\n preventCancel: boolean,\n signal: AbortSignal | undefined): Promise {\n assert(IsReadableStream(source));\n assert(IsWritableStream(dest));\n assert(typeof preventClose === 'boolean');\n assert(typeof preventAbort === 'boolean');\n assert(typeof preventCancel === 'boolean');\n assert(signal === undefined || isAbortSignal(signal));\n assert(!IsReadableStreamLocked(source));\n assert(!IsWritableStreamLocked(dest));\n\n const reader = AcquireReadableStreamDefaultReader(source);\n const writer = AcquireWritableStreamDefaultWriter(dest);\n\n source._disturbed = true;\n\n let shuttingDown = false;\n\n // This is used to keep track of the spec's requirement that we wait for ongoing writes during shutdown.\n let currentWrite = promiseResolvedWith(undefined);\n\n return newPromise((resolve, reject) => {\n let abortAlgorithm: () => void;\n if (signal !== undefined) {\n abortAlgorithm = () => {\n const error = signal.reason !== undefined ? signal.reason : new DOMException('Aborted', 'AbortError');\n const actions: Array<() => Promise> = [];\n if (!preventAbort) {\n actions.push(() => {\n if (dest._state === 'writable') {\n return WritableStreamAbort(dest, error);\n }\n return promiseResolvedWith(undefined);\n });\n }\n if (!preventCancel) {\n actions.push(() => {\n if (source._state === 'readable') {\n return ReadableStreamCancel(source, error);\n }\n return promiseResolvedWith(undefined);\n });\n }\n shutdownWithAction(() => Promise.all(actions.map(action => action())), true, error);\n };\n\n if (signal.aborted) {\n abortAlgorithm();\n return;\n }\n\n signal.addEventListener('abort', abortAlgorithm);\n }\n\n // Using reader and writer, read all chunks from this and write them to dest\n // - Backpressure must be enforced\n // - Shutdown must stop all activity\n function pipeLoop() {\n return newPromise((resolveLoop, rejectLoop) => {\n function next(done: boolean) {\n if (done) {\n resolveLoop();\n } else {\n // Use `PerformPromiseThen` instead of `uponPromise` to avoid\n // adding unnecessary `.catch(rethrowAssertionErrorRejection)` handlers\n PerformPromiseThen(pipeStep(), next, rejectLoop);\n }\n }\n\n next(false);\n });\n }\n\n function pipeStep(): Promise {\n if (shuttingDown) {\n return promiseResolvedWith(true);\n }\n\n return PerformPromiseThen(writer._readyPromise, () => {\n return newPromise((resolveRead, rejectRead) => {\n ReadableStreamDefaultReaderRead(\n reader,\n {\n _chunkSteps: chunk => {\n currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, chunk), undefined, noop);\n resolveRead(false);\n },\n _closeSteps: () => resolveRead(true),\n _errorSteps: rejectRead\n }\n );\n });\n });\n }\n\n // Errors must be propagated forward\n isOrBecomesErrored(source, reader._closedPromise, storedError => {\n if (!preventAbort) {\n shutdownWithAction(() => WritableStreamAbort(dest, storedError), true, storedError);\n } else {\n shutdown(true, storedError);\n }\n return null;\n });\n\n // Errors must be propagated backward\n isOrBecomesErrored(dest, writer._closedPromise, storedError => {\n if (!preventCancel) {\n shutdownWithAction(() => ReadableStreamCancel(source, storedError), true, storedError);\n } else {\n shutdown(true, storedError);\n }\n return null;\n });\n\n // Closing must be propagated forward\n isOrBecomesClosed(source, reader._closedPromise, () => {\n if (!preventClose) {\n shutdownWithAction(() => WritableStreamDefaultWriterCloseWithErrorPropagation(writer));\n } else {\n shutdown();\n }\n return null;\n });\n\n // Closing must be propagated backward\n if (WritableStreamCloseQueuedOrInFlight(dest) || dest._state === 'closed') {\n const destClosed = new TypeError('the destination writable stream closed before all data could be piped to it');\n\n if (!preventCancel) {\n shutdownWithAction(() => ReadableStreamCancel(source, destClosed), true, destClosed);\n } else {\n shutdown(true, destClosed);\n }\n }\n\n setPromiseIsHandledToTrue(pipeLoop());\n\n function waitForWritesToFinish(): Promise {\n // Another write may have started while we were waiting on this currentWrite, so we have to be sure to wait\n // for that too.\n const oldCurrentWrite = currentWrite;\n return PerformPromiseThen(\n currentWrite,\n () => oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined\n );\n }\n\n function isOrBecomesErrored(stream: ReadableStream | WritableStream,\n promise: Promise,\n action: (reason: any) => null) {\n if (stream._state === 'errored') {\n action(stream._storedError);\n } else {\n uponRejection(promise, action);\n }\n }\n\n function isOrBecomesClosed(stream: ReadableStream | WritableStream, promise: Promise, action: () => null) {\n if (stream._state === 'closed') {\n action();\n } else {\n uponFulfillment(promise, action);\n }\n }\n\n function shutdownWithAction(action: () => Promise, originalIsError?: boolean, originalError?: any) {\n if (shuttingDown) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && !WritableStreamCloseQueuedOrInFlight(dest)) {\n uponFulfillment(waitForWritesToFinish(), doTheRest);\n } else {\n doTheRest();\n }\n\n function doTheRest(): null {\n uponPromise(\n action(),\n () => finalize(originalIsError, originalError),\n newError => finalize(true, newError)\n );\n return null;\n }\n }\n\n function shutdown(isError?: boolean, error?: any) {\n if (shuttingDown) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && !WritableStreamCloseQueuedOrInFlight(dest)) {\n uponFulfillment(waitForWritesToFinish(), () => finalize(isError, error));\n } else {\n finalize(isError, error);\n }\n }\n\n function finalize(isError?: boolean, error?: any): null {\n WritableStreamDefaultWriterRelease(writer);\n ReadableStreamReaderGenericRelease(reader);\n\n if (signal !== undefined) {\n signal.removeEventListener('abort', abortAlgorithm);\n }\n if (isError) {\n reject(error);\n } else {\n resolve(undefined);\n }\n\n return null;\n }\n });\n}\n","import type { QueuingStrategySizeCallback } from '../queuing-strategy';\nimport assert from '../../stub/assert';\nimport { DequeueValue, EnqueueValueWithSize, type QueuePair, ResetQueue } from '../abstract-ops/queue-with-sizes';\nimport {\n ReadableStreamAddReadRequest,\n ReadableStreamFulfillReadRequest,\n ReadableStreamGetNumReadRequests,\n type ReadRequest\n} from './default-reader';\nimport { SimpleQueue } from '../simple-queue';\nimport { IsReadableStreamLocked, ReadableStream, ReadableStreamClose, ReadableStreamError } from '../readable-stream';\nimport type { ValidatedUnderlyingSource } from './underlying-source';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { CancelSteps, PullSteps, ReleaseSteps } from '../abstract-ops/internal-methods';\nimport { promiseResolvedWith, uponPromise } from '../helpers/webidl';\n\n/**\n * Allows control of a {@link ReadableStream | readable stream}'s state and internal queue.\n *\n * @public\n */\nexport class ReadableStreamDefaultController {\n /** @internal */\n _controlledReadableStream!: ReadableStream;\n /** @internal */\n _queue!: SimpleQueue>;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _closeRequested!: boolean;\n /** @internal */\n _pullAgain!: boolean;\n /** @internal */\n _pulling !: boolean;\n /** @internal */\n _strategySizeAlgorithm!: QueuingStrategySizeCallback;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _pullAlgorithm!: () => Promise;\n /** @internal */\n _cancelAlgorithm!: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is\n * over-full. An underlying source ought to use this information to determine when and how to apply backpressure.\n */\n get desiredSize(): number | null {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n return ReadableStreamDefaultControllerGetDesiredSize(this);\n }\n\n /**\n * Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from\n * the stream, but once those are read, the stream will become closed.\n */\n close(): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('close');\n }\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {\n throw new TypeError('The stream is not in a state that permits close');\n }\n\n ReadableStreamDefaultControllerClose(this);\n }\n\n /**\n * Enqueues the given chunk `chunk` in the controlled readable stream.\n */\n enqueue(chunk: R): void;\n enqueue(chunk: R = undefined!): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {\n throw new TypeError('The stream is not in a state that permits enqueue');\n }\n\n return ReadableStreamDefaultControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.\n */\n error(e: any = undefined): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n\n ReadableStreamDefaultControllerError(this, e);\n }\n\n /** @internal */\n [CancelSteps](reason: any): Promise {\n ResetQueue(this);\n const result = this._cancelAlgorithm(reason);\n ReadableStreamDefaultControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [PullSteps](readRequest: ReadRequest): void {\n const stream = this._controlledReadableStream;\n\n if (this._queue.length > 0) {\n const chunk = DequeueValue(this);\n\n if (this._closeRequested && this._queue.length === 0) {\n ReadableStreamDefaultControllerClearAlgorithms(this);\n ReadableStreamClose(stream);\n } else {\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n }\n\n readRequest._chunkSteps(chunk);\n } else {\n ReadableStreamAddReadRequest(stream, readRequest);\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n }\n }\n\n /** @internal */\n [ReleaseSteps](): void {\n // Do nothing.\n }\n}\n\nObject.defineProperties(ReadableStreamDefaultController.prototype, {\n close: { enumerable: true },\n enqueue: { enumerable: true },\n error: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(ReadableStreamDefaultController.prototype.close, 'close');\nsetFunctionName(ReadableStreamDefaultController.prototype.enqueue, 'enqueue');\nsetFunctionName(ReadableStreamDefaultController.prototype.error, 'error');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamDefaultController',\n configurable: true\n });\n}\n\n// Abstract operations for the ReadableStreamDefaultController.\n\nfunction IsReadableStreamDefaultController(x: any): x is ReadableStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableStream')) {\n return false;\n }\n\n return x instanceof ReadableStreamDefaultController;\n}\n\nfunction ReadableStreamDefaultControllerCallPullIfNeeded(controller: ReadableStreamDefaultController): void {\n const shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);\n if (!shouldPull) {\n return;\n }\n\n if (controller._pulling) {\n controller._pullAgain = true;\n return;\n }\n\n assert(!controller._pullAgain);\n\n controller._pulling = true;\n\n const pullPromise = controller._pullAlgorithm();\n uponPromise(\n pullPromise,\n () => {\n controller._pulling = false;\n\n if (controller._pullAgain) {\n controller._pullAgain = false;\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n }\n\n return null;\n },\n e => {\n ReadableStreamDefaultControllerError(controller, e);\n return null;\n }\n );\n}\n\nfunction ReadableStreamDefaultControllerShouldCallPull(controller: ReadableStreamDefaultController): boolean {\n const stream = controller._controlledReadableStream;\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return false;\n }\n\n if (!controller._started) {\n return false;\n }\n\n if (IsReadableStreamLocked(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n const desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);\n assert(desiredSize !== null);\n if (desiredSize! > 0) {\n return true;\n }\n\n return false;\n}\n\nfunction ReadableStreamDefaultControllerClearAlgorithms(controller: ReadableStreamDefaultController) {\n controller._pullAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n controller._strategySizeAlgorithm = undefined!;\n}\n\n// A client of ReadableStreamDefaultController may use these functions directly to bypass state check.\n\nexport function ReadableStreamDefaultControllerClose(controller: ReadableStreamDefaultController) {\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return;\n }\n\n const stream = controller._controlledReadableStream;\n\n controller._closeRequested = true;\n\n if (controller._queue.length === 0) {\n ReadableStreamDefaultControllerClearAlgorithms(controller);\n ReadableStreamClose(stream);\n }\n}\n\nexport function ReadableStreamDefaultControllerEnqueue(\n controller: ReadableStreamDefaultController,\n chunk: R\n): void {\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return;\n }\n\n const stream = controller._controlledReadableStream;\n\n if (IsReadableStreamLocked(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n ReadableStreamFulfillReadRequest(stream, chunk, false);\n } else {\n let chunkSize;\n try {\n chunkSize = controller._strategySizeAlgorithm(chunk);\n } catch (chunkSizeE) {\n ReadableStreamDefaultControllerError(controller, chunkSizeE);\n throw chunkSizeE;\n }\n\n try {\n EnqueueValueWithSize(controller, chunk, chunkSize);\n } catch (enqueueE) {\n ReadableStreamDefaultControllerError(controller, enqueueE);\n throw enqueueE;\n }\n }\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n}\n\nexport function ReadableStreamDefaultControllerError(controller: ReadableStreamDefaultController, e: any) {\n const stream = controller._controlledReadableStream;\n\n if (stream._state !== 'readable') {\n return;\n }\n\n ResetQueue(controller);\n\n ReadableStreamDefaultControllerClearAlgorithms(controller);\n ReadableStreamError(stream, e);\n}\n\nexport function ReadableStreamDefaultControllerGetDesiredSize(\n controller: ReadableStreamDefaultController\n): number | null {\n const state = controller._controlledReadableStream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\n// This is used in the implementation of TransformStream.\nexport function ReadableStreamDefaultControllerHasBackpressure(\n controller: ReadableStreamDefaultController\n): boolean {\n if (ReadableStreamDefaultControllerShouldCallPull(controller)) {\n return false;\n }\n\n return true;\n}\n\nexport function ReadableStreamDefaultControllerCanCloseOrEnqueue(\n controller: ReadableStreamDefaultController\n): boolean {\n const state = controller._controlledReadableStream._state;\n\n if (!controller._closeRequested && state === 'readable') {\n return true;\n }\n\n return false;\n}\n\nexport function SetUpReadableStreamDefaultController(stream: ReadableStream,\n controller: ReadableStreamDefaultController,\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n assert(stream._readableStreamController === undefined);\n\n controller._controlledReadableStream = stream;\n\n controller._queue = undefined!;\n controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._started = false;\n controller._closeRequested = false;\n controller._pullAgain = false;\n controller._pulling = false;\n\n controller._strategySizeAlgorithm = sizeAlgorithm;\n controller._strategyHWM = highWaterMark;\n\n controller._pullAlgorithm = pullAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n stream._readableStreamController = controller;\n\n const startResult = startAlgorithm();\n uponPromise(\n promiseResolvedWith(startResult),\n () => {\n controller._started = true;\n\n assert(!controller._pulling);\n assert(!controller._pullAgain);\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n return null;\n },\n r => {\n ReadableStreamDefaultControllerError(controller, r);\n return null;\n }\n );\n}\n\nexport function SetUpReadableStreamDefaultControllerFromUnderlyingSource(\n stream: ReadableStream,\n underlyingSource: ValidatedUnderlyingSource,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback\n) {\n const controller: ReadableStreamDefaultController = Object.create(ReadableStreamDefaultController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let pullAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (underlyingSource.start !== undefined) {\n startAlgorithm = () => underlyingSource.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingSource.pull !== undefined) {\n pullAlgorithm = () => underlyingSource.pull!(controller);\n } else {\n pullAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSource.cancel !== undefined) {\n cancelAlgorithm = reason => underlyingSource.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpReadableStreamDefaultController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm\n );\n}\n\n// Helper functions for the ReadableStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamDefaultController.prototype.${name} can only be used on a ReadableStreamDefaultController`);\n}\n","import {\n CreateReadableByteStream,\n CreateReadableStream,\n type DefaultReadableStream,\n IsReadableStream,\n type ReadableByteStream,\n ReadableStream,\n ReadableStreamCancel,\n type ReadableStreamReader\n} from '../readable-stream';\nimport { ReadableStreamReaderGenericRelease } from './generic-reader';\nimport {\n AcquireReadableStreamDefaultReader,\n IsReadableStreamDefaultReader,\n ReadableStreamDefaultReaderRead,\n type ReadRequest\n} from './default-reader';\nimport {\n AcquireReadableStreamBYOBReader,\n IsReadableStreamBYOBReader,\n ReadableStreamBYOBReaderRead,\n type ReadIntoRequest\n} from './byob-reader';\nimport assert from '../../stub/assert';\nimport { newPromise, promiseResolvedWith, queueMicrotask, uponRejection } from '../helpers/webidl';\nimport {\n ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError\n} from './default-controller';\nimport {\n IsReadableByteStreamController,\n ReadableByteStreamControllerClose,\n ReadableByteStreamControllerEnqueue,\n ReadableByteStreamControllerError,\n ReadableByteStreamControllerGetBYOBRequest,\n ReadableByteStreamControllerRespond,\n ReadableByteStreamControllerRespondWithNewView\n} from './byte-stream-controller';\nimport { CreateArrayFromList } from '../abstract-ops/ecmascript';\nimport { CloneAsUint8Array } from '../abstract-ops/miscellaneous';\nimport type { NonShared } from '../helpers/array-buffer-view';\n\nexport function ReadableStreamTee(stream: ReadableStream,\n cloneForBranch2: boolean): [ReadableStream, ReadableStream] {\n assert(IsReadableStream(stream));\n assert(typeof cloneForBranch2 === 'boolean');\n if (IsReadableByteStreamController(stream._readableStreamController)) {\n return ReadableByteStreamTee(stream as unknown as ReadableByteStream) as\n unknown as [ReadableStream, ReadableStream];\n }\n return ReadableStreamDefaultTee(stream, cloneForBranch2);\n}\n\nexport function ReadableStreamDefaultTee(\n stream: ReadableStream,\n cloneForBranch2: boolean\n): [DefaultReadableStream, DefaultReadableStream] {\n assert(IsReadableStream(stream));\n assert(typeof cloneForBranch2 === 'boolean');\n\n const reader = AcquireReadableStreamDefaultReader(stream);\n\n let reading = false;\n let readAgain = false;\n let canceled1 = false;\n let canceled2 = false;\n let reason1: any;\n let reason2: any;\n let branch1: DefaultReadableStream;\n let branch2: DefaultReadableStream;\n\n let resolveCancelPromise: (value: undefined | Promise) => void;\n const cancelPromise = newPromise(resolve => {\n resolveCancelPromise = resolve;\n });\n\n function pullAlgorithm(): Promise {\n if (reading) {\n readAgain = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgain = false;\n const chunk1 = chunk;\n const chunk2 = chunk;\n\n // There is no way to access the cloning code right now in the reference implementation.\n // If we add one then we'll need an implementation for serializable objects.\n // if (!canceled2 && cloneForBranch2) {\n // chunk2 = StructuredDeserialize(StructuredSerialize(chunk2));\n // }\n\n if (!canceled1) {\n ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, chunk1);\n }\n if (!canceled2) {\n ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, chunk2);\n }\n\n reading = false;\n if (readAgain) {\n pullAlgorithm();\n }\n });\n },\n _closeSteps: () => {\n reading = false;\n if (!canceled1) {\n ReadableStreamDefaultControllerClose(branch1._readableStreamController);\n }\n if (!canceled2) {\n ReadableStreamDefaultControllerClose(branch2._readableStreamController);\n }\n\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n\n return promiseResolvedWith(undefined);\n }\n\n function cancel1Algorithm(reason: any): Promise {\n canceled1 = true;\n reason1 = reason;\n if (canceled2) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function cancel2Algorithm(reason: any): Promise {\n canceled2 = true;\n reason2 = reason;\n if (canceled1) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function startAlgorithm() {\n // do nothing\n }\n\n branch1 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel1Algorithm);\n branch2 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel2Algorithm);\n\n uponRejection(reader._closedPromise, (r: any) => {\n ReadableStreamDefaultControllerError(branch1._readableStreamController, r);\n ReadableStreamDefaultControllerError(branch2._readableStreamController, r);\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n return null;\n });\n\n return [branch1, branch2];\n}\n\nexport function ReadableByteStreamTee(stream: ReadableByteStream): [ReadableByteStream, ReadableByteStream] {\n assert(IsReadableStream(stream));\n assert(IsReadableByteStreamController(stream._readableStreamController));\n\n let reader: ReadableStreamReader> = AcquireReadableStreamDefaultReader(stream);\n let reading = false;\n let readAgainForBranch1 = false;\n let readAgainForBranch2 = false;\n let canceled1 = false;\n let canceled2 = false;\n let reason1: any;\n let reason2: any;\n let branch1: ReadableByteStream;\n let branch2: ReadableByteStream;\n\n let resolveCancelPromise: (value: undefined | Promise) => void;\n const cancelPromise = newPromise(resolve => {\n resolveCancelPromise = resolve;\n });\n\n function forwardReaderError(thisReader: ReadableStreamReader>) {\n uponRejection(thisReader._closedPromise, r => {\n if (thisReader !== reader) {\n return null;\n }\n ReadableByteStreamControllerError(branch1._readableStreamController, r);\n ReadableByteStreamControllerError(branch2._readableStreamController, r);\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n return null;\n });\n }\n\n function pullWithDefaultReader() {\n if (IsReadableStreamBYOBReader(reader)) {\n assert(reader._readIntoRequests.length === 0);\n ReadableStreamReaderGenericRelease(reader);\n\n reader = AcquireReadableStreamDefaultReader(stream);\n forwardReaderError(reader);\n }\n\n const readRequest: ReadRequest> = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgainForBranch1 = false;\n readAgainForBranch2 = false;\n\n const chunk1 = chunk;\n let chunk2 = chunk;\n if (!canceled1 && !canceled2) {\n try {\n chunk2 = CloneAsUint8Array(chunk);\n } catch (cloneE) {\n ReadableByteStreamControllerError(branch1._readableStreamController, cloneE);\n ReadableByteStreamControllerError(branch2._readableStreamController, cloneE);\n resolveCancelPromise(ReadableStreamCancel(stream, cloneE));\n return;\n }\n }\n\n if (!canceled1) {\n ReadableByteStreamControllerEnqueue(branch1._readableStreamController, chunk1);\n }\n if (!canceled2) {\n ReadableByteStreamControllerEnqueue(branch2._readableStreamController, chunk2);\n }\n\n reading = false;\n if (readAgainForBranch1) {\n pull1Algorithm();\n } else if (readAgainForBranch2) {\n pull2Algorithm();\n }\n });\n },\n _closeSteps: () => {\n reading = false;\n if (!canceled1) {\n ReadableByteStreamControllerClose(branch1._readableStreamController);\n }\n if (!canceled2) {\n ReadableByteStreamControllerClose(branch2._readableStreamController);\n }\n if (branch1._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(branch1._readableStreamController, 0);\n }\n if (branch2._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(branch2._readableStreamController, 0);\n }\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n }\n\n function pullWithBYOBReader(view: NonShared, forBranch2: boolean) {\n if (IsReadableStreamDefaultReader>(reader)) {\n assert(reader._readRequests.length === 0);\n ReadableStreamReaderGenericRelease(reader);\n\n reader = AcquireReadableStreamBYOBReader(stream);\n forwardReaderError(reader);\n }\n\n const byobBranch = forBranch2 ? branch2 : branch1;\n const otherBranch = forBranch2 ? branch1 : branch2;\n\n const readIntoRequest: ReadIntoRequest> = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgainForBranch1 = false;\n readAgainForBranch2 = false;\n\n const byobCanceled = forBranch2 ? canceled2 : canceled1;\n const otherCanceled = forBranch2 ? canceled1 : canceled2;\n\n if (!otherCanceled) {\n let clonedChunk;\n try {\n clonedChunk = CloneAsUint8Array(chunk);\n } catch (cloneE) {\n ReadableByteStreamControllerError(byobBranch._readableStreamController, cloneE);\n ReadableByteStreamControllerError(otherBranch._readableStreamController, cloneE);\n resolveCancelPromise(ReadableStreamCancel(stream, cloneE));\n return;\n }\n if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n ReadableByteStreamControllerEnqueue(otherBranch._readableStreamController, clonedChunk);\n } else if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n\n reading = false;\n if (readAgainForBranch1) {\n pull1Algorithm();\n } else if (readAgainForBranch2) {\n pull2Algorithm();\n }\n });\n },\n _closeSteps: chunk => {\n reading = false;\n\n const byobCanceled = forBranch2 ? canceled2 : canceled1;\n const otherCanceled = forBranch2 ? canceled1 : canceled2;\n\n if (!byobCanceled) {\n ReadableByteStreamControllerClose(byobBranch._readableStreamController);\n }\n if (!otherCanceled) {\n ReadableByteStreamControllerClose(otherBranch._readableStreamController);\n }\n\n if (chunk !== undefined) {\n assert(chunk.byteLength === 0);\n\n if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n if (!otherCanceled && otherBranch._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(otherBranch._readableStreamController, 0);\n }\n }\n\n if (!byobCanceled || !otherCanceled) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamBYOBReaderRead(reader, view, 1, readIntoRequest);\n }\n\n function pull1Algorithm(): Promise {\n if (reading) {\n readAgainForBranch1 = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch1._readableStreamController);\n if (byobRequest === null) {\n pullWithDefaultReader();\n } else {\n pullWithBYOBReader(byobRequest._view!, false);\n }\n\n return promiseResolvedWith(undefined);\n }\n\n function pull2Algorithm(): Promise {\n if (reading) {\n readAgainForBranch2 = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch2._readableStreamController);\n if (byobRequest === null) {\n pullWithDefaultReader();\n } else {\n pullWithBYOBReader(byobRequest._view!, true);\n }\n\n return promiseResolvedWith(undefined);\n }\n\n function cancel1Algorithm(reason: any): Promise {\n canceled1 = true;\n reason1 = reason;\n if (canceled2) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function cancel2Algorithm(reason: any): Promise {\n canceled2 = true;\n reason2 = reason;\n if (canceled1) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function startAlgorithm(): void {\n return;\n }\n\n branch1 = CreateReadableByteStream(startAlgorithm, pull1Algorithm, cancel1Algorithm);\n branch2 = CreateReadableByteStream(startAlgorithm, pull2Algorithm, cancel2Algorithm);\n\n forwardReaderError(reader);\n\n return [branch1, branch2];\n}\n","import { typeIsObject } from '../helpers/miscellaneous';\nimport type { ReadableStreamDefaultReadResult } from './default-reader';\n\n/**\n * A common interface for a `ReadadableStream` implementation.\n *\n * @public\n */\nexport interface ReadableStreamLike {\n readonly locked: boolean;\n\n getReader(): ReadableStreamDefaultReaderLike;\n}\n\n/**\n * A common interface for a `ReadableStreamDefaultReader` implementation.\n *\n * @public\n */\nexport interface ReadableStreamDefaultReaderLike {\n readonly closed: Promise;\n\n cancel(reason?: any): Promise;\n\n read(): Promise>;\n\n releaseLock(): void;\n}\n\nexport function isReadableStreamLike(stream: unknown): stream is ReadableStreamLike {\n return typeIsObject(stream) && typeof (stream as ReadableStreamLike).getReader !== 'undefined';\n}\n","import { CreateReadableStream, type DefaultReadableStream } from '../readable-stream';\nimport {\n isReadableStreamLike,\n type ReadableStreamDefaultReaderLike,\n type ReadableStreamLike\n} from './readable-stream-like';\nimport { ReadableStreamDefaultControllerClose, ReadableStreamDefaultControllerEnqueue } from './default-controller';\nimport { GetIterator, GetMethod, IteratorComplete, IteratorNext, IteratorValue } from '../abstract-ops/ecmascript';\nimport { promiseRejectedWith, promiseResolvedWith, reflectCall, transformPromiseWith } from '../helpers/webidl';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport { noop } from '../../utils';\n\nexport function ReadableStreamFrom(\n source: Iterable | AsyncIterable | ReadableStreamLike\n): DefaultReadableStream {\n if (isReadableStreamLike(source)) {\n return ReadableStreamFromDefaultReader(source.getReader());\n }\n return ReadableStreamFromIterable(source);\n}\n\nexport function ReadableStreamFromIterable(asyncIterable: Iterable | AsyncIterable): DefaultReadableStream {\n let stream: DefaultReadableStream;\n const iteratorRecord = GetIterator(asyncIterable, 'async');\n\n const startAlgorithm = noop;\n\n function pullAlgorithm(): Promise {\n let nextResult;\n try {\n nextResult = IteratorNext(iteratorRecord);\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const nextPromise = promiseResolvedWith(nextResult);\n return transformPromiseWith(nextPromise, iterResult => {\n if (!typeIsObject(iterResult)) {\n throw new TypeError('The promise returned by the iterator.next() method must fulfill with an object');\n }\n const done = IteratorComplete(iterResult);\n if (done) {\n ReadableStreamDefaultControllerClose(stream._readableStreamController);\n } else {\n const value = IteratorValue(iterResult);\n ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);\n }\n });\n }\n\n function cancelAlgorithm(reason: any): Promise {\n const iterator = iteratorRecord.iterator;\n let returnMethod: (typeof iterator)['return'] | undefined;\n try {\n returnMethod = GetMethod(iterator, 'return');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n if (returnMethod === undefined) {\n return promiseResolvedWith(undefined);\n }\n let returnResult: IteratorResult | Promise>;\n try {\n returnResult = reflectCall(returnMethod, iterator, [reason]);\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const returnPromise = promiseResolvedWith(returnResult);\n return transformPromiseWith(returnPromise, iterResult => {\n if (!typeIsObject(iterResult)) {\n throw new TypeError('The promise returned by the iterator.return() method must fulfill with an object');\n }\n return undefined;\n });\n }\n\n stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);\n return stream;\n}\n\nexport function ReadableStreamFromDefaultReader(\n reader: ReadableStreamDefaultReaderLike\n): DefaultReadableStream {\n let stream: DefaultReadableStream;\n\n const startAlgorithm = noop;\n\n function pullAlgorithm(): Promise {\n let readPromise;\n try {\n readPromise = reader.read();\n } catch (e) {\n return promiseRejectedWith(e);\n }\n return transformPromiseWith(readPromise, readResult => {\n if (!typeIsObject(readResult)) {\n throw new TypeError('The promise returned by the reader.read() method must fulfill with an object');\n }\n if (readResult.done) {\n ReadableStreamDefaultControllerClose(stream._readableStreamController);\n } else {\n const value = readResult.value;\n ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);\n }\n });\n }\n\n function cancelAlgorithm(reason: any): Promise {\n try {\n return promiseResolvedWith(reader.cancel(reason));\n } catch (e) {\n return promiseRejectedWith(e);\n }\n }\n\n stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);\n return stream;\n}\n","import { assertDictionary, assertFunction, convertUnsignedLongLongWithEnforceRange } from './basic';\nimport type {\n ReadableStreamController,\n UnderlyingByteSource,\n UnderlyingDefaultOrByteSource,\n UnderlyingDefaultOrByteSourcePullCallback,\n UnderlyingDefaultOrByteSourceStartCallback,\n UnderlyingSource,\n UnderlyingSourceCancelCallback,\n ValidatedUnderlyingDefaultOrByteSource\n} from '../readable-stream/underlying-source';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\n\nexport function convertUnderlyingDefaultOrByteSource(\n source: UnderlyingSource | UnderlyingByteSource | null,\n context: string\n): ValidatedUnderlyingDefaultOrByteSource {\n assertDictionary(source, context);\n const original = source as (UnderlyingDefaultOrByteSource | null);\n const autoAllocateChunkSize = original?.autoAllocateChunkSize;\n const cancel = original?.cancel;\n const pull = original?.pull;\n const start = original?.start;\n const type = original?.type;\n return {\n autoAllocateChunkSize: autoAllocateChunkSize === undefined ?\n undefined :\n convertUnsignedLongLongWithEnforceRange(\n autoAllocateChunkSize,\n `${context} has member 'autoAllocateChunkSize' that`\n ),\n cancel: cancel === undefined ?\n undefined :\n convertUnderlyingSourceCancelCallback(cancel, original!, `${context} has member 'cancel' that`),\n pull: pull === undefined ?\n undefined :\n convertUnderlyingSourcePullCallback(pull, original!, `${context} has member 'pull' that`),\n start: start === undefined ?\n undefined :\n convertUnderlyingSourceStartCallback(start, original!, `${context} has member 'start' that`),\n type: type === undefined ? undefined : convertReadableStreamType(type, `${context} has member 'type' that`)\n };\n}\n\nfunction convertUnderlyingSourceCancelCallback(\n fn: UnderlyingSourceCancelCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n\nfunction convertUnderlyingSourcePullCallback(\n fn: UnderlyingDefaultOrByteSourcePullCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): (controller: ReadableStreamController) => Promise {\n assertFunction(fn, context);\n return (controller: ReadableStreamController) => promiseCall(fn, original, [controller]);\n}\n\nfunction convertUnderlyingSourceStartCallback(\n fn: UnderlyingDefaultOrByteSourceStartCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): UnderlyingDefaultOrByteSourceStartCallback {\n assertFunction(fn, context);\n return (controller: ReadableStreamController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertReadableStreamType(type: string, context: string): 'bytes' {\n type = `${type}`;\n if (type !== 'bytes') {\n throw new TypeError(`${context} '${type}' is not a valid enumeration value for ReadableStreamType`);\n }\n return type;\n}\n","import { assertDictionary } from './basic';\nimport type {\n ReadableStreamIteratorOptions,\n ValidatedReadableStreamIteratorOptions\n} from '../readable-stream/iterator-options';\n\nexport function convertIteratorOptions(options: ReadableStreamIteratorOptions | null | undefined,\n context: string): ValidatedReadableStreamIteratorOptions {\n assertDictionary(options, context);\n const preventCancel = options?.preventCancel;\n return { preventCancel: Boolean(preventCancel) };\n}\n","import { assertDictionary } from './basic';\nimport type { StreamPipeOptions, ValidatedStreamPipeOptions } from '../readable-stream/pipe-options';\nimport { type AbortSignal, isAbortSignal } from '../abort-signal';\n\nexport function convertPipeOptions(options: StreamPipeOptions | null | undefined,\n context: string): ValidatedStreamPipeOptions {\n assertDictionary(options, context);\n const preventAbort = options?.preventAbort;\n const preventCancel = options?.preventCancel;\n const preventClose = options?.preventClose;\n const signal = options?.signal;\n if (signal !== undefined) {\n assertAbortSignal(signal, `${context} has member 'signal' that`);\n }\n return {\n preventAbort: Boolean(preventAbort),\n preventCancel: Boolean(preventCancel),\n preventClose: Boolean(preventClose),\n signal\n };\n}\n\nfunction assertAbortSignal(signal: unknown, context: string): asserts signal is AbortSignal {\n if (!isAbortSignal(signal)) {\n throw new TypeError(`${context} is not an AbortSignal.`);\n }\n}\n","import { assertDictionary, assertRequiredField } from './basic';\nimport { ReadableStream } from '../readable-stream';\nimport { WritableStream } from '../writable-stream';\nimport { assertReadableStream } from './readable-stream';\nimport { assertWritableStream } from './writable-stream';\n\nexport function convertReadableWritablePair(\n pair: { readable: RS; writable: WS } | null | undefined,\n context: string\n): { readable: RS; writable: WS } {\n assertDictionary(pair, context);\n\n const readable = pair?.readable;\n assertRequiredField(readable, 'readable', 'ReadableWritablePair');\n assertReadableStream(readable, `${context} has member 'readable' that`);\n\n const writable = pair?.writable;\n assertRequiredField(writable, 'writable', 'ReadableWritablePair');\n assertWritableStream(writable, `${context} has member 'writable' that`);\n\n return { readable, writable };\n}\n","import assert from '../stub/assert';\nimport {\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n transformPromiseWith\n} from './helpers/webidl';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { AcquireReadableStreamAsyncIterator, type ReadableStreamAsyncIterator } from './readable-stream/async-iterator';\nimport { defaultReaderClosedPromiseReject, defaultReaderClosedPromiseResolve } from './readable-stream/generic-reader';\nimport {\n AcquireReadableStreamDefaultReader,\n IsReadableStreamDefaultReader,\n ReadableStreamDefaultReader,\n ReadableStreamDefaultReaderErrorReadRequests,\n type ReadableStreamDefaultReadResult\n} from './readable-stream/default-reader';\nimport {\n AcquireReadableStreamBYOBReader,\n IsReadableStreamBYOBReader,\n ReadableStreamBYOBReader,\n ReadableStreamBYOBReaderErrorReadIntoRequests,\n type ReadableStreamBYOBReadResult\n} from './readable-stream/byob-reader';\nimport { ReadableStreamPipeTo } from './readable-stream/pipe';\nimport { ReadableStreamTee } from './readable-stream/tee';\nimport { ReadableStreamFrom } from './readable-stream/from';\nimport { IsWritableStream, IsWritableStreamLocked, WritableStream } from './writable-stream';\nimport { SimpleQueue } from './simple-queue';\nimport {\n ReadableByteStreamController,\n ReadableStreamBYOBRequest,\n SetUpReadableByteStreamController,\n SetUpReadableByteStreamControllerFromUnderlyingSource\n} from './readable-stream/byte-stream-controller';\nimport {\n ReadableStreamDefaultController,\n SetUpReadableStreamDefaultController,\n SetUpReadableStreamDefaultControllerFromUnderlyingSource\n} from './readable-stream/default-controller';\nimport type {\n UnderlyingByteSource,\n UnderlyingByteSourcePullCallback,\n UnderlyingByteSourceStartCallback,\n UnderlyingSource,\n UnderlyingSourceCancelCallback,\n UnderlyingSourcePullCallback,\n UnderlyingSourceStartCallback\n} from './readable-stream/underlying-source';\nimport { noop } from '../utils';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { CreateArrayFromList, SymbolAsyncIterator } from './abstract-ops/ecmascript';\nimport { CancelSteps } from './abstract-ops/internal-methods';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { assertObject, assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport { convertUnderlyingDefaultOrByteSource } from './validators/underlying-source';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ReadableStreamGetReaderOptions\n} from './readable-stream/reader-options';\nimport { convertReaderOptions } from './validators/reader-options';\nimport type { StreamPipeOptions, ValidatedStreamPipeOptions } from './readable-stream/pipe-options';\nimport type { ReadableStreamIteratorOptions } from './readable-stream/iterator-options';\nimport { convertIteratorOptions } from './validators/iterator-options';\nimport { convertPipeOptions } from './validators/pipe-options';\nimport type { ReadableWritablePair } from './readable-stream/readable-writable-pair';\nimport { convertReadableWritablePair } from './validators/readable-writable-pair';\nimport type { ReadableStreamDefaultReaderLike, ReadableStreamLike } from './readable-stream/readable-stream-like';\nimport type { NonShared } from './helpers/array-buffer-view';\n\nexport type DefaultReadableStream = ReadableStream & {\n _readableStreamController: ReadableStreamDefaultController\n};\n\nexport type ReadableByteStream = ReadableStream> & {\n _readableStreamController: ReadableByteStreamController\n};\n\ntype ReadableStreamState = 'readable' | 'closed' | 'errored';\n\n/**\n * A readable stream represents a source of data, from which you can read.\n *\n * @public\n */\nexport class ReadableStream implements AsyncIterable {\n /** @internal */\n _state!: ReadableStreamState;\n /** @internal */\n _reader: ReadableStreamReader | undefined;\n /** @internal */\n _storedError: any;\n /** @internal */\n _disturbed!: boolean;\n /** @internal */\n _readableStreamController!: ReadableStreamDefaultController | ReadableByteStreamController;\n\n constructor(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number; size?: undefined });\n constructor(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy);\n constructor(rawUnderlyingSource: UnderlyingSource | UnderlyingByteSource | null | undefined = {},\n rawStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawUnderlyingSource === undefined) {\n rawUnderlyingSource = null;\n } else {\n assertObject(rawUnderlyingSource, 'First parameter');\n }\n\n const strategy = convertQueuingStrategy(rawStrategy, 'Second parameter');\n const underlyingSource = convertUnderlyingDefaultOrByteSource(rawUnderlyingSource, 'First parameter');\n\n InitializeReadableStream(this);\n\n if (underlyingSource.type === 'bytes') {\n if (strategy.size !== undefined) {\n throw new RangeError('The strategy for a byte stream cannot have a size function');\n }\n const highWaterMark = ExtractHighWaterMark(strategy, 0);\n SetUpReadableByteStreamControllerFromUnderlyingSource(\n this as unknown as ReadableByteStream,\n underlyingSource,\n highWaterMark\n );\n } else {\n assert(underlyingSource.type === undefined);\n const sizeAlgorithm = ExtractSizeAlgorithm(strategy);\n const highWaterMark = ExtractHighWaterMark(strategy, 1);\n SetUpReadableStreamDefaultControllerFromUnderlyingSource(\n this,\n underlyingSource,\n highWaterMark,\n sizeAlgorithm\n );\n }\n }\n\n /**\n * Whether or not the readable stream is locked to a {@link ReadableStreamDefaultReader | reader}.\n */\n get locked(): boolean {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('locked');\n }\n\n return IsReadableStreamLocked(this);\n }\n\n /**\n * Cancels the stream, signaling a loss of interest in the stream by a consumer.\n *\n * The supplied `reason` argument will be given to the underlying source's {@link UnderlyingSource.cancel | cancel()}\n * method, which might or might not use it.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('cancel'));\n }\n\n if (IsReadableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot cancel a stream that already has a reader'));\n }\n\n return ReadableStreamCancel(this, reason);\n }\n\n /**\n * Creates a {@link ReadableStreamBYOBReader} and locks the stream to the new reader.\n *\n * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams,\n * i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading.\n * The returned BYOB reader provides the ability to directly read individual chunks from the stream via its\n * {@link ReadableStreamBYOBReader.read | read()} method, into developer-supplied buffers, allowing more precise\n * control over allocation.\n */\n getReader({ mode }: { mode: 'byob' }): ReadableStreamBYOBReader;\n /**\n * Creates a {@link ReadableStreamDefaultReader} and locks the stream to the new reader.\n * While the stream is locked, no other reader can be acquired until this one is released.\n *\n * This functionality is especially useful for creating abstractions that desire the ability to consume a stream\n * in its entirety. By getting a reader for the stream, you can ensure nobody else can interleave reads with yours\n * or cancel the stream, which would interfere with your abstraction.\n */\n getReader(): ReadableStreamDefaultReader;\n getReader(\n rawOptions: ReadableStreamGetReaderOptions | null | undefined = undefined\n ): ReadableStreamDefaultReader | ReadableStreamBYOBReader {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('getReader');\n }\n\n const options = convertReaderOptions(rawOptions, 'First parameter');\n\n if (options.mode === undefined) {\n return AcquireReadableStreamDefaultReader(this);\n }\n\n assert(options.mode === 'byob');\n return AcquireReadableStreamBYOBReader(this as unknown as ReadableByteStream);\n }\n\n /**\n * Provides a convenient, chainable way of piping this readable stream through a transform stream\n * (or any other `{ writable, readable }` pair). It simply {@link ReadableStream.pipeTo | pipes} the stream\n * into the writable side of the supplied pair, and returns the readable side for further use.\n *\n * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n */\n pipeThrough(\n transform: { readable: RS; writable: WritableStream },\n options?: StreamPipeOptions\n ): RS;\n pipeThrough(\n rawTransform: { readable: RS; writable: WritableStream } | null | undefined,\n rawOptions: StreamPipeOptions | null | undefined = {}\n ): RS {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('pipeThrough');\n }\n assertRequiredArgument(rawTransform, 1, 'pipeThrough');\n\n const transform = convertReadableWritablePair(rawTransform, 'First parameter');\n const options = convertPipeOptions(rawOptions, 'Second parameter');\n\n if (IsReadableStreamLocked(this)) {\n throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream');\n }\n if (IsWritableStreamLocked(transform.writable)) {\n throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream');\n }\n\n const promise = ReadableStreamPipeTo(\n this, transform.writable, options.preventClose, options.preventAbort, options.preventCancel, options.signal\n );\n\n setPromiseIsHandledToTrue(promise);\n\n return transform.readable;\n }\n\n /**\n * Pipes this readable stream to a given writable stream. The way in which the piping process behaves under\n * various error conditions can be customized with a number of passed options. It returns a promise that fulfills\n * when the piping process completes successfully, or rejects if any errors were encountered.\n *\n * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n */\n pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise;\n pipeTo(destination: WritableStream | null | undefined,\n rawOptions: StreamPipeOptions | null | undefined = {}): Promise {\n if (!IsReadableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('pipeTo'));\n }\n\n if (destination === undefined) {\n return promiseRejectedWith(`Parameter 1 is required in 'pipeTo'.`);\n }\n if (!IsWritableStream(destination)) {\n return promiseRejectedWith(\n new TypeError(`ReadableStream.prototype.pipeTo's first argument must be a WritableStream`)\n );\n }\n\n let options: ValidatedStreamPipeOptions;\n try {\n options = convertPipeOptions(rawOptions, 'Second parameter');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n\n if (IsReadableStreamLocked(this)) {\n return promiseRejectedWith(\n new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream')\n );\n }\n if (IsWritableStreamLocked(destination)) {\n return promiseRejectedWith(\n new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream')\n );\n }\n\n return ReadableStreamPipeTo(\n this, destination, options.preventClose, options.preventAbort, options.preventCancel, options.signal\n );\n }\n\n /**\n * Tees this readable stream, returning a two-element array containing the two resulting branches as\n * new {@link ReadableStream} instances.\n *\n * Teeing a stream will lock it, preventing any other consumer from acquiring a reader.\n * To cancel the stream, cancel both of the resulting branches; a composite cancellation reason will then be\n * propagated to the stream's underlying source.\n *\n * Note that the chunks seen in each branch will be the same object. If the chunks are not immutable,\n * this could allow interference between the two branches.\n */\n tee(): [ReadableStream, ReadableStream] {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('tee');\n }\n\n const branches = ReadableStreamTee(this, false);\n return CreateArrayFromList(branches);\n }\n\n /**\n * Asynchronously iterates over the chunks in the stream's internal queue.\n *\n * Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader.\n * The lock will be released if the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method\n * is called, e.g. by breaking out of the loop.\n *\n * By default, calling the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method will also\n * cancel the stream. To prevent this, use the stream's {@link ReadableStream.values | values()} method, passing\n * `true` for the `preventCancel` option.\n */\n values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator;\n values(rawOptions: ReadableStreamIteratorOptions | null | undefined = undefined): ReadableStreamAsyncIterator {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('values');\n }\n\n const options = convertIteratorOptions(rawOptions, 'First parameter');\n return AcquireReadableStreamAsyncIterator(this, options.preventCancel);\n }\n\n /**\n * {@inheritDoc ReadableStream.values}\n */\n [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator;\n\n [SymbolAsyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator {\n // Stub implementation, overridden below\n return this.values(options);\n }\n\n /**\n * Creates a new ReadableStream wrapping the provided iterable or async iterable.\n *\n * This can be used to adapt various kinds of objects into a readable stream,\n * such as an array, an async generator, or a Node.js readable stream.\n */\n static from(asyncIterable: Iterable | AsyncIterable | ReadableStreamLike): ReadableStream {\n return ReadableStreamFrom(asyncIterable);\n }\n}\n\nObject.defineProperties(ReadableStream, {\n from: { enumerable: true }\n});\nObject.defineProperties(ReadableStream.prototype, {\n cancel: { enumerable: true },\n getReader: { enumerable: true },\n pipeThrough: { enumerable: true },\n pipeTo: { enumerable: true },\n tee: { enumerable: true },\n values: { enumerable: true },\n locked: { enumerable: true }\n});\nsetFunctionName(ReadableStream.from, 'from');\nsetFunctionName(ReadableStream.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStream.prototype.getReader, 'getReader');\nsetFunctionName(ReadableStream.prototype.pipeThrough, 'pipeThrough');\nsetFunctionName(ReadableStream.prototype.pipeTo, 'pipeTo');\nsetFunctionName(ReadableStream.prototype.tee, 'tee');\nsetFunctionName(ReadableStream.prototype.values, 'values');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStream.prototype, Symbol.toStringTag, {\n value: 'ReadableStream',\n configurable: true\n });\n}\nObject.defineProperty(ReadableStream.prototype, SymbolAsyncIterator, {\n value: ReadableStream.prototype.values,\n writable: true,\n configurable: true\n});\n\nexport type {\n ReadableStreamAsyncIterator,\n ReadableStreamDefaultReadResult,\n ReadableStreamBYOBReadResult,\n ReadableStreamBYOBReaderReadOptions,\n UnderlyingByteSource,\n UnderlyingSource,\n UnderlyingSourceStartCallback,\n UnderlyingSourcePullCallback,\n UnderlyingSourceCancelCallback,\n UnderlyingByteSourceStartCallback,\n UnderlyingByteSourcePullCallback,\n StreamPipeOptions,\n ReadableWritablePair,\n ReadableStreamIteratorOptions,\n ReadableStreamLike,\n ReadableStreamDefaultReaderLike\n};\n\n// Abstract operations for the ReadableStream.\n\n// Throws if and only if startAlgorithm throws.\nexport function CreateReadableStream(\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark = 1,\n sizeAlgorithm: QueuingStrategySizeCallback = () => 1\n): DefaultReadableStream {\n assert(IsNonNegativeNumber(highWaterMark));\n\n const stream: DefaultReadableStream = Object.create(ReadableStream.prototype);\n InitializeReadableStream(stream);\n\n const controller: ReadableStreamDefaultController = Object.create(ReadableStreamDefaultController.prototype);\n SetUpReadableStreamDefaultController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm\n );\n\n return stream;\n}\n\n// Throws if and only if startAlgorithm throws.\nexport function CreateReadableByteStream(\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise\n): ReadableByteStream {\n const stream: ReadableByteStream = Object.create(ReadableStream.prototype);\n InitializeReadableStream(stream);\n\n const controller: ReadableByteStreamController = Object.create(ReadableByteStreamController.prototype);\n SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, 0, undefined);\n\n return stream;\n}\n\nfunction InitializeReadableStream(stream: ReadableStream) {\n stream._state = 'readable';\n stream._reader = undefined;\n stream._storedError = undefined;\n stream._disturbed = false;\n}\n\nexport function IsReadableStream(x: unknown): x is ReadableStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {\n return false;\n }\n\n return x instanceof ReadableStream;\n}\n\nexport function IsReadableStreamDisturbed(stream: ReadableStream): boolean {\n assert(IsReadableStream(stream));\n\n return stream._disturbed;\n}\n\nexport function IsReadableStreamLocked(stream: ReadableStream): boolean {\n assert(IsReadableStream(stream));\n\n if (stream._reader === undefined) {\n return false;\n }\n\n return true;\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamCancel(stream: ReadableStream, reason: any): Promise {\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n return promiseResolvedWith(undefined);\n }\n if (stream._state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n\n ReadableStreamClose(stream);\n\n const reader = stream._reader;\n if (reader !== undefined && IsReadableStreamBYOBReader(reader)) {\n const readIntoRequests = reader._readIntoRequests;\n reader._readIntoRequests = new SimpleQueue();\n readIntoRequests.forEach(readIntoRequest => {\n readIntoRequest._closeSteps(undefined);\n });\n }\n\n const sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);\n return transformPromiseWith(sourceCancelPromise, noop);\n}\n\nexport function ReadableStreamClose(stream: ReadableStream): void {\n assert(stream._state === 'readable');\n\n stream._state = 'closed';\n\n const reader = stream._reader;\n\n if (reader === undefined) {\n return;\n }\n\n defaultReaderClosedPromiseResolve(reader);\n\n if (IsReadableStreamDefaultReader(reader)) {\n const readRequests = reader._readRequests;\n reader._readRequests = new SimpleQueue();\n readRequests.forEach(readRequest => {\n readRequest._closeSteps();\n });\n }\n}\n\nexport function ReadableStreamError(stream: ReadableStream, e: any): void {\n assert(IsReadableStream(stream));\n assert(stream._state === 'readable');\n\n stream._state = 'errored';\n stream._storedError = e;\n\n const reader = stream._reader;\n\n if (reader === undefined) {\n return;\n }\n\n defaultReaderClosedPromiseReject(reader, e);\n\n if (IsReadableStreamDefaultReader(reader)) {\n ReadableStreamDefaultReaderErrorReadRequests(reader, e);\n } else {\n assert(IsReadableStreamBYOBReader(reader));\n ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);\n }\n}\n\n// Readers\n\nexport type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader;\n\nexport {\n ReadableStreamDefaultReader,\n ReadableStreamBYOBReader\n};\n\n// Controllers\n\nexport {\n ReadableStreamDefaultController,\n ReadableStreamBYOBRequest,\n ReadableByteStreamController\n};\n\n// Helper functions for the ReadableStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(`ReadableStream.prototype.${name} can only be used on a ReadableStream`);\n}\n","import type { QueuingStrategyInit } from '../queuing-strategy';\nimport { assertDictionary, assertRequiredField, convertUnrestrictedDouble } from './basic';\n\nexport function convertQueuingStrategyInit(init: QueuingStrategyInit | null | undefined,\n context: string): QueuingStrategyInit {\n assertDictionary(init, context);\n const highWaterMark = init?.highWaterMark;\n assertRequiredField(highWaterMark, 'highWaterMark', 'QueuingStrategyInit');\n return {\n highWaterMark: convertUnrestrictedDouble(highWaterMark)\n };\n}\n","import type { QueuingStrategy, QueuingStrategyInit } from './queuing-strategy';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategyInit } from './validators/queuing-strategy-init';\n\n// The size function must not have a prototype property nor be a constructor\nconst byteLengthSizeFunction = (chunk: ArrayBufferView): number => {\n return chunk.byteLength;\n};\nsetFunctionName(byteLengthSizeFunction, 'size');\n\n/**\n * A queuing strategy that counts the number of bytes in each chunk.\n *\n * @public\n */\nexport default class ByteLengthQueuingStrategy implements QueuingStrategy {\n /** @internal */\n readonly _byteLengthQueuingStrategyHighWaterMark: number;\n\n constructor(options: QueuingStrategyInit) {\n assertRequiredArgument(options, 1, 'ByteLengthQueuingStrategy');\n options = convertQueuingStrategyInit(options, 'First parameter');\n this._byteLengthQueuingStrategyHighWaterMark = options.highWaterMark;\n }\n\n /**\n * Returns the high water mark provided to the constructor.\n */\n get highWaterMark(): number {\n if (!IsByteLengthQueuingStrategy(this)) {\n throw byteLengthBrandCheckException('highWaterMark');\n }\n return this._byteLengthQueuingStrategyHighWaterMark;\n }\n\n /**\n * Measures the size of `chunk` by returning the value of its `byteLength` property.\n */\n get size(): (chunk: ArrayBufferView) => number {\n if (!IsByteLengthQueuingStrategy(this)) {\n throw byteLengthBrandCheckException('size');\n }\n return byteLengthSizeFunction;\n }\n}\n\nObject.defineProperties(ByteLengthQueuingStrategy.prototype, {\n highWaterMark: { enumerable: true },\n size: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ByteLengthQueuingStrategy.prototype, Symbol.toStringTag, {\n value: 'ByteLengthQueuingStrategy',\n configurable: true\n });\n}\n\n// Helper functions for the ByteLengthQueuingStrategy.\n\nfunction byteLengthBrandCheckException(name: string): TypeError {\n return new TypeError(`ByteLengthQueuingStrategy.prototype.${name} can only be used on a ByteLengthQueuingStrategy`);\n}\n\nexport function IsByteLengthQueuingStrategy(x: any): x is ByteLengthQueuingStrategy {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_byteLengthQueuingStrategyHighWaterMark')) {\n return false;\n }\n\n return x instanceof ByteLengthQueuingStrategy;\n}\n","import type { QueuingStrategy, QueuingStrategyInit } from './queuing-strategy';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategyInit } from './validators/queuing-strategy-init';\n\n// The size function must not have a prototype property nor be a constructor\nconst countSizeFunction = (): 1 => {\n return 1;\n};\nsetFunctionName(countSizeFunction, 'size');\n\n/**\n * A queuing strategy that counts the number of chunks.\n *\n * @public\n */\nexport default class CountQueuingStrategy implements QueuingStrategy {\n /** @internal */\n readonly _countQueuingStrategyHighWaterMark!: number;\n\n constructor(options: QueuingStrategyInit) {\n assertRequiredArgument(options, 1, 'CountQueuingStrategy');\n options = convertQueuingStrategyInit(options, 'First parameter');\n this._countQueuingStrategyHighWaterMark = options.highWaterMark;\n }\n\n /**\n * Returns the high water mark provided to the constructor.\n */\n get highWaterMark(): number {\n if (!IsCountQueuingStrategy(this)) {\n throw countBrandCheckException('highWaterMark');\n }\n return this._countQueuingStrategyHighWaterMark;\n }\n\n /**\n * Measures the size of `chunk` by always returning 1.\n * This ensures that the total queue size is a count of the number of chunks in the queue.\n */\n get size(): (chunk: any) => 1 {\n if (!IsCountQueuingStrategy(this)) {\n throw countBrandCheckException('size');\n }\n return countSizeFunction;\n }\n}\n\nObject.defineProperties(CountQueuingStrategy.prototype, {\n highWaterMark: { enumerable: true },\n size: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(CountQueuingStrategy.prototype, Symbol.toStringTag, {\n value: 'CountQueuingStrategy',\n configurable: true\n });\n}\n\n// Helper functions for the CountQueuingStrategy.\n\nfunction countBrandCheckException(name: string): TypeError {\n return new TypeError(`CountQueuingStrategy.prototype.${name} can only be used on a CountQueuingStrategy`);\n}\n\nexport function IsCountQueuingStrategy(x: any): x is CountQueuingStrategy {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_countQueuingStrategyHighWaterMark')) {\n return false;\n }\n\n return x instanceof CountQueuingStrategy;\n}\n","import { assertDictionary, assertFunction } from './basic';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\nimport type {\n Transformer,\n TransformerCancelCallback,\n TransformerFlushCallback,\n TransformerStartCallback,\n TransformerTransformCallback,\n ValidatedTransformer\n} from '../transform-stream/transformer';\nimport { TransformStreamDefaultController } from '../transform-stream';\n\nexport function convertTransformer(original: Transformer | null,\n context: string): ValidatedTransformer {\n assertDictionary(original, context);\n const cancel = original?.cancel;\n const flush = original?.flush;\n const readableType = original?.readableType;\n const start = original?.start;\n const transform = original?.transform;\n const writableType = original?.writableType;\n return {\n cancel: cancel === undefined ?\n undefined :\n convertTransformerCancelCallback(cancel, original!, `${context} has member 'cancel' that`),\n flush: flush === undefined ?\n undefined :\n convertTransformerFlushCallback(flush, original!, `${context} has member 'flush' that`),\n readableType,\n start: start === undefined ?\n undefined :\n convertTransformerStartCallback(start, original!, `${context} has member 'start' that`),\n transform: transform === undefined ?\n undefined :\n convertTransformerTransformCallback(transform, original!, `${context} has member 'transform' that`),\n writableType\n };\n}\n\nfunction convertTransformerFlushCallback(\n fn: TransformerFlushCallback,\n original: Transformer,\n context: string\n): (controller: TransformStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (controller: TransformStreamDefaultController) => promiseCall(fn, original, [controller]);\n}\n\nfunction convertTransformerStartCallback(\n fn: TransformerStartCallback,\n original: Transformer,\n context: string\n): TransformerStartCallback {\n assertFunction(fn, context);\n return (controller: TransformStreamDefaultController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertTransformerTransformCallback(\n fn: TransformerTransformCallback,\n original: Transformer,\n context: string\n): (chunk: I, controller: TransformStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (chunk: I, controller: TransformStreamDefaultController) => promiseCall(fn, original, [chunk, controller]);\n}\n\nfunction convertTransformerCancelCallback(\n fn: TransformerCancelCallback,\n original: Transformer,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n","import assert from '../stub/assert';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n transformPromiseWith,\n uponPromise\n} from './helpers/webidl';\nimport { CreateReadableStream, type DefaultReadableStream, ReadableStream } from './readable-stream';\nimport {\n ReadableStreamDefaultControllerCanCloseOrEnqueue,\n ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError,\n ReadableStreamDefaultControllerGetDesiredSize,\n ReadableStreamDefaultControllerHasBackpressure\n} from './readable-stream/default-controller';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { CreateWritableStream, WritableStream, WritableStreamDefaultControllerErrorIfNeeded } from './writable-stream';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport type {\n Transformer,\n TransformerCancelCallback,\n TransformerFlushCallback,\n TransformerStartCallback,\n TransformerTransformCallback,\n ValidatedTransformer\n} from './transform-stream/transformer';\nimport { convertTransformer } from './validators/transformer';\n\n// Class TransformStream\n\n/**\n * A transform stream consists of a pair of streams: a {@link WritableStream | writable stream},\n * known as its writable side, and a {@link ReadableStream | readable stream}, known as its readable side.\n * In a manner specific to the transform stream in question, writes to the writable side result in new data being\n * made available for reading from the readable side.\n *\n * @public\n */\nexport class TransformStream {\n /** @internal */\n _writable!: WritableStream;\n /** @internal */\n _readable!: DefaultReadableStream;\n /** @internal */\n _backpressure!: boolean;\n /** @internal */\n _backpressureChangePromise!: Promise;\n /** @internal */\n _backpressureChangePromise_resolve!: () => void;\n /** @internal */\n _transformStreamController!: TransformStreamDefaultController;\n\n constructor(\n transformer?: Transformer,\n writableStrategy?: QueuingStrategy,\n readableStrategy?: QueuingStrategy\n );\n constructor(rawTransformer: Transformer | null | undefined = {},\n rawWritableStrategy: QueuingStrategy | null | undefined = {},\n rawReadableStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawTransformer === undefined) {\n rawTransformer = null;\n }\n\n const writableStrategy = convertQueuingStrategy(rawWritableStrategy, 'Second parameter');\n const readableStrategy = convertQueuingStrategy(rawReadableStrategy, 'Third parameter');\n\n const transformer = convertTransformer(rawTransformer, 'First parameter');\n if (transformer.readableType !== undefined) {\n throw new RangeError('Invalid readableType specified');\n }\n if (transformer.writableType !== undefined) {\n throw new RangeError('Invalid writableType specified');\n }\n\n const readableHighWaterMark = ExtractHighWaterMark(readableStrategy, 0);\n const readableSizeAlgorithm = ExtractSizeAlgorithm(readableStrategy);\n const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);\n const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);\n\n let startPromise_resolve!: (value: void | PromiseLike) => void;\n const startPromise = newPromise(resolve => {\n startPromise_resolve = resolve;\n });\n\n InitializeTransformStream(\n this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm\n );\n SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);\n\n if (transformer.start !== undefined) {\n startPromise_resolve(transformer.start(this._transformStreamController));\n } else {\n startPromise_resolve(undefined);\n }\n }\n\n /**\n * The readable side of the transform stream.\n */\n get readable(): ReadableStream {\n if (!IsTransformStream(this)) {\n throw streamBrandCheckException('readable');\n }\n\n return this._readable;\n }\n\n /**\n * The writable side of the transform stream.\n */\n get writable(): WritableStream {\n if (!IsTransformStream(this)) {\n throw streamBrandCheckException('writable');\n }\n\n return this._writable;\n }\n}\n\nObject.defineProperties(TransformStream.prototype, {\n readable: { enumerable: true },\n writable: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(TransformStream.prototype, Symbol.toStringTag, {\n value: 'TransformStream',\n configurable: true\n });\n}\n\nexport type {\n Transformer,\n TransformerCancelCallback,\n TransformerStartCallback,\n TransformerFlushCallback,\n TransformerTransformCallback\n};\n\n// Transform Stream Abstract Operations\n\nexport function CreateTransformStream(startAlgorithm: () => void | PromiseLike,\n transformAlgorithm: (chunk: I) => Promise,\n flushAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n writableHighWaterMark = 1,\n writableSizeAlgorithm: QueuingStrategySizeCallback = () => 1,\n readableHighWaterMark = 0,\n readableSizeAlgorithm: QueuingStrategySizeCallback = () => 1) {\n assert(IsNonNegativeNumber(writableHighWaterMark));\n assert(IsNonNegativeNumber(readableHighWaterMark));\n\n const stream: TransformStream = Object.create(TransformStream.prototype);\n\n let startPromise_resolve!: (value: void | PromiseLike) => void;\n const startPromise = newPromise(resolve => {\n startPromise_resolve = resolve;\n });\n\n InitializeTransformStream(stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark,\n readableSizeAlgorithm);\n\n const controller: TransformStreamDefaultController = Object.create(TransformStreamDefaultController.prototype);\n\n SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);\n\n const startResult = startAlgorithm();\n startPromise_resolve(startResult);\n return stream;\n}\n\nfunction InitializeTransformStream(stream: TransformStream,\n startPromise: Promise,\n writableHighWaterMark: number,\n writableSizeAlgorithm: QueuingStrategySizeCallback,\n readableHighWaterMark: number,\n readableSizeAlgorithm: QueuingStrategySizeCallback) {\n function startAlgorithm(): Promise {\n return startPromise;\n }\n\n function writeAlgorithm(chunk: I): Promise {\n return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk);\n }\n\n function abortAlgorithm(reason: any): Promise {\n return TransformStreamDefaultSinkAbortAlgorithm(stream, reason);\n }\n\n function closeAlgorithm(): Promise {\n return TransformStreamDefaultSinkCloseAlgorithm(stream);\n }\n\n stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm,\n writableHighWaterMark, writableSizeAlgorithm);\n\n function pullAlgorithm(): Promise {\n return TransformStreamDefaultSourcePullAlgorithm(stream);\n }\n\n function cancelAlgorithm(reason: any): Promise {\n return TransformStreamDefaultSourceCancelAlgorithm(stream, reason);\n }\n\n stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark,\n readableSizeAlgorithm);\n\n // The [[backpressure]] slot is set to undefined so that it can be initialised by TransformStreamSetBackpressure.\n stream._backpressure = undefined!;\n stream._backpressureChangePromise = undefined!;\n stream._backpressureChangePromise_resolve = undefined!;\n TransformStreamSetBackpressure(stream, true);\n\n stream._transformStreamController = undefined!;\n}\n\nfunction IsTransformStream(x: unknown): x is TransformStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {\n return false;\n }\n\n return x instanceof TransformStream;\n}\n\n// This is a no-op if both sides are already errored.\nfunction TransformStreamError(stream: TransformStream, e: any) {\n ReadableStreamDefaultControllerError(stream._readable._readableStreamController, e);\n TransformStreamErrorWritableAndUnblockWrite(stream, e);\n}\n\nfunction TransformStreamErrorWritableAndUnblockWrite(stream: TransformStream, e: any) {\n TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);\n WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e);\n TransformStreamUnblockWrite(stream);\n}\n\nfunction TransformStreamUnblockWrite(stream: TransformStream) {\n if (stream._backpressure) {\n // Pretend that pull() was called to permit any pending write() calls to complete. TransformStreamSetBackpressure()\n // cannot be called from enqueue() or pull() once the ReadableStream is errored, so this will will be the final time\n // _backpressure is set.\n TransformStreamSetBackpressure(stream, false);\n }\n}\n\nfunction TransformStreamSetBackpressure(stream: TransformStream, backpressure: boolean) {\n // Passes also when called during construction.\n assert(stream._backpressure !== backpressure);\n\n if (stream._backpressureChangePromise !== undefined) {\n stream._backpressureChangePromise_resolve();\n }\n\n stream._backpressureChangePromise = newPromise(resolve => {\n stream._backpressureChangePromise_resolve = resolve;\n });\n\n stream._backpressure = backpressure;\n}\n\n// Class TransformStreamDefaultController\n\n/**\n * Allows control of the {@link ReadableStream} and {@link WritableStream} of the associated {@link TransformStream}.\n *\n * @public\n */\nexport class TransformStreamDefaultController {\n /** @internal */\n _controlledTransformStream: TransformStream;\n /** @internal */\n _finishPromise: Promise | undefined;\n /** @internal */\n _finishPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _finishPromise_reject?: (reason: any) => void;\n /** @internal */\n _transformAlgorithm: (chunk: any) => Promise;\n /** @internal */\n _flushAlgorithm: () => Promise;\n /** @internal */\n _cancelAlgorithm: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the desired size to fill the readable side’s internal queue. It can be negative, if the queue is over-full.\n */\n get desiredSize(): number | null {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n const readableController = this._controlledTransformStream._readable._readableStreamController;\n return ReadableStreamDefaultControllerGetDesiredSize(readableController);\n }\n\n /**\n * Enqueues the given chunk `chunk` in the readable side of the controlled transform stream.\n */\n enqueue(chunk: O): void;\n enqueue(chunk: O = undefined!): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n TransformStreamDefaultControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors both the readable side and the writable side of the controlled transform stream, making all future\n * interactions with it fail with the given error `e`. Any chunks queued for transformation will be discarded.\n */\n error(reason: any = undefined): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n\n TransformStreamDefaultControllerError(this, reason);\n }\n\n /**\n * Closes the readable side and errors the writable side of the controlled transform stream. This is useful when the\n * transformer only needs to consume a portion of the chunks written to the writable side.\n */\n terminate(): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('terminate');\n }\n\n TransformStreamDefaultControllerTerminate(this);\n }\n}\n\nObject.defineProperties(TransformStreamDefaultController.prototype, {\n enqueue: { enumerable: true },\n error: { enumerable: true },\n terminate: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(TransformStreamDefaultController.prototype.enqueue, 'enqueue');\nsetFunctionName(TransformStreamDefaultController.prototype.error, 'error');\nsetFunctionName(TransformStreamDefaultController.prototype.terminate, 'terminate');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(TransformStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'TransformStreamDefaultController',\n configurable: true\n });\n}\n\n// Transform Stream Default Controller Abstract Operations\n\nfunction IsTransformStreamDefaultController(x: any): x is TransformStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {\n return false;\n }\n\n return x instanceof TransformStreamDefaultController;\n}\n\nfunction SetUpTransformStreamDefaultController(stream: TransformStream,\n controller: TransformStreamDefaultController,\n transformAlgorithm: (chunk: I) => Promise,\n flushAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise) {\n assert(IsTransformStream(stream));\n assert(stream._transformStreamController === undefined);\n\n controller._controlledTransformStream = stream;\n stream._transformStreamController = controller;\n\n controller._transformAlgorithm = transformAlgorithm;\n controller._flushAlgorithm = flushAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n controller._finishPromise = undefined;\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\nfunction SetUpTransformStreamDefaultControllerFromTransformer(stream: TransformStream,\n transformer: ValidatedTransformer) {\n const controller: TransformStreamDefaultController = Object.create(TransformStreamDefaultController.prototype);\n\n let transformAlgorithm: (chunk: I) => Promise;\n let flushAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (transformer.transform !== undefined) {\n transformAlgorithm = chunk => transformer.transform!(chunk, controller);\n } else {\n transformAlgorithm = chunk => {\n try {\n TransformStreamDefaultControllerEnqueue(controller, chunk as unknown as O);\n return promiseResolvedWith(undefined);\n } catch (transformResultE) {\n return promiseRejectedWith(transformResultE);\n }\n };\n }\n\n if (transformer.flush !== undefined) {\n flushAlgorithm = () => transformer.flush!(controller);\n } else {\n flushAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n if (transformer.cancel !== undefined) {\n cancelAlgorithm = reason => transformer.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);\n}\n\nfunction TransformStreamDefaultControllerClearAlgorithms(controller: TransformStreamDefaultController) {\n controller._transformAlgorithm = undefined!;\n controller._flushAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n}\n\nfunction TransformStreamDefaultControllerEnqueue(controller: TransformStreamDefaultController, chunk: O) {\n const stream = controller._controlledTransformStream;\n const readableController = stream._readable._readableStreamController;\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController)) {\n throw new TypeError('Readable side is not in a state that permits enqueue');\n }\n\n // We throttle transform invocations based on the backpressure of the ReadableStream, but we still\n // accept TransformStreamDefaultControllerEnqueue() calls.\n\n try {\n ReadableStreamDefaultControllerEnqueue(readableController, chunk);\n } catch (e) {\n // This happens when readableStrategy.size() throws.\n TransformStreamErrorWritableAndUnblockWrite(stream, e);\n\n throw stream._readable._storedError;\n }\n\n const backpressure = ReadableStreamDefaultControllerHasBackpressure(readableController);\n if (backpressure !== stream._backpressure) {\n assert(backpressure);\n TransformStreamSetBackpressure(stream, true);\n }\n}\n\nfunction TransformStreamDefaultControllerError(controller: TransformStreamDefaultController, e: any) {\n TransformStreamError(controller._controlledTransformStream, e);\n}\n\nfunction TransformStreamDefaultControllerPerformTransform(controller: TransformStreamDefaultController,\n chunk: I) {\n const transformPromise = controller._transformAlgorithm(chunk);\n return transformPromiseWith(transformPromise, undefined, r => {\n TransformStreamError(controller._controlledTransformStream, r);\n throw r;\n });\n}\n\nfunction TransformStreamDefaultControllerTerminate(controller: TransformStreamDefaultController) {\n const stream = controller._controlledTransformStream;\n const readableController = stream._readable._readableStreamController;\n\n ReadableStreamDefaultControllerClose(readableController);\n\n const error = new TypeError('TransformStream terminated');\n TransformStreamErrorWritableAndUnblockWrite(stream, error);\n}\n\n// TransformStreamDefaultSink Algorithms\n\nfunction TransformStreamDefaultSinkWriteAlgorithm(stream: TransformStream, chunk: I): Promise {\n assert(stream._writable._state === 'writable');\n\n const controller = stream._transformStreamController;\n\n if (stream._backpressure) {\n const backpressureChangePromise = stream._backpressureChangePromise;\n assert(backpressureChangePromise !== undefined);\n return transformPromiseWith(backpressureChangePromise, () => {\n const writable = stream._writable;\n const state = writable._state;\n if (state === 'erroring') {\n throw writable._storedError;\n }\n assert(state === 'writable');\n return TransformStreamDefaultControllerPerformTransform(controller, chunk);\n });\n }\n\n return TransformStreamDefaultControllerPerformTransform(controller, chunk);\n}\n\nfunction TransformStreamDefaultSinkAbortAlgorithm(stream: TransformStream, reason: any): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._readable cannot change after construction, so caching it across a call to user code is safe.\n const readable = stream._readable;\n\n // Assign the _finishPromise now so that if _cancelAlgorithm calls readable.cancel() internally,\n // we don't run the _cancelAlgorithm again.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const cancelPromise = controller._cancelAlgorithm(reason);\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(cancelPromise, () => {\n if (readable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, readable._storedError);\n } else {\n ReadableStreamDefaultControllerError(readable._readableStreamController, reason);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n ReadableStreamDefaultControllerError(readable._readableStreamController, r);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\nfunction TransformStreamDefaultSinkCloseAlgorithm(stream: TransformStream): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._readable cannot change after construction, so caching it across a call to user code is safe.\n const readable = stream._readable;\n\n // Assign the _finishPromise now so that if _flushAlgorithm calls readable.cancel() internally,\n // we don't also run the _cancelAlgorithm.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const flushPromise = controller._flushAlgorithm();\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(flushPromise, () => {\n if (readable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, readable._storedError);\n } else {\n ReadableStreamDefaultControllerClose(readable._readableStreamController);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n ReadableStreamDefaultControllerError(readable._readableStreamController, r);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\n// TransformStreamDefaultSource Algorithms\n\nfunction TransformStreamDefaultSourcePullAlgorithm(stream: TransformStream): Promise {\n // Invariant. Enforced by the promises returned by start() and pull().\n assert(stream._backpressure);\n\n assert(stream._backpressureChangePromise !== undefined);\n\n TransformStreamSetBackpressure(stream, false);\n\n // Prevent the next pull() call until there is backpressure.\n return stream._backpressureChangePromise;\n}\n\nfunction TransformStreamDefaultSourceCancelAlgorithm(stream: TransformStream, reason: any): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._writable cannot change after construction, so caching it across a call to user code is safe.\n const writable = stream._writable;\n\n // Assign the _finishPromise now so that if _flushAlgorithm calls writable.abort() or\n // writable.cancel() internally, we don't run the _cancelAlgorithm again, or also run the\n // _flushAlgorithm.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const cancelPromise = controller._cancelAlgorithm(reason);\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(cancelPromise, () => {\n if (writable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, writable._storedError);\n } else {\n WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, reason);\n TransformStreamUnblockWrite(stream);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, r);\n TransformStreamUnblockWrite(stream);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\n// Helper functions for the TransformStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`);\n}\n\nexport function defaultControllerFinishPromiseResolve(controller: TransformStreamDefaultController) {\n if (controller._finishPromise_resolve === undefined) {\n return;\n }\n\n controller._finishPromise_resolve();\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\nexport function defaultControllerFinishPromiseReject(controller: TransformStreamDefaultController, reason: any) {\n if (controller._finishPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(controller._finishPromise!);\n controller._finishPromise_reject(reason);\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\n// Helper functions for the TransformStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(\n `TransformStream.prototype.${name} can only be used on a TransformStream`);\n}\n","/* c8 ignore start */\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\nif (!globalThis.ReadableStream) {\n // `node:stream/web` got introduced in v16.5.0 as experimental\n // and it's preferred over the polyfilled version. So we also\n // suppress the warning that gets emitted by NodeJS for using it.\n try {\n const process = require('node:process')\n const { emitWarning } = process\n try {\n process.emitWarning = () => {}\n Object.assign(globalThis, require('node:stream/web'))\n process.emitWarning = emitWarning\n } catch (error) {\n process.emitWarning = emitWarning\n throw error\n }\n } catch (error) {\n // fallback to polyfill implementation\n Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js'))\n }\n}\n\ntry {\n // Don't use node: prefix for this, require+node: is not supported until node v14.14\n // Only `import()` can use prefix in 12.20 and later\n const { Blob } = require('buffer')\n if (Blob && !Blob.prototype.stream) {\n Blob.prototype.stream = function name (params) {\n let position = 0\n const blob = this\n\n return new ReadableStream({\n type: 'bytes',\n async pull (ctrl) {\n const chunk = blob.slice(position, Math.min(blob.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n ctrl.enqueue(new Uint8Array(buffer))\n\n if (position === blob.size) {\n ctrl.close()\n }\n }\n })\n }\n }\n} catch (error) {}\n/* c8 ignore end */\n","/*! fetch-blob. MIT License. Jimmy Wärting */\n\n// TODO (jimmywarting): in the feature use conditional loading with top level await (requires 14.x)\n// Node has recently added whatwg stream into core\n\nimport './streams.cjs'\n\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\n/** @param {(Blob | Uint8Array)[]} parts */\nasync function * toIterator (parts, clone = true) {\n for (const part of parts) {\n if ('stream' in part) {\n yield * (/** @type {AsyncIterableIterator} */ (part.stream()))\n } else if (ArrayBuffer.isView(part)) {\n if (clone) {\n let position = part.byteOffset\n const end = part.byteOffset + part.byteLength\n while (position !== end) {\n const size = Math.min(end - position, POOL_SIZE)\n const chunk = part.buffer.slice(position, position + size)\n position += chunk.byteLength\n yield new Uint8Array(chunk)\n }\n } else {\n yield part\n }\n /* c8 ignore next 10 */\n } else {\n // For blobs that have arrayBuffer but no stream method (nodes buffer.Blob)\n let position = 0, b = (/** @type {Blob} */ (part))\n while (position !== b.size) {\n const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n yield new Uint8Array(buffer)\n }\n }\n }\n}\n\nconst _Blob = class Blob {\n /** @type {Array.<(Blob|Uint8Array)>} */\n #parts = []\n #type = ''\n #size = 0\n #endings = 'transparent'\n\n /**\n * The Blob() constructor returns a new Blob object. The content\n * of the blob consists of the concatenation of the values given\n * in the parameter array.\n *\n * @param {*} blobParts\n * @param {{ type?: string, endings?: string }} [options]\n */\n constructor (blobParts = [], options = {}) {\n if (typeof blobParts !== 'object' || blobParts === null) {\n throw new TypeError('Failed to construct \\'Blob\\': The provided value cannot be converted to a sequence.')\n }\n\n if (typeof blobParts[Symbol.iterator] !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': The object must have a callable @@iterator property.')\n }\n\n if (typeof options !== 'object' && typeof options !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': parameter 2 cannot convert to dictionary.')\n }\n\n if (options === null) options = {}\n\n const encoder = new TextEncoder()\n for (const element of blobParts) {\n let part\n if (ArrayBuffer.isView(element)) {\n part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength))\n } else if (element instanceof ArrayBuffer) {\n part = new Uint8Array(element.slice(0))\n } else if (element instanceof Blob) {\n part = element\n } else {\n part = encoder.encode(`${element}`)\n }\n\n this.#size += ArrayBuffer.isView(part) ? part.byteLength : part.size\n this.#parts.push(part)\n }\n\n this.#endings = `${options.endings === undefined ? 'transparent' : options.endings}`\n const type = options.type === undefined ? '' : String(options.type)\n this.#type = /^[\\x20-\\x7E]*$/.test(type) ? type : ''\n }\n\n /**\n * The Blob interface's size property returns the\n * size of the Blob in bytes.\n */\n get size () {\n return this.#size\n }\n\n /**\n * The type property of a Blob object returns the MIME type of the file.\n */\n get type () {\n return this.#type\n }\n\n /**\n * The text() method in the Blob interface returns a Promise\n * that resolves with a string containing the contents of\n * the blob, interpreted as UTF-8.\n *\n * @return {Promise}\n */\n async text () {\n // More optimized than using this.arrayBuffer()\n // that requires twice as much ram\n const decoder = new TextDecoder()\n let str = ''\n for await (const part of toIterator(this.#parts, false)) {\n str += decoder.decode(part, { stream: true })\n }\n // Remaining\n str += decoder.decode()\n return str\n }\n\n /**\n * The arrayBuffer() method in the Blob interface returns a\n * Promise that resolves with the contents of the blob as\n * binary data contained in an ArrayBuffer.\n *\n * @return {Promise}\n */\n async arrayBuffer () {\n // Easier way... Just a unnecessary overhead\n // const view = new Uint8Array(this.size);\n // await this.stream().getReader({mode: 'byob'}).read(view);\n // return view.buffer;\n\n const data = new Uint8Array(this.size)\n let offset = 0\n for await (const chunk of toIterator(this.#parts, false)) {\n data.set(chunk, offset)\n offset += chunk.length\n }\n\n return data.buffer\n }\n\n stream () {\n const it = toIterator(this.#parts, true)\n\n return new globalThis.ReadableStream({\n // @ts-ignore\n type: 'bytes',\n async pull (ctrl) {\n const chunk = await it.next()\n chunk.done ? ctrl.close() : ctrl.enqueue(chunk.value)\n },\n\n async cancel () {\n await it.return()\n }\n })\n }\n\n /**\n * The Blob interface's slice() method creates and returns a\n * new Blob object which contains data from a subset of the\n * blob on which it's called.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @param {string} [type]\n */\n slice (start = 0, end = this.size, type = '') {\n const { size } = this\n\n let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size)\n let relativeEnd = end < 0 ? Math.max(size + end, 0) : Math.min(end, size)\n\n const span = Math.max(relativeEnd - relativeStart, 0)\n const parts = this.#parts\n const blobParts = []\n let added = 0\n\n for (const part of parts) {\n // don't add the overflow to new blobParts\n if (added >= span) {\n break\n }\n\n const size = ArrayBuffer.isView(part) ? part.byteLength : part.size\n if (relativeStart && size <= relativeStart) {\n // Skip the beginning and change the relative\n // start & end position as we skip the unwanted parts\n relativeStart -= size\n relativeEnd -= size\n } else {\n let chunk\n if (ArrayBuffer.isView(part)) {\n chunk = part.subarray(relativeStart, Math.min(size, relativeEnd))\n added += chunk.byteLength\n } else {\n chunk = part.slice(relativeStart, Math.min(size, relativeEnd))\n added += chunk.size\n }\n relativeEnd -= size\n blobParts.push(chunk)\n relativeStart = 0 // All next sequential parts should start at 0\n }\n }\n\n const blob = new Blob([], { type: String(type).toLowerCase() })\n blob.#size = span\n blob.#parts = blobParts\n\n return blob\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n\n static [Symbol.hasInstance] (object) {\n return (\n object &&\n typeof object === 'object' &&\n typeof object.constructor === 'function' &&\n (\n typeof object.stream === 'function' ||\n typeof object.arrayBuffer === 'function'\n ) &&\n /^(Blob|File)$/.test(object[Symbol.toStringTag])\n )\n }\n}\n\nObject.defineProperties(_Blob.prototype, {\n size: { enumerable: true },\n type: { enumerable: true },\n slice: { enumerable: true }\n})\n\n/** @type {typeof globalThis.Blob} */\nexport const Blob = _Blob\nexport default Blob\n","import Blob from './index.js'\n\nconst _File = class File extends Blob {\n #lastModified = 0\n #name = ''\n\n /**\n * @param {*[]} fileBits\n * @param {string} fileName\n * @param {{lastModified?: number, type?: string}} options\n */// @ts-ignore\n constructor (fileBits, fileName, options = {}) {\n if (arguments.length < 2) {\n throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)\n }\n super(fileBits, options)\n\n if (options === null) options = {}\n\n // Simulate WebIDL type casting for NaN value in lastModified option.\n const lastModified = options.lastModified === undefined ? Date.now() : Number(options.lastModified)\n if (!Number.isNaN(lastModified)) {\n this.#lastModified = lastModified\n }\n\n this.#name = String(fileName)\n }\n\n get name () {\n return this.#name\n }\n\n get lastModified () {\n return this.#lastModified\n }\n\n get [Symbol.toStringTag] () {\n return 'File'\n }\n\n static [Symbol.hasInstance] (object) {\n return !!object && object instanceof Blob &&\n /^(File)$/.test(object[Symbol.toStringTag])\n }\n}\n\n/** @type {typeof globalThis.File} */// @ts-ignore\nexport const File = _File\nexport default File\n","/*! formdata-polyfill. MIT License. Jimmy Wärting */\n\nimport C from 'fetch-blob'\nimport F from 'fetch-blob/file.js'\n\nvar {toStringTag:t,iterator:i,hasInstance:h}=Symbol,\nr=Math.random,\nm='append,set,get,getAll,delete,keys,values,entries,forEach,constructor'.split(','),\nf=(a,b,c)=>(a+='',/^(Blob|File)$/.test(b && b[t])?[(c=c!==void 0?c+'':b[t]=='File'?b.name:'blob',a),b.name!==c||b[t]=='blob'?new F([b],c,b):b]:[a,b+'']),\ne=(c,f)=>(f?c:c.replace(/\\r?\\n|\\r/g,'\\r\\n')).replace(/\\n/g,'%0A').replace(/\\r/g,'%0D').replace(/\"/g,'%22'),\nx=(n, a, e)=>{if(a.lengthtypeof o[m]!='function')}\nappend(...a){x('append',arguments,2);this.#d.push(f(...a))}\ndelete(a){x('delete',arguments,1);a+='';this.#d=this.#d.filter(([b])=>b!==a)}\nget(a){x('get',arguments,1);a+='';for(var b=this.#d,l=b.length,c=0;cc[0]===a&&b.push(c[1]));return b}\nhas(a){x('has',arguments,1);a+='';return this.#d.some(b=>b[0]===a)}\nforEach(a,b){x('forEach',arguments,1);for(var [c,d]of this)a.call(b,d,c,this)}\nset(...a){x('set',arguments,2);var b=[],c=!0;a=f(...a);this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)});c&&b.push(a);this.#d=b}\n*entries(){yield*this.#d}\n*keys(){for(var[a]of this)yield a}\n*values(){for(var[,a]of this)yield a}}\n\n/** @param {FormData} F */\nexport function formDataToBlob (F,B=C){\nvar b=`${r()}${r()}`.replace(/\\./g, '').slice(-28).padStart(32, '-'),c=[],p=`--${b}\\r\\nContent-Disposition: form-data; name=\"`\nF.forEach((v,n)=>typeof v=='string'\n?c.push(p+e(n)+`\"\\r\\n\\r\\n${v.replace(/\\r(?!\\n)|(? {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.append === 'function' &&\n\t\ttypeof object.delete === 'function' &&\n\t\ttypeof object.get === 'function' &&\n\t\ttypeof object.getAll === 'function' &&\n\t\ttypeof object.has === 'function' &&\n\t\ttypeof object.set === 'function' &&\n\t\ttypeof object.sort === 'function' &&\n\t\tobject[NAME] === 'URLSearchParams'\n\t);\n};\n\n/**\n * Check if `object` is a W3C `Blob` object (which `File` inherits from)\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isBlob = object => {\n\treturn (\n\t\tobject &&\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.arrayBuffer === 'function' &&\n\t\ttypeof object.type === 'string' &&\n\t\ttypeof object.stream === 'function' &&\n\t\ttypeof object.constructor === 'function' &&\n\t\t/^(Blob|File)$/.test(object[NAME])\n\t);\n};\n\n/**\n * Check if `obj` is an instance of AbortSignal.\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isAbortSignal = object => {\n\treturn (\n\t\ttypeof object === 'object' && (\n\t\t\tobject[NAME] === 'AbortSignal' ||\n\t\t\tobject[NAME] === 'EventTarget'\n\t\t)\n\t);\n};\n\n/**\n * isDomainOrSubdomain reports whether sub is a subdomain (or exact match) of\n * the parent domain.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isDomainOrSubdomain = (destination, original) => {\n\tconst orig = new URL(original).hostname;\n\tconst dest = new URL(destination).hostname;\n\n\treturn orig === dest || orig.endsWith(`.${dest}`);\n};\n\n/**\n * isSameProtocol reports whether the two provided URLs use the same protocol.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isSameProtocol = (destination, original) => {\n\tconst orig = new URL(original).protocol;\n\tconst dest = new URL(destination).protocol;\n\n\treturn orig === dest;\n};\n","/*! node-domexception. MIT License. Jimmy Wärting */\n\nif (!globalThis.DOMException) {\n try {\n const { MessageChannel } = require('worker_threads'),\n port = new MessageChannel().port1,\n ab = new ArrayBuffer()\n port.postMessage(ab, [ab, ab])\n } catch (err) {\n err.constructor.name === 'DOMException' && (\n globalThis.DOMException = err.constructor\n )\n }\n}\n\nmodule.exports = globalThis.DOMException\n","import { statSync, createReadStream, promises as fs } from 'node:fs'\nimport { basename } from 'node:path'\nimport DOMException from 'node-domexception'\n\nimport File from './file.js'\nimport Blob from './index.js'\n\nconst { stat } = fs\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n */\nconst blobFromSync = (path, type) => fromBlob(statSync(path), path, type)\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n * @returns {Promise}\n */\nconst blobFrom = (path, type) => stat(path).then(stat => fromBlob(stat, path, type))\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n * @returns {Promise}\n */\nconst fileFrom = (path, type) => stat(path).then(stat => fromFile(stat, path, type))\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n */\nconst fileFromSync = (path, type) => fromFile(statSync(path), path, type)\n\n// @ts-ignore\nconst fromBlob = (stat, path, type = '') => new Blob([new BlobDataItem({\n path,\n size: stat.size,\n lastModified: stat.mtimeMs,\n start: 0\n})], { type })\n\n// @ts-ignore\nconst fromFile = (stat, path, type = '') => new File([new BlobDataItem({\n path,\n size: stat.size,\n lastModified: stat.mtimeMs,\n start: 0\n})], basename(path), { type, lastModified: stat.mtimeMs })\n\n/**\n * This is a blob backed up by a file on the disk\n * with minium requirement. Its wrapped around a Blob as a blobPart\n * so you have no direct access to this.\n *\n * @private\n */\nclass BlobDataItem {\n #path\n #start\n\n constructor (options) {\n this.#path = options.path\n this.#start = options.start\n this.size = options.size\n this.lastModified = options.lastModified\n }\n\n /**\n * Slicing arguments is first validated and formatted\n * to not be out of range by Blob.prototype.slice\n */\n slice (start, end) {\n return new BlobDataItem({\n path: this.#path,\n lastModified: this.lastModified,\n size: end - start,\n start: this.#start + start\n })\n }\n\n async * stream () {\n const { mtimeMs } = await stat(this.#path)\n if (mtimeMs > this.lastModified) {\n throw new DOMException('The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.', 'NotReadableError')\n }\n yield * createReadStream(this.#path, {\n start: this.#start,\n end: this.#start + this.size - 1\n })\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n}\n\nexport default blobFromSync\nexport { File, Blob, blobFrom, blobFromSync, fileFrom, fileFromSync }\n","import {File} from 'fetch-blob/from.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\n\nlet s = 0;\nconst S = {\n\tSTART_BOUNDARY: s++,\n\tHEADER_FIELD_START: s++,\n\tHEADER_FIELD: s++,\n\tHEADER_VALUE_START: s++,\n\tHEADER_VALUE: s++,\n\tHEADER_VALUE_ALMOST_DONE: s++,\n\tHEADERS_ALMOST_DONE: s++,\n\tPART_DATA_START: s++,\n\tPART_DATA: s++,\n\tEND: s++\n};\n\nlet f = 1;\nconst F = {\n\tPART_BOUNDARY: f,\n\tLAST_BOUNDARY: f *= 2\n};\n\nconst LF = 10;\nconst CR = 13;\nconst SPACE = 32;\nconst HYPHEN = 45;\nconst COLON = 58;\nconst A = 97;\nconst Z = 122;\n\nconst lower = c => c | 0x20;\n\nconst noop = () => {};\n\nclass MultipartParser {\n\t/**\n\t * @param {string} boundary\n\t */\n\tconstructor(boundary) {\n\t\tthis.index = 0;\n\t\tthis.flags = 0;\n\n\t\tthis.onHeaderEnd = noop;\n\t\tthis.onHeaderField = noop;\n\t\tthis.onHeadersEnd = noop;\n\t\tthis.onHeaderValue = noop;\n\t\tthis.onPartBegin = noop;\n\t\tthis.onPartData = noop;\n\t\tthis.onPartEnd = noop;\n\n\t\tthis.boundaryChars = {};\n\n\t\tboundary = '\\r\\n--' + boundary;\n\t\tconst ui8a = new Uint8Array(boundary.length);\n\t\tfor (let i = 0; i < boundary.length; i++) {\n\t\t\tui8a[i] = boundary.charCodeAt(i);\n\t\t\tthis.boundaryChars[ui8a[i]] = true;\n\t\t}\n\n\t\tthis.boundary = ui8a;\n\t\tthis.lookbehind = new Uint8Array(this.boundary.length + 8);\n\t\tthis.state = S.START_BOUNDARY;\n\t}\n\n\t/**\n\t * @param {Uint8Array} data\n\t */\n\twrite(data) {\n\t\tlet i = 0;\n\t\tconst length_ = data.length;\n\t\tlet previousIndex = this.index;\n\t\tlet {lookbehind, boundary, boundaryChars, index, state, flags} = this;\n\t\tconst boundaryLength = this.boundary.length;\n\t\tconst boundaryEnd = boundaryLength - 1;\n\t\tconst bufferLength = data.length;\n\t\tlet c;\n\t\tlet cl;\n\n\t\tconst mark = name => {\n\t\t\tthis[name + 'Mark'] = i;\n\t\t};\n\n\t\tconst clear = name => {\n\t\t\tdelete this[name + 'Mark'];\n\t\t};\n\n\t\tconst callback = (callbackSymbol, start, end, ui8a) => {\n\t\t\tif (start === undefined || start !== end) {\n\t\t\t\tthis[callbackSymbol](ui8a && ui8a.subarray(start, end));\n\t\t\t}\n\t\t};\n\n\t\tconst dataCallback = (name, clear) => {\n\t\t\tconst markSymbol = name + 'Mark';\n\t\t\tif (!(markSymbol in this)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (clear) {\n\t\t\t\tcallback(name, this[markSymbol], i, data);\n\t\t\t\tdelete this[markSymbol];\n\t\t\t} else {\n\t\t\t\tcallback(name, this[markSymbol], data.length, data);\n\t\t\t\tthis[markSymbol] = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (i = 0; i < length_; i++) {\n\t\t\tc = data[i];\n\n\t\t\tswitch (state) {\n\t\t\t\tcase S.START_BOUNDARY:\n\t\t\t\t\tif (index === boundary.length - 2) {\n\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else if (c !== CR) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if (index - 1 === boundary.length - 2) {\n\t\t\t\t\t\tif (flags & F.LAST_BOUNDARY && c === HYPHEN) {\n\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c !== boundary[index + 2]) {\n\t\t\t\t\t\tindex = -2;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === boundary[index + 2]) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_FIELD_START:\n\t\t\t\t\tstate = S.HEADER_FIELD;\n\t\t\t\t\tmark('onHeaderField');\n\t\t\t\t\tindex = 0;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_FIELD:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tclear('onHeaderField');\n\t\t\t\t\t\tstate = S.HEADERS_ALMOST_DONE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === COLON) {\n\t\t\t\t\t\tif (index === 1) {\n\t\t\t\t\t\t\t// empty header field\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdataCallback('onHeaderField', true);\n\t\t\t\t\t\tstate = S.HEADER_VALUE_START;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcl = lower(c);\n\t\t\t\t\tif (cl < A || cl > Z) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_START:\n\t\t\t\t\tif (c === SPACE) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tmark('onHeaderValue');\n\t\t\t\t\tstate = S.HEADER_VALUE;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_VALUE:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tdataCallback('onHeaderValue', true);\n\t\t\t\t\t\tcallback('onHeaderEnd');\n\t\t\t\t\t\tstate = S.HEADER_VALUE_ALMOST_DONE;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADERS_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tcallback('onHeadersEnd');\n\t\t\t\t\tstate = S.PART_DATA_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.PART_DATA_START:\n\t\t\t\t\tstate = S.PART_DATA;\n\t\t\t\t\tmark('onPartData');\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.PART_DATA:\n\t\t\t\t\tpreviousIndex = index;\n\n\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t// boyer-moore derrived algorithm to safely skip non-boundary data\n\t\t\t\t\t\ti += boundaryEnd;\n\t\t\t\t\t\twhile (i < bufferLength && !(data[i] in boundaryChars)) {\n\t\t\t\t\t\t\ti += boundaryLength;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ti -= boundaryEnd;\n\t\t\t\t\t\tc = data[i];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index < boundary.length) {\n\t\t\t\t\t\tif (boundary[index] === c) {\n\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\tdataCallback('onPartData', true);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === boundary.length) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\t\t// CR = part boundary\n\t\t\t\t\t\t\tflags |= F.PART_BOUNDARY;\n\t\t\t\t\t\t} else if (c === HYPHEN) {\n\t\t\t\t\t\t\t// HYPHEN = end boundary\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index - 1 === boundary.length) {\n\t\t\t\t\t\tif (flags & F.PART_BOUNDARY) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tif (c === LF) {\n\t\t\t\t\t\t\t\t// unset the PART_BOUNDARY flag\n\t\t\t\t\t\t\t\tflags &= ~F.PART_BOUNDARY;\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (flags & F.LAST_BOUNDARY) {\n\t\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index > 0) {\n\t\t\t\t\t\t// when matching a possible boundary, keep a lookbehind reference\n\t\t\t\t\t\t// in case it turns out to be a false lead\n\t\t\t\t\t\tlookbehind[index - 1] = c;\n\t\t\t\t\t} else if (previousIndex > 0) {\n\t\t\t\t\t\t// if our boundary turned out to be rubbish, the captured lookbehind\n\t\t\t\t\t\t// belongs to partData\n\t\t\t\t\t\tconst _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);\n\t\t\t\t\t\tcallback('onPartData', 0, previousIndex, _lookbehind);\n\t\t\t\t\t\tpreviousIndex = 0;\n\t\t\t\t\t\tmark('onPartData');\n\n\t\t\t\t\t\t// reconsider the current character even so it interrupted the sequence\n\t\t\t\t\t\t// it could be the beginning of a new sequence\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.END:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Unexpected state entered: ${state}`);\n\t\t\t}\n\t\t}\n\n\t\tdataCallback('onHeaderField');\n\t\tdataCallback('onHeaderValue');\n\t\tdataCallback('onPartData');\n\n\t\t// Update properties for the next call\n\t\tthis.index = index;\n\t\tthis.state = state;\n\t\tthis.flags = flags;\n\t}\n\n\tend() {\n\t\tif ((this.state === S.HEADER_FIELD_START && this.index === 0) ||\n\t\t\t(this.state === S.PART_DATA && this.index === this.boundary.length)) {\n\t\t\tthis.onPartEnd();\n\t\t} else if (this.state !== S.END) {\n\t\t\tthrow new Error('MultipartParser.end(): stream ended unexpectedly');\n\t\t}\n\t}\n}\n\nfunction _fileName(headerValue) {\n\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\tconst m = headerValue.match(/\\bfilename=(\"(.*?)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))($|;\\s)/i);\n\tif (!m) {\n\t\treturn;\n\t}\n\n\tconst match = m[2] || m[3] || '';\n\tlet filename = match.slice(match.lastIndexOf('\\\\') + 1);\n\tfilename = filename.replace(/%22/g, '\"');\n\tfilename = filename.replace(/&#(\\d{4});/g, (m, code) => {\n\t\treturn String.fromCharCode(code);\n\t});\n\treturn filename;\n}\n\nexport async function toFormData(Body, ct) {\n\tif (!/multipart/i.test(ct)) {\n\t\tthrow new TypeError('Failed to fetch');\n\t}\n\n\tconst m = ct.match(/boundary=(?:\"([^\"]+)\"|([^;]+))/i);\n\n\tif (!m) {\n\t\tthrow new TypeError('no or bad content-type header, no multipart boundary');\n\t}\n\n\tconst parser = new MultipartParser(m[1] || m[2]);\n\n\tlet headerField;\n\tlet headerValue;\n\tlet entryValue;\n\tlet entryName;\n\tlet contentType;\n\tlet filename;\n\tconst entryChunks = [];\n\tconst formData = new FormData();\n\n\tconst onPartData = ui8a => {\n\t\tentryValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tconst appendToFile = ui8a => {\n\t\tentryChunks.push(ui8a);\n\t};\n\n\tconst appendFileToFormData = () => {\n\t\tconst file = new File(entryChunks, filename, {type: contentType});\n\t\tformData.append(entryName, file);\n\t};\n\n\tconst appendEntryToFormData = () => {\n\t\tformData.append(entryName, entryValue);\n\t};\n\n\tconst decoder = new TextDecoder('utf-8');\n\tdecoder.decode();\n\n\tparser.onPartBegin = function () {\n\t\tparser.onPartData = onPartData;\n\t\tparser.onPartEnd = appendEntryToFormData;\n\n\t\theaderField = '';\n\t\theaderValue = '';\n\t\tentryValue = '';\n\t\tentryName = '';\n\t\tcontentType = '';\n\t\tfilename = null;\n\t\tentryChunks.length = 0;\n\t};\n\n\tparser.onHeaderField = function (ui8a) {\n\t\theaderField += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderValue = function (ui8a) {\n\t\theaderValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderEnd = function () {\n\t\theaderValue += decoder.decode();\n\t\theaderField = headerField.toLowerCase();\n\n\t\tif (headerField === 'content-disposition') {\n\t\t\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\t\t\tconst m = headerValue.match(/\\bname=(\"([^\"]*)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))/i);\n\n\t\t\tif (m) {\n\t\t\t\tentryName = m[2] || m[3] || '';\n\t\t\t}\n\n\t\t\tfilename = _fileName(headerValue);\n\n\t\t\tif (filename) {\n\t\t\t\tparser.onPartData = appendToFile;\n\t\t\t\tparser.onPartEnd = appendFileToFormData;\n\t\t\t}\n\t\t} else if (headerField === 'content-type') {\n\t\t\tcontentType = headerValue;\n\t\t}\n\n\t\theaderValue = '';\n\t\theaderField = '';\n\t};\n\n\tfor await (const chunk of Body) {\n\t\tparser.write(chunk);\n\t}\n\n\tparser.end();\n\n\treturn formData;\n}\n","\n/**\n * Body.js\n *\n * Body interface provides common methods for Request and Response\n */\n\nimport Stream, {PassThrough} from 'node:stream';\nimport {types, deprecate, promisify} from 'node:util';\nimport {Buffer} from 'node:buffer';\n\nimport Blob from 'fetch-blob';\nimport {FormData, formDataToBlob} from 'formdata-polyfill/esm.min.js';\n\nimport {FetchError} from './errors/fetch-error.js';\nimport {FetchBaseError} from './errors/base.js';\nimport {isBlob, isURLSearchParameters} from './utils/is.js';\n\nconst pipeline = promisify(Stream.pipeline);\nconst INTERNALS = Symbol('Body internals');\n\n/**\n * Body mixin\n *\n * Ref: https://fetch.spec.whatwg.org/#body\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Body {\n\tconstructor(body, {\n\t\tsize = 0\n\t} = {}) {\n\t\tlet boundary = null;\n\n\t\tif (body === null) {\n\t\t\t// Body is undefined or null\n\t\t\tbody = null;\n\t\t} else if (isURLSearchParameters(body)) {\n\t\t\t// Body is a URLSearchParams\n\t\t\tbody = Buffer.from(body.toString());\n\t\t} else if (isBlob(body)) {\n\t\t\t// Body is blob\n\t\t} else if (Buffer.isBuffer(body)) {\n\t\t\t// Body is Buffer\n\t\t} else if (types.isAnyArrayBuffer(body)) {\n\t\t\t// Body is ArrayBuffer\n\t\t\tbody = Buffer.from(body);\n\t\t} else if (ArrayBuffer.isView(body)) {\n\t\t\t// Body is ArrayBufferView\n\t\t\tbody = Buffer.from(body.buffer, body.byteOffset, body.byteLength);\n\t\t} else if (body instanceof Stream) {\n\t\t\t// Body is stream\n\t\t} else if (body instanceof FormData) {\n\t\t\t// Body is FormData\n\t\t\tbody = formDataToBlob(body);\n\t\t\tboundary = body.type.split('=')[1];\n\t\t} else {\n\t\t\t// None of the above\n\t\t\t// coerce to string then buffer\n\t\t\tbody = Buffer.from(String(body));\n\t\t}\n\n\t\tlet stream = body;\n\n\t\tif (Buffer.isBuffer(body)) {\n\t\t\tstream = Stream.Readable.from(body);\n\t\t} else if (isBlob(body)) {\n\t\t\tstream = Stream.Readable.from(body.stream());\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\tbody,\n\t\t\tstream,\n\t\t\tboundary,\n\t\t\tdisturbed: false,\n\t\t\terror: null\n\t\t};\n\t\tthis.size = size;\n\n\t\tif (body instanceof Stream) {\n\t\t\tbody.on('error', error_ => {\n\t\t\t\tconst error = error_ instanceof FetchBaseError ?\n\t\t\t\t\terror_ :\n\t\t\t\t\tnew FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, 'system', error_);\n\t\t\t\tthis[INTERNALS].error = error;\n\t\t\t});\n\t\t}\n\t}\n\n\tget body() {\n\t\treturn this[INTERNALS].stream;\n\t}\n\n\tget bodyUsed() {\n\t\treturn this[INTERNALS].disturbed;\n\t}\n\n\t/**\n\t * Decode response as ArrayBuffer\n\t *\n\t * @return Promise\n\t */\n\tasync arrayBuffer() {\n\t\tconst {buffer, byteOffset, byteLength} = await consumeBody(this);\n\t\treturn buffer.slice(byteOffset, byteOffset + byteLength);\n\t}\n\n\tasync formData() {\n\t\tconst ct = this.headers.get('content-type');\n\n\t\tif (ct.startsWith('application/x-www-form-urlencoded')) {\n\t\t\tconst formData = new FormData();\n\t\t\tconst parameters = new URLSearchParams(await this.text());\n\n\t\t\tfor (const [name, value] of parameters) {\n\t\t\t\tformData.append(name, value);\n\t\t\t}\n\n\t\t\treturn formData;\n\t\t}\n\n\t\tconst {toFormData} = await import('./utils/multipart-parser.js');\n\t\treturn toFormData(this.body, ct);\n\t}\n\n\t/**\n\t * Return raw response as Blob\n\t *\n\t * @return Promise\n\t */\n\tasync blob() {\n\t\tconst ct = (this.headers && this.headers.get('content-type')) || (this[INTERNALS].body && this[INTERNALS].body.type) || '';\n\t\tconst buf = await this.arrayBuffer();\n\n\t\treturn new Blob([buf], {\n\t\t\ttype: ct\n\t\t});\n\t}\n\n\t/**\n\t * Decode response as json\n\t *\n\t * @return Promise\n\t */\n\tasync json() {\n\t\tconst text = await this.text();\n\t\treturn JSON.parse(text);\n\t}\n\n\t/**\n\t * Decode response as text\n\t *\n\t * @return Promise\n\t */\n\tasync text() {\n\t\tconst buffer = await consumeBody(this);\n\t\treturn new TextDecoder().decode(buffer);\n\t}\n\n\t/**\n\t * Decode response as buffer (non-spec api)\n\t *\n\t * @return Promise\n\t */\n\tbuffer() {\n\t\treturn consumeBody(this);\n\t}\n}\n\nBody.prototype.buffer = deprecate(Body.prototype.buffer, 'Please use \\'response.arrayBuffer()\\' instead of \\'response.buffer()\\'', 'node-fetch#buffer');\n\n// In browsers, all properties are enumerable.\nObject.defineProperties(Body.prototype, {\n\tbody: {enumerable: true},\n\tbodyUsed: {enumerable: true},\n\tarrayBuffer: {enumerable: true},\n\tblob: {enumerable: true},\n\tjson: {enumerable: true},\n\ttext: {enumerable: true},\n\tdata: {get: deprecate(() => {},\n\t\t'data doesn\\'t exist, use json(), text(), arrayBuffer(), or body instead',\n\t\t'https://github.com/node-fetch/node-fetch/issues/1000 (response)')}\n});\n\n/**\n * Consume and convert an entire Body to a Buffer.\n *\n * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body\n *\n * @return Promise\n */\nasync function consumeBody(data) {\n\tif (data[INTERNALS].disturbed) {\n\t\tthrow new TypeError(`body used already for: ${data.url}`);\n\t}\n\n\tdata[INTERNALS].disturbed = true;\n\n\tif (data[INTERNALS].error) {\n\t\tthrow data[INTERNALS].error;\n\t}\n\n\tconst {body} = data;\n\n\t// Body is null\n\tif (body === null) {\n\t\treturn Buffer.alloc(0);\n\t}\n\n\t/* c8 ignore next 3 */\n\tif (!(body instanceof Stream)) {\n\t\treturn Buffer.alloc(0);\n\t}\n\n\t// Body is stream\n\t// get ready to actually consume the body\n\tconst accum = [];\n\tlet accumBytes = 0;\n\n\ttry {\n\t\tfor await (const chunk of body) {\n\t\t\tif (data.size > 0 && accumBytes + chunk.length > data.size) {\n\t\t\t\tconst error = new FetchError(`content size at ${data.url} over limit: ${data.size}`, 'max-size');\n\t\t\t\tbody.destroy(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\taccumBytes += chunk.length;\n\t\t\taccum.push(chunk);\n\t\t}\n\t} catch (error) {\n\t\tconst error_ = error instanceof FetchBaseError ? error : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`, 'system', error);\n\t\tthrow error_;\n\t}\n\n\tif (body.readableEnded === true || body._readableState.ended === true) {\n\t\ttry {\n\t\t\tif (accum.every(c => typeof c === 'string')) {\n\t\t\t\treturn Buffer.from(accum.join(''));\n\t\t\t}\n\n\t\t\treturn Buffer.concat(accum, accumBytes);\n\t\t} catch (error) {\n\t\t\tthrow new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`, 'system', error);\n\t\t}\n\t} else {\n\t\tthrow new FetchError(`Premature close of server response while trying to fetch ${data.url}`);\n\t}\n}\n\n/**\n * Clone body given Res/Req instance\n *\n * @param Mixed instance Response or Request instance\n * @param String highWaterMark highWaterMark for both PassThrough body streams\n * @return Mixed\n */\nexport const clone = (instance, highWaterMark) => {\n\tlet p1;\n\tlet p2;\n\tlet {body} = instance[INTERNALS];\n\n\t// Don't allow cloning a used body\n\tif (instance.bodyUsed) {\n\t\tthrow new Error('cannot clone body after it is used');\n\t}\n\n\t// Check that body is a stream and not form-data object\n\t// note: we can't clone the form-data object without having it as a dependency\n\tif ((body instanceof Stream) && (typeof body.getBoundary !== 'function')) {\n\t\t// Tee instance body\n\t\tp1 = new PassThrough({highWaterMark});\n\t\tp2 = new PassThrough({highWaterMark});\n\t\tbody.pipe(p1);\n\t\tbody.pipe(p2);\n\t\t// Set instance body to teed body and return the other teed body\n\t\tinstance[INTERNALS].stream = p1;\n\t\tbody = p2;\n\t}\n\n\treturn body;\n};\n\nconst getNonSpecFormDataBoundary = deprecate(\n\tbody => body.getBoundary(),\n\t'form-data doesn\\'t follow the spec and requires special treatment. Use alternative package',\n\t'https://github.com/node-fetch/node-fetch/issues/1167'\n);\n\n/**\n * Performs the operation \"extract a `Content-Type` value from |object|\" as\n * specified in the specification:\n * https://fetch.spec.whatwg.org/#concept-bodyinit-extract\n *\n * This function assumes that instance.body is present.\n *\n * @param {any} body Any options.body input\n * @returns {string | null}\n */\nexport const extractContentType = (body, request) => {\n\t// Body is null or undefined\n\tif (body === null) {\n\t\treturn null;\n\t}\n\n\t// Body is string\n\tif (typeof body === 'string') {\n\t\treturn 'text/plain;charset=UTF-8';\n\t}\n\n\t// Body is a URLSearchParams\n\tif (isURLSearchParameters(body)) {\n\t\treturn 'application/x-www-form-urlencoded;charset=UTF-8';\n\t}\n\n\t// Body is blob\n\tif (isBlob(body)) {\n\t\treturn body.type || null;\n\t}\n\n\t// Body is a Buffer (Buffer, ArrayBuffer or ArrayBufferView)\n\tif (Buffer.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {\n\t\treturn null;\n\t}\n\n\tif (body instanceof FormData) {\n\t\treturn `multipart/form-data; boundary=${request[INTERNALS].boundary}`;\n\t}\n\n\t// Detect form data input from form-data module\n\tif (body && typeof body.getBoundary === 'function') {\n\t\treturn `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`;\n\t}\n\n\t// Body is stream - can't really do much about this\n\tif (body instanceof Stream) {\n\t\treturn null;\n\t}\n\n\t// Body constructor defaults other things to string\n\treturn 'text/plain;charset=UTF-8';\n};\n\n/**\n * The Fetch Standard treats this as if \"total bytes\" is a property on the body.\n * For us, we have to explicitly get it with a function.\n *\n * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes\n *\n * @param {any} obj.body Body object from the Body instance.\n * @returns {number | null}\n */\nexport const getTotalBytes = request => {\n\tconst {body} = request[INTERNALS];\n\n\t// Body is null or undefined\n\tif (body === null) {\n\t\treturn 0;\n\t}\n\n\t// Body is Blob\n\tif (isBlob(body)) {\n\t\treturn body.size;\n\t}\n\n\t// Body is Buffer\n\tif (Buffer.isBuffer(body)) {\n\t\treturn body.length;\n\t}\n\n\t// Detect form data input from form-data module\n\tif (body && typeof body.getLengthSync === 'function') {\n\t\treturn body.hasKnownLength && body.hasKnownLength() ? body.getLengthSync() : null;\n\t}\n\n\t// Body is stream\n\treturn null;\n};\n\n/**\n * Write a Body to a Node.js WritableStream (e.g. http.Request) object.\n *\n * @param {Stream.Writable} dest The stream to write to.\n * @param obj.body Body object from the Body instance.\n * @returns {Promise}\n */\nexport const writeToStream = async (dest, {body}) => {\n\tif (body === null) {\n\t\t// Body is null\n\t\tdest.end();\n\t} else {\n\t\t// Body is stream\n\t\tawait pipeline(body, dest);\n\t}\n};\n","/**\n * Headers.js\n *\n * Headers class offers convenient helpers\n */\n\nimport {types} from 'node:util';\nimport http from 'node:http';\n\n/* c8 ignore next 9 */\nconst validateHeaderName = typeof http.validateHeaderName === 'function' ?\n\thttp.validateHeaderName :\n\tname => {\n\t\tif (!/^[\\^`\\-\\w!#$%&'*+.|~]+$/.test(name)) {\n\t\t\tconst error = new TypeError(`Header name must be a valid HTTP token [${name}]`);\n\t\t\tObject.defineProperty(error, 'code', {value: 'ERR_INVALID_HTTP_TOKEN'});\n\t\t\tthrow error;\n\t\t}\n\t};\n\n/* c8 ignore next 9 */\nconst validateHeaderValue = typeof http.validateHeaderValue === 'function' ?\n\thttp.validateHeaderValue :\n\t(name, value) => {\n\t\tif (/[^\\t\\u0020-\\u007E\\u0080-\\u00FF]/.test(value)) {\n\t\t\tconst error = new TypeError(`Invalid character in header content [\"${name}\"]`);\n\t\t\tObject.defineProperty(error, 'code', {value: 'ERR_INVALID_CHAR'});\n\t\t\tthrow error;\n\t\t}\n\t};\n\n/**\n * @typedef {Headers | Record | Iterable | Iterable>} HeadersInit\n */\n\n/**\n * This Fetch API interface allows you to perform various actions on HTTP request and response headers.\n * These actions include retrieving, setting, adding to, and removing.\n * A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.\n * You can add to this using methods like append() (see Examples.)\n * In all methods of this interface, header names are matched by case-insensitive byte sequence.\n *\n */\nexport default class Headers extends URLSearchParams {\n\t/**\n\t * Headers class\n\t *\n\t * @constructor\n\t * @param {HeadersInit} [init] - Response headers\n\t */\n\tconstructor(init) {\n\t\t// Validate and normalize init object in [name, value(s)][]\n\t\t/** @type {string[][]} */\n\t\tlet result = [];\n\t\tif (init instanceof Headers) {\n\t\t\tconst raw = init.raw();\n\t\t\tfor (const [name, values] of Object.entries(raw)) {\n\t\t\t\tresult.push(...values.map(value => [name, value]));\n\t\t\t}\n\t\t} else if (init == null) { // eslint-disable-line no-eq-null, eqeqeq\n\t\t\t// No op\n\t\t} else if (typeof init === 'object' && !types.isBoxedPrimitive(init)) {\n\t\t\tconst method = init[Symbol.iterator];\n\t\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\t\tif (method == null) {\n\t\t\t\t// Record\n\t\t\t\tresult.push(...Object.entries(init));\n\t\t\t} else {\n\t\t\t\tif (typeof method !== 'function') {\n\t\t\t\t\tthrow new TypeError('Header pairs must be iterable');\n\t\t\t\t}\n\n\t\t\t\t// Sequence>\n\t\t\t\t// Note: per spec we have to first exhaust the lists then process them\n\t\t\t\tresult = [...init]\n\t\t\t\t\t.map(pair => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof pair !== 'object' || types.isBoxedPrimitive(pair)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new TypeError('Each header pair must be an iterable object');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn [...pair];\n\t\t\t\t\t}).map(pair => {\n\t\t\t\t\t\tif (pair.length !== 2) {\n\t\t\t\t\t\t\tthrow new TypeError('Each header pair must be a name/value tuple');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn [...pair];\n\t\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new TypeError('Failed to construct \\'Headers\\': The provided value is not of type \\'(sequence> or record)');\n\t\t}\n\n\t\t// Validate and lowercase\n\t\tresult =\n\t\t\tresult.length > 0 ?\n\t\t\t\tresult.map(([name, value]) => {\n\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\treturn [String(name).toLowerCase(), String(value)];\n\t\t\t\t}) :\n\t\t\t\tundefined;\n\n\t\tsuper(result);\n\n\t\t// Returning a Proxy that will lowercase key names, validate parameters and sort keys\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn new Proxy(this, {\n\t\t\tget(target, p, receiver) {\n\t\t\t\tswitch (p) {\n\t\t\t\t\tcase 'append':\n\t\t\t\t\tcase 'set':\n\t\t\t\t\t\treturn (name, value) => {\n\t\t\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\t\t\treturn URLSearchParams.prototype[p].call(\n\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\tString(name).toLowerCase(),\n\t\t\t\t\t\t\t\tString(value)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase 'delete':\n\t\t\t\t\tcase 'has':\n\t\t\t\t\tcase 'getAll':\n\t\t\t\t\t\treturn name => {\n\t\t\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\t\t\treturn URLSearchParams.prototype[p].call(\n\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\tString(name).toLowerCase()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase 'keys':\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\ttarget.sort();\n\t\t\t\t\t\t\treturn new Set(URLSearchParams.prototype.keys.call(target)).keys();\n\t\t\t\t\t\t};\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn Reflect.get(target, p, receiver);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t/* c8 ignore next */\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn this.constructor.name;\n\t}\n\n\ttoString() {\n\t\treturn Object.prototype.toString.call(this);\n\t}\n\n\tget(name) {\n\t\tconst values = this.getAll(name);\n\t\tif (values.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet value = values.join(', ');\n\t\tif (/^content-encoding$/i.test(name)) {\n\t\t\tvalue = value.toLowerCase();\n\t\t}\n\n\t\treturn value;\n\t}\n\n\tforEach(callback, thisArg = undefined) {\n\t\tfor (const name of this.keys()) {\n\t\t\tReflect.apply(callback, thisArg, [this.get(name), name, this]);\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const name of this.keys()) {\n\t\t\tyield this.get(name);\n\t\t}\n\t}\n\n\t/**\n\t * @type {() => IterableIterator<[string, string]>}\n\t */\n\t* entries() {\n\t\tfor (const name of this.keys()) {\n\t\t\tyield [name, this.get(name)];\n\t\t}\n\t}\n\n\t[Symbol.iterator]() {\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Node-fetch non-spec method\n\t * returning all headers and their values as array\n\t * @returns {Record}\n\t */\n\traw() {\n\t\treturn [...this.keys()].reduce((result, key) => {\n\t\t\tresult[key] = this.getAll(key);\n\t\t\treturn result;\n\t\t}, {});\n\t}\n\n\t/**\n\t * For better console.log(headers) and also to convert Headers into Node.js Request compatible format\n\t */\n\t[Symbol.for('nodejs.util.inspect.custom')]() {\n\t\treturn [...this.keys()].reduce((result, key) => {\n\t\t\tconst values = this.getAll(key);\n\t\t\t// Http.request() only supports string as Host header.\n\t\t\t// This hack makes specifying custom Host header possible.\n\t\t\tif (key === 'host') {\n\t\t\t\tresult[key] = values[0];\n\t\t\t} else {\n\t\t\t\tresult[key] = values.length > 1 ? values : values[0];\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}, {});\n\t}\n}\n\n/**\n * Re-shaping object for Web IDL tests\n * Only need to do it for overridden methods\n */\nObject.defineProperties(\n\tHeaders.prototype,\n\t['get', 'entries', 'forEach', 'values'].reduce((result, property) => {\n\t\tresult[property] = {enumerable: true};\n\t\treturn result;\n\t}, {})\n);\n\n/**\n * Create a Headers object from an http.IncomingMessage.rawHeaders, ignoring those that do\n * not conform to HTTP grammar productions.\n * @param {import('http').IncomingMessage['rawHeaders']} headers\n */\nexport function fromRawHeaders(headers = []) {\n\treturn new Headers(\n\t\theaders\n\t\t\t// Split into pairs\n\t\t\t.reduce((result, value, index, array) => {\n\t\t\t\tif (index % 2 === 0) {\n\t\t\t\t\tresult.push(array.slice(index, index + 2));\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}, [])\n\t\t\t.filter(([name, value]) => {\n\t\t\t\ttry {\n\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\treturn true;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t})\n\n\t);\n}\n","const redirectStatus = new Set([301, 302, 303, 307, 308]);\n\n/**\n * Redirect code matching\n *\n * @param {number} code - Status code\n * @return {boolean}\n */\nexport const isRedirect = code => {\n\treturn redirectStatus.has(code);\n};\n","/**\n * Response.js\n *\n * Response class provides content decoding\n */\n\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType} from './body.js';\nimport {isRedirect} from './utils/is-redirect.js';\n\nconst INTERNALS = Symbol('Response internals');\n\n/**\n * Response class\n *\n * Ref: https://fetch.spec.whatwg.org/#response-class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Response extends Body {\n\tconstructor(body = null, options = {}) {\n\t\tsuper(body, options);\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq, no-negated-condition\n\t\tconst status = options.status != null ? options.status : 200;\n\n\t\tconst headers = new Headers(options.headers);\n\n\t\tif (body !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\ttype: 'default',\n\t\t\turl: options.url,\n\t\t\tstatus,\n\t\t\tstatusText: options.statusText || '',\n\t\t\theaders,\n\t\t\tcounter: options.counter,\n\t\t\thighWaterMark: options.highWaterMark\n\t\t};\n\t}\n\n\tget type() {\n\t\treturn this[INTERNALS].type;\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS].status;\n\t}\n\n\t/**\n\t * Convenience property representing if the request ended normally\n\t */\n\tget ok() {\n\t\treturn this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget highWaterMark() {\n\t\treturn this[INTERNALS].highWaterMark;\n\t}\n\n\t/**\n\t * Clone this response\n\t *\n\t * @return Response\n\t */\n\tclone() {\n\t\treturn new Response(clone(this, this.highWaterMark), {\n\t\t\ttype: this.type,\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected,\n\t\t\tsize: this.size,\n\t\t\thighWaterMark: this.highWaterMark\n\t\t});\n\t}\n\n\t/**\n\t * @param {string} url The URL that the new response is to originate from.\n\t * @param {number} status An optional status code for the response (e.g., 302.)\n\t * @returns {Response} A Response object.\n\t */\n\tstatic redirect(url, status = 302) {\n\t\tif (!isRedirect(status)) {\n\t\t\tthrow new RangeError('Failed to execute \"redirect\" on \"response\": Invalid status code');\n\t\t}\n\n\t\treturn new Response(null, {\n\t\t\theaders: {\n\t\t\t\tlocation: new URL(url).toString()\n\t\t\t},\n\t\t\tstatus\n\t\t});\n\t}\n\n\tstatic error() {\n\t\tconst response = new Response(null, {status: 0, statusText: ''});\n\t\tresponse[INTERNALS].type = 'error';\n\t\treturn response;\n\t}\n\n\tstatic json(data = undefined, init = {}) {\n\t\tconst body = JSON.stringify(data);\n\n\t\tif (body === undefined) {\n\t\t\tthrow new TypeError('data is not JSON serializable');\n\t\t}\n\n\t\tconst headers = new Headers(init && init.headers);\n\n\t\tif (!headers.has('content-type')) {\n\t\t\theaders.set('content-type', 'application/json');\n\t\t}\n\n\t\treturn new Response(body, {\n\t\t\t...init,\n\t\t\theaders\n\t\t});\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Response';\n\t}\n}\n\nObject.defineProperties(Response.prototype, {\n\ttype: {enumerable: true},\n\turl: {enumerable: true},\n\tstatus: {enumerable: true},\n\tok: {enumerable: true},\n\tredirected: {enumerable: true},\n\tstatusText: {enumerable: true},\n\theaders: {enumerable: true},\n\tclone: {enumerable: true}\n});\n","export const getSearch = parsedURL => {\n\tif (parsedURL.search) {\n\t\treturn parsedURL.search;\n\t}\n\n\tconst lastOffset = parsedURL.href.length - 1;\n\tconst hash = parsedURL.hash || (parsedURL.href[lastOffset] === '#' ? '#' : '');\n\treturn parsedURL.href[lastOffset - hash.length] === '?' ? '?' : '';\n};\n","import {isIP} from 'node:net';\n\n/**\n * @external URL\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/URL|URL}\n */\n\n/**\n * @module utils/referrer\n * @private\n */\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#strip-url|Referrer Policy §8.4. Strip url for use as a referrer}\n * @param {string} URL\n * @param {boolean} [originOnly=false]\n */\nexport function stripURLForUseAsAReferrer(url, originOnly = false) {\n\t// 1. If url is null, return no referrer.\n\tif (url == null) { // eslint-disable-line no-eq-null, eqeqeq\n\t\treturn 'no-referrer';\n\t}\n\n\turl = new URL(url);\n\n\t// 2. If url's scheme is a local scheme, then return no referrer.\n\tif (/^(about|blob|data):$/.test(url.protocol)) {\n\t\treturn 'no-referrer';\n\t}\n\n\t// 3. Set url's username to the empty string.\n\turl.username = '';\n\n\t// 4. Set url's password to null.\n\t// Note: `null` appears to be a mistake as this actually results in the password being `\"null\"`.\n\turl.password = '';\n\n\t// 5. Set url's fragment to null.\n\t// Note: `null` appears to be a mistake as this actually results in the fragment being `\"#null\"`.\n\turl.hash = '';\n\n\t// 6. If the origin-only flag is true, then:\n\tif (originOnly) {\n\t\t// 6.1. Set url's path to null.\n\t\t// Note: `null` appears to be a mistake as this actually results in the path being `\"/null\"`.\n\t\turl.pathname = '';\n\n\t\t// 6.2. Set url's query to null.\n\t\t// Note: `null` appears to be a mistake as this actually results in the query being `\"?null\"`.\n\t\turl.search = '';\n\t}\n\n\t// 7. Return url.\n\treturn url;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#enumdef-referrerpolicy|enum ReferrerPolicy}\n */\nexport const ReferrerPolicy = new Set([\n\t'',\n\t'no-referrer',\n\t'no-referrer-when-downgrade',\n\t'same-origin',\n\t'origin',\n\t'strict-origin',\n\t'origin-when-cross-origin',\n\t'strict-origin-when-cross-origin',\n\t'unsafe-url'\n]);\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#default-referrer-policy|default referrer policy}\n */\nexport const DEFAULT_REFERRER_POLICY = 'strict-origin-when-cross-origin';\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#referrer-policies|Referrer Policy §3. Referrer Policies}\n * @param {string} referrerPolicy\n * @returns {string} referrerPolicy\n */\nexport function validateReferrerPolicy(referrerPolicy) {\n\tif (!ReferrerPolicy.has(referrerPolicy)) {\n\t\tthrow new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);\n\t}\n\n\treturn referrerPolicy;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy|Referrer Policy §3.2. Is origin potentially trustworthy?}\n * @param {external:URL} url\n * @returns `true`: \"Potentially Trustworthy\", `false`: \"Not Trustworthy\"\n */\nexport function isOriginPotentiallyTrustworthy(url) {\n\t// 1. If origin is an opaque origin, return \"Not Trustworthy\".\n\t// Not applicable\n\n\t// 2. Assert: origin is a tuple origin.\n\t// Not for implementations\n\n\t// 3. If origin's scheme is either \"https\" or \"wss\", return \"Potentially Trustworthy\".\n\tif (/^(http|ws)s:$/.test(url.protocol)) {\n\t\treturn true;\n\t}\n\n\t// 4. If origin's host component matches one of the CIDR notations 127.0.0.0/8 or ::1/128 [RFC4632], return \"Potentially Trustworthy\".\n\tconst hostIp = url.host.replace(/(^\\[)|(]$)/g, '');\n\tconst hostIPVersion = isIP(hostIp);\n\n\tif (hostIPVersion === 4 && /^127\\./.test(hostIp)) {\n\t\treturn true;\n\t}\n\n\tif (hostIPVersion === 6 && /^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)) {\n\t\treturn true;\n\t}\n\n\t// 5. If origin's host component is \"localhost\" or falls within \".localhost\", and the user agent conforms to the name resolution rules in [let-localhost-be-localhost], return \"Potentially Trustworthy\".\n\t// We are returning FALSE here because we cannot ensure conformance to\n\t// let-localhost-be-loalhost (https://tools.ietf.org/html/draft-west-let-localhost-be-localhost)\n\tif (url.host === 'localhost' || url.host.endsWith('.localhost')) {\n\t\treturn false;\n\t}\n\n\t// 6. If origin's scheme component is file, return \"Potentially Trustworthy\".\n\tif (url.protocol === 'file:') {\n\t\treturn true;\n\t}\n\n\t// 7. If origin's scheme component is one which the user agent considers to be authenticated, return \"Potentially Trustworthy\".\n\t// Not supported\n\n\t// 8. If origin has been configured as a trustworthy origin, return \"Potentially Trustworthy\".\n\t// Not supported\n\n\t// 9. Return \"Not Trustworthy\".\n\treturn false;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-url-trustworthy|Referrer Policy §3.3. Is url potentially trustworthy?}\n * @param {external:URL} url\n * @returns `true`: \"Potentially Trustworthy\", `false`: \"Not Trustworthy\"\n */\nexport function isUrlPotentiallyTrustworthy(url) {\n\t// 1. If url is \"about:blank\" or \"about:srcdoc\", return \"Potentially Trustworthy\".\n\tif (/^about:(blank|srcdoc)$/.test(url)) {\n\t\treturn true;\n\t}\n\n\t// 2. If url's scheme is \"data\", return \"Potentially Trustworthy\".\n\tif (url.protocol === 'data:') {\n\t\treturn true;\n\t}\n\n\t// Note: The origin of blob: and filesystem: URLs is the origin of the context in which they were\n\t// created. Therefore, blobs created in a trustworthy origin will themselves be potentially\n\t// trustworthy.\n\tif (/^(blob|filesystem):$/.test(url.protocol)) {\n\t\treturn true;\n\t}\n\n\t// 3. Return the result of executing §3.2 Is origin potentially trustworthy? on url's origin.\n\treturn isOriginPotentiallyTrustworthy(url);\n}\n\n/**\n * Modifies the referrerURL to enforce any extra security policy considerations.\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7\n * @callback module:utils/referrer~referrerURLCallback\n * @param {external:URL} referrerURL\n * @returns {external:URL} modified referrerURL\n */\n\n/**\n * Modifies the referrerOrigin to enforce any extra security policy considerations.\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7\n * @callback module:utils/referrer~referrerOriginCallback\n * @param {external:URL} referrerOrigin\n * @returns {external:URL} modified referrerOrigin\n */\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}\n * @param {Request} request\n * @param {object} o\n * @param {module:utils/referrer~referrerURLCallback} o.referrerURLCallback\n * @param {module:utils/referrer~referrerOriginCallback} o.referrerOriginCallback\n * @returns {external:URL} Request's referrer\n */\nexport function determineRequestsReferrer(request, {referrerURLCallback, referrerOriginCallback} = {}) {\n\t// There are 2 notes in the specification about invalid pre-conditions. We return null, here, for\n\t// these cases:\n\t// > Note: If request's referrer is \"no-referrer\", Fetch will not call into this algorithm.\n\t// > Note: If request's referrer policy is the empty string, Fetch will not call into this\n\t// > algorithm.\n\tif (request.referrer === 'no-referrer' || request.referrerPolicy === '') {\n\t\treturn null;\n\t}\n\n\t// 1. Let policy be request's associated referrer policy.\n\tconst policy = request.referrerPolicy;\n\n\t// 2. Let environment be request's client.\n\t// not applicable to node.js\n\n\t// 3. Switch on request's referrer:\n\tif (request.referrer === 'about:client') {\n\t\treturn 'no-referrer';\n\t}\n\n\t// \"a URL\": Let referrerSource be request's referrer.\n\tconst referrerSource = request.referrer;\n\n\t// 4. Let request's referrerURL be the result of stripping referrerSource for use as a referrer.\n\tlet referrerURL = stripURLForUseAsAReferrer(referrerSource);\n\n\t// 5. Let referrerOrigin be the result of stripping referrerSource for use as a referrer, with the\n\t// origin-only flag set to true.\n\tlet referrerOrigin = stripURLForUseAsAReferrer(referrerSource, true);\n\n\t// 6. If the result of serializing referrerURL is a string whose length is greater than 4096, set\n\t// referrerURL to referrerOrigin.\n\tif (referrerURL.toString().length > 4096) {\n\t\treferrerURL = referrerOrigin;\n\t}\n\n\t// 7. The user agent MAY alter referrerURL or referrerOrigin at this point to enforce arbitrary\n\t// policy considerations in the interests of minimizing data leakage. For example, the user\n\t// agent could strip the URL down to an origin, modify its host, replace it with an empty\n\t// string, etc.\n\tif (referrerURLCallback) {\n\t\treferrerURL = referrerURLCallback(referrerURL);\n\t}\n\n\tif (referrerOriginCallback) {\n\t\treferrerOrigin = referrerOriginCallback(referrerOrigin);\n\t}\n\n\t// 8.Execute the statements corresponding to the value of policy:\n\tconst currentURL = new URL(request.url);\n\n\tswitch (policy) {\n\t\tcase 'no-referrer':\n\t\t\treturn 'no-referrer';\n\n\t\tcase 'origin':\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'unsafe-url':\n\t\t\treturn referrerURL;\n\n\t\tcase 'strict-origin':\n\t\t\t// 1. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 2. Return referrerOrigin.\n\t\t\treturn referrerOrigin.toString();\n\n\t\tcase 'strict-origin-when-cross-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// 2. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 3. Return referrerOrigin.\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'same-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// 2. Return no referrer.\n\t\t\treturn 'no-referrer';\n\n\t\tcase 'origin-when-cross-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// Return referrerOrigin.\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'no-referrer-when-downgrade':\n\t\t\t// 1. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 2. Return referrerURL.\n\t\t\treturn referrerURL;\n\n\t\tdefault:\n\t\t\tthrow new TypeError(`Invalid referrerPolicy: ${policy}`);\n\t}\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#parse-referrer-policy-from-header|Referrer Policy §8.1. Parse a referrer policy from a Referrer-Policy header}\n * @param {Headers} headers Response headers\n * @returns {string} policy\n */\nexport function parseReferrerPolicyFromHeader(headers) {\n\t// 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy`\n\t// and response’s header list.\n\tconst policyTokens = (headers.get('referrer-policy') || '').split(/[,\\s]+/);\n\n\t// 2. Let policy be the empty string.\n\tlet policy = '';\n\n\t// 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty\n\t// string, then set policy to token.\n\t// Note: This algorithm loops over multiple policy values to allow deployment of new policy\n\t// values with fallbacks for older user agents, as described in § 11.1 Unknown Policy Values.\n\tfor (const token of policyTokens) {\n\t\tif (token && ReferrerPolicy.has(token)) {\n\t\t\tpolicy = token;\n\t\t}\n\t}\n\n\t// 4. Return policy.\n\treturn policy;\n}\n","/**\n * Request.js\n *\n * Request class contains server only options\n *\n * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.\n */\n\nimport {format as formatUrl} from 'node:url';\nimport {deprecate} from 'node:util';\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType, getTotalBytes} from './body.js';\nimport {isAbortSignal} from './utils/is.js';\nimport {getSearch} from './utils/get-search.js';\nimport {\n\tvalidateReferrerPolicy, determineRequestsReferrer, DEFAULT_REFERRER_POLICY\n} from './utils/referrer.js';\n\nconst INTERNALS = Symbol('Request internals');\n\n/**\n * Check if `obj` is an instance of Request.\n *\n * @param {*} object\n * @return {boolean}\n */\nconst isRequest = object => {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object[INTERNALS] === 'object'\n\t);\n};\n\nconst doBadDataWarn = deprecate(() => {},\n\t'.data is not a valid RequestInit property, use .body instead',\n\t'https://github.com/node-fetch/node-fetch/issues/1000 (request)');\n\n/**\n * Request class\n *\n * Ref: https://fetch.spec.whatwg.org/#request-class\n *\n * @param Mixed input Url or Request instance\n * @param Object init Custom options\n * @return Void\n */\nexport default class Request extends Body {\n\tconstructor(input, init = {}) {\n\t\tlet parsedURL;\n\n\t\t// Normalize input and force URL to be encoded as UTF-8 (https://github.com/node-fetch/node-fetch/issues/245)\n\t\tif (isRequest(input)) {\n\t\t\tparsedURL = new URL(input.url);\n\t\t} else {\n\t\t\tparsedURL = new URL(input);\n\t\t\tinput = {};\n\t\t}\n\n\t\tif (parsedURL.username !== '' || parsedURL.password !== '') {\n\t\t\tthrow new TypeError(`${parsedURL} is an url with embedded credentials.`);\n\t\t}\n\n\t\tlet method = init.method || input.method || 'GET';\n\t\tif (/^(delete|get|head|options|post|put)$/i.test(method)) {\n\t\t\tmethod = method.toUpperCase();\n\t\t}\n\n\t\tif (!isRequest(init) && 'data' in init) {\n\t\t\tdoBadDataWarn();\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif ((init.body != null || (isRequest(input) && input.body !== null)) &&\n\t\t\t(method === 'GET' || method === 'HEAD')) {\n\t\t\tthrow new TypeError('Request with GET/HEAD method cannot have body');\n\t\t}\n\n\t\tconst inputBody = init.body ?\n\t\t\tinit.body :\n\t\t\t(isRequest(input) && input.body !== null ?\n\t\t\t\tclone(input) :\n\t\t\t\tnull);\n\n\t\tsuper(inputBody, {\n\t\t\tsize: init.size || input.size || 0\n\t\t});\n\n\t\tconst headers = new Headers(init.headers || input.headers || {});\n\n\t\tif (inputBody !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(inputBody, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.set('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tlet signal = isRequest(input) ?\n\t\t\tinput.signal :\n\t\t\tnull;\n\t\tif ('signal' in init) {\n\t\t\tsignal = init.signal;\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif (signal != null && !isAbortSignal(signal)) {\n\t\t\tthrow new TypeError('Expected signal to be an instanceof AbortSignal or EventTarget');\n\t\t}\n\n\t\t// §5.4, Request constructor steps, step 15.1\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tlet referrer = init.referrer == null ? input.referrer : init.referrer;\n\t\tif (referrer === '') {\n\t\t\t// §5.4, Request constructor steps, step 15.2\n\t\t\treferrer = 'no-referrer';\n\t\t} else if (referrer) {\n\t\t\t// §5.4, Request constructor steps, step 15.3.1, 15.3.2\n\t\t\tconst parsedReferrer = new URL(referrer);\n\t\t\t// §5.4, Request constructor steps, step 15.3.3, 15.3.4\n\t\t\treferrer = /^about:(\\/\\/)?client$/.test(parsedReferrer) ? 'client' : parsedReferrer;\n\t\t} else {\n\t\t\treferrer = undefined;\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\tmethod,\n\t\t\tredirect: init.redirect || input.redirect || 'follow',\n\t\t\theaders,\n\t\t\tparsedURL,\n\t\t\tsignal,\n\t\t\treferrer\n\t\t};\n\n\t\t// Node-fetch-only options\n\t\tthis.follow = init.follow === undefined ? (input.follow === undefined ? 20 : input.follow) : init.follow;\n\t\tthis.compress = init.compress === undefined ? (input.compress === undefined ? true : input.compress) : init.compress;\n\t\tthis.counter = init.counter || input.counter || 0;\n\t\tthis.agent = init.agent || input.agent;\n\t\tthis.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;\n\t\tthis.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;\n\n\t\t// §5.4, Request constructor steps, step 16.\n\t\t// Default is empty string per https://fetch.spec.whatwg.org/#concept-request-referrer-policy\n\t\tthis.referrerPolicy = init.referrerPolicy || input.referrerPolicy || '';\n\t}\n\n\t/** @returns {string} */\n\tget method() {\n\t\treturn this[INTERNALS].method;\n\t}\n\n\t/** @returns {string} */\n\tget url() {\n\t\treturn formatUrl(this[INTERNALS].parsedURL);\n\t}\n\n\t/** @returns {Headers} */\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget redirect() {\n\t\treturn this[INTERNALS].redirect;\n\t}\n\n\t/** @returns {AbortSignal} */\n\tget signal() {\n\t\treturn this[INTERNALS].signal;\n\t}\n\n\t// https://fetch.spec.whatwg.org/#dom-request-referrer\n\tget referrer() {\n\t\tif (this[INTERNALS].referrer === 'no-referrer') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer === 'client') {\n\t\t\treturn 'about:client';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer) {\n\t\t\treturn this[INTERNALS].referrer.toString();\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tget referrerPolicy() {\n\t\treturn this[INTERNALS].referrerPolicy;\n\t}\n\n\tset referrerPolicy(referrerPolicy) {\n\t\tthis[INTERNALS].referrerPolicy = validateReferrerPolicy(referrerPolicy);\n\t}\n\n\t/**\n\t * Clone this request\n\t *\n\t * @return Request\n\t */\n\tclone() {\n\t\treturn new Request(this);\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Request';\n\t}\n}\n\nObject.defineProperties(Request.prototype, {\n\tmethod: {enumerable: true},\n\turl: {enumerable: true},\n\theaders: {enumerable: true},\n\tredirect: {enumerable: true},\n\tclone: {enumerable: true},\n\tsignal: {enumerable: true},\n\treferrer: {enumerable: true},\n\treferrerPolicy: {enumerable: true}\n});\n\n/**\n * Convert a Request to Node.js http request options.\n *\n * @param {Request} request - A Request instance\n * @return The options object to be passed to http.request\n */\nexport const getNodeRequestOptions = request => {\n\tconst {parsedURL} = request[INTERNALS];\n\tconst headers = new Headers(request[INTERNALS].headers);\n\n\t// Fetch step 1.3\n\tif (!headers.has('Accept')) {\n\t\theaders.set('Accept', '*/*');\n\t}\n\n\t// HTTP-network-or-cache fetch steps 2.4-2.7\n\tlet contentLengthValue = null;\n\tif (request.body === null && /^(post|put)$/i.test(request.method)) {\n\t\tcontentLengthValue = '0';\n\t}\n\n\tif (request.body !== null) {\n\t\tconst totalBytes = getTotalBytes(request);\n\t\t// Set Content-Length if totalBytes is a number (that is not NaN)\n\t\tif (typeof totalBytes === 'number' && !Number.isNaN(totalBytes)) {\n\t\t\tcontentLengthValue = String(totalBytes);\n\t\t}\n\t}\n\n\tif (contentLengthValue) {\n\t\theaders.set('Content-Length', contentLengthValue);\n\t}\n\n\t// 4.1. Main fetch, step 2.6\n\t// > If request's referrer policy is the empty string, then set request's referrer policy to the\n\t// > default referrer policy.\n\tif (request.referrerPolicy === '') {\n\t\trequest.referrerPolicy = DEFAULT_REFERRER_POLICY;\n\t}\n\n\t// 4.1. Main fetch, step 2.7\n\t// > If request's referrer is not \"no-referrer\", set request's referrer to the result of invoking\n\t// > determine request's referrer.\n\tif (request.referrer && request.referrer !== 'no-referrer') {\n\t\trequest[INTERNALS].referrer = determineRequestsReferrer(request);\n\t} else {\n\t\trequest[INTERNALS].referrer = 'no-referrer';\n\t}\n\n\t// 4.5. HTTP-network-or-cache fetch, step 6.9\n\t// > If httpRequest's referrer is a URL, then append `Referer`/httpRequest's referrer, serialized\n\t// > and isomorphic encoded, to httpRequest's header list.\n\tif (request[INTERNALS].referrer instanceof URL) {\n\t\theaders.set('Referer', request.referrer);\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.11\n\tif (!headers.has('User-Agent')) {\n\t\theaders.set('User-Agent', 'node-fetch');\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.15\n\tif (request.compress && !headers.has('Accept-Encoding')) {\n\t\theaders.set('Accept-Encoding', 'gzip, deflate, br');\n\t}\n\n\tlet {agent} = request;\n\tif (typeof agent === 'function') {\n\t\tagent = agent(parsedURL);\n\t}\n\n\t// HTTP-network fetch step 4.2\n\t// chunked encoding is handled by Node.js\n\n\tconst search = getSearch(parsedURL);\n\n\t// Pass the full URL directly to request(), but overwrite the following\n\t// options:\n\tconst options = {\n\t\t// Overwrite search to retain trailing ? (issue #776)\n\t\tpath: parsedURL.pathname + search,\n\t\t// The following options are not expressed in the URL\n\t\tmethod: request.method,\n\t\theaders: headers[Symbol.for('nodejs.util.inspect.custom')](),\n\t\tinsecureHTTPParser: request.insecureHTTPParser,\n\t\tagent\n\t};\n\n\treturn {\n\t\t/** @type {URL} */\n\t\tparsedURL,\n\t\toptions\n\t};\n};\n","import {FetchBaseError} from './base.js';\n\n/**\n * AbortError interface for cancelled requests\n */\nexport class AbortError extends FetchBaseError {\n\tconstructor(message, type = 'aborted') {\n\t\tsuper(message, type);\n\t}\n}\n","/**\n * Index.js\n *\n * a request API compatible with window.fetch\n *\n * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.\n */\n\nimport http from 'node:http';\nimport https from 'node:https';\nimport zlib from 'node:zlib';\nimport Stream, {PassThrough, pipeline as pump} from 'node:stream';\nimport {Buffer} from 'node:buffer';\n\nimport dataUriToBuffer from 'data-uri-to-buffer';\n\nimport {writeToStream, clone} from './body.js';\nimport Response from './response.js';\nimport Headers, {fromRawHeaders} from './headers.js';\nimport Request, {getNodeRequestOptions} from './request.js';\nimport {FetchError} from './errors/fetch-error.js';\nimport {AbortError} from './errors/abort-error.js';\nimport {isRedirect} from './utils/is-redirect.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\nimport {isDomainOrSubdomain, isSameProtocol} from './utils/is.js';\nimport {parseReferrerPolicyFromHeader} from './utils/referrer.js';\nimport {\n\tBlob,\n\tFile,\n\tfileFromSync,\n\tfileFrom,\n\tblobFromSync,\n\tblobFrom\n} from 'fetch-blob/from.js';\n\nexport {FormData, Headers, Request, Response, FetchError, AbortError, isRedirect};\nexport {Blob, File, fileFromSync, fileFrom, blobFromSync, blobFrom};\n\nconst supportedSchemas = new Set(['data:', 'http:', 'https:']);\n\n/**\n * Fetch function\n *\n * @param {string | URL | import('./request').default} url - Absolute url or Request instance\n * @param {*} [options_] - Fetch options\n * @return {Promise}\n */\nexport default async function fetch(url, options_) {\n\treturn new Promise((resolve, reject) => {\n\t\t// Build request object\n\t\tconst request = new Request(url, options_);\n\t\tconst {parsedURL, options} = getNodeRequestOptions(request);\n\t\tif (!supportedSchemas.has(parsedURL.protocol)) {\n\t\t\tthrow new TypeError(`node-fetch cannot load ${url}. URL scheme \"${parsedURL.protocol.replace(/:$/, '')}\" is not supported.`);\n\t\t}\n\n\t\tif (parsedURL.protocol === 'data:') {\n\t\t\tconst data = dataUriToBuffer(request.url);\n\t\t\tconst response = new Response(data, {headers: {'Content-Type': data.typeFull}});\n\t\t\tresolve(response);\n\t\t\treturn;\n\t\t}\n\n\t\t// Wrap http.request into fetch\n\t\tconst send = (parsedURL.protocol === 'https:' ? https : http).request;\n\t\tconst {signal} = request;\n\t\tlet response = null;\n\n\t\tconst abort = () => {\n\t\t\tconst error = new AbortError('The operation was aborted.');\n\t\t\treject(error);\n\t\t\tif (request.body && request.body instanceof Stream.Readable) {\n\t\t\t\trequest.body.destroy(error);\n\t\t\t}\n\n\t\t\tif (!response || !response.body) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tresponse.body.emit('error', error);\n\t\t};\n\n\t\tif (signal && signal.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\n\t\tconst abortAndFinalize = () => {\n\t\t\tabort();\n\t\t\tfinalize();\n\t\t};\n\n\t\t// Send request\n\t\tconst request_ = send(parsedURL.toString(), options);\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', abortAndFinalize);\n\t\t}\n\n\t\tconst finalize = () => {\n\t\t\trequest_.abort();\n\t\t\tif (signal) {\n\t\t\t\tsignal.removeEventListener('abort', abortAndFinalize);\n\t\t\t}\n\t\t};\n\n\t\trequest_.on('error', error => {\n\t\t\treject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, 'system', error));\n\t\t\tfinalize();\n\t\t});\n\n\t\tfixResponseChunkedTransferBadEnding(request_, error => {\n\t\t\tif (response && response.body) {\n\t\t\t\tresponse.body.destroy(error);\n\t\t\t}\n\t\t});\n\n\t\t/* c8 ignore next 18 */\n\t\tif (process.version < 'v14') {\n\t\t\t// Before Node.js 14, pipeline() does not fully support async iterators and does not always\n\t\t\t// properly handle when the socket close/end events are out of order.\n\t\t\trequest_.on('socket', s => {\n\t\t\t\tlet endedWithEventsCount;\n\t\t\t\ts.prependListener('end', () => {\n\t\t\t\t\tendedWithEventsCount = s._eventsCount;\n\t\t\t\t});\n\t\t\t\ts.prependListener('close', hadError => {\n\t\t\t\t\t// if end happened before close but the socket didn't emit an error, do it now\n\t\t\t\t\tif (response && endedWithEventsCount < s._eventsCount && !hadError) {\n\t\t\t\t\t\tconst error = new Error('Premature close');\n\t\t\t\t\t\terror.code = 'ERR_STREAM_PREMATURE_CLOSE';\n\t\t\t\t\t\tresponse.body.emit('error', error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\trequest_.on('response', response_ => {\n\t\t\trequest_.setTimeout(0);\n\t\t\tconst headers = fromRawHeaders(response_.rawHeaders);\n\n\t\t\t// HTTP fetch step 5\n\t\t\tif (isRedirect(response_.statusCode)) {\n\t\t\t\t// HTTP fetch step 5.2\n\t\t\t\tconst location = headers.get('Location');\n\n\t\t\t\t// HTTP fetch step 5.3\n\t\t\t\tlet locationURL = null;\n\t\t\t\ttry {\n\t\t\t\t\tlocationURL = location === null ? null : new URL(location, request.url);\n\t\t\t\t} catch {\n\t\t\t\t\t// error here can only be invalid URL in Location: header\n\t\t\t\t\t// do not throw when options.redirect == manual\n\t\t\t\t\t// let the user extract the errorneous redirect URL\n\t\t\t\t\tif (request.redirect !== 'manual') {\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// HTTP fetch step 5.5\n\t\t\t\tswitch (request.redirect) {\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase 'manual':\n\t\t\t\t\t\t// Nothing to do\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'follow': {\n\t\t\t\t\t\t// HTTP-redirect fetch step 2\n\t\t\t\t\t\tif (locationURL === null) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 5\n\t\t\t\t\t\tif (request.counter >= request.follow) {\n\t\t\t\t\t\t\treject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 6 (counter increment)\n\t\t\t\t\t\t// Create a new Request object.\n\t\t\t\t\t\tconst requestOptions = {\n\t\t\t\t\t\t\theaders: new Headers(request.headers),\n\t\t\t\t\t\t\tfollow: request.follow,\n\t\t\t\t\t\t\tcounter: request.counter + 1,\n\t\t\t\t\t\t\tagent: request.agent,\n\t\t\t\t\t\t\tcompress: request.compress,\n\t\t\t\t\t\t\tmethod: request.method,\n\t\t\t\t\t\t\tbody: clone(request),\n\t\t\t\t\t\t\tsignal: request.signal,\n\t\t\t\t\t\t\tsize: request.size,\n\t\t\t\t\t\t\treferrer: request.referrer,\n\t\t\t\t\t\t\treferrerPolicy: request.referrerPolicy\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// when forwarding sensitive headers like \"Authorization\",\n\t\t\t\t\t\t// \"WWW-Authenticate\", and \"Cookie\" to untrusted targets,\n\t\t\t\t\t\t// headers will be ignored when following a redirect to a domain\n\t\t\t\t\t\t// that is not a subdomain match or exact match of the initial domain.\n\t\t\t\t\t\t// For example, a redirect from \"foo.com\" to either \"foo.com\" or \"sub.foo.com\"\n\t\t\t\t\t\t// will forward the sensitive headers, but a redirect to \"bar.com\" will not.\n\t\t\t\t\t\t// headers will also be ignored when following a redirect to a domain using\n\t\t\t\t\t\t// a different protocol. For example, a redirect from \"https://foo.com\" to \"http://foo.com\"\n\t\t\t\t\t\t// will not forward the sensitive headers\n\t\t\t\t\t\tif (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {\n\t\t\t\t\t\t\tfor (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {\n\t\t\t\t\t\t\t\trequestOptions.headers.delete(name);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 9\n\t\t\t\t\t\tif (response_.statusCode !== 303 && request.body && options_.body instanceof Stream.Readable) {\n\t\t\t\t\t\t\treject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 11\n\t\t\t\t\t\tif (response_.statusCode === 303 || ((response_.statusCode === 301 || response_.statusCode === 302) && request.method === 'POST')) {\n\t\t\t\t\t\t\trequestOptions.method = 'GET';\n\t\t\t\t\t\t\trequestOptions.body = undefined;\n\t\t\t\t\t\t\trequestOptions.headers.delete('content-length');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 14\n\t\t\t\t\t\tconst responseReferrerPolicy = parseReferrerPolicyFromHeader(headers);\n\t\t\t\t\t\tif (responseReferrerPolicy) {\n\t\t\t\t\t\t\trequestOptions.referrerPolicy = responseReferrerPolicy;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 15\n\t\t\t\t\t\tresolve(fetch(new Request(locationURL, requestOptions)));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Prepare response\n\t\t\tif (signal) {\n\t\t\t\tresponse_.once('end', () => {\n\t\t\t\t\tsignal.removeEventListener('abort', abortAndFinalize);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet body = pump(response_, new PassThrough(), error => {\n\t\t\t\tif (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\t\t\t});\n\t\t\t// see https://github.com/nodejs/node/pull/29376\n\t\t\t/* c8 ignore next 3 */\n\t\t\tif (process.version < 'v12.10') {\n\t\t\t\tresponse_.on('aborted', abortAndFinalize);\n\t\t\t}\n\n\t\t\tconst responseOptions = {\n\t\t\t\turl: request.url,\n\t\t\t\tstatus: response_.statusCode,\n\t\t\t\tstatusText: response_.statusMessage,\n\t\t\t\theaders,\n\t\t\t\tsize: request.size,\n\t\t\t\tcounter: request.counter,\n\t\t\t\thighWaterMark: request.highWaterMark\n\t\t\t};\n\n\t\t\t// HTTP-network fetch step 12.1.1.3\n\t\t\tconst codings = headers.get('Content-Encoding');\n\n\t\t\t// HTTP-network fetch step 12.1.1.4: handle content codings\n\n\t\t\t// in following scenarios we ignore compression support\n\t\t\t// 1. compression support is disabled\n\t\t\t// 2. HEAD request\n\t\t\t// 3. no Content-Encoding header\n\t\t\t// 4. no content response (204)\n\t\t\t// 5. content not modified response (304)\n\t\t\tif (!request.compress || request.method === 'HEAD' || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For Node v6+\n\t\t\t// Be less strict when decoding compressed responses, since sometimes\n\t\t\t// servers send slightly invalid responses that are still accepted\n\t\t\t// by common browsers.\n\t\t\t// Always using Z_SYNC_FLUSH is what cURL does.\n\t\t\tconst zlibOptions = {\n\t\t\t\tflush: zlib.Z_SYNC_FLUSH,\n\t\t\t\tfinishFlush: zlib.Z_SYNC_FLUSH\n\t\t\t};\n\n\t\t\t// For gzip\n\t\t\tif (codings === 'gzip' || codings === 'x-gzip') {\n\t\t\t\tbody = pump(body, zlib.createGunzip(zlibOptions), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For deflate\n\t\t\tif (codings === 'deflate' || codings === 'x-deflate') {\n\t\t\t\t// Handle the infamous raw deflate response from old servers\n\t\t\t\t// a hack for old IIS and Apache servers\n\t\t\t\tconst raw = pump(response_, new PassThrough(), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\traw.once('data', chunk => {\n\t\t\t\t\t// See http://stackoverflow.com/questions/37519828\n\t\t\t\t\tif ((chunk[0] & 0x0F) === 0x08) {\n\t\t\t\t\t\tbody = pump(body, zlib.createInflate(), error => {\n\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbody = pump(body, zlib.createInflateRaw(), error => {\n\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\t\tresolve(response);\n\t\t\t\t});\n\t\t\t\traw.once('end', () => {\n\t\t\t\t\t// Some old IIS servers return zero-length OK deflate responses, so\n\t\t\t\t\t// 'data' is never emitted. See https://github.com/node-fetch/node-fetch/pull/903\n\t\t\t\t\tif (!response) {\n\t\t\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\t\t\tresolve(response);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For br\n\t\t\tif (codings === 'br') {\n\t\t\t\tbody = pump(body, zlib.createBrotliDecompress(), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise, use response as-is\n\t\t\tresponse = new Response(body, responseOptions);\n\t\t\tresolve(response);\n\t\t});\n\n\t\t// eslint-disable-next-line promise/prefer-await-to-then\n\t\twriteToStream(request_, request).catch(reject);\n\t});\n}\n\nfunction fixResponseChunkedTransferBadEnding(request, errorCallback) {\n\tconst LAST_CHUNK = Buffer.from('0\\r\\n\\r\\n');\n\n\tlet isChunkedTransfer = false;\n\tlet properLastChunkReceived = false;\n\tlet previousChunk;\n\n\trequest.on('response', response => {\n\t\tconst {headers} = response;\n\t\tisChunkedTransfer = headers['transfer-encoding'] === 'chunked' && !headers['content-length'];\n\t});\n\n\trequest.on('socket', socket => {\n\t\tconst onSocketClose = () => {\n\t\t\tif (isChunkedTransfer && !properLastChunkReceived) {\n\t\t\t\tconst error = new Error('Premature close');\n\t\t\t\terror.code = 'ERR_STREAM_PREMATURE_CLOSE';\n\t\t\t\terrorCallback(error);\n\t\t\t}\n\t\t};\n\n\t\tconst onData = buf => {\n\t\t\tproperLastChunkReceived = Buffer.compare(buf.slice(-5), LAST_CHUNK) === 0;\n\n\t\t\t// Sometimes final 0-length chunk and end of message code are in separate packets\n\t\t\tif (!properLastChunkReceived && previousChunk) {\n\t\t\t\tproperLastChunkReceived = (\n\t\t\t\t\tBuffer.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 &&\n\t\t\t\t\tBuffer.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpreviousChunk = buf;\n\t\t};\n\n\t\tsocket.prependListener('close', onSocketClose);\n\t\tsocket.on('data', onData);\n\n\t\trequest.on('close', () => {\n\t\t\tsocket.removeListener('close', onSocketClose);\n\t\t\tsocket.removeListener('data', onData);\n\t\t});\n\t});\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Environment-aware HTTP client for the X API SDK.\n * \n * This module provides a universal HTTP client that works in both Node.js and browser environments\n * without requiring manual polyfills.\n */\n\n// Environment detection\nconst isNode =\n typeof process !== 'undefined' && process.versions && process.versions.node;\nconst isBrowser =\n typeof window !== 'undefined' && typeof window.fetch === 'function';\n\n// Type definitions\nexport interface RequestOptions {\n method?: string;\n headers?: Record | Headers;\n body?: string | Buffer | ArrayBuffer | ArrayBufferView;\n signal?: AbortSignal;\n timeout?: number;\n}\n\nexport interface HttpResponse {\n ok: boolean;\n status: number;\n statusText: string;\n headers: Headers;\n url: string;\n json(): Promise;\n text(): Promise;\n arrayBuffer(): Promise;\n}\n\n/**\n * Universal HTTP client that works in both Node.js and browser environments\n */\nexport class HttpClient {\n private fetch: any;\n private HeadersClass: any;\n\n constructor() {\n this.initializeEnvironment();\n }\n\n private initializeEnvironment(): void {\n if (isNode) {\n // Node.js environment - set up polyfills synchronously\n this.initializeNodeEnvironment();\n } else if (isBrowser) {\n // Browser environment - use native APIs\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n } else {\n // Fallback for other environments (Deno, etc.)\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n }\n }\n\n private initializeNodeEnvironment(): void {\n // Check if native fetch is available (Node.js 18+)\n if (\n typeof globalThis.fetch === 'function' &&\n typeof globalThis.Headers === 'function'\n ) {\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n return;\n }\n\n // Try to use node-fetch for older Node.js versions\n try {\n const nodeFetch = require('node-fetch');\n const { Headers: NodeHeaders } = nodeFetch;\n\n this.fetch = nodeFetch.default || nodeFetch;\n this.HeadersClass = NodeHeaders;\n } catch (error) {\n // If node-fetch is not available, provide a helpful error\n throw new Error(\n 'X API SDK: node-fetch not found. For Node.js environments, please install node-fetch:\\n' +\n 'npm install node-fetch\\n' +\n 'Or upgrade to Node.js 18+ for native fetch support.'\n );\n }\n }\n\n /**\n * Create a new Headers instance\n */\n createHeaders(init?: Record | Headers): Headers {\n return new this.HeadersClass(init) as Headers;\n }\n\n /**\n * Make an HTTP request\n */\n async request(\n url: string,\n options: RequestOptions = {}\n ): Promise {\n // Convert body to string if it's a Buffer or ArrayBuffer\n let body = options.body;\n if (body && typeof body !== 'string') {\n if (Buffer.isBuffer(body)) {\n body = body.toString();\n } else if (body instanceof ArrayBuffer) {\n body = new TextDecoder().decode(body);\n } else if (ArrayBuffer.isView(body)) {\n body = new TextDecoder().decode(body);\n }\n }\n\n // Handle timeout\n let signal = options.signal;\n if (options.timeout && options.timeout > 0 && !signal) {\n const controller = new AbortController();\n setTimeout(() => controller.abort(), options.timeout);\n signal = controller.signal;\n }\n\n const response = await this.fetch(url, {\n method: options.method || 'GET',\n headers: options.headers as any,\n body: body as any,\n signal: signal,\n });\n\n return response as HttpResponse;\n }\n\n /**\n * Make a GET request\n */\n async get(\n url: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'GET',\n headers,\n });\n }\n\n /**\n * Make a POST request\n */\n async post(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'POST',\n headers,\n body,\n });\n }\n\n /**\n * Make a PUT request\n */\n async put(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'PUT',\n headers,\n body,\n });\n }\n\n /**\n * Make a DELETE request\n */\n async delete(\n url: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'DELETE',\n headers,\n });\n }\n\n /**\n * Make a PATCH request\n */\n async patch(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'PATCH',\n headers,\n body,\n });\n }\n}\n\n// Export a singleton instance\nexport const httpClient = new HttpClient();\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * news client for the X API.\n *\n * This module provides a client for interacting with the news endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetResponse } from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for news operations\n * \n * This client provides methods for interacting with the news endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all news related operations.\n * \n * @category news\n */\nexport class NewsClient {\n private client: Client;\n\n /**\n * Creates a new news client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get news stories by ID\n * Retrieves news story by its ID.\n\n\n * @param id The ID of the news story.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(id: string, options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/news/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for news operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2NewsIdResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * users client for the X API.\n *\n * This module provides a client for interacting with the users endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n UnlikePostResponse,\n GetOwnedListsResponse,\n GetBlockingResponse,\n DeleteBookmarkResponse,\n GetByUsernameResponse,\n UnpinListResponse,\n GetPostsResponse,\n GetBookmarksResponse,\n CreateBookmarkRequest,\n CreateBookmarkResponse,\n BlockDmsResponse,\n UnfollowListResponse,\n GetMutingResponse,\n MuteUserRequest,\n MuteUserResponse,\n GetByIdResponse,\n GetMeResponse,\n UnrepostPostResponse,\n UnmuteUserResponse,\n SearchResponse,\n GetPinnedListsResponse,\n PinListRequest,\n PinListResponse,\n GetFollowedListsResponse,\n FollowListRequest,\n FollowListResponse,\n LikePostRequest,\n LikePostResponse,\n GetLikedPostsResponse,\n GetByUsernamesResponse,\n RepostPostRequest,\n RepostPostResponse,\n UnfollowUserResponse,\n GetFollowersResponse,\n GetByIdsResponse,\n GetBookmarksByFolderIdResponse,\n GetBookmarkFoldersResponse,\n GetFollowingResponse,\n FollowUserRequest,\n FollowUserResponse,\n GetTimelineResponse,\n UnblockDmsResponse,\n GetMentionsResponse,\n GetListMembershipsResponse,\n GetRepostsOfMeResponse,\n} from './models.js';\n\n/**\n * Options for getOwnedLists method\n * \n * @public\n */\nexport interface GetOwnedListsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBlocking method\n * \n * @public\n */\nexport interface GetBlockingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByUsername method\n * \n * @public\n */\nexport interface GetByUsernameOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBookmarks method\n * \n * @public\n */\nexport interface GetBookmarksOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMuting method\n * \n * @public\n */\nexport interface GetMutingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for muteUser method\n * \n * @public\n */\nexport interface MuteUserOptions {\n /** Request body */\n body?: MuteUserRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMe method\n * \n * @public\n */\nexport interface GetMeOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPinnedLists method\n * \n * @public\n */\nexport interface GetPinnedListsOptions {\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowedLists method\n * \n * @public\n */\nexport interface GetFollowedListsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for followList method\n * \n * @public\n */\nexport interface FollowListOptions {\n /** Request body */\n body?: FollowListRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for likePost method\n * \n * @public\n */\nexport interface LikePostOptions {\n /** Request body */\n body?: LikePostRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getLikedPosts method\n * \n * @public\n */\nexport interface GetLikedPostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByUsernames method\n * \n * @public\n */\nexport interface GetByUsernamesOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for repostPost method\n * \n * @public\n */\nexport interface RepostPostOptions {\n /** Request body */\n body?: RepostPostRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowers method\n * \n * @public\n */\nexport interface GetFollowersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBookmarkFolders method\n * \n * @public\n */\nexport interface GetBookmarkFoldersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowing method\n * \n * @public\n */\nexport interface GetFollowingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for followUser method\n * \n * @public\n */\nexport interface FollowUserOptions {\n /** Request body */\n body?: FollowUserRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getTimeline method\n * \n * @public\n */\nexport interface GetTimelineOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMentions method\n * \n * @public\n */\nexport interface GetMentionsOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getListMemberships method\n * \n * @public\n */\nexport interface GetListMembershipsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getRepostsOfMe method\n * \n * @public\n */\nexport interface GetRepostsOfMeOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for users operations\n * \n * This client provides methods for interacting with the users endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all users related operations.\n * \n * @category users\n */\nexport class UsersClient {\n private client: Client;\n\n /**\n * Creates a new users client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Unlike Post\n * Causes the authenticated user to Unlike a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to unlike the Post.\n\n\n\n * @param tweetId The ID of the Post that the User is requesting to unlike.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unlikePost(id: string, tweetId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/likes/{tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get owned Lists\n * Retrieves a list of Lists owned by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getOwnedLists(\n id: string,\n options: GetOwnedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/owned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get blocking\n * Retrieves a list of Users blocked by the specified User ID.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBlocking(\n id: string,\n options: GetBlockingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/blocking';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['block.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Bookmark\n * Removes a Post from the authenticated user’s Bookmarks by its ID.\n\n\n * @param id The ID of the authenticated source User whose bookmark is to be removed.\n\n\n\n * @param tweetId The ID of the Post that the source User is removing from bookmarks.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteBookmark(\n id: string,\n tweetId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/{tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get User by username\n * Retrieves details of a specific User by their username.\n\n\n * @param username A username.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByUsername(\n username: string,\n options: GetByUsernameOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/by/username/{username}';\n\n path = path.replace('{username}', encodeURIComponent(String(username)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unpin List\n * Causes the authenticated user to unpin a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n * @param listId The ID of the List to unpin.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unpinList(id: string, listId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists/{list_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{list_id}', encodeURIComponent(String(listId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Posts\n * Retrieves a list of posts authored by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmarks\n * Retrieves a list of Posts bookmarked by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarks(\n id: string,\n options: GetBookmarksOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Bookmark\n * Adds a post to the authenticated user’s bookmarks.\n\n\n * @param id The ID of the authenticated source User for whom to add bookmarks.\n\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createBookmark(\n id: string,\n body: CreateBookmarkRequest\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Block DMs\n * Blocks direct messages to or from a specific User by their ID for the authenticated user.\n\n\n * @param id The ID of the target User that the authenticated user requesting to block dms for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async blockDms(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/dm/block';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unfollow List\n * Causes the authenticated user to unfollow a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will unfollow the List.\n\n\n\n * @param listId The ID of the List to unfollow.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unfollowList(\n id: string,\n listId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists/{list_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{list_id}', encodeURIComponent(String(listId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get muting\n * Retrieves a list of Users muted by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMuting(\n id: string,\n options: GetMutingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/muting';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Mute User\n * Causes the authenticated user to mute a specific User by their ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to mute the target User.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async muteUser(\n id: string,\n options: MuteUserOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/muting';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get User by ID\n * Retrieves details of a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get my User\n * Retrieves details of the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMe(options: GetMeOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/me';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unrepost Post\n * Causes the authenticated user to unrepost a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to repost the Post.\n\n\n\n * @param sourceTweetId The ID of the Post that the User is requesting to unretweet.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unrepostPost(\n id: string,\n sourceTweetId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/retweets/{source_tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace(\n '{source_tweet_id}',\n encodeURIComponent(String(sourceTweetId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unmute User\n * Causes the authenticated user to unmute a specific user by their ID.\n\n\n * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User.\n\n\n\n * @param targetUserId The ID of the User that the source User is requesting to unmute.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unmuteUser(\n sourceUserId: string,\n targetUserId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{source_user_id}/muting/{target_user_id}';\n\n path = path.replace(\n '{source_user_id}',\n encodeURIComponent(String(sourceUserId))\n );\n\n path = path.replace(\n '{target_user_id}',\n encodeURIComponent(String(targetUserId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Users\n * Retrieves a list of Users matching a search query.\n\n\n\n * @param query TThe the query string by which to query for users.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: any,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n nextToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get pinned Lists\n * Retrieves a list of Lists pinned by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPinnedLists(\n id: string,\n options: GetPinnedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Pin List\n * Causes the authenticated user to pin a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will pin the List.\n\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async pinList(id: string, body: PinListRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get followed Lists\n * Retrieves a list of Lists followed by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowedLists(\n id: string,\n options: GetFollowedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Follow List\n * Causes the authenticated user to follow a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will follow the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async followList(\n id: string,\n options: FollowListOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Like Post\n * Causes the authenticated user to Like a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to like the Post.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async likePost(\n id: string,\n options: LikePostOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/likes';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get liked Posts\n * Retrieves a list of Posts liked by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getLikedPosts(\n id: string,\n options: GetLikedPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/liked_tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Users by usernames\n * Retrieves details of multiple Users by their usernames.\n\n\n\n * @param usernames A list of usernames, comma-separated.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByUsernames(\n usernames: Array,\n options: GetByUsernamesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/by';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (usernames !== undefined && usernames.length > 0) {\n params.append('usernames', usernames.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Repost Post\n * Causes the authenticated user to repost a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to repost the Post.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async repostPost(\n id: string,\n options: RepostPostOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/retweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unfollow User\n * Causes the authenticated user to unfollow a specific user by their ID.\n\n\n * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User.\n\n\n\n * @param targetUserId The ID of the User that the source User is requesting to unfollow.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unfollowUser(\n sourceUserId: string,\n targetUserId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{source_user_id}/following/{target_user_id}';\n\n path = path.replace(\n '{source_user_id}',\n encodeURIComponent(String(sourceUserId))\n );\n\n path = path.replace(\n '{target_user_id}',\n encodeURIComponent(String(targetUserId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get followers\n * Retrieves a list of Users who follow a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowers(\n id: string,\n options: GetFollowersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Users by IDs\n * Retrieves details of multiple Users by their IDs.\n\n\n\n * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmarks by folder ID\n * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarksByFolderId(\n id: string,\n folderId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/folders/{folder_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{folder_id}', encodeURIComponent(String(folderId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmark folders\n * Retrieves a list of Bookmark folders created by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarkFolders(\n id: string,\n options: GetBookmarkFoldersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/folders';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get following\n * Retrieves a list of Users followed by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowing(\n id: string,\n options: GetFollowingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/following';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Follow User\n * Causes the authenticated user to follow a specific user by their ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to follow the target User.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async followUser(\n id: string,\n options: FollowUserOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/following';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Timeline\n * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline.\n\n\n * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getTimeline(\n id: string,\n options: GetTimelineOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/timelines/reverse_chronological';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unblock DMs\n * Unblocks direct messages to or from a specific User by their ID for the authenticated user.\n\n\n * @param id The ID of the target User that the authenticated user requesting to unblock dms for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unblockDms(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/dm/unblock';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get mentions\n * Retrieves a list of Posts that mention a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMentions(\n id: string,\n options: GetMentionsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/mentions';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List memberships\n * Retrieves a list of Lists that a specific User is a member of by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getListMemberships(\n id: string,\n options: GetListMembershipsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/list_memberships';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposts of me\n * Retrieves a list of Posts that repost content from the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getRepostsOfMe(\n options: GetRepostsOfMeOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/reposts_of_me';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['timeline.read', 'tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for users operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for unlikePost\n * \n * @public\n */\nexport type UnlikePostResponse = Schemas.UsersLikesDeleteResponse;\n/**\n * Response for getOwnedLists\n * \n * @public\n */\nexport type GetOwnedListsResponse = Schemas.Get2UsersIdOwnedListsResponse;\n/**\n * Response for getBlocking\n * \n * @public\n */\nexport type GetBlockingResponse = Schemas.Get2UsersIdBlockingResponse;\n/**\n * Response for deleteBookmark\n * \n * @public\n */\nexport type DeleteBookmarkResponse = Schemas.BookmarkMutationResponse;\n/**\n * Response for getByUsername\n * \n * @public\n */\nexport type GetByUsernameResponse = Schemas.Get2UsersByUsernameUsernameResponse;\n/**\n * Response for unpinList\n * \n * @public\n */\nexport type UnpinListResponse = Schemas.ListUnpinResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2UsersIdTweetsResponse;\n/**\n * Response for getBookmarks\n * \n * @public\n */\nexport type GetBookmarksResponse = Schemas.Get2UsersIdBookmarksResponse;\n/**\n * Request for createBookmark\n * \n * @public\n */\nexport type CreateBookmarkRequest = Schemas.BookmarkAddRequest;\n/**\n * Response for createBookmark\n * \n * @public\n */\nexport type CreateBookmarkResponse = Schemas.BookmarkMutationResponse;\n/**\n * Response for blockDms\n * \n * @public\n */\nexport type BlockDmsResponse = Schemas.UsersDMBlockCreateResponse;\n/**\n * Response for unfollowList\n * \n * @public\n */\nexport type UnfollowListResponse = Schemas.ListFollowedResponse;\n/**\n * Response for getMuting\n * \n * @public\n */\nexport type GetMutingResponse = Schemas.Get2UsersIdMutingResponse;\n\n/**\n * Request for muteUser\n * \n * @public\n */\nexport type { MuteUserRequest as MuteUserRequest } from '../schemas.js';\n/**\n * Response for muteUser\n * \n * @public\n */\nexport type MuteUserResponse = Schemas.MuteUserMutationResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2UsersIdResponse;\n/**\n * Response for getMe\n * \n * @public\n */\nexport type GetMeResponse = Schemas.Get2UsersMeResponse;\n/**\n * Response for unrepostPost\n * \n * @public\n */\nexport type UnrepostPostResponse = Schemas.UsersRetweetsDeleteResponse;\n/**\n * Response for unmuteUser\n * \n * @public\n */\nexport type UnmuteUserResponse = Schemas.MuteUserMutationResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2UsersSearchResponse;\n/**\n * Response for getPinnedLists\n * \n * @public\n */\nexport type GetPinnedListsResponse = Schemas.Get2UsersIdPinnedListsResponse;\n/**\n * Request for pinList\n * \n * @public\n */\nexport type PinListRequest = Schemas.ListPinnedRequest;\n/**\n * Response for pinList\n * \n * @public\n */\nexport type PinListResponse = Schemas.ListPinnedResponse;\n/**\n * Response for getFollowedLists\n * \n * @public\n */\nexport type GetFollowedListsResponse = Schemas.Get2UsersIdFollowedListsResponse;\n/**\n * Request for followList\n * \n * @public\n */\nexport type FollowListRequest = Schemas.ListFollowedRequest;\n/**\n * Response for followList\n * \n * @public\n */\nexport type FollowListResponse = Schemas.ListFollowedResponse;\n/**\n * Request for likePost\n * \n * @public\n */\nexport type LikePostRequest = Schemas.UsersLikesCreateRequest;\n/**\n * Response for likePost\n * \n * @public\n */\nexport type LikePostResponse = Schemas.UsersLikesCreateResponse;\n/**\n * Response for getLikedPosts\n * \n * @public\n */\nexport type GetLikedPostsResponse = Schemas.Get2UsersIdLikedTweetsResponse;\n/**\n * Response for getByUsernames\n * \n * @public\n */\nexport type GetByUsernamesResponse = Schemas.Get2UsersByResponse;\n/**\n * Request for repostPost\n * \n * @public\n */\nexport type RepostPostRequest = Schemas.UsersRetweetsCreateRequest;\n/**\n * Response for repostPost\n * \n * @public\n */\nexport type RepostPostResponse = Schemas.UsersRetweetsCreateResponse;\n/**\n * Response for unfollowUser\n * \n * @public\n */\nexport type UnfollowUserResponse = Schemas.UsersFollowingDeleteResponse;\n/**\n * Response for getFollowers\n * \n * @public\n */\nexport type GetFollowersResponse = Schemas.Get2UsersIdFollowersResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2UsersResponse;\n/**\n * Response for getBookmarksByFolderId\n * \n * @public\n */\nexport type GetBookmarksByFolderIdResponse = Schemas.BookmarkFolderPostsResponse;\n/**\n * Response for getBookmarkFolders\n * \n * @public\n */\nexport type GetBookmarkFoldersResponse = Schemas.BookmarkFoldersResponse;\n/**\n * Response for getFollowing\n * \n * @public\n */\nexport type GetFollowingResponse = Schemas.Get2UsersIdFollowingResponse;\n/**\n * Request for followUser\n * \n * @public\n */\nexport type FollowUserRequest = Schemas.UsersFollowingCreateRequest;\n/**\n * Response for followUser\n * \n * @public\n */\nexport type FollowUserResponse = Schemas.UsersFollowingCreateResponse;\n/**\n * Response for getTimeline\n * \n * @public\n */\nexport type GetTimelineResponse = Schemas.Get2UsersIdTimelinesReverseChronologicalResponse;\n/**\n * Response for unblockDms\n * \n * @public\n */\nexport type UnblockDmsResponse = Schemas.UsersDMUnBlockCreateResponse;\n/**\n * Response for getMentions\n * \n * @public\n */\nexport type GetMentionsResponse = Schemas.Get2UsersIdMentionsResponse;\n/**\n * Response for getListMemberships\n * \n * @public\n */\nexport type GetListMembershipsResponse = Schemas.Get2UsersIdListMembershipsResponse;\n/**\n * Response for getRepostsOfMe\n * \n * @public\n */\nexport type GetRepostsOfMeResponse = Schemas.Get2UsersRepostsOfMeResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * direct messages client for the X API.\n *\n * This module provides a client for interacting with the direct messages endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetEventsByParticipantIdResponse,\n CreateByConversationIdRequest,\n CreateByConversationIdResponse,\n CreateByParticipantIdRequest,\n CreateByParticipantIdResponse,\n CreateConversationRequest,\n CreateConversationResponse,\n GetEventsByIdResponse,\n DeleteEventsResponse,\n GetEventsResponse,\n GetEventsByConversationIdResponse,\n} from './models.js';\n\n/**\n * Options for getEventsByParticipantId method\n * \n * @public\n */\nexport interface GetEventsByParticipantIdOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createByConversationId method\n * \n * @public\n */\nexport interface CreateByConversationIdOptions {\n /** Request body */\n body?: CreateByConversationIdRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createByParticipantId method\n * \n * @public\n */\nexport interface CreateByParticipantIdOptions {\n /** Request body */\n body?: CreateByParticipantIdRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createConversation method\n * \n * @public\n */\nexport interface CreateConversationOptions {\n /** Request body */\n body?: CreateConversationRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsById method\n * \n * @public\n */\nexport interface GetEventsByIdOptions {\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEvents method\n * \n * @public\n */\nexport interface GetEventsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsByConversationId method\n * \n * @public\n */\nexport interface GetEventsByConversationIdOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for direct messages operations\n * \n * This client provides methods for interacting with the direct messages endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all direct messages related operations.\n * \n * @category direct messages\n */\nexport class DirectMessagesClient {\n private client: Client;\n\n /**\n * Creates a new direct messages client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get DM events for a DM conversation\n * Retrieves direct message events for a specific conversation.\n\n\n * @param participantId The ID of the participant user for the One to One DM conversation.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsByParticipantId(\n participantId: string,\n options: GetEventsByParticipantIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/with/{participant_id}/dm_events';\n\n path = path.replace(\n '{participant_id}',\n encodeURIComponent(String(participantId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM message by conversation ID\n * Sends a new direct message to a specific conversation by its ID.\n\n\n * @param dmConversationId The DM Conversation ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createByConversationId(\n dmConversationId: string,\n options: CreateByConversationIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/{dm_conversation_id}/messages';\n\n path = path.replace(\n '{dm_conversation_id}',\n encodeURIComponent(String(dmConversationId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM message by participant ID\n * Sends a new direct message to a specific participant by their ID.\n\n\n * @param participantId The ID of the recipient user that will receive the DM.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createByParticipantId(\n participantId: string,\n options: CreateByParticipantIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/with/{participant_id}/messages';\n\n path = path.replace(\n '{participant_id}',\n encodeURIComponent(String(participantId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM conversation\n * Initiates a new direct message conversation with specified participants.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createConversation(\n options: CreateConversationOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM event by ID\n * Retrieves details of a specific direct message event by its ID.\n\n\n * @param eventId dm event id.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsById(\n eventId: string,\n options: GetEventsByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_events/{event_id}';\n\n path = path.replace('{event_id}', encodeURIComponent(String(eventId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete DM event\n * Deletes a specific direct message event by its ID, if owned by the authenticated user.\n\n\n * @param eventId The ID of the direct-message event to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteEvents(eventId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/dm_events/{event_id}';\n\n path = path.replace('{event_id}', encodeURIComponent(String(eventId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events\n * Retrieves a list of recent direct message events across all conversations.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEvents(options: GetEventsOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_events';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events for a DM conversation\n * Retrieves direct message events for a specific conversation.\n\n\n * @param id The DM conversation ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsByConversationId(\n id: string,\n options: GetEventsByConversationIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/{id}/dm_events';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for direct messages operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getEventsByParticipantId\n * \n * @public\n */\nexport type GetEventsByParticipantIdResponse = Schemas.Get2DmConversationsWithParticipantIdDmEventsResponse;\n/**\n * Request for createByConversationId\n * \n * @public\n */\nexport type CreateByConversationIdRequest = Schemas.CreateMessageRequest;\n/**\n * Response for createByConversationId\n * \n * @public\n */\nexport type CreateByConversationIdResponse = Schemas.CreateDmEventResponse;\n/**\n * Request for createByParticipantId\n * \n * @public\n */\nexport type CreateByParticipantIdRequest = Schemas.CreateMessageRequest;\n/**\n * Response for createByParticipantId\n * \n * @public\n */\nexport type CreateByParticipantIdResponse = Schemas.CreateDmEventResponse;\n/**\n * Request for createConversation\n * \n * @public\n */\nexport type CreateConversationRequest = Schemas.CreateDmConversationRequest;\n/**\n * Response for createConversation\n * \n * @public\n */\nexport type CreateConversationResponse = Schemas.CreateDmEventResponse;\n/**\n * Response for getEventsById\n * \n * @public\n */\nexport type GetEventsByIdResponse = Schemas.Get2DmEventsEventIdResponse;\n/**\n * Response for deleteEvents\n * \n * @public\n */\nexport type DeleteEventsResponse = Schemas.DeleteDmResponse;\n/**\n * Response for getEvents\n * \n * @public\n */\nexport type GetEventsResponse = Schemas.Get2DmEventsResponse;\n/**\n * Response for getEventsByConversationId\n * \n * @public\n */\nexport type GetEventsByConversationIdResponse = Schemas.Get2DmConversationsIdDmEventsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * community notes client for the X API.\n *\n * This module provides a client for interacting with the community notes endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n DeleteResponse,\n SearchEligiblePostsResponse,\n EvaluateRequest,\n EvaluateResponse,\n SearchWrittenResponse,\n CreateRequest,\n CreateResponse,\n} from './models.js';\n\n/**\n * Options for searchEligiblePosts method\n * \n * @public\n */\nexport interface SearchEligiblePostsOptions {\n /** Pagination token to get next set of posts eligible for notes. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Max results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. \n * Also accepts: post_selection or proper camelCase (e.g., postSelection) */\n postSelection?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for evaluate method\n * \n * @public\n */\nexport interface EvaluateOptions {\n /** Request body */\n body?: EvaluateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchWritten method\n * \n * @public\n */\nexport interface SearchWrittenOptions {\n /** Pagination token to get next set of posts eligible for notes. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Max results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Note fields to display. \n * Also accepts: note.fields or proper camelCase (e.g., noteFields) */\n noteFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for community notes operations\n * \n * This client provides methods for interacting with the community notes endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all community notes related operations.\n * \n * @category community notes\n */\nexport class CommunityNotesClient {\n private client: Client;\n\n /**\n * Creates a new community notes client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Delete a Community Note\n * Deletes a community note.\n\n\n * @param id The community note id to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/notes/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search for Posts Eligible for Community Notes\n * Returns all the posts that are eligible for community notes.\n\n\n\n * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchEligiblePosts(\n testMode: boolean,\n options: SearchEligiblePostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n post_selection: 'postSelection',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n postSelection = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes/search/posts_eligible_for_notes';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (testMode !== undefined) {\n params.append('test_mode', String(testMode));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (postSelection !== undefined) {\n params.append('post_selection', String(postSelection));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Evaluate a Community Note\n * Endpoint to evaluate a community note.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async evaluate(options: EvaluateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/evaluate_note';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search for Community Notes Written\n * Returns all the community notes written by the user.\n\n\n\n * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchWritten(\n testMode: boolean,\n options: SearchWrittenOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n 'note.fields': 'noteFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n noteFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes/search/notes_written';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (testMode !== undefined) {\n params.append('test_mode', String(testMode));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (noteFields !== undefined && noteFields.length > 0) {\n params.append('note.fields', noteFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create a Community Note\n * Creates a community note endpoint for LLM use case.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for community notes operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.DeleteNoteResponse;\n/**\n * Response for searchEligiblePosts\n * \n * @public\n */\nexport type SearchEligiblePostsResponse = Schemas.Get2NotesSearchPostsEligibleForNotesResponse;\n/**\n * Request for evaluate\n * \n * @public\n */\nexport type EvaluateRequest = Schemas.EvaluateNoteRequest;\n/**\n * Response for evaluate\n * \n * @public\n */\nexport type EvaluateResponse = Schemas.EvaluateNoteResponse;\n/**\n * Response for searchWritten\n * \n * @public\n */\nexport type SearchWrittenResponse = Schemas.Get2NotesSearchNotesWrittenResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.CreateNoteRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.CreateNoteResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * posts client for the X API.\n *\n * This module provides a client for interacting with the posts endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n HideReplyRequest,\n HideReplyResponse,\n GetAnalyticsResponse,\n GetInsightsHistoricalResponse,\n GetCountsRecentResponse,\n GetCountsAllResponse,\n GetRepostsResponse,\n GetByIdResponse,\n DeleteResponse,\n GetRepostedByResponse,\n GetInsights28hrResponse,\n GetByIdsResponse,\n CreateRequest,\n CreateResponse,\n GetLikingUsersResponse,\n SearchAllResponse,\n GetQuotedResponse,\n SearchRecentResponse,\n} from './models.js';\n\n/**\n * Options for hideReply method\n * \n * @public\n */\nexport interface HideReplyOptions {\n /** Request body */\n body?: HideReplyRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getAnalytics method\n * \n * @public\n */\nexport interface GetAnalyticsOptions {\n /** A comma separated list of Analytics fields to display. \n * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */\n analyticsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getInsightsHistorical method\n * \n * @public\n */\nexport interface GetInsightsHistoricalOptions {\n /** A comma separated list of Engagement fields to display. \n * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */\n engagementFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getCountsRecent method\n * \n * @public\n */\nexport interface GetCountsRecentOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The granularity for the search counts results. \n * Also accepts: granularity or proper camelCase (e.g., granularity) */\n granularity?: string;\n\n /** A comma separated list of SearchCount fields to display. \n * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */\n searchCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getCountsAll method\n * \n * @public\n */\nexport interface GetCountsAllOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The granularity for the search counts results. \n * Also accepts: granularity or proper camelCase (e.g., granularity) */\n granularity?: string;\n\n /** A comma separated list of SearchCount fields to display. \n * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */\n searchCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getReposts method\n * \n * @public\n */\nexport interface GetRepostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getRepostedBy method\n * \n * @public\n */\nexport interface GetRepostedByOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getInsights28hr method\n * \n * @public\n */\nexport interface GetInsights28hrOptions {\n /** A comma separated list of Engagement fields to display. \n * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */\n engagementFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getLikingUsers method\n * \n * @public\n */\nexport interface GetLikingUsersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchAll method\n * \n * @public\n */\nexport interface SearchAllOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** This order in which to return results. \n * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */\n sortOrder?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getQuoted method\n * \n * @public\n */\nexport interface GetQuotedOptions {\n /** The maximum number of results to be returned. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchRecent method\n * \n * @public\n */\nexport interface SearchRecentOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** This order in which to return results. \n * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */\n sortOrder?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for posts operations\n * \n * This client provides methods for interacting with the posts endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all posts related operations.\n * \n * @category posts\n */\nexport class PostsClient {\n private client: Client;\n\n /**\n * Creates a new posts client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Hide reply\n * Hides or unhides a reply to a conversation owned by the authenticated user.\n\n\n * @param tweetId The ID of the reply that you want to hide or unhide.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async hideReply(\n tweetId: string,\n options: HideReplyOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{tweet_id}/hidden';\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.moderate.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Post analytics\n * Retrieves analytics data for specified Posts within a defined time range.\n\n\n\n * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity The granularity for the search counts results.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAnalytics(\n ids: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n options: GetAnalyticsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'analytics.fields': 'analyticsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n analyticsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/analytics';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (analyticsFields !== undefined && analyticsFields.length > 0) {\n params.append('analytics.fields', analyticsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get historical Post insights\n * Retrieves historical engagement metrics for specified Posts within a defined time range.\n\n\n\n * @param tweetIds List of PostIds for historical metrics.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity granularity of metrics response.\n\n\n\n * @param requestedMetrics request metrics for historical request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getInsightsHistorical(\n tweetIds: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n requestedMetrics: Array,\n options: GetInsightsHistoricalOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'engagement.fields': 'engagementFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n engagementFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/insights/historical';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetIds !== undefined && tweetIds.length > 0) {\n params.append('tweet_ids', tweetIds.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (requestedMetrics !== undefined && requestedMetrics.length > 0) {\n params.append('requested_metrics', requestedMetrics.join(','));\n }\n\n if (engagementFields !== undefined && engagementFields.length > 0) {\n params.append('engagement.fields', engagementFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get count of recent Posts\n * Retrieves the count of Posts from the last 7 days matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getCountsRecent(\n query: string,\n options: GetCountsRecentOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'search_count.fields': 'searchCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n granularity = undefined,\n\n searchCountFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/counts/recent';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (searchCountFields !== undefined && searchCountFields.length > 0) {\n params.append('search_count.fields', searchCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get count of all Posts\n * Retrieves the count of Posts matching a search query from the full archive.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getCountsAll(\n query: string,\n options: GetCountsAllOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'search_count.fields': 'searchCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n granularity = undefined,\n\n searchCountFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/counts/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (searchCountFields !== undefined && searchCountFields.length > 0) {\n params.append('search_count.fields', searchCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposts\n * Retrieves a list of Posts that repost a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getReposts(\n id: string,\n options: GetRepostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/retweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Post by ID\n * Retrieves details of a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Post\n * Deletes a specific Post by its ID, if owned by the authenticated user.\n\n\n * @param id The ID of the Post to be deleted.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposted by\n * Retrieves a list of Users who reposted a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getRepostedBy(\n id: string,\n options: GetRepostedByOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/retweeted_by';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get 28-hour Post insights\n * Retrieves engagement metrics for specified Posts over the last 28 hours.\n\n\n\n * @param tweetIds List of PostIds for 28hr metrics.\n\n\n\n * @param granularity granularity of metrics response.\n\n\n\n * @param requestedMetrics request metrics for historical request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getInsights28hr(\n tweetIds: Array,\n granularity: string,\n requestedMetrics: Array,\n options: GetInsights28hrOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'engagement.fields': 'engagementFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n engagementFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/insights/28hr';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetIds !== undefined && tweetIds.length > 0) {\n params.append('tweet_ids', tweetIds.join(','));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (requestedMetrics !== undefined && requestedMetrics.length > 0) {\n params.append('requested_metrics', requestedMetrics.join(','));\n }\n\n if (engagementFields !== undefined && engagementFields.length > 0) {\n params.append('engagement.fields', engagementFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Posts by IDs\n * Retrieves details of multiple Posts by their IDs.\n\n\n\n * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create or Edit Post\n * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided.\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(body: CreateRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Liking Users\n * Retrieves a list of Users who liked a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getLikingUsers(\n id: string,\n options: GetLikingUsersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/liking_users';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search all Posts\n * Retrieves Posts from the full archive matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchAll(\n query: string,\n options: SearchAllOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n sort_order: 'sortOrder',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n sortOrder = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (sortOrder !== undefined) {\n params.append('sort_order', String(sortOrder));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Quoted Posts\n * Retrieves a list of Posts that quote a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getQuoted(\n id: string,\n options: GetQuotedOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/quote_tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search recent Posts\n * Retrieves Posts from the last 7 days matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchRecent(\n query: string,\n options: SearchRecentOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n sort_order: 'sortOrder',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n sortOrder = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/recent';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (sortOrder !== undefined) {\n params.append('sort_order', String(sortOrder));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for posts operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Request for hideReply\n * \n * @public\n */\nexport type HideReplyRequest = Schemas.TweetHideRequest;\n/**\n * Response for hideReply\n * \n * @public\n */\nexport type HideReplyResponse = Schemas.TweetHideResponse;\n/**\n * Response for getAnalytics\n * \n * @public\n */\nexport type GetAnalyticsResponse = Schemas.Analytics;\n/**\n * Response for getInsightsHistorical\n * \n * @public\n */\nexport type GetInsightsHistoricalResponse = Schemas.Get2InsightsHistoricalResponse;\n/**\n * Response for getCountsRecent\n * \n * @public\n */\nexport type GetCountsRecentResponse = Schemas.Get2TweetsCountsRecentResponse;\n/**\n * Response for getCountsAll\n * \n * @public\n */\nexport type GetCountsAllResponse = Schemas.Get2TweetsCountsAllResponse;\n/**\n * Response for getReposts\n * \n * @public\n */\nexport type GetRepostsResponse = Schemas.Get2TweetsIdRetweetsResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2TweetsIdResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.TweetDeleteResponse;\n/**\n * Response for getRepostedBy\n * \n * @public\n */\nexport type GetRepostedByResponse = Schemas.Get2TweetsIdRetweetedByResponse;\n/**\n * Response for getInsights28hr\n * \n * @public\n */\nexport type GetInsights28hrResponse = Schemas.Get2Insights28hrResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2TweetsResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.TweetCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.TweetCreateResponse;\n/**\n * Response for getLikingUsers\n * \n * @public\n */\nexport type GetLikingUsersResponse = Schemas.Get2TweetsIdLikingUsersResponse;\n/**\n * Response for searchAll\n * \n * @public\n */\nexport type SearchAllResponse = Schemas.Get2TweetsSearchAllResponse;\n/**\n * Response for getQuoted\n * \n * @public\n */\nexport type GetQuotedResponse = Schemas.Get2TweetsIdQuoteTweetsResponse;\n/**\n * Response for searchRecent\n * \n * @public\n */\nexport type SearchRecentResponse = Schemas.Get2TweetsSearchRecentResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * trends client for the X API.\n *\n * This module provides a client for interacting with the trends endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetAiResponse,\n GetByWoeidResponse,\n GetPersonalizedResponse,\n} from './models.js';\n\n/**\n * Options for getAi method\n * \n * @public\n */\nexport interface GetAiOptions {\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByWoeid method\n * \n * @public\n */\nexport interface GetByWoeidOptions {\n /** The maximum number of results. \n * Also accepts: max_trends or proper camelCase (e.g., maxTrends) */\n maxTrends?: number;\n\n /** A comma separated list of Trend fields to display. \n * Also accepts: trend.fields or proper camelCase (e.g., trendFields) */\n trendFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPersonalized method\n * \n * @public\n */\nexport interface GetPersonalizedOptions {\n /** A comma separated list of PersonalizedTrend fields to display. \n * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */\n personalizedTrendFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for trends operations\n * \n * This client provides methods for interacting with the trends endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all trends related operations.\n * \n * @category trends\n */\nexport class TrendsClient {\n private client: Client;\n\n /**\n * Creates a new trends client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get AI Trends by ID\n * Retrieves an AI trend by its ID.\n\n\n * @param id The ID of the ai trend.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAi(id: string, options: GetAiOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/ai_trends/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Trends by WOEID\n * Retrieves trending topics for a specific location identified by its WOEID.\n\n\n * @param woeid The WOEID of the place to lookup a trend for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByWoeid(\n woeid: number,\n options: GetByWoeidOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_trends: 'maxTrends',\n\n 'trend.fields': 'trendFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxTrends = undefined,\n\n trendFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/trends/by/woeid/{woeid}';\n\n path = path.replace('{woeid}', encodeURIComponent(String(woeid)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxTrends !== undefined) {\n params.append('max_trends', String(maxTrends));\n }\n\n if (trendFields !== undefined && trendFields.length > 0) {\n params.append('trend.fields', trendFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get personalized Trends\n * Retrieves personalized trending topics for the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPersonalized(\n options: GetPersonalizedOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'personalized_trend.fields': 'personalizedTrendFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n personalizedTrendFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/personalized_trends';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (\n personalizedTrendFields !== undefined &&\n personalizedTrendFields.length > 0\n ) {\n params.append(\n 'personalized_trend.fields',\n personalizedTrendFields.join(',')\n );\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for trends operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getAi\n * \n * @public\n */\nexport type GetAiResponse = Schemas.Get2AiTrendsIdResponse;\n/**\n * Response for getByWoeid\n * \n * @public\n */\nexport type GetByWoeidResponse = Schemas.Get2TrendsByWoeidWoeidResponse;\n/**\n * Response for getPersonalized\n * \n * @public\n */\nexport type GetPersonalizedResponse = Schemas.Get2UsersPersonalizedTrendsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * activity client for the X API.\n *\n * This module provides a client for interacting with the activity endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetSubscriptionsResponse,\n CreateSubscriptionRequest,\n CreateSubscriptionResponse,\n UpdateSubscriptionRequest,\n UpdateSubscriptionResponse,\n DeleteSubscriptionResponse,\n StreamResponse,\n} from './models.js';\n\n/**\n * Options for createSubscription method\n * \n * @public\n */\nexport interface CreateSubscriptionOptions {\n /** Request body */\n body?: CreateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for updateSubscription method\n * \n * @public\n */\nexport interface UpdateSubscriptionOptions {\n /** Request body */\n body?: UpdateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for stream method\n * \n * @public\n */\nexport interface StreamOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for activity operations\n * \n * This client provides methods for interacting with the activity endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all activity related operations.\n * \n * @category activity\n */\nexport class ActivityClient {\n private client: Client;\n\n /**\n * Creates a new activity client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get X activity subscriptions\n * Get a list of active subscriptions for XAA\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptions(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create X activity subscription\n * Creates a subscription for an X activity event\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubscription(\n options: CreateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update X activity subscription\n * Updates a subscription for an X activity event\n\n\n * @param subscriptionId The ID of the subscription to update.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async updateSubscription(\n subscriptionId: string,\n options: UpdateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions/{subscription_id}';\n\n path = path.replace(\n '{subscription_id}',\n encodeURIComponent(String(subscriptionId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Deletes X activity subscription\n * Deletes a subscription for an X activity event\n\n\n * @param subscriptionId The ID of the subscription to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubscription(\n subscriptionId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions/{subscription_id}';\n\n path = path.replace(\n '{subscription_id}',\n encodeURIComponent(String(subscriptionId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Activity Stream\n * Stream of X Activities\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async stream(options: StreamOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for activity operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getSubscriptions\n * \n * @public\n */\nexport type GetSubscriptionsResponse = Schemas.ActivitySubscriptionGetResponse;\n/**\n * Request for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionRequest = Schemas.ActivitySubscriptionCreateRequest;\n/**\n * Response for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionResponse = Schemas.ActivitySubscriptionCreateResponse;\n/**\n * Request for updateSubscription\n * \n * @public\n */\nexport type UpdateSubscriptionRequest = Schemas.ActivitySubscriptionUpdateRequest;\n/**\n * Response for updateSubscription\n * \n * @public\n */\nexport type UpdateSubscriptionResponse = Schemas.ActivitySubscriptionUpdateResponse;\n/**\n * Response for deleteSubscription\n * \n * @public\n */\nexport type DeleteSubscriptionResponse = Schemas.ActivitySubscriptionDeleteResponse;\n/**\n * Response for stream\n * \n * @public\n */\nexport type StreamResponse = Schemas.ActivityStreamingResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * usage client for the X API.\n *\n * This module provides a client for interacting with the usage endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetResponse } from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** The number of days for which you need usage for. \n * Also accepts: days or proper camelCase (e.g., days) */\n days?: number;\n\n /** A comma separated list of Usage fields to display. \n * Also accepts: usage.fields or proper camelCase (e.g., usageFields) */\n usageFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for usage operations\n * \n * This client provides methods for interacting with the usage endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all usage related operations.\n * \n * @category usage\n */\nexport class UsageClient {\n private client: Client;\n\n /**\n * Creates a new usage client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get usage\n * Retrieves usage statistics for Posts over a specified number of days.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'usage.fields': 'usageFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n days = undefined,\n\n usageFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/usage/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (days !== undefined) {\n params.append('days', String(days));\n }\n\n if (usageFields !== undefined && usageFields.length > 0) {\n params.append('usage.fields', usageFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for usage operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2UsageTweetsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * spaces client for the X API.\n *\n * This module provides a client for interacting with the spaces endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetPostsResponse,\n SearchResponse,\n GetByIdResponse,\n GetByCreatorIdsResponse,\n GetBuyersResponse,\n GetByIdsResponse,\n} from './models.js';\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The state of Spaces to search for. \n * Also accepts: state or proper camelCase (e.g., state) */\n state?: string;\n\n /** The number of results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByCreatorIds method\n * \n * @public\n */\nexport interface GetByCreatorIdsOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBuyers method\n * \n * @public\n */\nexport interface GetBuyersOptions {\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for spaces operations\n * \n * This client provides methods for interacting with the spaces endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all spaces related operations.\n * \n * @category spaces\n */\nexport class SpacesClient {\n private client: Client;\n\n /**\n * Creates a new spaces client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Space Posts\n * Retrieves a list of Posts shared in a specific Space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Spaces\n * Retrieves a list of Spaces matching the specified search query.\n\n\n\n * @param query The search query.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n state = undefined,\n\n maxResults = undefined,\n\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (state !== undefined) {\n params.append('state', String(state));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get space by ID\n * Retrieves details of a specific space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Spaces by creator IDs\n * Retrieves details of Spaces created by specified User IDs.\n\n\n\n * @param userIds The IDs of Users to search through.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByCreatorIds(\n userIds: Array,\n options: GetByCreatorIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/by/creator_ids';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userIds !== undefined && userIds.length > 0) {\n params.append('user_ids', userIds.join(','));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Space ticket buyers\n * Retrieves a list of Users who purchased tickets to a specific Space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBuyers(\n id: string,\n options: GetBuyersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}/buyers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Spaces by IDs\n * Retrieves details of multiple Spaces by their IDs.\n\n\n\n * @param ids The list of Space IDs to return.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for spaces operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2SpacesIdTweetsResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2SpacesSearchResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2SpacesIdResponse;\n/**\n * Response for getByCreatorIds\n * \n * @public\n */\nexport type GetByCreatorIdsResponse = Schemas.Get2SpacesByCreatorIdsResponse;\n/**\n * Response for getBuyers\n * \n * @public\n */\nexport type GetBuyersResponse = Schemas.Get2SpacesIdBuyersResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2SpacesResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * communities client for the X API.\n *\n * This module provides a client for interacting with the communities endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetByIdResponse, SearchResponse } from './models.js';\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Community fields to display. \n * Also accepts: community.fields or proper camelCase (e.g., communityFields) */\n communityFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Community fields to display. \n * Also accepts: community.fields or proper camelCase (e.g., communityFields) */\n communityFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for communities operations\n * \n * This client provides methods for interacting with the communities endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all communities related operations.\n * \n * @category communities\n */\nexport class CommunitiesClient {\n private client: Client;\n\n /**\n * Creates a new communities client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Community by ID\n * Retrieves details of a specific Community by its ID.\n\n\n * @param id The ID of the Community.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'community.fields': 'communityFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n communityFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/communities/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (communityFields !== undefined && communityFields.length > 0) {\n params.append('community.fields', communityFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Communities\n * Retrieves a list of Communities matching the specified search query.\n\n\n\n * @param query Query to search communities.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'community.fields': 'communityFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n communityFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/communities/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (communityFields !== undefined && communityFields.length > 0) {\n params.append('community.fields', communityFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for communities operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2CommunitiesIdResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2CommunitiesSearchResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * connections client for the X API.\n *\n * This module provides a client for interacting with the connections endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { DeleteAllResponse } from './models.js';\n\n/**\n * Client for connections operations\n * \n * This client provides methods for interacting with the connections endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all connections related operations.\n * \n * @category connections\n */\nexport class ConnectionsClient {\n private client: Client;\n\n /**\n * Creates a new connections client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Terminate all connections\n * Terminates all active streaming connections for the authenticated application.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteAll(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/connections/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for connections operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for deleteAll\n * \n * @public\n */\nexport type DeleteAllResponse = Schemas.KillAllConnectionsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * media client for the X API.\n *\n * This module provides a client for interacting with the media endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetAnalyticsResponse,\n CreateSubtitlesRequest,\n CreateSubtitlesResponse,\n DeleteSubtitlesRequest,\n DeleteSubtitlesResponse,\n InitializeUploadRequest,\n InitializeUploadResponse,\n GetUploadStatusResponse,\n UploadRequest,\n UploadResponse,\n GetByKeyResponse,\n AppendUploadRequest,\n AppendUploadResponse,\n GetByKeysResponse,\n FinalizeUploadResponse,\n CreateMetadataRequest,\n CreateMetadataResponse,\n} from './models.js';\n\n/**\n * Options for getAnalytics method\n * \n * @public\n */\nexport interface GetAnalyticsOptions {\n /** A comma separated list of MediaAnalytics fields to display. \n * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */\n mediaAnalyticsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createSubtitles method\n * \n * @public\n */\nexport interface CreateSubtitlesOptions {\n /** Request body */\n body?: CreateSubtitlesRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for deleteSubtitles method\n * \n * @public\n */\nexport interface DeleteSubtitlesOptions {\n /** Request body */\n body?: DeleteSubtitlesRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for initializeUpload method\n * \n * @public\n */\nexport interface InitializeUploadOptions {\n /** Request body */\n body?: InitializeUploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getUploadStatus method\n * \n * @public\n */\nexport interface GetUploadStatusOptions {\n /** The command for the media upload request. \n * Also accepts: command or proper camelCase (e.g., command) */\n command?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for upload method\n * \n * @public\n */\nexport interface UploadOptions {\n /** Request body */\n body?: UploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByKey method\n * \n * @public\n */\nexport interface GetByKeyOptions {\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for appendUpload method\n * \n * @public\n */\nexport interface AppendUploadOptions {\n /** Request body */\n body?: AppendUploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByKeys method\n * \n * @public\n */\nexport interface GetByKeysOptions {\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createMetadata method\n * \n * @public\n */\nexport interface CreateMetadataOptions {\n /** Request body */\n body?: CreateMetadataRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for media operations\n * \n * This client provides methods for interacting with the media endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all media related operations.\n * \n * @category media\n */\nexport class MediaClient {\n private client: Client;\n\n /**\n * Creates a new media client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Media analytics\n * Retrieves analytics data for media.\n\n\n\n * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity The granularity for the search counts results.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAnalytics(\n mediaKeys: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n options: GetAnalyticsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media_analytics.fields': 'mediaAnalyticsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaAnalyticsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/analytics';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaKeys !== undefined && mediaKeys.length > 0) {\n params.append('media_keys', mediaKeys.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (mediaAnalyticsFields !== undefined && mediaAnalyticsFields.length > 0) {\n params.append('media_analytics.fields', mediaAnalyticsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Media subtitles\n * Creates subtitles for a specific Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubtitles(\n options: CreateSubtitlesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/subtitles';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Media subtitles\n * Deletes subtitles for a specific Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubtitles(\n options: DeleteSubtitlesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/subtitles';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Initialize media upload\n * Initializes a media upload.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async initializeUpload(\n options: InitializeUploadOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload/initialize';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media upload status\n * Retrieves the status of a Media upload by its ID.\n\n\n\n * @param mediaId Media id for the requested media upload status.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getUploadStatus(\n mediaId: any,\n options: GetUploadStatusOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {};\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n command = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaId !== undefined) {\n params.append('media_id', String(mediaId));\n }\n\n if (command !== undefined) {\n params.append('command', String(command));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Upload media\n * Uploads a media file for use in posts or other content.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async upload(options: UploadOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media by media key\n * Retrieves details of a specific Media file by its media key.\n\n\n * @param mediaKey A single Media Key.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByKey(\n mediaKey: string,\n options: GetByKeyOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media.fields': 'mediaFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/{media_key}';\n\n path = path.replace('{media_key}', encodeURIComponent(String(mediaKey)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Append Media upload\n * Appends data to a Media upload request.\n\n\n * @param id The media identifier for the media to perform the append operation.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async appendUpload(\n id: string,\n options: AppendUploadOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload/{id}/append';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media by media keys\n * Retrieves details of Media files by their media keys.\n\n\n\n * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByKeys(\n mediaKeys: Array,\n options: GetByKeysOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media.fields': 'mediaFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaKeys !== undefined && mediaKeys.length > 0) {\n params.append('media_keys', mediaKeys.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Finalize Media upload\n * Finalizes a Media upload request.\n\n\n * @param id The media id of the targeted media to finalize.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async finalizeUpload(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/media/upload/{id}/finalize';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Media metadata\n * Creates metadata for a Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createMetadata(\n options: CreateMetadataOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/metadata';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for media operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getAnalytics\n * \n * @public\n */\nexport type GetAnalyticsResponse = Schemas.MediaAnalytics;\n/**\n * Request for createSubtitles\n * \n * @public\n */\nexport type CreateSubtitlesRequest = Schemas.SubtitlesCreateRequest;\n/**\n * Response for createSubtitles\n * \n * @public\n */\nexport type CreateSubtitlesResponse = Schemas.SubtitlesCreateResponse;\n/**\n * Request for deleteSubtitles\n * \n * @public\n */\nexport type DeleteSubtitlesRequest = Schemas.SubtitlesDeleteRequest;\n/**\n * Response for deleteSubtitles\n * \n * @public\n */\nexport type DeleteSubtitlesResponse = Schemas.SubtitlesDeleteResponse;\n/**\n * Request for initializeUpload\n * \n * @public\n */\nexport type InitializeUploadRequest = Schemas.MediaUploadConfigRequest;\n/**\n * Response for initializeUpload\n * \n * @public\n */\nexport type InitializeUploadResponse = Schemas.MediaUploadResponse;\n/**\n * Response for getUploadStatus\n * \n * @public\n */\nexport type GetUploadStatusResponse = Schemas.MediaUploadResponse;\n/**\n * Request for upload\n * \n * @public\n */\nexport type UploadRequest = Schemas.MediaUploadRequestOneShot;\n/**\n * Response for upload\n * \n * @public\n */\nexport type UploadResponse = Schemas.MediaUploadResponse;\n/**\n * Response for getByKey\n * \n * @public\n */\nexport type GetByKeyResponse = Schemas.Get2MediaMediaKeyResponse;\n/**\n * Request for appendUpload\n * \n * @public\n */\nexport type AppendUploadRequest = Schemas.MediaUploadAppendRequest;\n/**\n * Response for appendUpload\n * \n * @public\n */\nexport type AppendUploadResponse = Schemas.MediaUploadAppendResponse;\n/**\n * Response for getByKeys\n * \n * @public\n */\nexport type GetByKeysResponse = Schemas.Get2MediaResponse;\n/**\n * Response for finalizeUpload\n * \n * @public\n */\nexport type FinalizeUploadResponse = Schemas.MediaUploadResponse;\n/**\n * Request for createMetadata\n * \n * @public\n */\nexport type CreateMetadataRequest = Schemas.MetadataCreateRequest;\n/**\n * Response for createMetadata\n * \n * @public\n */\nexport type CreateMetadataResponse = Schemas.MetadataCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * lists client for the X API.\n *\n * This module provides a client for interacting with the lists endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n RemoveMemberByUserIdResponse,\n GetByIdResponse,\n UpdateRequest,\n UpdateResponse,\n DeleteResponse,\n GetMembersResponse,\n AddMemberRequest,\n AddMemberResponse,\n GetFollowersResponse,\n GetPostsResponse,\n CreateRequest,\n CreateResponse,\n} from './models.js';\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for update method\n * \n * @public\n */\nexport interface UpdateOptions {\n /** Request body */\n body?: UpdateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMembers method\n * \n * @public\n */\nexport interface GetMembersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for addMember method\n * \n * @public\n */\nexport interface AddMemberOptions {\n /** Request body */\n body?: AddMemberRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowers method\n * \n * @public\n */\nexport interface GetFollowersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for lists operations\n * \n * This client provides methods for interacting with the lists endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all lists related operations.\n * \n * @category lists\n */\nexport class ListsClient {\n private client: Client;\n\n /**\n * Creates a new lists client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Remove List member\n * Removes a User from a specific List by its ID and the User’s ID.\n\n\n * @param id The ID of the List to remove a member.\n\n\n\n * @param userId The ID of User that will be removed from the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async removeMemberByUserId(\n id: string,\n userId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members/{user_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{user_id}', encodeURIComponent(String(userId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List by ID\n * Retrieves details of a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update List\n * Updates the details of a specific List owned by the authenticated user by its ID.\n\n\n * @param id The ID of the List to modify.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async update(\n id: string,\n options: UpdateOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete List\n * Deletes a specific List owned by the authenticated user by its ID.\n\n\n * @param id The ID of the List to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List members\n * Retrieves a list of Users who are members of a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMembers(\n id: string,\n options: GetMembersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Add List member\n * Adds a User to a specific List by its ID.\n\n\n * @param id The ID of the List for which to add a member.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async addMember(\n id: string,\n options: AddMemberOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List followers\n * Retrieves a list of Users who follow a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowers(\n id: string,\n options: GetFollowersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/followers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List Posts\n * Retrieves a list of Posts associated with a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create List\n * Creates a new List for the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: [\n 'list.read',\n 'list.write',\n 'tweet.read',\n 'users.read',\n ],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for lists operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for removeMemberByUserId\n * \n * @public\n */\nexport type RemoveMemberByUserIdResponse = Schemas.ListMutateResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2ListsIdResponse;\n/**\n * Request for update\n * \n * @public\n */\nexport type UpdateRequest = Schemas.ListUpdateRequest;\n/**\n * Response for update\n * \n * @public\n */\nexport type UpdateResponse = Schemas.ListUpdateResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.ListDeleteResponse;\n/**\n * Response for getMembers\n * \n * @public\n */\nexport type GetMembersResponse = Schemas.Get2ListsIdMembersResponse;\n/**\n * Request for addMember\n * \n * @public\n */\nexport type AddMemberRequest = Schemas.ListAddUserRequest;\n/**\n * Response for addMember\n * \n * @public\n */\nexport type AddMemberResponse = Schemas.ListMutateResponse;\n/**\n * Response for getFollowers\n * \n * @public\n */\nexport type GetFollowersResponse = Schemas.Get2ListsIdFollowersResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2ListsIdTweetsResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.ListCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.ListCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * compliance client for the X API.\n *\n * This module provides a client for interacting with the compliance endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetJobsByIdResponse,\n GetJobsResponse,\n CreateJobsRequest,\n CreateJobsResponse,\n} from './models.js';\n\n/**\n * Options for getJobsById method\n * \n * @public\n */\nexport interface GetJobsByIdOptions {\n /** A comma separated list of ComplianceJob fields to display. \n * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */\n complianceJobFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getJobs method\n * \n * @public\n */\nexport interface GetJobsOptions {\n /** Status of Compliance Job to list. \n * Also accepts: status or proper camelCase (e.g., status) */\n status?: string;\n\n /** A comma separated list of ComplianceJob fields to display. \n * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */\n complianceJobFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for compliance operations\n * \n * This client provides methods for interacting with the compliance endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all compliance related operations.\n * \n * @category compliance\n */\nexport class ComplianceClient {\n private client: Client;\n\n /**\n * Creates a new compliance client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Compliance Job by ID\n * Retrieves details of a specific Compliance Job by its ID.\n\n\n * @param id The ID of the Compliance Job to retrieve.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getJobsById(\n id: string,\n options: GetJobsByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'compliance_job.fields': 'complianceJobFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n complianceJobFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (complianceJobFields !== undefined && complianceJobFields.length > 0) {\n params.append('compliance_job.fields', complianceJobFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Compliance Jobs\n * Retrieves a list of Compliance Jobs filtered by job type and optional status.\n\n\n\n * @param type Type of Compliance Job to list.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getJobs(\n type: string,\n options: GetJobsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'compliance_job.fields': 'complianceJobFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n status = undefined,\n\n complianceJobFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (type !== undefined) {\n params.append('type', String(type));\n }\n\n if (status !== undefined) {\n params.append('status', String(status));\n }\n\n if (complianceJobFields !== undefined && complianceJobFields.length > 0) {\n params.append('compliance_job.fields', complianceJobFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Compliance Job\n * Creates a new Compliance Job for the specified job type.\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createJobs(body: CreateJobsRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for compliance operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getJobsById\n * \n * @public\n */\nexport type GetJobsByIdResponse = Schemas.Get2ComplianceJobsIdResponse;\n/**\n * Response for getJobs\n * \n * @public\n */\nexport type GetJobsResponse = Schemas.Get2ComplianceJobsResponse;\n/**\n * Request for createJobs\n * \n * @public\n */\nexport type CreateJobsRequest = Schemas.CreateComplianceJobRequest;\n/**\n * Response for createJobs\n * \n * @public\n */\nexport type CreateJobsResponse = Schemas.CreateComplianceJobResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * general client for the X API.\n *\n * This module provides a client for interacting with the general endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetOpenApiSpecResponse } from './models.js';\n\n/**\n * Client for general operations\n * \n * This client provides methods for interacting with the general endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all general related operations.\n * \n * @category general\n */\nexport class GeneralClient {\n private client: Client;\n\n /**\n * Creates a new general client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get OpenAPI Spec.\n * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md)\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getOpenApiSpec(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/openapi.json';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for general operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n\n/**\n * Response for getOpenApiSpec\n * \n * @public\n */\nexport type GetOpenApiSpecResponse = Record;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * account activity client for the X API.\n *\n * This module provides a client for interacting with the account activity endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n ValidateSubscriptionResponse,\n CreateSubscriptionRequest,\n CreateSubscriptionResponse,\n GetSubscriptionCountResponse,\n GetSubscriptionsResponse,\n CreateReplayJobResponse,\n DeleteSubscriptionResponse,\n} from './models.js';\n\n/**\n * Options for createSubscription method\n * \n * @public\n */\nexport interface CreateSubscriptionOptions {\n /** Request body */\n body?: CreateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for account activity operations\n * \n * This client provides methods for interacting with the account activity endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all account activity related operations.\n * \n * @category account activity\n */\nexport class AccountActivityClient {\n private client: Client;\n\n /**\n * Creates a new account activity client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Validate subscription\n * Checks a user’s Account Activity subscription for a given webhook.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async validateSubscription(\n webhookId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create subscription\n * Creates an Account Activity subscription for the user and the given webhook.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubscription(\n webhookId: string,\n options: CreateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get subscription count\n * Retrieves a count of currently active Account Activity subscriptions.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptionCount(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/account_activity/subscriptions/count';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get subscriptions\n * Retrieves a list of all active subscriptions for a given webhook.\n\n\n * @param webhookId The webhook ID to pull subscriptions for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptions(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create replay job\n * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook.\n\n\n * @param webhookId The unique identifier for the webhook configuration.\n\n\n\n\n * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format.\n\n\n\n * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createReplayJob(\n webhookId: string,\n fromDate: string,\n toDate: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (fromDate !== undefined) {\n params.append('from_date', String(fromDate));\n }\n\n if (toDate !== undefined) {\n params.append('to_date', String(toDate));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete subscription\n * Deletes an Account Activity subscription for the given webhook and user ID.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n * @param userId User ID to unsubscribe from.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubscription(\n webhookId: string,\n userId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n path = path.replace('{user_id}', encodeURIComponent(String(userId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for account activity operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for validateSubscription\n * \n * @public\n */\nexport type ValidateSubscriptionResponse = Schemas.SubscriptionsGetResponse;\n/**\n * Request for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionRequest = Schemas.SubscriptionsCreateRequest;\n/**\n * Response for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionResponse = Schemas.SubscriptionsCreateResponse;\n/**\n * Response for getSubscriptionCount\n * \n * @public\n */\nexport type GetSubscriptionCountResponse = Schemas.SubscriptionsCountGetResponse;\n/**\n * Response for getSubscriptions\n * \n * @public\n */\nexport type GetSubscriptionsResponse = Schemas.SubscriptionsListGetResponse;\n/**\n * Response for createReplayJob\n * \n * @public\n */\nexport type CreateReplayJobResponse = Schemas.ReplayJobCreateResponse;\n/**\n * Response for deleteSubscription\n * \n * @public\n */\nexport type DeleteSubscriptionResponse = Schemas.SubscriptionsDeleteResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Event-driven streaming utilities for the X API.\n * \n * This module provides event-driven streaming interfaces that are more user-friendly\n * than manual ReadableStream management.\n */\n\n// Event types for the stream (using string literals for simplicity)\n// Based on actual Twitter API behavior from documentation\nexport const StreamEvent = {\n Data: 'data', // When JSON data arrives\n KeepAlive: 'keepAlive', // 20-second heartbeat (newline character)\n Error: 'error', // HTTP errors, ConnectionException, operational-disconnect\n Close: 'close', // When stream ends\n};\n\n// Event data types\nexport interface StreamDataEvent {\n data: any;\n includes?: any;\n matching_rules?: any[];\n}\n\nexport interface StreamErrorEvent {\n error: Error;\n // Additional error details from the API response\n code?: string;\n status?: number;\n}\n\n/**\n * Event-driven stream class for handling streaming data from the X API.\n * \n * This class provides an event-driven interface for working with streaming endpoints,\n * allowing you to listen to 'data', 'keepAlive', 'error', and 'close' events.\n * \n * @public\n */\nexport class EventDrivenStream {\n private webStream: ReadableStream | null = null;\n private reader: ReadableStreamDefaultReader | null = null;\n private decoder: TextDecoder;\n private isConnected: boolean = false;\n private isClosed: boolean = false;\n private buffer: string = '';\n private eventListeners: Map = new Map();\n private autoReconnect: boolean = false;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = 5;\n private reconnectDelay: number = 1000;\n\n constructor() {\n this.decoder = new TextDecoder();\n this.setupEventListeners();\n }\n\n /**\n * Initialize the stream with a Web ReadableStream\n */\n async connect(webStream: ReadableStream): Promise {\n if (this.isConnected) {\n throw new Error('Stream is already connected');\n }\n\n this.webStream = webStream;\n this.isConnected = true;\n this.isClosed = false;\n this.reconnectAttempts = 0;\n\n this.emit(StreamEvent.Data, { message: 'Stream connected' });\n this.startReading(); // Don't await this - it runs in the background\n }\n\n /**\n * Start reading from the stream\n */\n private async startReading(): Promise {\n if (!this.webStream || !this.isConnected) {\n return;\n }\n\n this.reader = this.webStream.getReader();\n\n try {\n while (this.isConnected && !this.isClosed) {\n const { done, value } = await this.reader.read();\n\n if (done) {\n this.handleConnectionClosed();\n break;\n }\n\n if (value) {\n await this.processChunk(value);\n }\n }\n } catch (error) {\n this.handleConnectionError(error as Error);\n } finally {\n this.cleanup();\n }\n }\n\n /**\n * Process incoming data chunks\n */\n private async processChunk(value: Uint8Array): Promise {\n const chunk = this.decoder.decode(value, { stream: true });\n this.buffer += chunk;\n\n // Process complete lines (ending with newline)\n let boundary;\n while ((boundary = this.buffer.indexOf('\\n')) !== -1) {\n const line = this.buffer.substring(0, boundary);\n this.buffer = this.buffer.substring(boundary + 1);\n\n if (line.trim()) {\n try {\n const data = JSON.parse(line);\n\n // Check if it's a keep-alive signal (20-second heartbeat)\n if (this.isKeepAlive(data)) {\n this.emit(StreamEvent.KeepAlive, { data });\n continue;\n }\n\n // Emit data event for actual content\n this.emit(StreamEvent.Data, data);\n } catch (parseError) {\n // Skip invalid JSON lines - these are usually incomplete chunks\n console.warn('Skipping invalid JSON:', line.substring(0, 100));\n }\n }\n }\n }\n\n /**\n * Check if data is a keep-alive signal (20-second heartbeat)\n * Twitter sends newline characters every 20 seconds to prevent timeouts\n */\n private isKeepAlive(data: any): boolean {\n // Twitter sends empty objects or just newline characters as keep-alive\n return !data.data && !data.includes && !data.matching_rules && !data.errors;\n }\n\n /**\n * Handle connection errors\n */\n private handleConnectionError(error: Error): void {\n this.isConnected = false;\n\n // Emit the error as-is (API returns the actual error details)\n this.emit(StreamEvent.Error, { error });\n\n if (\n this.autoReconnect &&\n this.reconnectAttempts < this.maxReconnectAttempts\n ) {\n this.attemptReconnect();\n }\n }\n\n /**\n * Handle connection closed\n */\n private handleConnectionClosed(): void {\n this.isConnected = false;\n this.emit(StreamEvent.Close, { message: 'Connection closed' });\n }\n\n /**\n * Attempt to reconnect\n */\n private async attemptReconnect(): Promise {\n this.reconnectAttempts++;\n this.emit(StreamEvent.Data, {\n message: `Reconnect attempt ${this.reconnectAttempts}/${this\n .maxReconnectAttempts}`,\n });\n\n // Wait before reconnecting\n await new Promise(resolve =>\n setTimeout(resolve, this.reconnectDelay * this.reconnectAttempts)\n );\n\n try {\n // This would need to be implemented based on how you get a new stream\n // For now, we'll just emit the events\n this.emit(StreamEvent.Error, {\n error: new Error('Reconnect not implemented in this example'),\n });\n } catch (error) {\n this.emit(StreamEvent.Error, { error: error as Error });\n }\n }\n\n /**\n * Clean up resources\n */\n private cleanup(): void {\n if (this.reader) {\n try {\n // Try to release the lock - it will throw if already released\n this.reader.releaseLock();\n } catch (error) {\n // Ignore errors when releasing the lock (already released)\n console.debug('Reader lock already released or error:', error);\n }\n this.reader = null;\n }\n this.buffer = '';\n }\n\n /**\n * Close the stream\n */\n close(): void {\n this.isClosed = true;\n this.isConnected = false;\n this.cleanup();\n this.emit(StreamEvent.Close, { message: 'Stream closed by user' });\n }\n\n /**\n * Add event listener\n */\n on(event: string, listener: Function): this {\n if (!this.eventListeners.has(event)) {\n this.eventListeners.set(event, []);\n }\n this.eventListeners.get(event)!.push(listener);\n return this;\n }\n\n /**\n * Remove event listener\n */\n off(event: string, listener: Function): this {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n const index = listeners.indexOf(listener);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n }\n return this;\n }\n\n /**\n * Emit event to listeners\n */\n private emit(event: string, data: any): void {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n listeners.forEach(listener => {\n try {\n listener(data);\n } catch (error) {\n console.error(`Error in ${event} listener:`, error);\n }\n });\n }\n }\n\n /**\n * Setup default event listeners\n */\n private setupEventListeners(): void {\n // Default error handling\n this.on(StreamEvent.Error, (eventData: StreamErrorEvent) => {\n console.error('Stream error:', eventData.error);\n });\n }\n\n /**\n * Enable/disable auto-reconnect\n */\n set autoReconnectEnabled(enabled: boolean) {\n this.autoReconnect = enabled;\n }\n\n get autoReconnectEnabled(): boolean {\n return this.autoReconnect;\n }\n\n /**\n * Set max reconnect attempts\n */\n set maxReconnectAttemptsCount(count: number) {\n this.maxReconnectAttempts = count;\n }\n\n get maxReconnectAttemptsCount(): number {\n return this.maxReconnectAttempts;\n }\n\n /**\n * Async iterator for tweets\n */\n async *[Symbol.asyncIterator](): AsyncGenerator<\n StreamDataEvent,\n void,\n unknown\n > {\n const dataQueue: StreamDataEvent[] = [];\n let isComplete = false;\n let hasError = false;\n let error: Error | null = null;\n\n // Set up listeners\n const dataListener = (eventData: any) => {\n dataQueue.push(eventData);\n };\n\n const errorListener = (eventData: StreamErrorEvent) => {\n hasError = true;\n error = eventData.error;\n };\n\n const closeListener = () => {\n isComplete = true;\n };\n\n this.on(StreamEvent.Data, dataListener);\n this.on(StreamEvent.Error, errorListener);\n this.on(StreamEvent.Close, closeListener);\n\n try {\n while (!isComplete && !hasError) {\n if (dataQueue.length > 0) {\n yield dataQueue.shift()!;\n } else {\n // Wait a bit for more data\n await new Promise(resolve => setTimeout(resolve, 10));\n }\n }\n\n if (hasError && error) {\n throw error;\n }\n } finally {\n // Clean up listeners\n this.off(StreamEvent.Data, dataListener);\n this.off(StreamEvent.Error, errorListener);\n this.off(StreamEvent.Close, closeListener);\n }\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Stream client for the X API.\n *\n * This module provides a client for interacting with the streaming endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport { EventDrivenStream, StreamEvent } from './event_driven_stream.js';\nimport {\n PostsSampleResponse,\n PostsFirehoseResponse,\n LabelsComplianceResponse,\n LikesComplianceResponse,\n LikesSample10Response,\n PostsFirehosePtResponse,\n PostsFirehoseEnResponse,\n PostsResponse,\n GetRulesResponse,\n UpdateRulesResponse,\n PostsComplianceResponse,\n PostsFirehoseKoResponse,\n LikesFirehoseResponse,\n PostsSample10Response,\n PostsFirehoseJaResponse,\n GetRuleCountsResponse,\n UsersComplianceResponse,\n} from './models.js';\n\n/**\n * Options for postsSample method\n * \n * @public\n */\nexport interface PostsSampleStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehose method\n * \n * @public\n */\nexport interface PostsFirehoseStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for labelsCompliance method\n * \n * @public\n */\nexport interface LabelsComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesCompliance method\n * \n * @public\n */\nexport interface LikesComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesSample10 method\n * \n * @public\n */\nexport interface LikesSample10StreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of LikeWithTweetAuthor fields to display. \n * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */\n likeWithTweetAuthorFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehosePt method\n * \n * @public\n */\nexport interface PostsFirehosePtStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseEn method\n * \n * @public\n */\nexport interface PostsFirehoseEnStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for posts method\n * \n * @public\n */\nexport interface PostsStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for getRules method\n * \n * @public\n */\nexport interface GetRulesStreamingOptions {\n /** A comma-separated list of Rule IDs. \n * Also accepts: ids or proper camelCase (e.g., ids) */\n ids?: Array;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This value is populated by passing the 'next_token' returned in a request to paginate through results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for updateRules method\n * \n * @public\n */\nexport interface UpdateRulesStreamingOptions {\n /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. \n * Also accepts: dry_run or proper camelCase (e.g., dryRun) */\n dryRun?: boolean;\n\n /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. \n * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */\n deleteAll?: boolean;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsCompliance method\n * \n * @public\n */\nexport interface PostsComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseKo method\n * \n * @public\n */\nexport interface PostsFirehoseKoStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesFirehose method\n * \n * @public\n */\nexport interface LikesFirehoseStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of LikeWithTweetAuthor fields to display. \n * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */\n likeWithTweetAuthorFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsSample10 method\n * \n * @public\n */\nexport interface PostsSample10StreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseJa method\n * \n * @public\n */\nexport interface PostsFirehoseJaStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for getRuleCounts method\n * \n * @public\n */\nexport interface GetRuleCountsStreamingOptions {\n /** A comma separated list of RulesCount fields to display. \n * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */\n rulesCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for usersCompliance method\n * \n * @public\n */\nexport interface UsersComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\nexport class StreamClient {\n private client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Stream sampled Posts\n * Streams a 1% sample of public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsSample(\n options: PostsSampleStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsSample');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/sample/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream all Posts\n * Streams all public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehose(\n partition: number,\n options: PostsFirehoseStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehose');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Post labels\n * Streams all labeling events applied to Posts.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async labelsCompliance(\n options: LabelsComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'labelsCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/label/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Likes compliance data\n * Streams all compliance data related to Likes for Users.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesCompliance(\n options: LikesComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream sampled Likes\n * Streams a 10% sample of public Likes in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesSample10(\n partition: number,\n options: LikesSample10StreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesSample10');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n likeWithTweetAuthorFields = [],\n\n expansions = [],\n\n userFields = [],\n\n tweetFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/sample10/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (\n likeWithTweetAuthorFields !== undefined &&\n likeWithTweetAuthorFields.length > 0\n ) {\n params.append(\n 'like_with_tweet_author.fields',\n likeWithTweetAuthorFields.join(',')\n );\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Portuguese Posts\n * Streams all public Portuguese-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehosePt(\n partition: number,\n options: PostsFirehosePtStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehosePt');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/pt';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream English Posts\n * Streams all public English-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseEn(\n partition: number,\n options: PostsFirehoseEnStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseEn');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/en';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream filtered Posts\n * Streams Posts in real-time matching the active rule set.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async posts(options: PostsStreamingOptions = {}): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'posts');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Posts compliance data\n * Streams all compliance data related to Posts.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsCompliance(\n partition: number,\n options: PostsComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Korean Posts\n * Streams all public Korean-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseKo(\n partition: number,\n options: PostsFirehoseKoStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseKo');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/ko';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream all Likes\n * Streams all public Likes in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesFirehose(\n partition: number,\n options: LikesFirehoseStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesFirehose');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n likeWithTweetAuthorFields = [],\n\n expansions = [],\n\n userFields = [],\n\n tweetFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/firehose/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (\n likeWithTweetAuthorFields !== undefined &&\n likeWithTweetAuthorFields.length > 0\n ) {\n params.append(\n 'like_with_tweet_author.fields',\n likeWithTweetAuthorFields.join(',')\n );\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream 10% sampled Posts\n * Streams a 10% sample of public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsSample10(\n partition: number,\n options: PostsSample10StreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsSample10');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/sample10/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Japanese Posts\n * Streams all public Japanese-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseJa(\n partition: number,\n options: PostsFirehoseJaStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseJa');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/ja';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Users compliance data\n * Streams all compliance data related to Users.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async usersCompliance(\n partition: number,\n options: UsersComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'usersCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Get stream rules\n * Retrieves the active rule set or a subset of rules for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async getRules(\n options: GetRulesStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'getRules');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n ids = [],\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update stream rules\n * Adds or deletes rules from the active rule set for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async updateRules(\n body: any,\n options: UpdateRulesStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'updateRules');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n dry_run: 'dryRun',\n\n delete_all: 'deleteAll',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n dryRun = undefined,\n\n deleteAll = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (dryRun !== undefined) {\n params.append('dry_run', String(dryRun));\n }\n\n if (deleteAll !== undefined) {\n params.append('delete_all', String(deleteAll));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n body: JSON.stringify(body),\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get stream rule counts\n * Retrieves the count of rules in the active rule set for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async getRuleCounts(\n options: GetRuleCountsStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'getRuleCounts');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'rules_count.fields': 'rulesCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n rulesCountFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules/counts';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (rulesCountFields !== undefined && rulesCountFields.length > 0) {\n params.append('rules_count.fields', rulesCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * webhooks client for the X API.\n *\n * This module provides a client for interacting with the webhooks endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n CreateStreamLinkResponse,\n DeleteStreamLinkResponse,\n ValidateResponse,\n DeleteResponse,\n GetStreamLinksResponse,\n GetResponse,\n CreateRequest,\n CreateResponse,\n} from './models.js';\n\n/**\n * Options for createStreamLink method\n * \n * @public\n */\nexport interface CreateStreamLinkOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: string;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: string;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: string;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: string;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: string;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** A comma separated list of WebhookConfig fields to display. \n * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */\n webhookConfigFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for webhooks operations\n * \n * This client provides methods for interacting with the webhooks endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all webhooks related operations.\n * \n * @category webhooks\n */\nexport class WebhooksClient {\n private client: Client;\n\n /**\n * Creates a new webhooks client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Create stream link\n * Creates a link to deliver FilteredStream events to the given webhook.\n\n\n * @param webhookId The webhook ID to link to your FilteredStream ruleset.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createStreamLink(\n webhookId: string,\n options: CreateStreamLinkOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = undefined,\n\n expansions = undefined,\n\n mediaFields = undefined,\n\n pollFields = undefined,\n\n userFields = undefined,\n\n placeFields = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetFields !== undefined) {\n params.append('tweet.fields', String(tweetFields));\n }\n\n if (expansions !== undefined) {\n params.append('expansions', String(expansions));\n }\n\n if (mediaFields !== undefined) {\n params.append('media.fields', String(mediaFields));\n }\n\n if (pollFields !== undefined) {\n params.append('poll.fields', String(pollFields));\n }\n\n if (userFields !== undefined) {\n params.append('user.fields', String(userFields));\n }\n\n if (placeFields !== undefined) {\n params.append('place.fields', String(placeFields));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete stream link\n * Deletes a link from FilteredStream events to the given webhook.\n\n\n * @param webhookId The webhook ID to link to your FilteredStream ruleset.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteStreamLink(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Validate webhook\n * Triggers a CRC check for a given webhook.\n\n\n * @param webhookId The ID of the webhook to check.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async validate(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete webhook\n * Deletes an existing webhook configuration.\n\n\n * @param webhookId The ID of the webhook to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get stream links\n * Get a list of webhook links associated with a filtered stream ruleset.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getStreamLinks(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get webhook\n * Get a list of webhook configs associated with a client app.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'webhook_config.fields': 'webhookConfigFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n webhookConfigFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (webhookConfigFields !== undefined && webhookConfigFields.length > 0) {\n params.append('webhook_config.fields', webhookConfigFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create webhook\n * Creates a new webhook configuration.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for webhooks operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for createStreamLink\n * \n * @public\n */\nexport type CreateStreamLinkResponse = Schemas.WebhookLinksCreateResponse;\n/**\n * Response for deleteStreamLink\n * \n * @public\n */\nexport type DeleteStreamLinkResponse = Schemas.WebhookLinksDeleteResponse;\n/**\n * Response for validate\n * \n * @public\n */\nexport type ValidateResponse = Schemas.WebhookConfigPutResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.WebhookConfigDeleteResponse;\n/**\n * Response for getStreamLinks\n * \n * @public\n */\nexport type GetStreamLinksResponse = Schemas.WebhookLinksGetResponse;\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2WebhooksResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.WebhookConfigCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.WebhookConfigCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Main client for the X API.\n *\n * This module provides the main client class for interacting with the X API.\n */\n\nimport { httpClient } from \"./http-client.js\";\nimport { \n Paginator, \n PostPaginator, \n UserPaginator, \n EventPaginator\n} from \"./paginator.js\";\n\n\n\nimport { NewsClient } from \"./news/index.js\";\n\n\n\nimport { UsersClient } from \"./users/index.js\";\n\n\n\nimport { DirectMessagesClient } from \"./direct_messages/index.js\";\n\n\n\nimport { CommunityNotesClient } from \"./community_notes/index.js\";\n\n\n\nimport { PostsClient } from \"./posts/index.js\";\n\n\n\nimport { TrendsClient } from \"./trends/index.js\";\n\n\n\nimport { ActivityClient } from \"./activity/index.js\";\n\n\n\nimport { UsageClient } from \"./usage/index.js\";\n\n\n\nimport { SpacesClient } from \"./spaces/index.js\";\n\n\n\nimport { CommunitiesClient } from \"./communities/index.js\";\n\n\n\nimport { ConnectionsClient } from \"./connections/index.js\";\n\n\n\nimport { MediaClient } from \"./media/index.js\";\n\n\n\nimport { ListsClient } from \"./lists/index.js\";\n\n\n\nimport { ComplianceClient } from \"./compliance/index.js\";\n\n\n\nimport { GeneralClient } from \"./general/index.js\";\n\n\n\nimport { AccountActivityClient } from \"./account_activity/index.js\";\n\n\n\nimport { StreamClient } from \"./stream/client.js\";\n\n\n\nimport { WebhooksClient } from \"./webhooks/index.js\";\n\n\n\n/**\n * Configuration options for the X API client\n */\nexport interface ClientConfig {\n /** Base URL for API requests */\n baseUrl?: string;\n /** Bearer token for authentication */\n bearerToken?: string;\n /** OAuth2 access token */\n accessToken?: string;\n /** OAuth1 instance for authentication */\n oauth1?: any;\n /** Custom headers to include in requests */\n headers?: Record;\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Whether to automatically retry failed requests */\n retry?: boolean;\n /** Maximum number of retry attempts */\n maxRetries?: number;\n}\n\n/**\n * API Error class for handling X API errors\n */\nexport class ApiError extends Error {\n public readonly status: number;\n public readonly statusText: string;\n public readonly headers: Headers;\n public readonly data?: any;\n\n constructor(message: string, status: number, statusText: string, headers: Headers, data?: any) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.statusText = statusText;\n this.headers = headers;\n this.data = data;\n }\n}\n\n/**\n * Request options for API calls\n */\nexport interface RequestOptions {\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Additional headers */\n headers?: Record;\n /** Request signal for cancellation */\n signal?: AbortSignal;\n /** Request body */\n body?: string;\n /** Return raw HTTP wrapper instead of parsed body */\n raw?: boolean;\n /** Security requirements for the endpoint (from OpenAPI spec) - used for smart auth selection */\n security?: Array>;\n}\n\n/**\n * Response wrapper with metadata\n */\nexport interface ApiResponse {\n /** Response body */\n body: T;\n /** Response headers */\n headers: Headers;\n /** HTTP status code */\n status: number;\n /** HTTP status text */\n statusText: string;\n /** Response URL */\n url: string;\n}\n\n/**\n * Pagination metadata\n */\nexport interface PaginationMeta {\n /** Next page token */\n next_token?: string;\n /** Previous page token */\n previous_token?: string;\n /** Total count */\n total_count?: number;\n /** Result count */\n result_count?: number;\n}\n\n\n/**\n * Main client class for the X API\n * \n * This is the primary entry point for interacting with the X API. It provides\n * access to all API endpoints through specialized client modules and handles\n * authentication, request configuration, and error handling.\n * \n * @example\n * ```typescript\n * import { Client } from 'x-api-sdk';\n * \n * const client = new Client({\n * bearerToken: 'your-bearer-token'\n * });\n * \n * // Get user information\n * const user = await client.users.getUser('783214');\n * \n * // Get followers with pagination\n * const followers = await client.users.getFollowers('783214', {\n * maxResults: 10,\n * userFields: ['id', 'name', 'username']\n * });\n * \n * // Iterate through followers\n * for await (const follower of followers) {\n * console.log(follower.username);\n * }\n * ```\n * \n * @category Client\n */\nexport class Client {\n /** Base URL for API requests */\n readonly baseUrl: string;\n /** Bearer token for authentication */\n readonly bearerToken?: string;\n /** OAuth2 access token */\n readonly accessToken?: string;\n /** OAuth1 instance for authentication */\n readonly oauth1?: any;\n /** Headers for requests */\n readonly headers: Headers;\n /** Request timeout in milliseconds */\n readonly timeout: number;\n /** Whether to automatically retry failed requests */\n readonly retry: boolean;\n /** Maximum number of retry attempts */\n readonly maxRetries: number;\n\n /** HTTP client for making requests */\n readonly httpClient = httpClient;\n\n\n /** news client */\n readonly news: NewsClient;\n\n /** users client */\n readonly users: UsersClient;\n\n /** direct messages client */\n readonly directMessages: DirectMessagesClient;\n\n /** community notes client */\n readonly communityNotes: CommunityNotesClient;\n\n /** posts client */\n readonly posts: PostsClient;\n\n /** trends client */\n readonly trends: TrendsClient;\n\n /** activity client */\n readonly activity: ActivityClient;\n\n /** usage client */\n readonly usage: UsageClient;\n\n /** spaces client */\n readonly spaces: SpacesClient;\n\n /** communities client */\n readonly communities: CommunitiesClient;\n\n /** connections client */\n readonly connections: ConnectionsClient;\n\n /** media client */\n readonly media: MediaClient;\n\n /** lists client */\n readonly lists: ListsClient;\n\n /** compliance client */\n readonly compliance: ComplianceClient;\n\n /** general client */\n readonly general: GeneralClient;\n\n /** account activity client */\n readonly accountActivity: AccountActivityClient;\n\n /** stream client */\n readonly stream: StreamClient;\n\n /** webhooks client */\n readonly webhooks: WebhooksClient;\n\n\n /**\n * Creates a new X API client instance\n * \n * @param config - Configuration options for the client\n * \n * @example\n * ```typescript\n * // Bearer token authentication\n * const client = new Client({\n * bearerToken: 'your-bearer-token'\n * });\n * \n * // OAuth2 authentication\n * const client = new Client({\n * accessToken: 'your-access-token'\n * });\n * \n * // OAuth1 authentication\n * const client = new Client({\n * oauth1: oauth1Instance\n * });\n * ```\n */\n constructor(config: ClientConfig | any) {\n // Handle OAuth1 instance passed directly\n if (config && typeof config === 'object' && config.accessToken && config.accessToken.accessToken && config.accessToken.accessTokenSecret) {\n // This is an OAuth1 instance\n this.oauth1 = config;\n this.baseUrl = \"https://api.x.com\";\n } else {\n // This is a regular config object\n const clientConfig = config as ClientConfig;\n this.baseUrl = clientConfig.baseUrl || \"https://api.x.com\";\n this.bearerToken = clientConfig.bearerToken;\n this.accessToken = clientConfig.accessToken;\n this.oauth1 = clientConfig.oauth1;\n }\n \n this.timeout = (config as ClientConfig).timeout || 30000;\n this.retry = (config as ClientConfig).retry ?? true;\n this.maxRetries = (config as ClientConfig).maxRetries || 3;\n \n // Initialize headers\n const defaultHeaders: Record = {\n 'User-Agent': 'xdk-typescript/0.2.1-beta',\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n ...((config as ClientConfig).headers || {}),\n };\n \n this.headers = httpClient.createHeaders(defaultHeaders);\n\n\n this.news = new NewsClient(this);\n\n this.users = new UsersClient(this);\n\n this.directMessages = new DirectMessagesClient(this);\n\n this.communityNotes = new CommunityNotesClient(this);\n\n this.posts = new PostsClient(this);\n\n this.trends = new TrendsClient(this);\n\n this.activity = new ActivityClient(this);\n\n this.usage = new UsageClient(this);\n\n this.spaces = new SpacesClient(this);\n\n this.communities = new CommunitiesClient(this);\n\n this.connections = new ConnectionsClient(this);\n\n this.media = new MediaClient(this);\n\n this.lists = new ListsClient(this);\n\n this.compliance = new ComplianceClient(this);\n\n this.general = new GeneralClient(this);\n\n this.accountActivity = new AccountActivityClient(this);\n\n this.stream = new StreamClient(this);\n\n this.webhooks = new WebhooksClient(this);\n\n }\n\n /**\n * Make an authenticated request to the X API\n * \n * This method handles authentication, request formatting, and error handling\n * for all API requests. It automatically adds the appropriate authentication\n * headers based on the client configuration.\n * \n * @param method - HTTP method (GET, POST, PUT, DELETE, etc.)\n * @param path - API endpoint path (e.g., '/2/users/by/username/username')\n * @param options - Request options including timeout, headers, and body\n * @returns Promise that resolves to the parsed response data\n * \n * @example\n * ```typescript\n * // GET request\n * const user = await client.request('GET', '/2/users/by/username/username', {\n * timeout: 5000\n * });\n * \n * // POST request with body\n * const result = await client.request('POST', '/2/tweets', {\n * body: JSON.stringify({ text: 'Hello World!' })\n * });\n * ```\n * \n * @throws {ApiError} When the API returns an error response\n */\n async request(\n method: string,\n path: string,\n options: RequestOptions = {}\n ): Promise {\n const url = `${this.baseUrl}${path}`;\n const headers = new Headers(this.headers);\n \n // Select the best authentication method based on endpoint requirements\n const selectedAuth = this.selectAuthMethod(method, options.security);\n \n // Add authentication headers based on selected method\n if (selectedAuth === 'bearer_token' && this.bearerToken) {\n headers.set('Authorization', `Bearer ${this.bearerToken}`);\n } else if (selectedAuth === 'oauth2_user_context' && this.accessToken) {\n headers.set('Authorization', `Bearer ${this.accessToken}`);\n } else if (selectedAuth === 'oauth1' && this.oauth1 && this.oauth1.accessToken) {\n // OAuth1 authentication - build proper OAuth1 header\n try {\n const oauthHeader = await this.oauth1.buildRequestHeader(method, url, options.body || '');\n headers.set('Authorization', oauthHeader);\n \n // Keep Content-Type header for JSON requests - X API requires it\n // Only remove Content-Type for form-encoded OAuth1 requests\n // JSON bodies are not included in OAuth1 signature (per OAuth1 spec)\n } catch (error) {\n throw new Error(`Failed to build OAuth1 header: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n } else if (!selectedAuth) {\n // No suitable auth method found - validate authentication\n const requiredSchemes = options.security \n ? options.security.flatMap(req => Object.keys(req))\n : [];\n if (requiredSchemes.length > 0) {\n this.validateAuthentication(requiredSchemes, path);\n }\n }\n \n // Add custom headers\n if (options.headers) {\n Object.entries(options.headers).forEach(([key, value]) => {\n headers.set(key, value);\n });\n }\n\n try {\n const response = await this.httpClient.request(url, {\n method,\n headers,\n signal: options.signal,\n body: options.body,\n timeout: options.timeout !== undefined ? options.timeout : this.timeout,\n });\n\n if (!response.ok) {\n let errorData: any;\n try {\n errorData = await response.json();\n } catch {\n errorData = await response.text();\n }\n \n throw new ApiError(\n errorData && errorData.message ? errorData.message : `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n response.headers,\n errorData\n );\n }\n\n // For streaming requests, return the raw Response object\n if (options.raw) {\n return response as any; // Return the actual Response object for streaming\n }\n\n let data: T;\n const contentType = response.headers.get('content-type');\n if (contentType && contentType.includes('application/json')) {\n data = await response.json();\n } else {\n data = await response.text() as T;\n }\n\n // Return parsed body for non-streaming requests\n return data;\n } catch (error) {\n if (error instanceof ApiError) {\n throw error;\n }\n throw new ApiError(\n error instanceof Error ? error.message : 'Request failed',\n 0,\n 'NETWORK_ERROR',\n new Headers(),\n error\n );\n }\n }\n\n /**\n * Check if the OAuth2 token is expired\n */\n isTokenExpired(): boolean {\n // TODO: Implement token expiration check\n return false;\n }\n\n /**\n * Refresh the OAuth2 token\n */\n async refreshToken(): Promise {\n // TODO: Implement token refresh\n }\n\n /**\n * Get the current authentication status\n */\n isAuthenticated(): boolean {\n return !!(this.bearerToken || this.accessToken || (this.oauth1 && this.oauth1.accessToken));\n }\n\n /**\n * Map OpenAPI security scheme names to internal authentication types\n * @param securitySchemeName The security scheme name from OpenAPI\n * @returns Array of internal authentication types\n */\n public mapSecuritySchemeToAuthTypes(securitySchemeName: string): string[] {\n // Mappings for X/Twitter API security schemes\n const schemeMapping: Record = {\n 'BearerToken': ['bearer_token'], // App-only OAuth2.0\n 'OAuth2UserToken': ['oauth2_user_context'], // OAuth2.0 User Context\n 'UserToken': ['oauth1'], // OAuth1.0a User Context\n // Fallback mappings for common variations\n 'OAuth2': ['bearer_token', 'oauth2_user_context'],\n 'OAuth1': ['oauth1'],\n 'Bearer': ['bearer_token'],\n 'OAuth2User': ['oauth2_user_context'],\n 'OAuth1User': ['oauth1'],\n };\n\n return schemeMapping[securitySchemeName] || [securitySchemeName.toLowerCase()];\n }\n\n /**\n * Select the best authentication method based on endpoint requirements and available credentials\n * \n * Priority strategy:\n * 1. If endpoint only accepts one method, use that (if available)\n * 2. If endpoint accepts multiple methods:\n * - For write operations (POST/PUT/DELETE): Prefer OAuth1 > OAuth2 User Token > Bearer Token\n * - For read operations (GET): Prefer Bearer Token > OAuth2 User Token > OAuth1\n * - This allows Bearer Token for read-only operations while using user context for writes\n * \n * @param method HTTP method (GET, POST, etc.)\n * @param securityRequirements Security requirements from OpenAPI spec (array of security requirement objects)\n * @returns Selected auth method: 'bearer_token', 'oauth2_user_context', 'oauth1', or null if none available\n */\n private selectAuthMethod(method: string, securityRequirements?: Array>): 'bearer_token' | 'oauth2_user_context' | 'oauth1' | null {\n // If no security requirements, use default priority\n if (!securityRequirements || securityRequirements.length === 0) {\n if (this.bearerToken) return 'bearer_token';\n if (this.accessToken) return 'oauth2_user_context';\n if (this.oauth1 && this.oauth1.accessToken) return 'oauth1';\n return null;\n }\n\n // Extract all acceptable security schemes from requirements\n // Security requirements are OR'd together (any one can be used)\n const acceptableSchemes = new Set();\n for (const requirement of securityRequirements) {\n for (const schemeName of Object.keys(requirement)) {\n acceptableSchemes.add(schemeName);\n }\n }\n\n // Check what auth methods we have available\n const availableAuth: Record = {\n 'BearerToken': !!this.bearerToken,\n 'OAuth2UserToken': !!this.accessToken,\n 'UserToken': !!(this.oauth1 && this.oauth1.accessToken),\n };\n\n // If only one scheme is acceptable, use it if available\n if (acceptableSchemes.size === 1) {\n const scheme = Array.from(acceptableSchemes)[0];\n if (availableAuth[scheme]) {\n return this.mapSecuritySchemeToAuthTypes(scheme)[0] as 'bearer_token' | 'oauth2_user_context' | 'oauth1';\n }\n return null;\n }\n\n // Multiple schemes acceptable - use priority based on operation type\n const isWriteOperation = ['POST', 'PUT', 'DELETE', 'PATCH'].includes(method.toUpperCase());\n \n // Priority order for write operations: OAuth1 > OAuth2 User Token > Bearer Token\n // (User context is required for most write operations)\n if (isWriteOperation) {\n if (acceptableSchemes.has('UserToken') && availableAuth['UserToken']) {\n return 'oauth1';\n }\n if (acceptableSchemes.has('OAuth2UserToken') && availableAuth['OAuth2UserToken']) {\n return 'oauth2_user_context';\n }\n if (acceptableSchemes.has('BearerToken') && availableAuth['BearerToken']) {\n return 'bearer_token';\n }\n } else {\n // Priority order for read operations: Bearer Token > OAuth2 User Token > OAuth1\n // (Bearer Token is simpler for read-only operations)\n if (acceptableSchemes.has('BearerToken') && availableAuth['BearerToken']) {\n return 'bearer_token';\n }\n if (acceptableSchemes.has('OAuth2UserToken') && availableAuth['OAuth2UserToken']) {\n return 'oauth2_user_context';\n }\n if (acceptableSchemes.has('UserToken') && availableAuth['UserToken']) {\n return 'oauth1';\n }\n }\n\n return null;\n }\n\n /**\n * Validate that the required authentication method is available\n * @param requiredAuthTypes Array of required authentication types (OpenAPI security scheme names)\n * @param operationName Name of the operation for error messages\n */\n public validateAuthentication(requiredAuthTypes: string[], operationName: string): void {\n if (requiredAuthTypes.length === 0) {\n return; // No authentication required\n }\n\n const availableAuthTypes: string[] = [];\n \n if (this.bearerToken) {\n availableAuthTypes.push('bearer_token');\n }\n if (this.accessToken) {\n availableAuthTypes.push('oauth2_user_context');\n }\n if (this.oauth1 && this.oauth1.accessToken) {\n availableAuthTypes.push('oauth1');\n }\n\n // Map OpenAPI security schemes to internal auth types\n const mappedRequiredTypes = requiredAuthTypes.flatMap(scheme => \n this.mapSecuritySchemeToAuthTypes(scheme)\n );\n\n // Check if any of the required auth types are available\n const hasRequiredAuth = mappedRequiredTypes.some(required => \n availableAuthTypes.includes(required)\n );\n\n if (!hasRequiredAuth) {\n const availableStr = availableAuthTypes.length > 0 ? availableAuthTypes.join(', ') : 'none';\n const requiredStr = requiredAuthTypes.join(', ');\n throw new Error(\n `Authentication required for ${operationName}. ` +\n `Required: ${requiredStr}. ` +\n `Available: ${availableStr}. ` +\n `Please configure the appropriate authentication method.`\n );\n }\n }\n\n /**\n * Get available authentication types\n */\n getAvailableAuthTypes(): string[] {\n const authTypes: string[] = [];\n if (this.bearerToken) authTypes.push('bearer_token');\n if (this.accessToken) authTypes.push('oauth2_user_context');\n if (this.oauth1 && this.oauth1.accessToken) authTypes.push('oauth1');\n return authTypes;\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Environment-agnostic cryptographic utilities for the X API SDK.\n * Provides HMAC-SHA1 implementation that works in both Node.js and browser environments.\n */\n\n/**\n * HMAC-SHA1 implementation that works in both Node.js and browser environments\n */\nexport class CryptoUtils {\n /**\n * Generate HMAC-SHA1 signature\n * @param key Signing key\n * @param message Message to sign\n * @returns Base64 encoded signature\n */\n static async hmacSha1(key: string, message: string): Promise {\n // Try to use native Node.js crypto first\n if (\n typeof process !== 'undefined' &&\n process.versions &&\n process.versions.node\n ) {\n try {\n return await this._nodeHmacSha1(key, message);\n } catch (error) {\n // Fall back to Web Crypto API or polyfill\n console.warn('Node.js crypto failed, falling back:', error);\n }\n }\n\n // Try Web Crypto API (modern browsers)\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n try {\n return await this._webCryptoHmacSha1(key, message);\n } catch (error) {\n // Fall back to polyfill\n console.warn('Web Crypto API failed, falling back:', error);\n }\n }\n\n // Fall back to polyfill implementation\n return this._polyfillHmacSha1(key, message);\n }\n\n /**\n * Node.js native HMAC-SHA1 implementation\n */\n private static async _nodeHmacSha1(\n key: string,\n message: string\n ): Promise {\n // Dynamic import for Node.js crypto module (ES module compatible)\n const crypto = await import('crypto');\n const hmac = crypto.createHmac('sha1', key);\n hmac.update(message);\n return hmac.digest('base64');\n }\n\n /**\n * Web Crypto API HMAC-SHA1 implementation\n */\n private static async _webCryptoHmacSha1(\n key: string,\n message: string\n ): Promise {\n // Convert string key to ArrayBuffer\n const keyBuffer = this._stringToArrayBuffer(key);\n const messageBuffer = this._stringToArrayBuffer(message);\n\n // Import the key\n const cryptoKey = await crypto.subtle.importKey(\n 'raw',\n keyBuffer,\n { name: 'HMAC', hash: 'SHA-1' },\n false,\n ['sign']\n );\n\n // Sign the message\n const signature = await crypto.subtle.sign(\n 'HMAC',\n cryptoKey,\n messageBuffer\n );\n\n // Convert to base64\n return this._arrayBufferToBase64(signature);\n }\n\n /**\n * Polyfill HMAC-SHA1 implementation using pure JavaScript\n * This is a fallback that works everywhere but is slower\n */\n private static _polyfillHmacSha1(key: string, message: string): string {\n // For now, throw an error to indicate that proper crypto is needed\n // This will help identify when the fallback is being used\n throw new Error(\n 'HMAC-SHA1 polyfill not implemented. Please ensure Node.js crypto or Web Crypto API is available.'\n );\n\n // In a real implementation, you would use a library like crypto-js:\n // import CryptoJS from 'crypto-js';\n // return CryptoJS.HmacSHA1(message, key).toString(CryptoJS.enc.Base64);\n }\n\n /**\n * Convert string to ArrayBuffer\n */\n private static _stringToArrayBuffer(str: string): ArrayBuffer {\n const buffer = new ArrayBuffer(str.length);\n const view = new Uint8Array(buffer);\n for (let i = 0; i < str.length; i++) {\n view[i] = str.charCodeAt(i);\n }\n return buffer;\n }\n\n /**\n * Convert ArrayBuffer to base64 string\n */\n private static _arrayBufferToBase64(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n /**\n * Generate a random nonce for OAuth\n * @param length Length of the nonce\n * @returns Random nonce string\n */\n static generateNonce(length: number = 32): string {\n if (typeof crypto !== 'undefined' && crypto.getRandomValues) {\n // Use crypto.getRandomValues if available\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join(\n ''\n );\n } else {\n // Fallback to Math.random (less secure but functional)\n let result = '';\n const characters =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n for (let i = 0; i < length; i++) {\n result += characters.charAt(\n Math.floor(Math.random() * characters.length)\n );\n }\n return result;\n }\n }\n\n /**\n * Generate timestamp for OAuth\n * @returns Unix timestamp as string\n */\n static generateTimestamp(): string {\n return Math.floor(Date.now() / 1000).toString();\n }\n\n /**\n * Generate a cryptographically secure random string for PKCE code verifier\n * @param length Length of the code verifier (43-128 characters recommended)\n * @returns Random code verifier string\n */\n static generateCodeVerifier(length: number = 128): string {\n if (typeof crypto !== 'undefined' && crypto.getRandomValues) {\n // Use crypto.getRandomValues if available\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n // Convert to base64url encoding (RFC 7636)\n return this._base64UrlEncode(array);\n } else {\n // Fallback to Math.random (less secure but functional)\n const characters =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';\n let result = '';\n for (let i = 0; i < length; i++) {\n result += characters.charAt(\n Math.floor(Math.random() * characters.length)\n );\n }\n return result;\n }\n }\n\n /**\n * Generate PKCE code challenge from code verifier\n * @param codeVerifier The code verifier string\n * @returns Base64url encoded SHA256 hash of the code verifier\n */\n static async generateCodeChallenge(codeVerifier: string): Promise {\n // Try to use native Node.js crypto first\n if (\n typeof process !== 'undefined' &&\n process.versions &&\n process.versions.node\n ) {\n try {\n return await this._nodeSha256(codeVerifier);\n } catch (error) {\n console.warn('Node.js crypto failed for SHA256, falling back:', error);\n }\n }\n\n // Try Web Crypto API (modern browsers)\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n try {\n return await this._webCryptoSha256(codeVerifier);\n } catch (error) {\n console.warn('Web Crypto API failed for SHA256, falling back:', error);\n }\n }\n\n // Fall back to polyfill implementation\n return this._polyfillSha256(codeVerifier);\n }\n\n /**\n * Node.js native SHA256 implementation for PKCE\n */\n private static async _nodeSha256(message: string): Promise {\n const crypto = await import('crypto');\n const hash = crypto.createHash('sha256');\n hash.update(message);\n const digest = hash.digest();\n return this._base64UrlEncode(digest);\n }\n\n /**\n * Web Crypto API SHA256 implementation for PKCE\n */\n private static async _webCryptoSha256(message: string): Promise {\n const messageBuffer = this._stringToArrayBuffer(message);\n const hashBuffer = await crypto.subtle.digest('SHA-256', messageBuffer);\n return this._base64UrlEncode(hashBuffer);\n }\n\n /**\n * Polyfill SHA256 implementation for PKCE\n * This is a fallback that works everywhere but is slower\n */\n private static _polyfillSha256(message: string): string {\n // For now, throw an error to indicate that proper crypto is needed\n throw new Error(\n 'SHA256 polyfill not implemented. Please ensure Node.js crypto or Web Crypto API is available.'\n );\n\n // In a real implementation, you would use a library like crypto-js:\n // import CryptoJS from 'crypto-js';\n // return CryptoJS.SHA256(message).toString(CryptoJS.enc.Base64url);\n }\n\n /**\n * Convert ArrayBuffer or Uint8Array to base64url encoding (RFC 7636)\n */\n private static _base64UrlEncode(buffer: ArrayBuffer | Uint8Array): string {\n const bytes =\n buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n // Convert to base64url: replace + with -, / with _, and remove padding =\n return btoa(binary)\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '');\n }\n}\n\n/**\n * Convenience function for HMAC-SHA1\n * @param key Signing key\n * @param message Message to sign\n * @returns Promise that resolves to base64 encoded signature\n */\nexport async function hmacSha1(key: string, message: string): Promise {\n return CryptoUtils.hmacSha1(key, message);\n}\n\n/**\n * Convenience function for generating nonce\n * @param length Length of the nonce\n * @returns Random nonce string\n */\nexport function generateNonce(length: number = 32): string {\n return CryptoUtils.generateNonce(length);\n}\n\n/**\n * Convenience function for generating timestamp\n * @returns Unix timestamp as string\n */\nexport function generateTimestamp(): string {\n return CryptoUtils.generateTimestamp();\n}\n\n/**\n * Convenience function for generating PKCE code verifier\n * @param length Length of the code verifier\n * @returns Random code verifier string\n */\nexport function generateCodeVerifier(length: number = 128): string {\n return CryptoUtils.generateCodeVerifier(length);\n}\n\n/**\n * Convenience function for generating PKCE code challenge\n * @param codeVerifier The code verifier string\n * @returns Promise that resolves to base64url encoded SHA256 hash\n */\nexport async function generateCodeChallenge(\n codeVerifier: string\n): Promise {\n return CryptoUtils.generateCodeChallenge(codeVerifier);\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OAuth2 authentication utilities for the X API.\n */\n\nimport { CryptoUtils, generateCodeVerifier, generateCodeChallenge } from './crypto_utils.js';\n\n/**\n * OAuth2 configuration options\n */\nexport interface OAuth2Config {\n /** Client ID */\n clientId: string;\n /** Client secret (optional for public clients) */\n clientSecret?: string;\n /** Redirect URI */\n redirectUri: string;\n /** Scopes to request */\n scope?: string[];\n}\n\n/**\n * OAuth2 token response\n */\nexport interface OAuth2Token {\n /** Access token */\n access_token: string;\n /** Token type */\n token_type: string;\n /** Expiration time in seconds */\n expires_in: number;\n /** Refresh token */\n refresh_token?: string;\n /** Scopes granted */\n scope?: string;\n}\n\n/**\n * OAuth2 authentication handler\n */\nexport class OAuth2 {\n private config: OAuth2Config;\n private token?: OAuth2Token;\n private codeVerifier?: string;\n private codeChallenge?: string;\n\n constructor(config: OAuth2Config) {\n this.config = {\n scope: ['tweet.read', 'users.read'],\n ...config\n };\n }\n\n /**\n * Get the authorization URL\n * @param state Optional state parameter for security\n * @returns Authorization URL\n */\n async getAuthorizationUrl(state?: string): Promise {\n const params = new URLSearchParams({\n response_type: 'code',\n client_id: this.config.clientId,\n redirect_uri: this.config.redirectUri,\n scope: this.config.scope?.join(' ') || '',\n state: state || ''\n });\n\n // PKCE parameters are handled separately - not generated automatically\n\n return `https://x.com/i/oauth2/authorize?${params.toString()}`;\n }\n\n /**\n * Exchange authorization code for tokens\n * @param code Authorization code from callback\n * @param codeVerifier Optional code verifier for PKCE\n * @returns Promise with OAuth2 token\n */\n async exchangeCode(code: string, codeVerifier?: string): Promise {\n const params = new URLSearchParams({\n grant_type: 'authorization_code',\n code,\n redirect_uri: this.config.redirectUri\n });\n\n // Add PKCE code verifier if provided\n if (codeVerifier) {\n params.append('code_verifier', codeVerifier);\n }\n\n // Prepare headers\n const headers: Record = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n };\n\n // Add Basic Auth header if client secret is provided (optional but recommended)\n if (this.config.clientSecret) {\n const credentials = this._base64Encode(`${this.config.clientId}:${this.config.clientSecret}`);\n headers['Authorization'] = `Basic ${credentials}`;\n } else {\n // Only add client_id to body if no client_secret (public client)\n params.append('client_id', this.config.clientId);\n }\n \n const response = await fetch('https://api.x.com/2/oauth2/token', {\n method: 'POST',\n headers,\n body: params.toString()\n });\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => response.text());\n throw new Error(`HTTP error! status: ${response.status}, body: ${JSON.stringify(errorData)}`);\n }\n\n const data = await response.json();\n this.token = {\n access_token: data.access_token,\n token_type: data.token_type,\n expires_in: data.expires_in,\n refresh_token: data.refresh_token,\n scope: data.scope\n };\n\n return this.token;\n }\n\n /**\n * Get the current token\n * @returns Current OAuth2 token if available\n */\n getToken(): OAuth2Token | undefined {\n return this.token;\n }\n\n /**\n * Get the current code verifier (for PKCE)\n * @returns Current code verifier if available\n */\n getCodeVerifier(): string | undefined {\n return this.codeVerifier;\n }\n\n\n /**\n * Manually set PKCE parameters\n * @param codeVerifier The code verifier to use\n * @param codeChallenge Optional code challenge (will be generated if not provided)\n */\n async setPkceParameters(codeVerifier: string, codeChallenge?: string): Promise {\n this.codeVerifier = codeVerifier;\n if (codeChallenge) {\n this.codeChallenge = codeChallenge;\n } else {\n this.codeChallenge = await generateCodeChallenge(codeVerifier);\n }\n }\n\n /**\n * Get the current code challenge (for PKCE)\n * @returns Current code challenge if available\n */\n getCodeChallenge(): string | undefined {\n return this.codeChallenge;\n }\n\n /**\n * Base64 encode a string (with fallback for environments without btoa)\n * @param str String to encode\n * @returns Base64 encoded string\n */\n private _base64Encode(str: string): string {\n if (typeof btoa !== 'undefined') {\n return btoa(str);\n } else if (typeof Buffer !== 'undefined') {\n // Node.js fallback\n return Buffer.from(str, 'utf8').toString('base64');\n } else {\n // Manual base64 encoding fallback\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n let result = '';\n let i = 0;\n while (i < str.length) {\n const a = str.charCodeAt(i++);\n const b = i < str.length ? str.charCodeAt(i++) : 0;\n const c = i < str.length ? str.charCodeAt(i++) : 0;\n const bitmap = (a << 16) | (b << 8) | c;\n result += chars.charAt((bitmap >> 18) & 63);\n result += chars.charAt((bitmap >> 12) & 63);\n result += i - 2 < str.length ? chars.charAt((bitmap >> 6) & 63) : '=';\n result += i - 1 < str.length ? chars.charAt(bitmap & 63) : '=';\n }\n return result;\n }\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OAuth1 authentication utilities for the X API.\n */\n\nimport { CryptoUtils, generateNonce, generateTimestamp } from './crypto_utils.js';\n\n/**\n * OAuth1 configuration options\n */\nexport interface OAuth1Config {\n /** API Key (Consumer Key) */\n apiKey: string;\n /** API Secret (Consumer Secret) */\n apiSecret: string;\n /** Callback URL for OAuth flow */\n callback: string;\n /** Access Token (if already obtained) */\n accessToken?: string;\n /** Access Token Secret (if already obtained) */\n accessTokenSecret?: string;\n}\n\n/**\n * OAuth1 request token response\n */\nexport interface OAuth1RequestToken {\n /** OAuth token */\n oauthToken: string;\n /** OAuth token secret */\n oauthTokenSecret: string;\n}\n\n/**\n * OAuth1 access token response\n */\nexport interface OAuth1AccessToken {\n /** Access token */\n accessToken: string;\n /** Access token secret */\n accessTokenSecret: string;\n}\n\n/**\n * OAuth1 authentication handler\n */\nexport class OAuth1 {\n private config: OAuth1Config;\n public requestToken?: OAuth1RequestToken;\n public accessToken?: OAuth1AccessToken;\n\n constructor(config: OAuth1Config) {\n this.config = config;\n \n // If access token is provided, set it\n if (config.accessToken && config.accessTokenSecret) {\n this.accessToken = {\n accessToken: config.accessToken,\n accessTokenSecret: config.accessTokenSecret\n };\n }\n }\n\n /**\n * Get the authorization URL for OAuth1 flow\n * @param loginWithX Whether to use \"Log in with X\" flow\n * @returns Authorization URL\n */\n getAuthorizationUrl(loginWithX: boolean = false): string {\n if (!this.requestToken) {\n throw new Error('Request token not obtained. Call getRequestToken() first.');\n }\n\n const baseUrl = loginWithX \n ? 'https://x.com/i/oauth/authenticate'\n : 'https://x.com/oauth/authorize';\n\n const params = new URLSearchParams({\n oauth_token: this.requestToken.oauthToken\n });\n\n return `${baseUrl}?${params.toString()}`;\n }\n\n /**\n * Get request token to start OAuth1 flow\n * @returns Promise with request token\n */\n async getRequestToken(): Promise {\n const url = 'https://api.x.com/oauth/request_token';\n \n const params = new URLSearchParams({\n oauth_callback: this.config.callback\n });\n\n const response = await fetch(`${url}?${params.toString()}`, {\n method: 'POST',\n headers: {\n 'Authorization': await this._buildOAuthHeader('POST', url, params.toString())\n }\n });\n\n if (!response.ok) {\n throw new Error(`Failed to get request token: ${response.status} ${response.statusText}`);\n }\n\n const responseText = await response.text();\n const responseParams = new URLSearchParams(responseText);\n \n this.requestToken = {\n oauthToken: responseParams.get('oauth_token')!,\n oauthTokenSecret: responseParams.get('oauth_token_secret')!\n };\n\n return this.requestToken;\n }\n\n /**\n * Exchange verifier for access token\n * @param verifier OAuth verifier from callback or PIN\n * @returns Promise with access token\n */\n async getAccessToken(verifier: string): Promise {\n if (!this.requestToken) {\n throw new Error('Request token not obtained. Call getRequestToken() first.');\n }\n\n const url = 'https://api.x.com/oauth/access_token';\n \n const params = new URLSearchParams({\n oauth_token: this.requestToken.oauthToken,\n oauth_verifier: verifier\n });\n\n const response = await fetch(`${url}?${params.toString()}`, {\n method: 'POST',\n headers: {\n 'Authorization': await this._buildOAuthHeader('POST', url, params.toString())\n }\n });\n\n if (!response.ok) {\n throw new Error(`Failed to get access token: ${response.status} ${response.statusText}`);\n }\n\n const responseText = await response.text();\n const responseParams = new URLSearchParams(responseText);\n \n this.accessToken = {\n accessToken: responseParams.get('oauth_token')!,\n accessTokenSecret: responseParams.get('oauth_token_secret')!\n };\n\n return this.accessToken;\n }\n\n /**\n * Build OAuth1 authorization header\n * @param method HTTP method\n * @param url Request URL\n * @param body Request body\n * @returns Promise that resolves to OAuth1 authorization header string\n */\n private async _buildOAuthHeader(method: string, url: string, body: string): Promise {\n const timestamp = generateTimestamp();\n const nonce = generateNonce();\n \n const oauthParams: Record = {\n oauth_consumer_key: this.config.apiKey,\n oauth_nonce: nonce,\n oauth_signature_method: 'HMAC-SHA1',\n oauth_timestamp: timestamp,\n oauth_version: '1.0'\n };\n\n // Add request token if available\n if (this.requestToken) {\n oauthParams['oauth_token'] = this.requestToken.oauthToken;\n }\n\n // Add access token if available\n if (this.accessToken) {\n oauthParams['oauth_token'] = this.accessToken.accessToken;\n }\n\n // Build signature base string\n const paramString = this._buildParamString(oauthParams, body);\n const signatureBase = `${method.toUpperCase()}&${this._encode(url)}&${this._encode(paramString)}`;\n \n // Generate signature\n const signingKey = `${this._encode(this.config.apiSecret)}&${this._encode(\n this.requestToken?.oauthTokenSecret || this.accessToken?.accessTokenSecret || ''\n )}`;\n \n const signature = await CryptoUtils.hmacSha1(signingKey, signatureBase);\n oauthParams['oauth_signature'] = signature;\n\n // Build authorization header\n const headerParams = Object.entries(oauthParams)\n .map(([key, value]) => `${key}=\"${this._encode(value)}\"`)\n .join(', ');\n\n return `OAuth ${headerParams}`;\n }\n\n /**\n * Build parameter string for OAuth signature\n * @param oauthParams OAuth parameters\n * @param body Request body\n * @returns Parameter string\n */\n private _buildParamString(oauthParams: Record, body: string): string {\n const allParams = { ...oauthParams };\n \n // Parse body parameters if present and it's form-encoded (not JSON)\n // According to OAuth1 spec, JSON bodies should NOT be included in the signature\n if (body) {\n // Check if body is JSON by attempting to parse it\n let isJson = false;\n try {\n JSON.parse(body);\n isJson = true;\n } catch {\n // Not valid JSON, treat as form-encoded\n isJson = false;\n }\n \n if (!isJson) {\n // Only parse form-encoded bodies\n try {\n const bodyParams = new URLSearchParams(body);\n bodyParams.forEach((value, key) => {\n allParams[key] = value;\n });\n } catch (error) {\n // If body parsing fails, ignore it\n console.warn('Failed to parse body parameters:', error);\n }\n }\n // If body is JSON, we don't include it in the signature (per OAuth1 spec)\n }\n\n // Sort parameters alphabetically\n const sortedParams = Object.entries(allParams).sort(([a], [b]) => a.localeCompare(b));\n \n return sortedParams\n .map(([key, value]) => `${this._encode(key)}=${this._encode(value)}`)\n .join('&');\n }\n\n /**\n * URL encode string according to OAuth1 specification\n * @param str String to encode\n * @returns Encoded string\n */\n private _encode(str: string): string {\n return encodeURIComponent(str)\n .replace(/!/g, '%21')\n .replace(/\\*/g, '%2A')\n .replace(/'/g, '%27')\n .replace(/\\(/g, '%28')\n .replace(/\\)/g, '%29')\n .replace(/%7E/g, '~');\n }\n\n /**\n * Convenience method to start the OAuth1 flow\n * @param loginWithX Whether to use \"Log in with X\" flow\n * @returns Promise that resolves to the authorization URL\n */\n async startOAuthFlow(loginWithX: boolean = false): Promise {\n await this.getRequestToken();\n return this.getAuthorizationUrl(loginWithX);\n }\n\n /**\n * Build OAuth1 authorization header for API requests\n * @param method HTTP method\n * @param url Request URL\n * @param body Request body\n * @returns Promise that resolves to OAuth1 authorization header string\n */\n async buildRequestHeader(method: string, url: string, body: string = ''): Promise {\n if (!this.accessToken) {\n throw new Error('Access token not available. Complete OAuth1 flow first.');\n }\n\n // Extract query parameters from URL if present\n let urlWithoutQuery = url;\n let queryParams = '';\n \n try {\n const urlObj = new URL(url);\n if (urlObj.search) {\n queryParams = urlObj.search.substring(1); // Remove the '?' prefix\n urlWithoutQuery = urlObj.origin + urlObj.pathname;\n }\n } catch (error) {\n // If URL parsing fails, use the original URL\n console.warn('Failed to parse URL for OAuth1:', error);\n }\n\n // Combine query parameters with body parameters\n let allParams = '';\n if (queryParams && body) {\n allParams = `${queryParams}&${body}`;\n } else if (queryParams) {\n allParams = queryParams;\n } else if (body) {\n allParams = body;\n }\n\n return this._buildOAuthHeader(method, urlWithoutQuery, allParams);\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OpenAPI Schema Types\n * Auto-generated from OpenAPI components/schemas\n *\n * @internal\n */\n\n/**\nThe unique identifier of an Activity event.\n *\n * @public\n */\nexport type ActivityEventId = string; /**\nAn activity event or error that can be returned by the x activity streaming API.\n *\n * @public\n */\nexport interface ActivityStreamingResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for ActivityStreamingResponsePayload\n *\n * @public\n */\nexport type ActivityStreamingResponsePayload = any; /**\nAn XActivity subscription.\n *\n * @public\n */\nexport interface ActivitySubscription {\n /** none */ createdAt: string;\n /** none */ eventType: string;\n filter: ActivitySubscriptionFilter;\n subscriptionId: ActivitySubscriptionId;\n /** none */ tag?: string;\n /** none */ updatedAt: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionCreateRequest\n *\n * @public\n */\nexport interface ActivitySubscriptionCreateRequest {\n /** none */ eventType:\n | 'ProfileBioUpdate'\n | 'ProfilePictureUpdate'\n | 'ProfileBannerPictureUpdate'\n | 'ProfileScreennameUpdate'\n | 'ProfileGeoUpdate'\n | 'ProfileUrlUpdate'\n | 'ProfileVerifiedBadgeUpdate'\n | 'TrendsNew';\n filter: ActivitySubscriptionFilter;\n /** none */ tag?: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionCreateResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for ActivitySubscriptionDeleteResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nAn XAA subscription.\n *\n * @public\n */\nexport interface ActivitySubscriptionFilter {\n keyword?: Keyword;\n userId?: UserId;\n} /**\nSchema type for ActivitySubscriptionGetResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionGetResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nThe unique identifier of this subscription.\n *\n * @public\n */\nexport type ActivitySubscriptionId = string; /**\nSchema type for ActivitySubscriptionUpdateRequest\n *\n * @public\n */\nexport interface ActivitySubscriptionUpdateRequest {\n /** none */ tag?: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionUpdateResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionUpdateResponse {\n /** none */ data?: Record;\n}\n/**\nSchema type for AddOrDeleteRulesRequest\n *\n * @public\n */\nexport type AddOrDeleteRulesRequest = any; /**\nA response from modifying user-specified stream filtering rules.\n *\n * @public\n */\nexport interface AddOrDeleteRulesResponse {\n /** All user-specified stream filtering rules that were created. */ data?: Array<\n Rule\n >;\n /** none */ errors?: Array;\n meta: RulesResponseMetadata;\n} /**\nA request to add a user-specified stream filtering rule.\n *\n * @public\n */\nexport interface AddRulesRequest {\n /** none */ add: Array;\n} /**\nThe sum of results returned in this response.\n *\n * @public\n */\nexport type Aggregate = number; /**\nUnique identifier of ai trend.\n *\n * @public\n */\nexport type AiTrendId = string; /**\nSchema type for AllowDownloadStatus\n *\n * @public\n */\nexport interface AllowDownloadStatus {\n /** none */ allowDownload?: boolean;\n} /**\nClient App Rule Counts for all applications in the project\n *\n * @public\n */\nexport type AllProjectClientApps = Array<\n AppRulesCount\n>; /**\nSchema type for AltText\n *\n * @public\n */\nexport interface AltText {\n /** Description of media ( <= 1000 characters ) */ text: string;\n} /**\nSchema type for Analytics\n *\n * @public\n */\nexport interface Analytics {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n}\n/**\nSchema type for AnimatedGif\n *\n * @public\n */\nexport type AnimatedGif = any; /**\nA count of user-provided stream filtering rules at the client application level.\n *\n * @public\n */\nexport interface AppRulesCount {\n clientAppId?: ClientAppId;\n /** Number of rules for client application */ ruleCount?: number;\n} /**\nSchema type for AudiencePolicy\n *\n * @public\n */\nexport interface AudiencePolicy {\n /** none */ creatorSubscriptions?: Array<'Any'>;\n /** none */ xSubscriptions?: Array<'Any'>;\n} /**\nSchema type for BookmarkAddRequest\n *\n * @public\n */\nexport interface BookmarkAddRequest {\n tweetId: TweetId;\n} /**\nThe unique identifier of this Bookmark folder.\n *\n * @public\n */\nexport type BookmarkFolderId = string; /**\nSchema type for BookmarkFolderPostsResponse\n *\n * @public\n */\nexport interface BookmarkFolderPostsResponse {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for BookmarkFoldersResponse\n *\n * @public\n */\nexport interface BookmarkFoldersResponse {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for BookmarkMutationResponse\n *\n * @public\n */\nexport interface BookmarkMutationResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for CashtagEntity\n *\n * @public\n */\nexport type CashtagEntity = any; /**\nRepresent the portion of text recognized as a Cashtag, and its start and end position within the text.\n *\n * @public\n */\nexport interface CashtagFields {\n /** none */ tag: string;\n} /**\nThe ID of the client application\n *\n * @public\n */\nexport type ClientAppId = string; /**\nUsage per client app\n *\n * @public\n */\nexport interface ClientAppUsage {\n /** The unique identifier for this project */ clientAppId?: string;\n /** The usage value */ usage?: Array;\n /** The number of results returned */ usageResultCount?: number;\n}\n/**\nYour client has gone away.\n *\n * @public\n */\nexport type ClientDisconnectedProblem = any;\n/**\nA problem that indicates your client is forbidden from making this request.\n *\n * @public\n */\nexport type ClientForbiddenProblem = any; /**\nA X Community is a curated group of Posts.\n *\n * @public\n */\nexport interface Community {\n /** none */ createdAt?: string;\n id: CommunityId;\n /** The name of this Community. */ name: string;\n} /**\nThe unique identifier of this Community.\n *\n * @public\n */\nexport type CommunityId = string; /**\nSchema type for ComplianceJob\n *\n * @public\n */\nexport interface ComplianceJob {\n createdAt: CreatedAt;\n downloadExpiresAt: DownloadExpiration;\n downloadUrl: DownloadUrl;\n id: JobId;\n name?: ComplianceJobName;\n status: ComplianceJobStatus;\n type: ComplianceJobType;\n uploadExpiresAt: UploadExpiration;\n uploadUrl: UploadUrl;\n} /**\nUser-provided name for a compliance job.\n *\n * @public\n */\nexport type ComplianceJobName = string; /**\nStatus of a compliance job.\n *\n * @public\n */\nexport type ComplianceJobStatus =\n | 'created'\n | 'in_progress'\n | 'failed'\n | 'complete'\n | 'expired'; /**\nType of compliance job to list.\n *\n * @public\n */\nexport type ComplianceJobType = 'tweets' | 'users';\n/**\nYou cannot create a new job if one is already in progress.\n *\n * @public\n */\nexport type ConflictProblem = any;\n/**\nA problem that indicates something is wrong with the connection.\n *\n * @public\n */\nexport type ConnectionExceptionProblem = any; /**\nSchema type for ContentExpiration\n *\n * @public\n */\nexport interface ContentExpiration {\n /** Expiration time for content as a Unix timestamp in seconds */ timestampSec: number;\n} /**\nAnnotation inferred from the Tweet text.\n *\n * @public\n */\nexport interface ContextAnnotation {\n domain: ContextAnnotationDomainFields;\n entity: ContextAnnotationEntityFields;\n} /**\nRepresents the data for the context annotation domain.\n *\n * @public\n */\nexport interface ContextAnnotationDomainFields {\n /** Description of the context annotation domain. */ description?: string;\n /** The unique id for a context annotation domain. */ id: string;\n /** Name of the context annotation domain. */ name?: string;\n} /**\nRepresents the data for the context annotation entity.\n *\n * @public\n */\nexport interface ContextAnnotationEntityFields {\n /** Description of the context annotation entity. */ description?: string;\n /** The unique id for a context annotation entity. */ id: string;\n /** Name of the context annotation entity. */ name?: string;\n} /**\nA two-letter ISO 3166-1 alpha-2 country code.\n *\n * @public\n */\nexport type CountryCode = string; /**\nSchema type for CreateAttachmentsMessageRequest\n *\n * @public\n */\nexport interface CreateAttachmentsMessageRequest {\n attachments: DmAttachments;\n /** Text of the message. */ text?: string;\n} /**\nA request to create a new batch compliance job.\n *\n * @public\n */\nexport interface CreateComplianceJobRequest {\n name?: ComplianceJobName;\n /** If true, this endpoint will return a pre-signed URL with resumable uploads enabled. */ resumable?: boolean;\n /** Type of compliance job to list. */ type: 'tweets' | 'users';\n} /**\nSchema type for CreateComplianceJobResponse\n *\n * @public\n */\nexport interface CreateComplianceJobResponse {\n data?: ComplianceJob;\n /** none */ errors?: Array;\n} /**\nCreation time of the compliance job.\n *\n * @public\n */\nexport type CreatedAt = string; /**\nSchema type for CreateDmConversationRequest\n *\n * @public\n */\nexport interface CreateDmConversationRequest {\n /** The conversation type that is being created. */ conversationType: 'Group';\n message: CreateMessageRequest;\n participantIds: DmParticipants;\n} /**\nSchema type for CreateDmEventResponse\n *\n * @public\n */\nexport interface CreateDmEventResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for CreateMessageRequest\n *\n * @public\n */\nexport type CreateMessageRequest = any; /**\nSchema type for CreateNoteRequest\n *\n * @public\n */\nexport interface CreateNoteRequest {\n info: NoteInfo;\n postId: TweetId;\n /** If true, the note being submitted is only for testing the capability of the bot, and won't be publicly visible. If false, the note being submitted will be a new proposed note on the product. */ testMode: boolean;\n} /**\nSchema type for CreateNoteResponse\n *\n * @public\n */\nexport interface CreateNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for CreateTextMessageRequest\n *\n * @public\n */\nexport interface CreateTextMessageRequest {\n attachments?: DmAttachments;\n /** Text of the message. */ text: string;\n} /**\nSchema type for DeleteDmResponse\n *\n * @public\n */\nexport interface DeleteDmResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for DeleteNoteResponse\n *\n * @public\n */\nexport interface DeleteNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nA response from deleting user-specified stream filtering rules.\n *\n * @public\n */\nexport interface DeleteRulesRequest {\n /** IDs and values of all deleted user-specified stream filtering rules. */ delete: Record<\n string,\n any\n >;\n}\n/**\nA problem that indicates that the resource requested violates the precepts of this API.\n *\n * @public\n */\nexport type DisallowedResourceProblem = any; /**\nRepresent a boundary range (start and end zero-based indices) for the portion of text that is displayed for a post. `start` must be smaller than `end`. The start index is inclusive, the end index is exclusive.\n *\n * @public\n */\nexport type DisplayTextRange = Array<\n number\n>; /**\nAttachments to a DM Event.\n *\n * @public\n */\nexport type DmAttachments = Array<\n DmMediaAttachment\n>; /**\nUnique identifier of a DM conversation. This can either be a numeric string, or a pair of numeric strings separated by a '-' character in the case of one-on-one DM Conversations.\n *\n * @public\n */\nexport type DmConversationId = string; /**\nSchema type for DmEvent\n *\n * @public\n */\nexport interface DmEvent {\n /** Specifies the type of attachments (if any) present in this DM. */ attachments?: Record<\n string,\n any\n >;\n /** none */ cashtags?: Array;\n /** none */ createdAt?: string;\n dmConversationId?: DmConversationId;\n /** none */ eventType: string;\n /** none */ hashtags?: Array;\n id: DmEventId;\n /** none */ mentions?: Array;\n /** A list of participants for a ParticipantsJoin or ParticipantsLeave event_type. */ participantIds?: Array<\n UserId\n >;\n /** A list of Posts this DM refers to. */ referencedTweets?: Array<\n Record\n >;\n senderId?: UserId;\n /** none */ text?: string;\n /** none */ urls?: Array;\n} /**\nUnique identifier of a DM Event.\n *\n * @public\n */\nexport type DmEventId = string; /**\nSchema type for DmMediaAttachment\n *\n * @public\n */\nexport interface DmMediaAttachment {\n mediaId: MediaId;\n} /**\nParticipants for the DM Conversation.\n *\n * @public\n */\nexport type DmParticipants = Array<\n UserId\n>; /**\nSchema type for DomainRestrictions\n *\n * @public\n */\nexport interface DomainRestrictions {\n /** List of whitelisted domains */ whitelist: Array;\n} /**\nExpiration time of the download URL.\n *\n * @public\n */\nexport type DownloadExpiration = string; /**\nURL from which the user will retrieve their compliance results.\n *\n * @public\n */\nexport type DownloadUrl = string;\n/**\nThe rule you have submitted is a duplicate.\n *\n * @public\n */\nexport type DuplicateRuleProblem = any; /**\nThe end time of the bucket.\n *\n * @public\n */\nexport type End = string; /**\nAn Engagement Api Response.\n *\n * @public\n */\nexport interface Engagement {\n /** none */ errors?: Array>;\n /** none */ measurement?: Record;\n} /**\nRepresent a boundary range (start and end index) for a recognized entity (for example a hashtag or a mention). `start` must be smaller than `end`. The start index is inclusive, the end index is exclusive.\n *\n * @public\n */\nexport interface EntityIndicesInclusiveExclusive {\n /** Index (zero-based) at which position this entity ends. The index is exclusive. */ end: number;\n /** Index (zero-based) at which position this entity starts. The index is inclusive. */ start: number;\n} /**\nRepresent a boundary range (start and end index) for a recognized entity (for example a hashtag or a mention). `start` must be smaller than `end`. The start index is inclusive, the end index is inclusive.\n *\n * @public\n */\nexport interface EntityIndicesInclusiveInclusive {\n /** Index (zero-based) at which position this entity ends. The index is inclusive. */ end: number;\n /** Index (zero-based) at which position this entity starts. The index is inclusive. */ start: number;\n} /**\nSchema type for Error\n *\n * @public\n */\nexport interface Error {\n /** none */ code: number;\n /** none */ message: string;\n} /**\nSchema type for EvaluateNoteRequest\n *\n * @public\n */\nexport interface EvaluateNoteRequest {\n /** Text for the community note. */ noteText: string;\n postId: TweetId;\n} /**\nSchema type for EvaluateNoteResponse\n *\n * @public\n */\nexport interface EvaluateNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for Expansions\n *\n * @public\n */\nexport interface Expansions {\n /** none */ media?: Array;\n /** none */ places?: Array;\n /** none */ polls?: Array;\n /** none */ topics?: Array;\n /** none */ tweets?: Array;\n /** none */ users?: Array;\n}\n/**\nA problem that indicates that you are not allowed to see a particular field on a Tweet, User, etc.\n *\n * @public\n */\nexport type FieldUnauthorizedProblem = any; /**\nA Tweet or error that can be returned by the streaming Tweet API. The values returned with a successful streamed Tweet includes the user provided rules that the Tweet matched.\n *\n * @public\n */\nexport interface FilteredStreamingTweetResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** The list of rules which matched the Tweet */ matchingRules?: Array<\n Record\n >;\n} /**\nSchema type for FoundMediaOrigin\n *\n * @public\n */\nexport interface FoundMediaOrigin {\n /** Unique Identifier of media within provider ( <= 24 characters )) */ id: string;\n /** The media provider (e.g., 'giphy') that sourced the media ( <= 8 Characters ) */ provider: string;\n} /**\nSchema type for FullTextEntities\n *\n * @public\n */\nexport interface FullTextEntities {\n /** none */ annotations?: Array;\n /** none */ cashtags?: Array;\n /** none */ hashtags?: Array;\n /** none */ mentions?: Array;\n /** none */ urls?: Array;\n}\n/**\nA generic problem with no additional information beyond that provided by the HTTP status code.\n *\n * @public\n */\nexport type GenericProblem = any; /**\nSchema type for Geo\n *\n * @public\n */\nexport interface Geo {\n /** none */ bbox: Array;\n geometry?: Point;\n /** none */ properties: Record;\n /** none */ type: 'Feature';\n}\n/**\nSchema type for GeoRestrictions\n *\n * @public\n */\nexport type GeoRestrictions = any; /**\nSchema type for Get2AiTrendsIdResponse\n *\n * @public\n */\nexport interface Get2AiTrendsIdResponse {\n data?: News;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2CommunitiesIdResponse\n *\n * @public\n */\nexport interface Get2CommunitiesIdResponse {\n data?: Community;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2CommunitiesSearchResponse\n *\n * @public\n */\nexport interface Get2CommunitiesSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ComplianceJobsIdResponse\n *\n * @public\n */\nexport interface Get2ComplianceJobsIdResponse {\n data?: ComplianceJob;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2ComplianceJobsResponse\n *\n * @public\n */\nexport interface Get2ComplianceJobsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmConversationsIdDmEventsResponse\n *\n * @public\n */\nexport interface Get2DmConversationsIdDmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmConversationsWithParticipantIdDmEventsResponse\n *\n * @public\n */\nexport interface Get2DmConversationsWithParticipantIdDmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmEventsEventIdResponse\n *\n * @public\n */\nexport interface Get2DmEventsEventIdResponse {\n data?: DmEvent;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2DmEventsResponse\n *\n * @public\n */\nexport interface Get2DmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2FdxAccountsAccountidContactResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidContactResponse {\n data?: PlaidAccountContact;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidPayment-networksResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidPayment_networksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidResponse {\n data?: PlaidAccount;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidTransactionsResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidTransactionsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxCustomersCurrentResponse\n *\n * @public\n */\nexport interface Get2FdxCustomersCurrentResponse {\n data?: PlaidCustomer;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2Insights28hrResponse\n *\n * @public\n */\nexport interface Get2Insights28hrResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2InsightsHistoricalResponse\n *\n * @public\n */\nexport interface Get2InsightsHistoricalResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2LikesFirehoseStreamResponse\n *\n * @public\n */\nexport interface Get2LikesFirehoseStreamResponse {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2LikesSample10StreamResponse\n *\n * @public\n */\nexport interface Get2LikesSample10StreamResponse {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2ListsIdFollowersResponse\n *\n * @public\n */\nexport interface Get2ListsIdFollowersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ListsIdMembersResponse\n *\n * @public\n */\nexport interface Get2ListsIdMembersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ListsIdResponse\n *\n * @public\n */\nexport interface Get2ListsIdResponse {\n data?: List;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2ListsIdTweetsResponse\n *\n * @public\n */\nexport interface Get2ListsIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2MediaAnalyticsResponse\n *\n * @public\n */\nexport interface Get2MediaAnalyticsResponse {\n data?: MediaAnalytics;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2MediaMediaKeyResponse\n *\n * @public\n */\nexport interface Get2MediaMediaKeyResponse {\n data?: Media;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2MediaResponse\n *\n * @public\n */\nexport interface Get2MediaResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2NewsIdResponse\n *\n * @public\n */\nexport interface Get2NewsIdResponse {\n data?: News;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2NotesSearchNotesWrittenResponse\n *\n * @public\n */\nexport interface Get2NotesSearchNotesWrittenResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2NotesSearchPostsEligibleForNotesResponse\n *\n * @public\n */\nexport interface Get2NotesSearchPostsEligibleForNotesResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesByCreatorIdsResponse\n *\n * @public\n */\nexport interface Get2SpacesByCreatorIdsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesIdBuyersResponse\n *\n * @public\n */\nexport interface Get2SpacesIdBuyersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesIdResponse\n *\n * @public\n */\nexport interface Get2SpacesIdResponse {\n data?: Space;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2SpacesIdTweetsResponse\n *\n * @public\n */\nexport interface Get2SpacesIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesResponse\n *\n * @public\n */\nexport interface Get2SpacesResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2SpacesSearchResponse\n *\n * @public\n */\nexport interface Get2SpacesSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TrendsByWoeidWoeidResponse\n *\n * @public\n */\nexport interface Get2TrendsByWoeidWoeidResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2TweetsAnalyticsResponse\n *\n * @public\n */\nexport interface Get2TweetsAnalyticsResponse {\n data?: Analytics;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2TweetsCountsAllResponse\n *\n * @public\n */\nexport interface Get2TweetsCountsAllResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsCountsRecentResponse\n *\n * @public\n */\nexport interface Get2TweetsCountsRecentResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangEnResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangEnResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangJaResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangJaResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangKoResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangKoResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangPtResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangPtResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsIdLikingUsersResponse\n *\n * @public\n */\nexport interface Get2TweetsIdLikingUsersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdQuoteTweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsIdQuoteTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdResponse\n *\n * @public\n */\nexport interface Get2TweetsIdResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsIdRetweetedByResponse\n *\n * @public\n */\nexport interface Get2TweetsIdRetweetedByResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdRetweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsIdRetweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSample10StreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSample10StreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSampleStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSampleStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSearchAllResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchAllResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsSearchRecentResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchRecentResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsSearchStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSearchStreamRulesCountsResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchStreamRulesCountsResponse {\n data?: RulesCount;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsageTweetsResponse\n *\n * @public\n */\nexport interface Get2UsageTweetsResponse {\n data?: Usage;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsersByResponse\n *\n * @public\n */\nexport interface Get2UsersByResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersByUsernameUsernameResponse\n *\n * @public\n */\nexport interface Get2UsersByUsernameUsernameResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersIdBlockingResponse\n *\n * @public\n */\nexport interface Get2UsersIdBlockingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdBookmarksResponse\n *\n * @public\n */\nexport interface Get2UsersIdBookmarksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowersResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowingResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdLikedTweetsResponse\n *\n * @public\n */\nexport interface Get2UsersIdLikedTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdListMembershipsResponse\n *\n * @public\n */\nexport interface Get2UsersIdListMembershipsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdMentionsResponse\n *\n * @public\n */\nexport interface Get2UsersIdMentionsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdMutingResponse\n *\n * @public\n */\nexport interface Get2UsersIdMutingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdOwnedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdOwnedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdPinnedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdPinnedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdResponse\n *\n * @public\n */\nexport interface Get2UsersIdResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersIdTimelinesReverseChronologicalResponse\n *\n * @public\n */\nexport interface Get2UsersIdTimelinesReverseChronologicalResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdTweetsResponse\n *\n * @public\n */\nexport interface Get2UsersIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersMeResponse\n *\n * @public\n */\nexport interface Get2UsersMeResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersPersonalizedTrendsResponse\n *\n * @public\n */\nexport interface Get2UsersPersonalizedTrendsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsersRepostsOfMeResponse\n *\n * @public\n */\nexport interface Get2UsersRepostsOfMeResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersResponse\n *\n * @public\n */\nexport interface Get2UsersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersSearchResponse\n *\n * @public\n */\nexport interface Get2UsersSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2WebhooksResponse\n *\n * @public\n */\nexport interface Get2WebhooksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n}\n/**\nSchema type for HashtagEntity\n *\n * @public\n */\nexport type HashtagEntity = any; /**\nRepresent the portion of text recognized as a Hashtag, and its start and end position within the text.\n *\n * @public\n */\nexport interface HashtagFields {\n /** The text of the Hashtag. */ tag: string;\n} /**\nHTTP Status Code.\n *\n * @public\n */\nexport type HttpStatusCode = number;\n/**\nA problem that indicates this request is invalid.\n *\n * @public\n */\nexport type InvalidRequestProblem = any;\n/**\nThe rule you have submitted is invalid.\n *\n * @public\n */\nexport type InvalidRuleProblem = any; /**\nCompliance Job ID.\n *\n * @public\n */\nexport type JobId = string; /**\nA keyword to filter on.\n *\n * @public\n */\nexport type Keyword = string; /**\nSchema type for KillAllConnectionsResponse\n *\n * @public\n */\nexport interface KillAllConnectionsResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for LikeComplianceSchema\n *\n * @public\n */\nexport interface LikeComplianceSchema {\n delete: UnlikeComplianceSchema;\n} /**\nThe unique identifier of this Like.\n *\n * @public\n */\nexport type LikeId = string;\n/**\nLikes compliance stream events.\n *\n * @public\n */\nexport type LikesComplianceStreamResponse = any; /**\nA Like event, with the tweet author user and the tweet being liked\n *\n * @public\n */\nexport interface LikeWithTweetAuthor {\n /** Creation time of the Tweet. */ createdAt?: string;\n id?: LikeId;\n likedTweetId?: TweetId;\n /** Timestamp in milliseconds of creation. */ timestampMs?: number;\n tweetAuthorId?: UserId;\n} /**\nA X List is a curated group of accounts.\n *\n * @public\n */\nexport interface List {\n /** none */ createdAt?: string;\n /** none */ description?: string;\n /** none */ followerCount?: number;\n id: ListId;\n /** none */ memberCount?: number;\n /** The name of this List. */ name: string;\n ownerId?: UserId;\n /** none */ private?: boolean;\n} /**\nSchema type for ListAddUserRequest\n *\n * @public\n */\nexport interface ListAddUserRequest {\n userId: UserId;\n} /**\nSchema type for ListCreateRequest\n *\n * @public\n */\nexport interface ListCreateRequest {\n /** none */ description?: string;\n /** none */ name: string;\n /** none */ private?: boolean;\n} /**\nSchema type for ListCreateResponse\n *\n * @public\n */\nexport interface ListCreateResponse {\n /** A X List is a curated group of accounts. */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListDeleteResponse\n *\n * @public\n */\nexport interface ListDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListFollowedRequest\n *\n * @public\n */\nexport interface ListFollowedRequest {\n listId: ListId;\n} /**\nSchema type for ListFollowedResponse\n *\n * @public\n */\nexport interface ListFollowedResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe unique identifier of this List.\n *\n * @public\n */\nexport type ListId = string; /**\nSchema type for ListMutateResponse\n *\n * @public\n */\nexport interface ListMutateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListPinnedRequest\n *\n * @public\n */\nexport interface ListPinnedRequest {\n listId: ListId;\n} /**\nSchema type for ListPinnedResponse\n *\n * @public\n */\nexport interface ListPinnedResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListUnpinResponse\n *\n * @public\n */\nexport interface ListUnpinResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListUpdateRequest\n *\n * @public\n */\nexport interface ListUpdateRequest {\n /** none */ description?: string;\n /** none */ name?: string;\n /** none */ private?: boolean;\n} /**\nSchema type for ListUpdateResponse\n *\n * @public\n */\nexport interface ListUpdateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ManagementInfo\n *\n * @public\n */\nexport interface ManagementInfo {\n /** Indicates if the media is managed by Media Studio */ managed: boolean;\n} /**\nSchema type for Media\n *\n * @public\n */\nexport interface Media {\n height?: MediaHeight;\n mediaKey?: MediaKey;\n /** none */ type: string;\n width?: MediaWidth;\n} /**\nSchema type for MediaAnalytics\n *\n * @public\n */\nexport interface MediaAnalytics {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n} /**\nA string enum value which identifies a media use-case. This identifier is used to enforce use-case specific constraints (e.g. file size, video duration) and enable advanced features.\n *\n * @public\n */\nexport type MediaCategory =\n | 'amplify_video'\n | 'tweet_gif'\n | 'tweet_image'\n | 'tweet_video'\n | 'dm_gif'\n | 'dm_image'\n | 'dm_video'\n | 'subtitles'; /**\nA string enum value which identifies a media use-case. This identifier is used to enforce use-case specific constraints (e.g. file size) and enable advanced features.\n *\n * @public\n */\nexport type MediaCategoryOneShot =\n | 'tweet_image'\n | 'dm_image'\n | 'subtitles'; /**\nThe media category of uploaded media to which subtitles should be added/deleted\n *\n * @public\n */\nexport type MediaCategorySubtitles =\n | 'AmplifyVideo'\n | 'TweetVideo'; /**\nThe height of the media in pixels.\n *\n * @public\n */\nexport type MediaHeight = number; /**\nThe unique identifier of this Media.\n *\n * @public\n */\nexport type MediaId = string; /**\nThe Media Key identifier for this attachment.\n *\n * @public\n */\nexport type MediaKey = string; /**\nSchema type for MediaMetrics\n *\n * @public\n */\nexport interface MediaMetrics {\n /** Tracks the number of clicks on a call-to-action URL */ ctaUrlClicks?: number;\n /** Tracks the number of clicks to watch a video or media content */ ctaWatchClicks?: number;\n /** Tracks the number of times a video or media is played from a user tap */ playFromTap?: number;\n /** Tracks the number of times a video reaches 25% of its duration */ playback25?: number;\n /** Tracks the number of times a video reaches 50% of its duration */ playback50?: number;\n /** Tracks the number of times a video reaches 75% of its duration */ playback75?: number;\n /** Tracks the number of times a video is played to completion */ playbackComplete?: number;\n /** Tracks the number of times a video playback is initiated */ playbackStart?: number;\n /** Tracks the number of times a video is viewed */ videoViews?: number;\n /** Tracks the total time spent watching a video, measured in milliseconds */ watchTimeMs?: number;\n} /**\nThe file to upload.\n *\n * @public\n */\nexport type MediaPayloadBinary = string; /**\nThe file to upload.\n *\n * @public\n */\nexport type MediaPayloadByte = string;\n/**\nSchema type for MediaSegments\n *\n * @public\n */\nexport type MediaSegments = any; /**\nSchema type for MediaTimestampedMetrics\n *\n * @public\n */\nexport interface MediaTimestampedMetrics {\n metrics?: MediaMetrics;\n /** ISO8601 Time */ timestamp?: string;\n}\n/**\nSchema type for MediaUploadAppendRequest\n *\n * @public\n */\nexport type MediaUploadAppendRequest = any; /**\nA response from getting a media upload request status.\n *\n * @public\n */\nexport interface MediaUploadAppendResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for MediaUploadConfigRequest\n *\n * @public\n */\nexport interface MediaUploadConfigRequest {\n /** none */ additionalOwners?: Array;\n mediaCategory?: MediaCategory;\n /** The type of media. */ mediaType?:\n | 'video/mp4'\n | 'video/webm'\n | 'video/mp2t'\n | 'video/quicktime'\n | 'text/srt'\n | 'text/vtt'\n | 'image/jpeg'\n | 'image/gif'\n | 'image/bmp'\n | 'image/png'\n | 'image/webp'\n | 'image/pjpeg'\n | 'image/tiff'\n | 'model/gltf-binary'\n | 'model/vnd.usdz+zip';\n /** Whether this media is shared or not. */ shared?: boolean;\n /** The total size of the media upload in bytes. */ totalBytes?: number;\n} /**\nSchema type for MediaUploadRequestOneShot\n *\n * @public\n */\nexport interface MediaUploadRequestOneShot {\n /** none */ additionalOwners?: Array;\n /** none */ media: any;\n mediaCategory: MediaCategoryOneShot;\n /** The type of image or subtitle. */ mediaType?:\n | 'text/srt'\n | 'text/vtt'\n | 'image/jpeg'\n | 'image/bmp'\n | 'image/png'\n | 'image/webp'\n | 'image/pjpeg'\n | 'image/tiff';\n /** Whether this media is shared or not. */ shared?: boolean;\n} /**\nA response from getting a media upload request status.\n *\n * @public\n */\nexport interface MediaUploadResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe width of the media in pixels.\n *\n * @public\n */\nexport type MediaWidth = number;\n/**\nSchema type for MentionEntity\n *\n * @public\n */\nexport type MentionEntity = any; /**\nRepresent the portion of text recognized as a User mention, and its start and end position within the text.\n *\n * @public\n */\nexport interface MentionFields {\n id?: UserId;\n username: UserName;\n} /**\nSchema type for MetadataCreateRequest\n *\n * @public\n */\nexport interface MetadataCreateRequest {\n id: MediaId;\n /** none */ metadata?: Record;\n} /**\nSchema type for MetadataCreateResponse\n *\n * @public\n */\nexport interface MetadataCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for Metrics\n *\n * @public\n */\nexport interface Metrics {\n /** Tracks number of App Install Attempts */ appInstallAttempts?: number;\n /** Tracks number of App opens */ appOpens?: number;\n /** Tracks number of Detail expands */ detailExpands?: number;\n /** Tracks number of Email Tweet actions */ emailTweet?: number;\n /** Tracks total Engagements */ engagements?: number;\n /** Tracks number of Follows */ follows?: number;\n /** Tracks number of Hashtag clicks */ hashtagClicks?: number;\n /** Tracks number of Impressions */ impressions?: number;\n /** Tracks number of Likes */ likes?: number;\n /** Tracks number of Link clicks */ linkClicks?: number;\n /** Tracks number of Media engagements */ mediaEngagements?: number;\n /** Tracks number of Media views */ mediaViews?: number;\n /** Tracks number of Permalink clicks */ permalinkClicks?: number;\n /** Tracks number of Profile visits */ profileVisits?: number;\n /** Tracks number of Quote Tweets */ quoteTweets?: number;\n /** Tracks number of Replies */ replies?: number;\n /** Tracks number of Retweets */ retweets?: number;\n /** Tracks number of URL clicks */ urlClicks?: number;\n /** Tracks number of User Profile clicks */ userProfileClicks?: number;\n} /**\nCommunity Note misleading tags type.\n *\n * @public\n */\nexport type MisleadingTags =\n | 'disputed_claim_as_fact'\n | 'factual_error'\n | 'manipulated_media'\n | 'misinterpreted_satire'\n | 'missing_important_context'\n | 'other'\n | 'outdated_information'; /**\nSchema type for MuteUserMutationResponse\n *\n * @public\n */\nexport interface MuteUserMutationResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for MuteUserRequest\n *\n * @public\n */\nexport interface MuteUserRequest {\n targetUserId: UserId;\n} /**\nThe newest id in this response.\n *\n * @public\n */\nexport type NewestId = string; /**\nAn AI generated news story.\n *\n * @public\n */\nexport interface News {\n /** The news category. */ category?: string;\n /** none */ clusterPostsResults?: Array>;\n /** none */ contexts?: Record;\n /** none */ disclaimer?: string;\n /** The news hook. */ hook?: string;\n /** none */ keywords?: Array;\n /** none */ lastUpdatedAtMs?: string;\n /** The headline. */ name?: string;\n restId: NewsId;\n /** The news summary. */ summary?: string;\n} /**\nUnique identifier of news story.\n *\n * @public\n */\nexport type NewsId = string; /**\nThe next token.\n *\n * @public\n */\nexport type NextToken = string;\n/**\nA problem that indicates the user's rule set is not compliant.\n *\n * @public\n */\nexport type NonCompliantRulesProblem = any; /**\nA X Community Note is a note on a Post.\n *\n * @public\n */\nexport interface Note {\n id: NoteId;\n info?: NoteInfo;\n postId: TweetId;\n status?: NoteRatingStatus;\n testResult?: NoteTestResult;\n} /**\nCommunity Note classification type.\n *\n * @public\n */\nexport type NoteClassification =\n | 'misinformed_or_potentially_misleading'\n | 'not_misleading'; /**\nThe unique identifier of this Community Note.\n *\n * @public\n */\nexport type NoteId = string; /**\nA X Community Note is a note on a Post.\n *\n * @public\n */\nexport interface NoteInfo {\n classification: NoteClassification;\n /** none */ misleadingTags: Array;\n /** The text summary in the Community Note. */ text: string;\n /** Whether the note provided trustworthy links. */ trustworthySources: boolean;\n} /**\nCommunity Note rating status\n *\n * @public\n */\nexport type NoteRatingStatus =\n | 'currently_rated_helpful'\n | 'currently_rated_not_helpful'\n | 'firm_reject'\n | 'insufficient_consensus'\n | 'minimum_ratings_not_met'\n | 'needs_more_ratings'\n | 'needs_your_help'; /**\nThe evaluation result of a community note.\n *\n * @public\n */\nexport interface NoteTestResult {\n /** Score bucket from the evaluator result. */ evaluatorScoreBucket?: string;\n /** The type of the evaluator. */ evaluatorType?: string;\n} /**\nThe note content of the Tweet.\n *\n * @public\n */\nexport type NoteTweetText = string;\n/**\nA problem that indicates your client application does not have the required OAuth1 permissions for the requested endpoint.\n *\n * @public\n */\nexport type Oauth1PermissionsProblem = any; /**\nThe oldest id in this response.\n *\n * @public\n */\nexport type OldestId = string;\n/**\nYou have been disconnected for operational reasons.\n *\n * @public\n */\nexport type OperationalDisconnectProblem = any; /**\nA base32 pagination token.\n *\n * @public\n */\nexport type PaginationToken32 = string; /**\nA base36 pagination token.\n *\n * @public\n */\nexport type PaginationToken36 = string; /**\nA 'long' pagination token.\n *\n * @public\n */\nexport type PaginationTokenLong = string; /**\nA trend.\n *\n * @public\n */\nexport interface PersonalizedTrend {\n /** Category of this trend. */ category?: string;\n /** Number of posts pertaining to this trend. */ postCount?: number;\n /** Name of the trend. */ trendName?: string;\n /** Time since this is trending. */ trendingSince?: string;\n}\n/**\nSchema type for Photo\n *\n * @public\n */\nexport type Photo = any; /**\nSchema type for Place\n *\n * @public\n */\nexport interface Place {\n /** none */ containedWithin?: Array;\n /** The full name of the county in which this place exists. */ country?: string;\n countryCode?: CountryCode;\n /** The full name of this place. */ fullName: string;\n geo?: Geo;\n id: PlaceId;\n /** The human readable name of this place. */ name?: string;\n placeType?: PlaceType;\n} /**\nThe identifier for this place.\n *\n * @public\n */\nexport type PlaceId = string; /**\nSchema type for PlaceType\n *\n * @public\n */\nexport type PlaceType =\n | 'poi'\n | 'neighborhood'\n | 'city'\n | 'admin'\n | 'country'\n | 'unknown'; /**\nDescriptor for a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccount {\n /** The category of the account (e.g., personal, business). */ accountCategory: string;\n /** The Plaid account ID. */ accountId: string;\n /** The last 2-4 digits of the account number. */ accountNumberDisplay: string;\n /** The type of the account (e.g., checking, savings). */ accountType: string;\n /** The available balance of the account. */ availableBalance?: number;\n currency: PlaidCurrency;\n /** The current balance of the account. */ currentBalance?: number;\n /** The nickname of the account. */ nickname?: string;\n /** The name of the product associated with the account. */ productName: string;\n /** The status of the account. */ status: string;\n} /**\nContact information associated with a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccountContact {\n /** List of addresses associated with the account holder. */ addresses: Array<\n PlaidAddress\n >;\n /** List of email addresses associated with the account holder. */ emails: Array<\n string\n >;\n name: PlaidName;\n /** Relationship of the contact to the account. */ relationship?: string;\n /** List of telephone numbers associated with the account holder. */ telephones: Array<\n PlaidTelephone\n >;\n} /**\nPayment network details associated with the account.\n *\n * @public\n */\nexport interface PlaidAccountPaymentNetwork {\n /** The bank ID associated with the account. */ bankId: string;\n /** The payment network identifier. */ identifier: string;\n /** Indicates if transfers into the account are supported. */ transferIn: boolean;\n /** Indicates if transfers out of the account are supported. */ transferOut: boolean;\n /** The type of payment network (e.g., ACH, SEPA). */ type: string;\n} /**\nDescriptor for a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccountTransaction {\n /** The category of the account (e.g., personal, business). */ accountCategory: string;\n /** The amount transacted. */ amount: number;\n /** Memo for transaction (e.g. CREDIT) */ debitCreditMemo: string;\n /** The transaction description */ description: string;\n /** The timestamp when the transaction was posted. */ postedTimestamp?: string;\n /** The status of the transaction. */ status: string;\n /** The identifier for the transaction. */ transactionId: string;\n /** The timestamp when the transaction occurred. */ transactionTimestamp: string;\n} /**\nAddress information for the account holder.\n *\n * @public\n */\nexport interface PlaidAddress {\n /** The city of the address. */ city: string;\n /** The country of the address (ISO 3166-1 alpha-2 code). */ country: string;\n /** The first line of the address. */ line1: string;\n /** The second line of the address. */ line2?: string;\n /** The postal code of the address. */ postalCode?: string;\n /** The region or state of the address. */ region?: string;\n} /**\nCurrency information.\n *\n * @public\n */\nexport interface PlaidCurrency {\n /** The ISO 4217 currency code. */ currencyCode: string;\n} /**\nA user id for the plaid customer\n *\n * @public\n */\nexport interface PlaidCustomer {\n customerId?: UserId;\n} /**\nName information for the account holder.\n *\n * @public\n */\nexport interface PlaidName {\n /** The first name of the account holder. */ first: string;\n /** The last name of the account holder. */ last: string;\n} /**\nTelephone information for the account holder.\n *\n * @public\n */\nexport interface PlaidTelephone {\n /** The country code for the phone number (e.g., '+1'). */ country: string;\n /** The phone number. */ number: string;\n /** The type of phone number (e.g., 'mobile'). */ type: string;\n} /**\nA [GeoJson Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) geometry object.\n *\n * @public\n */\nexport interface Point {\n coordinates: Position;\n /** none */ type: 'Point';\n} /**\nRepresent a Poll attached to a Tweet.\n *\n * @public\n */\nexport interface Poll {\n /** none */ durationMinutes?: number;\n /** none */ endDatetime?: string;\n id: PollId;\n /** none */ options: Array;\n /** none */ votingStatus?: 'open' | 'closed';\n} /**\nUnique identifier of this poll.\n *\n * @public\n */\nexport type PollId = string; /**\nDescribes a choice in a Poll object.\n *\n * @public\n */\nexport interface PollOption {\n label: PollOptionLabel;\n /** Position of this choice in the poll. */ position: number;\n /** Number of users who voted for this choice. */ votes: number;\n} /**\nThe text of a poll choice.\n *\n * @public\n */\nexport type PollOptionLabel = string; /**\nA [GeoJson Position](https://tools.ietf.org/html/rfc7946#section-3.1.1) in the format `[longitude,latitude]`.\n *\n * @public\n */\nexport type Position = Array<\n number\n>; /**\nSchema type for PreviewImage\n *\n * @public\n */\nexport interface PreviewImage {\n /** none */ mediaKey: Record;\n} /**\nThe previous token.\n *\n * @public\n */\nexport type PreviousToken = string; /**\nAn HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807).\n *\n * @public\n */\nexport interface Problem {\n /** none */ detail?: string;\n /** none */ status?: number;\n /** none */ title: string;\n /** none */ type: string;\n} /**\nSchema type for ProcessingInfo\n *\n * @public\n */\nexport interface ProcessingInfo {\n /** Number of seconds to check again for status */ checkAfterSecs?: number;\n /** Percent of upload progress */ progressPercent?: number;\n /** State of upload */ state?:\n | 'succeeded'\n | 'in_progress'\n | 'pending'\n | 'failed';\n} /**\nSchema type for ProfileUpdateActivityResponsePayload\n *\n * @public\n */\nexport interface ProfileUpdateActivityResponsePayload {\n /** none */ after?: string;\n /** none */ before?: string;\n} /**\nConfirmation that the replay job request was accepted.\n *\n * @public\n */\nexport interface ReplayJobCreateResponse {\n /** The UTC timestamp indicating when the replay job was created. */ createdAt: string;\n /** The unique identifier for the initiated replay job. */ jobId: string;\n} /**\nShows who can reply a Tweet. Fields returned are everyone, mentioned_users, and following.\n *\n * @public\n */\nexport type ReplySettings =\n | 'everyone'\n | 'mentionedUsers'\n | 'following'\n | 'other'; /**\nShows who can reply a Tweet. Fields returned are everyone, mentioned_users, subscribers, verified and following.\n *\n * @public\n */\nexport type ReplySettingsWithVerifiedUsers =\n | 'everyone'\n | 'mentionedUsers'\n | 'following'\n | 'other'\n | 'subscribers'\n | 'verified';\n/**\nA problem that indicates that a given Tweet, User, etc. does not exist.\n *\n * @public\n */\nexport type ResourceNotFoundProblem = any;\n/**\nA problem that indicates you are not allowed to see a particular Tweet, User, etc.\n *\n * @public\n */\nexport type ResourceUnauthorizedProblem = any;\n/**\nA problem that indicates a particular Tweet, User, etc. is not available to you.\n *\n * @public\n */\nexport type ResourceUnavailableProblem = any; /**\nThe number of results returned in this response.\n *\n * @public\n */\nexport type ResultCount = number; /**\nA user-provided stream filtering rule.\n *\n * @public\n */\nexport interface Rule {\n id?: RuleId;\n tag?: RuleTag;\n value: RuleValue;\n} /**\nUnique identifier of this rule.\n *\n * @public\n */\nexport type RuleId = string; /**\nA user-provided stream filtering rule.\n *\n * @public\n */\nexport interface RuleNoId {\n tag?: RuleTag;\n value: RuleValue;\n}\n/**\nYou have exceeded the maximum number of rules.\n *\n * @public\n */\nexport type RulesCapProblem = any; /**\nA count of user-provided stream filtering rules at the application and project levels.\n *\n * @public\n */\nexport interface RulesCount {\n allProjectClientApps?: AllProjectClientApps;\n /** Cap of number of rules allowed per client application */ capPerClientApp?: number;\n /** Cap of number of rules allowed per project */ capPerProject?: number;\n clientAppRulesCount?: AppRulesCount;\n /** Number of rules for project */ projectRulesCount?: number;\n} /**\nSchema type for RulesLookupResponse\n *\n * @public\n */\nexport interface RulesLookupResponse {\n /** none */ data?: Array;\n meta: RulesResponseMetadata;\n}\n/**\nSchema type for RulesRequestSummary\n *\n * @public\n */\nexport type RulesRequestSummary = any; /**\nSchema type for RulesResponseMetadata\n *\n * @public\n */\nexport interface RulesResponseMetadata {\n nextToken?: NextToken;\n /** Number of Rules in result set. */ resultCount?: number;\n /** none */ sent: string;\n summary?: RulesRequestSummary;\n} /**\nA tag meant for the labeling of user provided rules.\n *\n * @public\n */\nexport type RuleTag = string; /**\nThe filterlang value of the rule.\n *\n * @public\n */\nexport type RuleValue = string; /**\nRepresent a Search Count Result.\n *\n * @public\n */\nexport interface SearchCount {\n end: End;\n start: Start;\n tweetCount: TweetCount;\n} /**\nSchema type for SensitiveMediaWarning\n *\n * @public\n */\nexport interface SensitiveMediaWarning {\n /** Indicates if the content contains adult material */ adultContent?: boolean;\n /** Indicates if the content depicts graphic violence */ graphicViolence?: boolean;\n /** Indicates if the content has other sensitive characteristics */ other?: boolean;\n} /**\nSchema type for SharedInfo\n *\n * @public\n */\nexport interface SharedInfo {\n /** Indicates if the media is shared in direct messages */ shared: boolean;\n} /**\nSchema type for Space\n *\n * @public\n */\nexport interface Space {\n /** Creation time of the Space. */ createdAt?: string;\n creatorId?: UserId;\n /** End time of the Space. */ endedAt?: string;\n /** The user ids for the hosts of the Space. */ hostIds?: Array;\n id: SpaceId;\n /** An array of user ids for people who were invited to a Space. */ invitedUserIds?: Array<\n UserId\n >;\n /** Denotes if the Space is a ticketed Space. */ isTicketed?: boolean;\n /** The language of the Space. */ lang?: string;\n /** The number of participants in a Space. */ participantCount?: number;\n /** A date time stamp for when a Space is scheduled to begin. */ scheduledStart?: string;\n /** An array of user ids for people who were speakers in a Space. */ speakerIds?: Array<\n UserId\n >;\n /** When the Space was started as a date string. */ startedAt?: string;\n /** The current state of the Space. */ state: 'live' | 'scheduled' | 'ended';\n /** The number of people who have either purchased a ticket or set a reminder for this Space. */ subscriberCount?: number;\n /** The title of the Space. */ title?: string;\n /** The topics of a Space, as selected by its creator. */ topics?: Array<\n Record\n >;\n /** When the Space was last updated. */ updatedAt?: string;\n} /**\nThe unique identifier of this Space.\n *\n * @public\n */\nexport type SpaceId = string; /**\nThe start time of the bucket.\n *\n * @public\n */\nexport type Start = string; /**\nSchema type for Sticker\n *\n * @public\n */\nexport interface Sticker {\n /** width-to-height ratio of the media */ aspectRatio?: number;\n /** A unique identifier for the group of annotations associated with the media */ groupAnnotationId?: number;\n /** Unique identifier for sticker */ id?: string;\n /** A unique identifier for the sticker set associated with the media */ stickerSetAnnotationId?: number;\n /** Scale or rotate the media on the x-axis */ transformA?: number;\n /** Skew the media on the x-axis */ transformB?: number;\n /** Skew the media on the y-axis */ transformC?: number;\n /** Scale or rotate the media on the y-axis */ transformD?: number;\n /** Scale or rotate the media on the x-axis */ transformTx?: number;\n /** The vertical translation (shift) value for the media */ transformTy?: number;\n} /**\nSchema type for StickerInfo\n *\n * @public\n */\nexport interface StickerInfo {\n /** Stickers list must not be empty and should not exceed 25 */ stickers: Array<\n Sticker\n >;\n} /**\nSchema type for StreamingLikeResponseV2\n *\n * @public\n */\nexport interface StreamingLikeResponseV2 {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for StreamingTweetResponse\n *\n * @public\n */\nexport interface StreamingTweetResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for SubscriptionsCountGetResponse\n *\n * @public\n */\nexport interface SubscriptionsCountGetResponse {\n /** The count of active subscriptions across all webhooks */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsCreateRequest\n *\n * @public\n */\nexport type SubscriptionsCreateRequest = Record<\n string,\n any\n>; /**\nSchema type for SubscriptionsCreateResponse\n *\n * @public\n */\nexport interface SubscriptionsCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsDeleteResponse\n *\n * @public\n */\nexport interface SubscriptionsDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsGetResponse\n *\n * @public\n */\nexport interface SubscriptionsGetResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsListGetResponse\n *\n * @public\n */\nexport interface SubscriptionsListGetResponse {\n /** The list of active subscriptions for a specified webhook */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n} /**\nThe language code should be a BCP47 code (e.g. 'EN\", \"SP\")\n *\n * @public\n */\nexport type SubtitleLanguageCode = string; /**\nSchema type for Subtitles\n *\n * @public\n */\nexport interface Subtitles {\n /** Language name in a human readable form */ displayName?: string;\n id?: MediaId;\n languageCode?: SubtitleLanguageCode;\n} /**\nSchema type for SubtitlesCreateRequest\n *\n * @public\n */\nexport interface SubtitlesCreateRequest {\n id?: MediaId;\n mediaCategory?: MediaCategorySubtitles;\n subtitles?: Subtitles;\n} /**\nSchema type for SubtitlesCreateResponse\n *\n * @public\n */\nexport interface SubtitlesCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubtitlesDeleteRequest\n *\n * @public\n */\nexport interface SubtitlesDeleteRequest {\n id?: MediaId;\n languageCode?: SubtitleLanguageCode;\n mediaCategory?: MediaCategorySubtitles;\n} /**\nSchema type for SubtitlesDeleteResponse\n *\n * @public\n */\nexport interface SubtitlesDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TimestampedMetrics\n *\n * @public\n */\nexport interface TimestampedMetrics {\n metrics?: Metrics;\n /** ISO8601 Time */ timestamp?: string;\n} /**\nThe topic of a Space, as selected by its creator.\n *\n * @public\n */\nexport interface Topic {\n /** The description of the given topic. */ description?: string;\n id: TopicId;\n /** The name of the given topic. */ name: string;\n} /**\nUnique identifier of this Topic.\n *\n * @public\n */\nexport type TopicId = string; /**\nA trend.\n *\n * @public\n */\nexport interface Trend {\n /** Name of the trend. */ trendName?: string;\n /** Number of Posts in this trend. */ tweetCount?: number;\n} /**\nSchema type for TrendActivityResponsePayload\n *\n * @public\n */\nexport interface TrendActivityResponsePayload {\n /** none */ category?: string;\n /** none */ headline?: string;\n /** none */ hook?: string;\n /** none */ summary?: string;\n} /**\nSchema type for Tweet\n *\n * @public\n */\nexport interface Tweet {\n /** Specifies the type of attachments (if any) present in this Tweet. */ attachments?: Record<\n string,\n any\n >;\n authorId?: UserId;\n communityId?: CommunityId;\n /** none */ contextAnnotations?: Array;\n conversationId?: TweetId;\n /** Creation time of the Tweet. */ createdAt?: string;\n displayTextRange?: DisplayTextRange;\n /** none */ editControls?: Record;\n /** A list of Tweet Ids in this Tweet chain. */ editHistoryTweetIds?: Array<\n TweetId\n >;\n entities?: FullTextEntities;\n /** The location tagged on the Tweet, if the user provided one. */ geo?: Record<\n string,\n any\n >;\n id?: TweetId;\n inReplyToUserId?: UserId;\n /** Language of the Tweet, if detected by X. Returned as a BCP47 language tag. */ lang?: string;\n /** Nonpublic engagement metrics for the Tweet at the time of the request. */ nonPublicMetrics?: Record<\n string,\n any\n >;\n /** The full-content of the Tweet, including text beyond 280 characters. */ noteTweet?: Record<\n string,\n any\n >;\n /** Organic nonpublic engagement metrics for the Tweet at the time of the request. */ organicMetrics?: Record<\n string,\n any\n >;\n /** Indicates if this Tweet contains URLs marked as sensitive, for example content suitable for mature audiences. */ possiblySensitive?: boolean;\n /** Promoted nonpublic engagement metrics for the Tweet at the time of the request. */ promotedMetrics?: Record<\n string,\n any\n >;\n /** Engagement metrics for the Tweet at the time of the request. */ publicMetrics?: Record<\n string,\n any\n >;\n /** A list of Posts this Tweet refers to. For example, if the parent Tweet is a Retweet, a Quoted Tweet or a Reply, it will include the related Tweet referenced to by its parent. */ referencedTweets?: Array<\n Record\n >;\n replySettings?: ReplySettingsWithVerifiedUsers;\n /** The scopes for this tweet */ scopes?: Record;\n /** This is deprecated. */ source?: string;\n /** none */ suggestedSourceLinks?: Array;\n text?: TweetText;\n username?: UserName;\n withheld?: TweetWithheld;\n}\n/**\nTweet compliance data.\n *\n * @public\n */\nexport type TweetComplianceData = any; /**\nSchema type for TweetComplianceSchema\n *\n * @public\n */\nexport interface TweetComplianceSchema {\n /** Event time. */ eventAt: string;\n quoteTweetId?: TweetId;\n /** none */ tweet: Record;\n}\n/**\nTweet compliance stream events.\n *\n * @public\n */\nexport type TweetComplianceStreamResponse = any; /**\nThe count for the bucket.\n *\n * @public\n */\nexport type TweetCount = number; /**\nSchema type for TweetCreateRequest\n *\n * @public\n */\nexport interface TweetCreateRequest {\n /** Card Uri Parameter. This is mutually exclusive from Quote Tweet Id, Poll, Media, and Direct Message Deep Link. */ cardUri?: string;\n communityId?: CommunityId;\n /** Link to take the conversation from the public timeline to a private Direct Message. */ directMessageDeepLink?: string;\n /** Options for editing an existing Post. When provided, this request will edit the specified Post instead of creating a new one. */ editOptions?: Record<\n string,\n any\n >;\n /** Exclusive Tweet for super followers. */ forSuperFollowersOnly?: boolean;\n /** Place ID being attached to the Tweet for geo location. */ geo?: Record<\n string,\n any\n >;\n /** Media information being attached to created Tweet. This is mutually exclusive from Quote Tweet Id, Poll, and Card URI. */ media?: Record<\n string,\n any\n >;\n /** Nullcasted (promoted-only) Posts do not appear in the public timeline and are not served to followers. */ nullcast?: boolean;\n /** Poll options for a Tweet with a poll. This is mutually exclusive from Media, Quote Tweet Id, and Card URI. */ poll?: Record<\n string,\n any\n >;\n quoteTweetId?: TweetId;\n /** Tweet information of the Tweet being replied to. */ reply?: Record<\n string,\n any\n >;\n /** Settings to indicate who can reply to the Tweet. */ replySettings?:\n | 'following'\n | 'mentionedUsers'\n | 'subscribers'\n | 'verified';\n /** Share community post with followers too. */ shareWithFollowers?: boolean;\n text?: TweetText;\n} /**\nSchema type for TweetCreateResponse\n *\n * @public\n */\nexport interface TweetCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TweetDeleteComplianceSchema\n *\n * @public\n */\nexport interface TweetDeleteComplianceSchema {\n delete: TweetComplianceSchema;\n} /**\nSchema type for TweetDeleteResponse\n *\n * @public\n */\nexport interface TweetDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TweetDropComplianceSchema\n *\n * @public\n */\nexport interface TweetDropComplianceSchema {\n drop: TweetComplianceSchema;\n} /**\nSchema type for TweetEditComplianceObjectSchema\n *\n * @public\n */\nexport interface TweetEditComplianceObjectSchema {\n /** none */ editTweetIds: Array;\n /** Event time. */ eventAt: string;\n initialTweetId: TweetId;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetEditComplianceSchema\n *\n * @public\n */\nexport interface TweetEditComplianceSchema {\n tweetEdit: TweetEditComplianceObjectSchema;\n} /**\nSchema type for TweetHideRequest\n *\n * @public\n */\nexport interface TweetHideRequest {\n /** none */ hidden: boolean;\n} /**\nSchema type for TweetHideResponse\n *\n * @public\n */\nexport interface TweetHideResponse {\n /** none */ data?: Record;\n} /**\nUnique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.\n *\n * @public\n */\nexport type TweetId = string;\n/**\nTweet label data.\n *\n * @public\n */\nexport type TweetLabelData = any;\n/**\nTweet label stream events.\n *\n * @public\n */\nexport type TweetLabelStreamResponse = any; /**\nSchema type for TweetNotice\n *\n * @public\n */\nexport interface TweetNotice {\n /** If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. */ application: string;\n /** Information shown on the Tweet label */ details?: string;\n /** Event time. */ eventAt: string;\n /** The type of label on the Tweet */ eventType: string;\n /** Link to more information about this kind of label */ extendedDetailsUrl?: string;\n /** Title/header of the Tweet label */ labelTitle?: string;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetNoticeSchema\n *\n * @public\n */\nexport interface TweetNoticeSchema {\n publicTweetNotice: TweetNotice;\n} /**\nSchema type for TweetTakedownComplianceSchema\n *\n * @public\n */\nexport interface TweetTakedownComplianceSchema {\n /** Event time. */ eventAt: string;\n quoteTweetId?: TweetId;\n /** none */ tweet: Record;\n /** none */ withheldInCountries: Array;\n} /**\nThe content of the Tweet.\n *\n * @public\n */\nexport type TweetText = string; /**\nSchema type for TweetUndropComplianceSchema\n *\n * @public\n */\nexport interface TweetUndropComplianceSchema {\n undrop: TweetComplianceSchema;\n} /**\nSchema type for TweetUnviewable\n *\n * @public\n */\nexport interface TweetUnviewable {\n /** If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. */ application: string;\n /** Event time. */ eventAt: string;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetUnviewableSchema\n *\n * @public\n */\nexport interface TweetUnviewableSchema {\n publicTweetUnviewable: TweetUnviewable;\n} /**\nIndicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).\n *\n * @public\n */\nexport interface TweetWithheld {\n /** Indicates if the content is being withheld for on the basis of copyright infringement. */ copyright: boolean;\n /** Provides a list of countries where this content is not available. */ countryCodes: Array<\n CountryCode\n >;\n /** Indicates whether the content being withheld is the `tweet` or a `user`. */ scope?:\n | 'tweet'\n | 'user';\n} /**\nSchema type for TweetWithheldComplianceSchema\n *\n * @public\n */\nexport interface TweetWithheldComplianceSchema {\n withheld: TweetTakedownComplianceSchema;\n} /**\nSchema type for UnlikeComplianceSchema\n *\n * @public\n */\nexport interface UnlikeComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ favorite: Record;\n}\n/**\nA problem that indicates that the authentication used is not supported.\n *\n * @public\n */\nexport type UnsupportedAuthenticationProblem = any; /**\nExpiration time of the upload URL.\n *\n * @public\n */\nexport type UploadExpiration = string; /**\nSchema type for UploadSource\n *\n * @public\n */\nexport interface UploadSource {\n /** Records the source (e.g., app, device) from which the media was uploaded */ uploadSource: string;\n} /**\nURL to which the user will upload their Tweet or user IDs.\n *\n * @public\n */\nexport type UploadUrl = string; /**\nA validly formatted URL.\n *\n * @public\n */\nexport type Url = string;\n/**\nRepresent the portion of text recognized as a URL, and its start and end position within the text.\n *\n * @public\n */\nexport type UrlEntity = any;\n/**\nRepresent the portion of text recognized as a URL, and its start and end position within the text.\n *\n * @public\n */\nexport type UrlEntityDm = any; /**\nRepresent the portion of text recognized as a URL.\n *\n * @public\n */\nexport interface UrlFields {\n /** Description of the URL landing page. */ description?: string;\n /** The URL as displayed in the X client. */ displayUrl?: string;\n expandedUrl?: Url;\n /** none */ images?: Array;\n mediaKey?: MediaKey;\n status?: HttpStatusCode;\n /** Title of the page the URL points to. */ title?: string;\n /** Fully resolved url. */ unwoundUrl?: string;\n url: Url;\n} /**\nRepresent the information for the URL image.\n *\n * @public\n */\nexport interface UrlImage {\n height?: MediaHeight;\n url?: Url;\n width?: MediaWidth;\n} /**\nUsage per client app\n *\n * @public\n */\nexport interface Usage {\n /** Number of days left for the Tweet cap to reset */ capResetDay?: number;\n /** The daily usage breakdown for each Client Application a project */ dailyClientAppUsage?: Array<\n ClientAppUsage\n >;\n /** The daily usage breakdown for a project */ dailyProjectUsage?: Record<\n string,\n any\n >;\n /** Total number of Posts that can be read in this project per month */ projectCap?: number;\n /** The unique identifier for this project */ projectId?: string;\n /** The number of Posts read in this project */ projectUsage?: number;\n}\n/**\nA problem that indicates that a usage cap has been exceeded.\n *\n * @public\n */\nexport type UsageCapExceededProblem = any; /**\nRepresents the data for Usage\n *\n * @public\n */\nexport interface UsageFields {\n /** The time period for the usage */ date?: string;\n /** The usage value */ usage?: number;\n} /**\nThe X User object.\n *\n * @public\n */\nexport interface User {\n /** Metadata about a user's affiliation. */ affiliation?: Record;\n /** Returns detailed information about the relationship between two users. */ connectionStatus?: Array<\n | 'follow_request_received'\n | 'follow_request_sent'\n | 'blocking'\n | 'followed_by'\n | 'following'\n | 'muting'\n >;\n /** Creation time of this User. */ createdAt?: string;\n /** The text of this User's profile description (also known as bio), if the User provided one. */ description?: string;\n /** A list of metadata found in the User's profile description. */ entities?: Record<\n string,\n any\n >;\n id: UserId;\n /** The location specified in the User's profile, if the User provided one. As this is a freeform value, it may not indicate a valid location, but it may be fuzzily evaluated when performing searches with location queries. */ location?: string;\n mostRecentTweetId?: TweetId;\n /** The friendly name of this User, as shown on their profile. */ name: string;\n pinnedTweetId?: TweetId;\n /** The URL to the profile banner for this User. */ profileBannerUrl?: string;\n /** The URL to the profile image for this User. */ profileImageUrl?: string;\n /** Indicates if this User has chosen to protect their Posts (in other words, if this User's Posts are private). */ protected?: boolean;\n /** A list of metrics for this User. */ publicMetrics?: Record;\n /** Indicates if you can send a DM to this User */ receivesYourDm?: boolean;\n /** The X Blue subscription type of the user, eg: Basic, Premium, PremiumPlus or None. */ subscriptionType?:\n | 'Basic'\n | 'Premium'\n | 'PremiumPlus'\n | 'None';\n /** The URL specified in the User's profile. */ url?: string;\n username: UserName;\n /** Indicate if this User is a verified X User. */ verified?: boolean;\n /** The X Blue verified type of the user, eg: blue, government, business or none. */ verifiedType?:\n | 'blue'\n | 'government'\n | 'business'\n | 'none';\n withheld?: UserWithheld;\n}\n/**\nUser compliance data.\n *\n * @public\n */\nexport type UserComplianceData = any; /**\nSchema type for UserComplianceSchema\n *\n * @public\n */\nexport interface UserComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ user: Record;\n}\n/**\nUser compliance stream events.\n *\n * @public\n */\nexport type UserComplianceStreamResponse = any; /**\nSchema type for UserDeleteComplianceSchema\n *\n * @public\n */\nexport interface UserDeleteComplianceSchema {\n userDelete: UserComplianceSchema;\n} /**\nUnique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.\n *\n * @public\n */\nexport type UserId = string; /**\nUnique identifier of this User. The value must be the same as the authenticated user.\n *\n * @public\n */\nexport type UserIdMatchesAuthenticatedUser = string; /**\nThe X handle (screen name) of this user.\n *\n * @public\n */\nexport type UserName = string; /**\nSchema type for UserProfileModificationComplianceSchema\n *\n * @public\n */\nexport interface UserProfileModificationComplianceSchema {\n userProfileModification: UserProfileModificationObjectSchema;\n} /**\nSchema type for UserProfileModificationObjectSchema\n *\n * @public\n */\nexport interface UserProfileModificationObjectSchema {\n /** Event time. */ eventAt: string;\n /** none */ newValue: string;\n /** none */ profileField: string;\n /** none */ user: Record;\n} /**\nSchema type for UserProtectComplianceSchema\n *\n * @public\n */\nexport interface UserProtectComplianceSchema {\n userProtect: UserComplianceSchema;\n} /**\nSchema type for UserScrubGeoObjectSchema\n *\n * @public\n */\nexport interface UserScrubGeoObjectSchema {\n /** Event time. */ eventAt: string;\n upToTweetId: TweetId;\n /** none */ user: Record;\n} /**\nSchema type for UserScrubGeoSchema\n *\n * @public\n */\nexport interface UserScrubGeoSchema {\n scrubGeo: UserScrubGeoObjectSchema;\n} /**\nSchema type for UsersDMBlockCreateResponse\n *\n * @public\n */\nexport interface UsersDMBlockCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersDMUnBlockCreateResponse\n *\n * @public\n */\nexport interface UsersDMUnBlockCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe the search string by which to query for users.\n *\n * @public\n */\nexport type UserSearchQueryVnext = string; /**\nSchema type for UsersFollowingCreateRequest\n *\n * @public\n */\nexport interface UsersFollowingCreateRequest {\n targetUserId: UserId;\n} /**\nSchema type for UsersFollowingCreateResponse\n *\n * @public\n */\nexport interface UsersFollowingCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersFollowingDeleteResponse\n *\n * @public\n */\nexport interface UsersFollowingDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersLikesCreateRequest\n *\n * @public\n */\nexport interface UsersLikesCreateRequest {\n tweetId: TweetId;\n} /**\nSchema type for UsersLikesCreateResponse\n *\n * @public\n */\nexport interface UsersLikesCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersLikesDeleteResponse\n *\n * @public\n */\nexport interface UsersLikesDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersRetweetsCreateRequest\n *\n * @public\n */\nexport interface UsersRetweetsCreateRequest {\n tweetId: TweetId;\n} /**\nSchema type for UsersRetweetsCreateResponse\n *\n * @public\n */\nexport interface UsersRetweetsCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersRetweetsDeleteResponse\n *\n * @public\n */\nexport interface UsersRetweetsDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UserSuspendComplianceSchema\n *\n * @public\n */\nexport interface UserSuspendComplianceSchema {\n userSuspend: UserComplianceSchema;\n} /**\nSchema type for UserTakedownComplianceSchema\n *\n * @public\n */\nexport interface UserTakedownComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ user: Record;\n /** none */ withheldInCountries: Array;\n} /**\nSchema type for UserUndeleteComplianceSchema\n *\n * @public\n */\nexport interface UserUndeleteComplianceSchema {\n userUndelete: UserComplianceSchema;\n} /**\nSchema type for UserUnprotectComplianceSchema\n *\n * @public\n */\nexport interface UserUnprotectComplianceSchema {\n userUnprotect: UserComplianceSchema;\n} /**\nSchema type for UserUnsuspendComplianceSchema\n *\n * @public\n */\nexport interface UserUnsuspendComplianceSchema {\n userUnsuspend: UserComplianceSchema;\n} /**\nIndicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).\n *\n * @public\n */\nexport interface UserWithheld {\n /** Provides a list of countries where this content is not available. */ countryCodes: Array<\n CountryCode\n >;\n /** Indicates that the content being withheld is a `user`. */ scope?: 'user';\n} /**\nSchema type for UserWithheldComplianceSchema\n *\n * @public\n */\nexport interface UserWithheldComplianceSchema {\n userWithheld: UserTakedownComplianceSchema;\n} /**\nSchema type for Variant\n *\n * @public\n */\nexport interface Variant {\n /** The bit rate of the media. */ bitRate?: number;\n /** The content type of the media. */ contentType?: string;\n /** The url to the media. */ url?: string;\n} /**\nAn array of all available variants of the media.\n *\n * @public\n */\nexport type Variants = Array;\n/**\nSchema type for Video\n *\n * @public\n */\nexport type Video = any; /**\nA Webhook Configuration\n *\n * @public\n */\nexport interface WebhookConfig {\n /** none */ createdAt: string;\n id: WebhookConfigId;\n /** The callback URL of the webhook. */ url: string;\n /** none */ valid: boolean;\n} /**\nSchema type for WebhookConfigCreateRequest\n *\n * @public\n */\nexport interface WebhookConfigCreateRequest {\n /** none */ url: string;\n} /**\nA Webhook Configuration\n *\n * @public\n */\nexport interface WebhookConfigCreateResponse {\n /** none */ createdAt: string;\n id: WebhookConfigId;\n /** The callback URL of the webhook. */ url: string;\n /** none */ valid: boolean;\n} /**\nSchema type for WebhookConfigDeleteResponse\n *\n * @public\n */\nexport interface WebhookConfigDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe unique identifier of this webhook config.\n *\n * @public\n */\nexport type WebhookConfigId = string; /**\nSchema type for WebhookConfigPutResponse\n *\n * @public\n */\nexport interface WebhookConfigPutResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksCreateResponse\n *\n * @public\n */\nexport interface WebhookLinksCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksDeleteResponse\n *\n * @public\n */\nexport interface WebhookLinksDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksGetResponse\n *\n * @public\n */\nexport interface WebhookLinksGetResponse {\n /** The list of active webhook links for a given stream */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for stream operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for postsSample\n * \n * @public\n */\nexport type PostsSampleResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsFirehose\n * \n * @public\n */\nexport type PostsFirehoseResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for labelsCompliance\n * \n * @public\n */\nexport type LabelsComplianceResponse = Schemas.TweetLabelStreamResponse;\n/**\n * Response for likesCompliance\n * \n * @public\n */\nexport type LikesComplianceResponse = Schemas.LikesComplianceStreamResponse;\n/**\n * Response for likesSample10\n * \n * @public\n */\nexport type LikesSample10Response = Schemas.StreamingLikeResponseV2;\n/**\n * Response for postsFirehosePt\n * \n * @public\n */\nexport type PostsFirehosePtResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsFirehoseEn\n * \n * @public\n */\nexport type PostsFirehoseEnResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for posts\n * \n * @public\n */\nexport type PostsResponse = Schemas.FilteredStreamingTweetResponse;\n/**\n * Response for getRules\n * \n * @public\n */\nexport type GetRulesResponse = Schemas.RulesLookupResponse;\n/**\n * Request for updateRules\n * \n * @public\n */\nexport type UpdateRulesRequest = Schemas.AddOrDeleteRulesRequest;\n/**\n * Response for updateRules\n * \n * @public\n */\nexport type UpdateRulesResponse = Schemas.AddOrDeleteRulesResponse;\n/**\n * Response for postsCompliance\n * \n * @public\n */\nexport type PostsComplianceResponse = Schemas.TweetComplianceStreamResponse;\n/**\n * Response for postsFirehoseKo\n * \n * @public\n */\nexport type PostsFirehoseKoResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for likesFirehose\n * \n * @public\n */\nexport type LikesFirehoseResponse = Schemas.StreamingLikeResponseV2;\n/**\n * Response for postsSample10\n * \n * @public\n */\nexport type PostsSample10Response = Schemas.Get2TweetsSample10StreamResponse;\n/**\n * Response for postsFirehoseJa\n * \n * @public\n */\nexport type PostsFirehoseJaResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for getRuleCounts\n * \n * @public\n */\nexport type GetRuleCountsResponse = Schemas.Get2TweetsSearchStreamRulesCountsResponse;\n/**\n * Response for usersCompliance\n * \n * @public\n */\nexport type UsersComplianceResponse = Schemas.UserComplianceStreamResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Pagination utilities for the X API.\n * \n * This module provides comprehensive pagination support for the X API, including\n * automatic iteration, manual page control, and metadata access.\n * \n * @category Pagination\n */\n\n/**\n * Paginated response interface\n * \n * Represents the structure of a paginated API response from the X API.\n * \n * @template T - The type of items in the response\n */\nexport interface PaginatedResponse {\n /** Array of items in the current page */\n data: T[];\n /** Pagination metadata */\n meta?: {\n /** Number of results in the current page */\n result_count?: number;\n /** Token for fetching the next page */\n next_token?: string;\n /** Token for fetching the previous page */\n previous_token?: string;\n };\n /** Additional included objects (users, tweets, etc.) */\n includes?: Record;\n /** Any errors in the response */\n errors?: Array;\n}\n\n\n/**\n * X API paginator with rich functionality\n * \n * This class provides comprehensive pagination support for the X API, including:\n * - Automatic iteration with `for await...of` loops\n * - Manual page control with `fetchNext()` and `fetchPrevious()`\n * - Metadata access for pagination tokens and counts\n * - Error handling and rate limit detection\n * - Support for both forward and backward pagination\n * \n * @template T - The type of items being paginated\n * \n * @example\n * ```typescript\n * // Automatic iteration\n * const followers = await client.users.getFollowers('783214');\n * for await (const follower of followers) {\n * console.log(follower.username);\n * }\n * \n * // Manual control\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext();\n * console.log(followers.items.length); // Number of followers\n * console.log(followers.meta.next_token); // Next page token\n * \n * // Check status\n * if (!followers.done) {\n * await followers.fetchNext();\n * }\n * ```\n * \n * @category Pagination\n */\nexport class Paginator implements AsyncIterable {\n private fetchPage: (token?: string) => Promise>;\n private currentToken?: string;\n private previousToken?: string;\n private hasMore: boolean = true;\n private isDone: boolean = false;\n private allItems: T[] = [];\n private currentMeta?: any;\n private currentIncludes?: Record;\n private currentErrors?: Array;\n private rateLimitHit: boolean = false;\n\n /**\n * Creates a new paginator instance\n * \n * @param fetchPage - Function that fetches a page of data given a pagination token\n */\n constructor(fetchPage: (token?: string) => Promise>) {\n this.fetchPage = fetchPage;\n }\n\n /**\n * Get all fetched items\n */\n get items(): T[] {\n return [...this.allItems];\n }\n\n /**\n * Get current pagination metadata\n */\n get meta(): any {\n return this.currentMeta;\n }\n\n /**\n * Get current includes data\n */\n get includes(): Record | undefined {\n return this.currentIncludes;\n }\n\n /**\n * Get current errors\n */\n get errors(): Array | undefined {\n return this.currentErrors;\n }\n\n /**\n * Check if pagination is done\n */\n get done(): boolean {\n return this.isDone || this.rateLimitHit;\n }\n\n /**\n * Check if rate limit was hit\n */\n get rateLimited(): boolean {\n return this.rateLimitHit;\n }\n\n /**\n * Fetch the next page and add items to current instance\n * \n * This method fetches the next page of data and appends the items to the\n * current paginator instance. It updates the pagination state and metadata.\n * \n * @example\n * ```typescript\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext(); // Fetch first page\n * console.log(followers.items.length); // Number of followers\n * \n * if (!followers.done) {\n * await followers.fetchNext(); // Fetch second page\n * console.log(followers.items.length); // Total followers across pages\n * }\n * ```\n * \n * @throws {Error} When the API request fails\n */\n async fetchNext(): Promise {\n if (this.done) {\n return;\n }\n\n try {\n const response = await this.fetchPage(this.currentToken);\n \n // Update tokens\n this.previousToken = this.currentToken;\n this.currentToken = response.meta?.next_token;\n \n // Update state\n this.hasMore = !!this.currentToken;\n this.isDone = !this.hasMore;\n \n // Add new items to collection\n if (response.data) {\n this.allItems.push(...response.data);\n }\n \n // Update metadata\n this.currentMeta = response.meta;\n this.currentIncludes = response.includes;\n this.currentErrors = response.errors;\n \n } catch (error: any) {\n // Check if it's a rate limit error\n if (error.status === 429 || error.message?.includes('rate limit')) {\n this.rateLimitHit = true;\n }\n throw error;\n }\n }\n\n /**\n * Get next page as a new instance\n * \n * This method creates a new paginator instance that starts from the next page,\n * without affecting the current paginator's state.\n * \n * @example\n * ```typescript\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext(); // Fetch first page\n * \n * if (!followers.done) {\n * const nextPage = await followers.next(); // Get next page as new instance\n * console.log(followers.items.length); // Still first page\n * console.log(nextPage.items.length); // Second page\n * }\n * ```\n * \n * @returns New paginator instance for the next page\n */\n async next(): Promise> {\n if (this.done) {\n return new Paginator(this.fetchPage);\n }\n\n const nextPaginator = new Paginator(this.fetchPage);\n nextPaginator.currentToken = this.currentToken;\n await nextPaginator.fetchNext();\n return nextPaginator;\n }\n\n /**\n * Fetch previous page (if supported)\n */\n async fetchPrevious(): Promise {\n if (!this.previousToken) {\n return;\n }\n\n try {\n const response = await this.fetchPage(this.previousToken);\n \n // Update tokens\n this.currentToken = this.previousToken;\n this.previousToken = response.meta?.previous_token;\n \n // Update state\n this.hasMore = !!this.currentToken;\n this.isDone = !this.hasMore;\n \n // Replace items with previous page items\n this.allItems = response.data || [];\n \n // Update metadata\n this.currentMeta = response.meta;\n this.currentIncludes = response.includes;\n this.currentErrors = response.errors;\n \n } catch (error: any) {\n if (error.status === 429 || error.message?.includes('rate limit')) {\n this.rateLimitHit = true;\n }\n throw error;\n }\n }\n\n /**\n * Get previous page as a new instance\n */\n async previous(): Promise> {\n if (!this.previousToken) {\n return new Paginator(this.fetchPage);\n }\n\n const prevPaginator = new Paginator(this.fetchPage);\n prevPaginator.currentToken = this.previousToken;\n await prevPaginator.fetchNext();\n return prevPaginator;\n }\n\n /**\n * Fetch up to a specified number of additional items\n */\n async fetchLast(count: number): Promise {\n let fetched = 0;\n \n while (!this.done && fetched < count) {\n const beforeCount = this.allItems.length;\n await this.fetchNext();\n const afterCount = this.allItems.length;\n fetched += (afterCount - beforeCount);\n }\n }\n\n /**\n * Reset paginator to initial state\n */\n reset(): void {\n this.currentToken = undefined;\n this.previousToken = undefined;\n this.hasMore = true;\n this.isDone = false;\n this.allItems = [];\n this.currentMeta = undefined;\n this.currentIncludes = undefined;\n this.currentErrors = undefined;\n this.rateLimitHit = false;\n }\n\n /**\n * Iterator for all fetched items\n */\n *[Symbol.iterator](): Iterator {\n for (const item of this.allItems) {\n yield item;\n }\n }\n\n /**\n * Async iterator that fetches pages automatically\n */\n async *[Symbol.asyncIterator](): AsyncIterator {\n let lastYieldedIndex = 0;\n \n // First, yield all currently fetched items\n for (let i = lastYieldedIndex; i < this.allItems.length; i++) {\n yield this.allItems[i];\n }\n lastYieldedIndex = this.allItems.length;\n\n // Then continue fetching and yielding new items\n while (!this.done) {\n await this.fetchNext();\n \n // Yield only new items since last iteration\n for (let i = lastYieldedIndex; i < this.allItems.length; i++) {\n yield this.allItems[i];\n }\n lastYieldedIndex = this.allItems.length;\n }\n }\n}\n\n/**\n * Specialized paginators for different data types\n */\n\n/**\n * Paginator for posts\n */\nexport class PostPaginator extends Paginator {\n get posts(): any[] {\n return this.items;\n }\n}\n\n/**\n * Paginator for users\n */\nexport class UserPaginator extends Paginator {\n get users(): any[] {\n return this.items;\n }\n}\n\n\n\n/**\n * Paginator for events (like DM events)\n */\nexport class EventPaginator extends Paginator {\n get events(): any[] {\n return this.items;\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * X API SDK\n *\n * A modern TypeScript/JavaScript SDK for interacting with the X API.\n * Built with full TypeScript support, React hooks, and Next.js integration.\n */\n\n// Automatic polyfill setup for Node.js environments\nif (typeof process !== 'undefined' && process.versions && process.versions.node) {\n // Node.js environment - set up polyfills if needed\n if (typeof globalThis.fetch === 'undefined' || typeof globalThis.Headers === 'undefined') {\n try {\n // Try to use native Node.js fetch (Node 18+)\n if (typeof globalThis.fetch === 'function' && typeof globalThis.Headers === 'function') {\n // Native APIs are available, no polyfills needed\n } else {\n // Need to set up polyfills for older Node.js versions\n const nodeFetch = require('node-fetch');\n const { Headers: NodeHeaders } = nodeFetch;\n \n if (typeof globalThis.fetch === 'undefined') {\n (globalThis as any).fetch = nodeFetch.default || nodeFetch;\n }\n if (typeof globalThis.Headers === 'undefined') {\n (globalThis as any).Headers = NodeHeaders;\n }\n }\n } catch (error) {\n // If node-fetch is not available, provide a helpful error\n console.warn(\n 'X API SDK: node-fetch not found. For Node.js environments, please install node-fetch:\\n' +\n 'npm install node-fetch\\n' +\n 'Or upgrade to Node.js 18+ for native fetch support.'\n );\n }\n }\n}\n\n// Main client\nexport { Client } from './client.js';\nexport type { ClientConfig } from './client.js';\n\n// Error handling\nexport { ApiError } from './client.js';\nexport type { RequestOptions, ApiResponse, PaginationMeta } from './client.js';\n\n// HTTP client\nexport { httpClient, HttpClient } from './http-client.js';\nexport type { RequestOptions as HttpClientRequestOptions, HttpResponse } from './http-client.js';\n\n// Authentication\nexport { OAuth2 } from './oauth2_auth.js';\nexport type { OAuth2Config, OAuth2Token } from './oauth2_auth.js';\nexport { OAuth1 } from './oauth1_auth.js';\nexport type { OAuth1Config, OAuth1RequestToken, OAuth1AccessToken } from './oauth1_auth.js';\n\n// Crypto utilities\nexport { CryptoUtils, hmacSha1, generateNonce, generateTimestamp, generateCodeVerifier, generateCodeChallenge } from './crypto_utils.js';\n\n// Streaming\nexport type { StreamListener, TweetStreamListener } from './stream_listener.js';\n\n// Schema types (export all OpenAPI schema types)\nexport * as Schemas from './schemas.js';\n\n// Client modules (export client classes and types)\n\nexport { NewsClient } from './news/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as News from './news/models.js';\n\nexport { UsersClient } from './users/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Users from './users/models.js';\n\nexport { DirectMessagesClient } from './direct_messages/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as DirectMessages from './direct_messages/models.js';\n\nexport { CommunityNotesClient } from './community_notes/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as CommunityNotes from './community_notes/models.js';\n\nexport { PostsClient } from './posts/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Posts from './posts/models.js';\n\nexport { TrendsClient } from './trends/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Trends from './trends/models.js';\n\nexport { ActivityClient } from './activity/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Activity from './activity/models.js';\n\nexport { UsageClient } from './usage/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Usage from './usage/models.js';\n\nexport { SpacesClient } from './spaces/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Spaces from './spaces/models.js';\n\nexport { CommunitiesClient } from './communities/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Communities from './communities/models.js';\n\nexport { ConnectionsClient } from './connections/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Connections from './connections/models.js';\n\nexport { MediaClient } from './media/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Media from './media/models.js';\n\nexport { ListsClient } from './lists/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Lists from './lists/models.js';\n\nexport { ComplianceClient } from './compliance/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Compliance from './compliance/models.js';\n\nexport { GeneralClient } from './general/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as General from './general/models.js';\n\nexport { AccountActivityClient } from './account_activity/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as AccountActivity from './account_activity/models.js';\n\nexport { StreamClient } from './stream/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Stream from './stream/models.js';\n\nexport { WebhooksClient } from './webhooks/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Webhooks from './webhooks/models.js';\n\n\n// Utilities\nexport * from './paginator.js'; "]} \ No newline at end of file +{"version":3,"sources":["../node_modules/data-uri-to-buffer/src/index.ts","../node_modules/web-streams-polyfill/src/utils.ts","../node_modules/web-streams-polyfill/src/lib/helpers/miscellaneous.ts","../node_modules/web-streams-polyfill/src/lib/helpers/webidl.ts","../node_modules/web-streams-polyfill/src/lib/simple-queue.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/internal-methods.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/generic-reader.ts","../node_modules/web-streams-polyfill/src/stub/number-isfinite.ts","../node_modules/web-streams-polyfill/src/stub/math-trunc.ts","../node_modules/web-streams-polyfill/src/lib/validators/basic.ts","../node_modules/web-streams-polyfill/src/lib/validators/readable-stream.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/default-reader.ts","../node_modules/web-streams-polyfill/src/target/es2018/stub/async-iterator-prototype.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/async-iterator.ts","../node_modules/web-streams-polyfill/src/stub/number-isnan.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/ecmascript.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/miscellaneous.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/queue-with-sizes.ts","../node_modules/web-streams-polyfill/src/lib/helpers/array-buffer-view.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/byte-stream-controller.ts","../node_modules/web-streams-polyfill/src/lib/validators/reader-options.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/byob-reader.ts","../node_modules/web-streams-polyfill/src/lib/abstract-ops/queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/underlying-sink.ts","../node_modules/web-streams-polyfill/src/lib/validators/writable-stream.ts","../node_modules/web-streams-polyfill/src/lib/abort-signal.ts","../node_modules/web-streams-polyfill/src/lib/writable-stream.ts","../node_modules/web-streams-polyfill/src/globals.ts","../node_modules/web-streams-polyfill/src/stub/dom-exception.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/pipe.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/default-controller.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/tee.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/readable-stream-like.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream/from.ts","../node_modules/web-streams-polyfill/src/lib/validators/underlying-source.ts","../node_modules/web-streams-polyfill/src/lib/validators/iterator-options.ts","../node_modules/web-streams-polyfill/src/lib/validators/pipe-options.ts","../node_modules/web-streams-polyfill/src/lib/validators/readable-writable-pair.ts","../node_modules/web-streams-polyfill/src/lib/readable-stream.ts","../node_modules/web-streams-polyfill/src/lib/validators/queuing-strategy-init.ts","../node_modules/web-streams-polyfill/src/lib/byte-length-queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/count-queuing-strategy.ts","../node_modules/web-streams-polyfill/src/lib/validators/transformer.ts","../node_modules/web-streams-polyfill/src/lib/transform-stream.ts","../node_modules/fetch-blob/streams.cjs","../node_modules/fetch-blob/index.js","../node_modules/fetch-blob/file.js","../node_modules/formdata-polyfill/esm.min.js","../node_modules/node-fetch/src/errors/base.js","../node_modules/node-fetch/src/errors/fetch-error.js","../node_modules/node-fetch/src/utils/is.js","../node_modules/node-domexception/index.js","../node_modules/fetch-blob/from.js","../node_modules/node-fetch/src/utils/multipart-parser.js","../node_modules/node-fetch/src/body.js","../node_modules/node-fetch/src/headers.js","../node_modules/node-fetch/src/utils/is-redirect.js","../node_modules/node-fetch/src/response.js","../node_modules/node-fetch/src/utils/get-search.js","../node_modules/node-fetch/src/utils/referrer.js","../node_modules/node-fetch/src/request.js","../node_modules/node-fetch/src/errors/abort-error.js","../node_modules/node-fetch/src/index.js","../src/http-client.ts","../src/activity/client.ts","../src/activity/models.ts","../src/news/client.ts","../src/news/models.ts","../src/connections/client.ts","../src/connections/models.ts","../src/account_activity/client.ts","../src/account_activity/models.ts","../src/spaces/client.ts","../src/spaces/models.ts","../src/trends/client.ts","../src/trends/models.ts","../src/media/client.ts","../src/media/models.ts","../src/direct_messages/client.ts","../src/direct_messages/models.ts","../src/posts/client.ts","../src/posts/models.ts","../src/lists/client.ts","../src/lists/models.ts","../src/community_notes/client.ts","../src/community_notes/models.ts","../src/general/client.ts","../src/general/models.ts","../src/webhooks/client.ts","../src/webhooks/models.ts","../src/users/client.ts","../src/users/models.ts","../src/communities/client.ts","../src/communities/models.ts","../src/stream/event_driven_stream.ts","../src/stream/stream_client.ts","../src/compliance/client.ts","../src/compliance/models.ts","../src/usage/client.ts","../src/usage/models.ts","../src/client.ts","../src/crypto_utils.ts","../src/oauth2_auth.ts","../src/oauth1_auth.ts","../src/schemas.ts","../src/stream/models.ts","../src/paginator.ts","../src/index.ts"],"names":["i","noop","x","_a","F","e","queueMicrotask","r","isAbortSignal","streamBrandCheckException","defaultControllerBrandCheckException","DOMException","ReadableStream","POOL_SIZE","process","Blob","clone","size","File","f","FormData","m","stat","Body","clear","Buffer","toFormData","types","Headers","INTERNALS","deprecate","fetch","http","Stream","PassThrough","response","s","models_exports","crypto"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaM,SAAU,gBAAgB,KAAW;AAC1C,MAAI,CAAC,UAAU,KAAK,GAAG,GAAG;AACzB,UAAM,IAAI,UACT,kEAAkE;;AAKpE,QAAM,IAAI,QAAQ,UAAU,EAAE;AAG9B,QAAM,aAAa,IAAI,QAAQ,GAAG;AAClC,MAAI,eAAe,MAAM,cAAc,GAAG;AACzC,UAAM,IAAI,UAAU,qBAAqB;;AA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AAY,YAAY;AAAA,MAExF,OAAO;AAEL,cAAM,YAAY;AAClB,cAAM,EAAE,SAAS,YAAY,IAAI;AAEjC,YAAI,OAAO,WAAW,UAAU,aAAa;AAC3C,UAAC,WAAmB,QAAQ,UAAU,WAAW;AAAA,QACnD;AACA,YAAI,OAAO,WAAW,YAAY,aAAa;AAC7C,UAAC,WAAmB,UAAU;AAAA,QAChC;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AAEd,cAAQ;AAAA,QACN;AAAA,MAGF;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["export interface MimeBuffer extends Buffer {\n\ttype: string;\n\ttypeFull: string;\n\tcharset: string;\n}\n\n/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @param {String} uri Data URI to turn into a Buffer instance\n * @returns {Buffer} Buffer instance from Data URI\n * @api public\n */\nexport function dataUriToBuffer(uri: string): MimeBuffer {\n\tif (!/^data:/i.test(uri)) {\n\t\tthrow new TypeError(\n\t\t\t'`uri` does not appear to be a Data URI (must begin with \"data:\")'\n\t\t);\n\t}\n\n\t// strip newlines\n\turi = uri.replace(/\\r?\\n/g, '');\n\n\t// split the URI up into the \"metadata\" and the \"data\" portions\n\tconst firstComma = uri.indexOf(',');\n\tif (firstComma === -1 || firstComma <= 4) {\n\t\tthrow new TypeError('malformed data: URI');\n\t}\n\n\t// remove the \"data:\" scheme and parse the metadata\n\tconst meta = uri.substring(5, firstComma).split(';');\n\n\tlet charset = '';\n\tlet base64 = false;\n\tconst type = meta[0] || 'text/plain';\n\tlet typeFull = type;\n\tfor (let i = 1; i < meta.length; i++) {\n\t\tif (meta[i] === 'base64') {\n\t\t\tbase64 = true;\n\t\t} else if(meta[i]) {\n\t\t\ttypeFull += `;${ meta[i]}`;\n\t\t\tif (meta[i].indexOf('charset=') === 0) {\n\t\t\t\tcharset = meta[i].substring(8);\n\t\t\t}\n\t\t}\n\t}\n\t// defaults to US-ASCII only if type is not provided\n\tif (!meta[0] && !charset.length) {\n\t\ttypeFull += ';charset=US-ASCII';\n\t\tcharset = 'US-ASCII';\n\t}\n\n\t// get the encoded data portion and decode URI-encoded chars\n\tconst encoding = base64 ? 'base64' : 'ascii';\n\tconst data = unescape(uri.substring(firstComma + 1));\n\tconst buffer = Buffer.from(data, encoding) as MimeBuffer;\n\n\t// set `.type` and `.typeFull` properties to MIME type\n\tbuffer.type = type;\n\tbuffer.typeFull = typeFull;\n\n\t// set the `.charset` property\n\tbuffer.charset = charset;\n\n\treturn buffer;\n}\n\nexport default dataUriToBuffer;\n","export function noop(): undefined {\n return undefined;\n}\n","import { noop } from '../../utils';\nimport { AssertionError } from '../../stub/assert';\n\nexport function typeIsObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport const rethrowAssertionErrorRejection: (e: any) => void =\n DEBUG ? e => {\n // Used throughout the reference implementation, as `.catch(rethrowAssertionErrorRejection)`, to ensure any errors\n // get shown. There are places in the spec where we do promise transformations and purposefully ignore or don't\n // expect any errors, but assertion errors are always problematic.\n if (e && e instanceof AssertionError) {\n setTimeout(() => {\n throw e;\n }, 0);\n }\n } : noop;\n\nexport function setFunctionName(fn: Function, name: string): void {\n try {\n Object.defineProperty(fn, 'name', {\n value: name,\n configurable: true\n });\n } catch {\n // This property is non-configurable in older browsers, so ignore if this throws.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#browser_compatibility\n }\n}\n","import { rethrowAssertionErrorRejection } from './miscellaneous';\nimport assert from '../../stub/assert';\n\nconst originalPromise = Promise;\nconst originalPromiseThen = Promise.prototype.then;\nconst originalPromiseReject = Promise.reject.bind(originalPromise);\n\n// https://webidl.spec.whatwg.org/#a-new-promise\nexport function newPromise(executor: (\n resolve: (value: T | PromiseLike) => void,\n reject: (reason?: any) => void\n) => void): Promise {\n return new originalPromise(executor);\n}\n\n// https://webidl.spec.whatwg.org/#a-promise-resolved-with\nexport function promiseResolvedWith(value: T | PromiseLike): Promise {\n return newPromise(resolve => resolve(value));\n}\n\n// https://webidl.spec.whatwg.org/#a-promise-rejected-with\nexport function promiseRejectedWith(reason: any): Promise {\n return originalPromiseReject(reason);\n}\n\nexport function PerformPromiseThen(\n promise: Promise,\n onFulfilled?: (value: T) => TResult1 | PromiseLike,\n onRejected?: (reason: any) => TResult2 | PromiseLike): Promise {\n // There doesn't appear to be any way to correctly emulate the behaviour from JavaScript, so this is just an\n // approximation.\n return originalPromiseThen.call(promise, onFulfilled, onRejected) as Promise;\n}\n\n// Bluebird logs a warning when a promise is created within a fulfillment handler, but then isn't returned\n// from that handler. To prevent this, return null instead of void from all handlers.\n// http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-created-in-a-handler-but-was-not-returned-from-it\nexport function uponPromise(\n promise: Promise,\n onFulfilled?: (value: T) => null | PromiseLike,\n onRejected?: (reason: any) => null | PromiseLike): void {\n PerformPromiseThen(\n PerformPromiseThen(promise, onFulfilled, onRejected),\n undefined,\n rethrowAssertionErrorRejection\n );\n}\n\nexport function uponFulfillment(promise: Promise, onFulfilled: (value: T) => null | PromiseLike): void {\n uponPromise(promise, onFulfilled);\n}\n\nexport function uponRejection(promise: Promise, onRejected: (reason: any) => null | PromiseLike): void {\n uponPromise(promise, undefined, onRejected);\n}\n\nexport function transformPromiseWith(\n promise: Promise,\n fulfillmentHandler?: (value: T) => TResult1 | PromiseLike,\n rejectionHandler?: (reason: any) => TResult2 | PromiseLike): Promise {\n return PerformPromiseThen(promise, fulfillmentHandler, rejectionHandler);\n}\n\nexport function setPromiseIsHandledToTrue(promise: Promise): void {\n PerformPromiseThen(promise, undefined, rethrowAssertionErrorRejection);\n}\n\nlet _queueMicrotask: (callback: () => void) => void = callback => {\n if (typeof queueMicrotask === 'function') {\n _queueMicrotask = queueMicrotask;\n } else {\n const resolvedPromise = promiseResolvedWith(undefined);\n _queueMicrotask = cb => PerformPromiseThen(resolvedPromise, cb);\n }\n return _queueMicrotask(callback);\n};\n\nexport { _queueMicrotask as queueMicrotask };\n\nexport function reflectCall(F: (this: T, ...fnArgs: A) => R, V: T, args: A): R {\n if (typeof F !== 'function') {\n throw new TypeError('Argument is not a function');\n }\n return Function.prototype.apply.call(F, V, args);\n}\n\nexport function promiseCall(F: (this: T, ...fnArgs: A) => R | PromiseLike,\n V: T,\n args: A): Promise {\n assert(typeof F === 'function');\n assert(V !== undefined);\n assert(Array.isArray(args));\n try {\n return promiseResolvedWith(reflectCall(F, V, args));\n } catch (value) {\n return promiseRejectedWith(value);\n }\n}\n","import assert from '../stub/assert';\n\n// Original from Chromium\n// https://chromium.googlesource.com/chromium/src/+/0aee4434a4dba42a42abaea9bfbc0cd196a63bc1/third_party/blink/renderer/core/streams/SimpleQueue.js\n\nconst QUEUE_MAX_ARRAY_SIZE = 16384;\n\ninterface Node {\n _elements: T[];\n _next: Node | undefined;\n}\n\n/**\n * Simple queue structure.\n *\n * Avoids scalability issues with using a packed array directly by using\n * multiple arrays in a linked list and keeping the array size bounded.\n */\nexport class SimpleQueue {\n private _front: Node;\n private _back: Node;\n private _cursor = 0;\n private _size = 0;\n\n constructor() {\n // _front and _back are always defined.\n this._front = {\n _elements: [],\n _next: undefined\n };\n this._back = this._front;\n // The cursor is used to avoid calling Array.shift().\n // It contains the index of the front element of the array inside the\n // front-most node. It is always in the range [0, QUEUE_MAX_ARRAY_SIZE).\n this._cursor = 0;\n // When there is only one node, size === elements.length - cursor.\n this._size = 0;\n }\n\n get length(): number {\n return this._size;\n }\n\n // For exception safety, this method is structured in order:\n // 1. Read state\n // 2. Calculate required state mutations\n // 3. Perform state mutations\n push(element: T): void {\n const oldBack = this._back;\n let newBack = oldBack;\n assert(oldBack._next === undefined);\n if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) {\n newBack = {\n _elements: [],\n _next: undefined\n };\n }\n\n // push() is the mutation most likely to throw an exception, so it\n // goes first.\n oldBack._elements.push(element);\n if (newBack !== oldBack) {\n this._back = newBack;\n oldBack._next = newBack;\n }\n ++this._size;\n }\n\n // Like push(), shift() follows the read -> calculate -> mutate pattern for\n // exception safety.\n shift(): T {\n assert(this._size > 0); // must not be called on an empty queue\n\n const oldFront = this._front;\n let newFront = oldFront;\n const oldCursor = this._cursor;\n let newCursor = oldCursor + 1;\n\n const elements = oldFront._elements;\n const element = elements[oldCursor];\n\n if (newCursor === QUEUE_MAX_ARRAY_SIZE) {\n assert(elements.length === QUEUE_MAX_ARRAY_SIZE);\n assert(oldFront._next !== undefined);\n newFront = oldFront._next!;\n newCursor = 0;\n }\n\n // No mutations before this point.\n --this._size;\n this._cursor = newCursor;\n if (oldFront !== newFront) {\n this._front = newFront;\n }\n\n // Permit shifted element to be garbage collected.\n elements[oldCursor] = undefined!;\n\n return element;\n }\n\n // The tricky thing about forEach() is that it can be called\n // re-entrantly. The queue may be mutated inside the callback. It is easy to\n // see that push() within the callback has no negative effects since the end\n // of the queue is checked for on every iteration. If shift() is called\n // repeatedly within the callback then the next iteration may return an\n // element that has been removed. In this case the callback will be called\n // with undefined values until we either \"catch up\" with elements that still\n // exist or reach the back of the queue.\n forEach(callback: (element: T) => void): void {\n let i = this._cursor;\n let node = this._front;\n let elements = node._elements;\n while (i !== elements.length || node._next !== undefined) {\n if (i === elements.length) {\n assert(node._next !== undefined);\n assert(i === QUEUE_MAX_ARRAY_SIZE);\n node = node._next!;\n elements = node._elements;\n i = 0;\n if (elements.length === 0) {\n break;\n }\n }\n callback(elements[i]);\n ++i;\n }\n }\n\n // Return the element that would be returned if shift() was called now,\n // without modifying the queue.\n peek(): T {\n assert(this._size > 0); // must not be called on an empty queue\n\n const front = this._front;\n const cursor = this._cursor;\n return front._elements[cursor];\n }\n}\n","export const AbortSteps = Symbol('[[AbortSteps]]');\nexport const ErrorSteps = Symbol('[[ErrorSteps]]');\nexport const CancelSteps = Symbol('[[CancelSteps]]');\nexport const PullSteps = Symbol('[[PullSteps]]');\nexport const ReleaseSteps = Symbol('[[ReleaseSteps]]');\n","import assert from '../../stub/assert';\nimport { ReadableStream, ReadableStreamCancel, type ReadableStreamReader } from '../readable-stream';\nimport { newPromise, setPromiseIsHandledToTrue } from '../helpers/webidl';\nimport { ReleaseSteps } from '../abstract-ops/internal-methods';\n\nexport function ReadableStreamReaderGenericInitialize(reader: ReadableStreamReader, stream: ReadableStream) {\n reader._ownerReadableStream = stream;\n stream._reader = reader;\n\n if (stream._state === 'readable') {\n defaultReaderClosedPromiseInitialize(reader);\n } else if (stream._state === 'closed') {\n defaultReaderClosedPromiseInitializeAsResolved(reader);\n } else {\n assert(stream._state === 'errored');\n\n defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);\n }\n}\n\n// A client of ReadableStreamDefaultReader and ReadableStreamBYOBReader may use these functions directly to bypass state\n// check.\n\nexport function ReadableStreamReaderGenericCancel(reader: ReadableStreamReader, reason: any): Promise {\n const stream = reader._ownerReadableStream;\n assert(stream !== undefined);\n return ReadableStreamCancel(stream, reason);\n}\n\nexport function ReadableStreamReaderGenericRelease(reader: ReadableStreamReader) {\n const stream = reader._ownerReadableStream;\n assert(stream !== undefined);\n assert(stream._reader === reader);\n\n if (stream._state === 'readable') {\n defaultReaderClosedPromiseReject(\n reader,\n new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));\n } else {\n defaultReaderClosedPromiseResetToRejected(\n reader,\n new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`));\n }\n\n stream._readableStreamController[ReleaseSteps]();\n\n stream._reader = undefined;\n reader._ownerReadableStream = undefined!;\n}\n\n// Helper functions for the readers.\n\nexport function readerLockException(name: string): TypeError {\n return new TypeError('Cannot ' + name + ' a stream using a released reader');\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nexport function defaultReaderClosedPromiseInitialize(reader: ReadableStreamReader) {\n reader._closedPromise = newPromise((resolve, reject) => {\n reader._closedPromise_resolve = resolve;\n reader._closedPromise_reject = reject;\n });\n}\n\nexport function defaultReaderClosedPromiseInitializeAsRejected(reader: ReadableStreamReader, reason: any) {\n defaultReaderClosedPromiseInitialize(reader);\n defaultReaderClosedPromiseReject(reader, reason);\n}\n\nexport function defaultReaderClosedPromiseInitializeAsResolved(reader: ReadableStreamReader) {\n defaultReaderClosedPromiseInitialize(reader);\n defaultReaderClosedPromiseResolve(reader);\n}\n\nexport function defaultReaderClosedPromiseReject(reader: ReadableStreamReader, reason: any) {\n if (reader._closedPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(reader._closedPromise);\n reader._closedPromise_reject(reason);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n\nexport function defaultReaderClosedPromiseResetToRejected(reader: ReadableStreamReader, reason: any) {\n assert(reader._closedPromise_resolve === undefined);\n assert(reader._closedPromise_reject === undefined);\n\n defaultReaderClosedPromiseInitializeAsRejected(reader, reason);\n}\n\nexport function defaultReaderClosedPromiseResolve(reader: ReadableStreamReader) {\n if (reader._closedPromise_resolve === undefined) {\n return;\n }\n\n reader._closedPromise_resolve(undefined);\n reader._closedPromise_resolve = undefined;\n reader._closedPromise_reject = undefined;\n}\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite#Polyfill\nconst NumberIsFinite: typeof Number.isFinite = Number.isFinite || function (x) {\n return typeof x === 'number' && isFinite(x);\n};\n\nexport default NumberIsFinite;\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc#Polyfill\nconst MathTrunc: typeof Math.trunc = Math.trunc || function (v) {\n return v < 0 ? Math.ceil(v) : Math.floor(v);\n};\n\nexport default MathTrunc;\n","import NumberIsFinite from '../../stub/number-isfinite';\nimport MathTrunc from '../../stub/math-trunc';\n\n// https://heycam.github.io/webidl/#idl-dictionaries\nexport function isDictionary(x: any): x is object | null {\n return typeof x === 'object' || typeof x === 'function';\n}\n\nexport function assertDictionary(obj: unknown,\n context: string): asserts obj is object | null | undefined {\n if (obj !== undefined && !isDictionary(obj)) {\n throw new TypeError(`${context} is not an object.`);\n }\n}\n\nexport type AnyFunction = (...args: any[]) => any;\n\n// https://heycam.github.io/webidl/#idl-callback-functions\nexport function assertFunction(x: unknown, context: string): asserts x is AnyFunction {\n if (typeof x !== 'function') {\n throw new TypeError(`${context} is not a function.`);\n }\n}\n\n// https://heycam.github.io/webidl/#idl-object\nexport function isObject(x: any): x is object {\n return (typeof x === 'object' && x !== null) || typeof x === 'function';\n}\n\nexport function assertObject(x: unknown,\n context: string): asserts x is object {\n if (!isObject(x)) {\n throw new TypeError(`${context} is not an object.`);\n }\n}\n\nexport function assertRequiredArgument(x: T | undefined,\n position: number,\n context: string): asserts x is T {\n if (x === undefined) {\n throw new TypeError(`Parameter ${position} is required in '${context}'.`);\n }\n}\n\nexport function assertRequiredField(x: T | undefined,\n field: string,\n context: string): asserts x is T {\n if (x === undefined) {\n throw new TypeError(`${field} is required in '${context}'.`);\n }\n}\n\n// https://heycam.github.io/webidl/#idl-unrestricted-double\nexport function convertUnrestrictedDouble(value: unknown): number {\n return Number(value);\n}\n\nfunction censorNegativeZero(x: number): number {\n return x === 0 ? 0 : x;\n}\n\nfunction integerPart(x: number): number {\n return censorNegativeZero(MathTrunc(x));\n}\n\n// https://heycam.github.io/webidl/#idl-unsigned-long-long\nexport function convertUnsignedLongLongWithEnforceRange(value: unknown, context: string): number {\n const lowerBound = 0;\n const upperBound = Number.MAX_SAFE_INTEGER;\n\n let x = Number(value);\n x = censorNegativeZero(x);\n\n if (!NumberIsFinite(x)) {\n throw new TypeError(`${context} is not a finite number`);\n }\n\n x = integerPart(x);\n\n if (x < lowerBound || x > upperBound) {\n throw new TypeError(`${context} is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`);\n }\n\n if (!NumberIsFinite(x) || x === 0) {\n return 0;\n }\n\n // TODO Use BigInt if supported?\n // let xBigInt = BigInt(integerPart(x));\n // xBigInt = BigInt.asUintN(64, xBigInt);\n // return Number(xBigInt);\n\n return x;\n}\n","import { IsReadableStream, ReadableStream } from '../readable-stream';\n\nexport function assertReadableStream(x: unknown, context: string): asserts x is ReadableStream {\n if (!IsReadableStream(x)) {\n throw new TypeError(`${context} is not a ReadableStream.`);\n }\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport {\n ReadableStreamReaderGenericCancel,\n ReadableStreamReaderGenericInitialize,\n ReadableStreamReaderGenericRelease,\n readerLockException\n} from './generic-reader';\nimport { IsReadableStreamLocked, ReadableStream } from '../readable-stream';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { PullSteps } from '../abstract-ops/internal-methods';\nimport { newPromise, promiseRejectedWith } from '../helpers/webidl';\nimport { assertRequiredArgument } from '../validators/basic';\nimport { assertReadableStream } from '../validators/readable-stream';\n\n/**\n * A result returned by {@link ReadableStreamDefaultReader.read}.\n *\n * @public\n */\nexport type ReadableStreamDefaultReadResult = {\n done: false;\n value: T;\n} | {\n done: true;\n value?: undefined;\n}\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamDefaultReader(stream: ReadableStream): ReadableStreamDefaultReader {\n return new ReadableStreamDefaultReader(stream);\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamAddReadRequest(stream: ReadableStream,\n readRequest: ReadRequest): void {\n assert(IsReadableStreamDefaultReader(stream._reader));\n assert(stream._state === 'readable');\n\n (stream._reader! as ReadableStreamDefaultReader)._readRequests.push(readRequest);\n}\n\nexport function ReadableStreamFulfillReadRequest(stream: ReadableStream, chunk: R | undefined, done: boolean) {\n const reader = stream._reader as ReadableStreamDefaultReader;\n\n assert(reader._readRequests.length > 0);\n\n const readRequest = reader._readRequests.shift()!;\n if (done) {\n readRequest._closeSteps();\n } else {\n readRequest._chunkSteps(chunk!);\n }\n}\n\nexport function ReadableStreamGetNumReadRequests(stream: ReadableStream): number {\n return (stream._reader as ReadableStreamDefaultReader)._readRequests.length;\n}\n\nexport function ReadableStreamHasDefaultReader(stream: ReadableStream): boolean {\n const reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (!IsReadableStreamDefaultReader(reader)) {\n return false;\n }\n\n return true;\n}\n\n// Readers\n\nexport interface ReadRequest {\n _chunkSteps(chunk: R): void;\n\n _closeSteps(): void;\n\n _errorSteps(e: any): void;\n}\n\n/**\n * A default reader vended by a {@link ReadableStream}.\n *\n * @public\n */\nexport class ReadableStreamDefaultReader {\n /** @internal */\n _ownerReadableStream!: ReadableStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _readRequests: SimpleQueue>;\n\n constructor(stream: ReadableStream) {\n assertRequiredArgument(stream, 1, 'ReadableStreamDefaultReader');\n assertReadableStream(stream, 'First parameter');\n\n if (IsReadableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readRequests = new SimpleQueue();\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed,\n * or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n\n /**\n * Returns a promise that allows access to the next chunk from the stream's internal queue, if available.\n *\n * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.\n */\n read(): Promise> {\n if (!IsReadableStreamDefaultReader(this)) {\n return promiseRejectedWith(defaultReaderBrandCheckException('read'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('read from'));\n }\n\n let resolvePromise!: (result: ReadableStreamDefaultReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => resolvePromise({ value: chunk, done: false }),\n _closeSteps: () => resolvePromise({ value: undefined, done: true }),\n _errorSteps: e => rejectPromise(e)\n };\n ReadableStreamDefaultReaderRead(this, readRequest);\n return promise;\n }\n\n /**\n * Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.\n * If the associated stream is errored when the lock is released, the reader will appear errored in the same way\n * from now on; otherwise, the reader will appear closed.\n *\n * A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by\n * the reader's {@link ReadableStreamDefaultReader.read | read()} method has not yet been settled. Attempting to\n * do so will throw a `TypeError` and leave the reader locked to the stream.\n */\n releaseLock(): void {\n if (!IsReadableStreamDefaultReader(this)) {\n throw defaultReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n ReadableStreamDefaultReaderRelease(this);\n }\n}\n\nObject.defineProperties(ReadableStreamDefaultReader.prototype, {\n cancel: { enumerable: true },\n read: { enumerable: true },\n releaseLock: { enumerable: true },\n closed: { enumerable: true }\n});\nsetFunctionName(ReadableStreamDefaultReader.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStreamDefaultReader.prototype.read, 'read');\nsetFunctionName(ReadableStreamDefaultReader.prototype.releaseLock, 'releaseLock');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamDefaultReader.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamDefaultReader',\n configurable: true\n });\n}\n\n// Abstract operations for the readers.\n\nexport function IsReadableStreamDefaultReader(x: any): x is ReadableStreamDefaultReader {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {\n return false;\n }\n\n return x instanceof ReadableStreamDefaultReader;\n}\n\nexport function ReadableStreamDefaultReaderRead(reader: ReadableStreamDefaultReader,\n readRequest: ReadRequest): void {\n const stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n readRequest._closeSteps();\n } else if (stream._state === 'errored') {\n readRequest._errorSteps(stream._storedError);\n } else {\n assert(stream._state === 'readable');\n stream._readableStreamController[PullSteps](readRequest as ReadRequest);\n }\n}\n\nexport function ReadableStreamDefaultReaderRelease(reader: ReadableStreamDefaultReader) {\n ReadableStreamReaderGenericRelease(reader);\n const e = new TypeError('Reader was released');\n ReadableStreamDefaultReaderErrorReadRequests(reader, e);\n}\n\nexport function ReadableStreamDefaultReaderErrorReadRequests(reader: ReadableStreamDefaultReader, e: any) {\n const readRequests = reader._readRequests;\n reader._readRequests = new SimpleQueue();\n readRequests.forEach(readRequest => {\n readRequest._errorSteps(e);\n });\n}\n\n// Helper functions for the ReadableStreamDefaultReader.\n\nfunction defaultReaderBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamDefaultReader.prototype.${name} can only be used on a ReadableStreamDefaultReader`);\n}\n","/// \n\n/* eslint-disable @typescript-eslint/no-empty-function */\nexport const AsyncIteratorPrototype: AsyncIterable =\n Object.getPrototypeOf(Object.getPrototypeOf(async function* (): AsyncIterableIterator {}).prototype);\n","/// \n\nimport { ReadableStream } from '../readable-stream';\nimport {\n AcquireReadableStreamDefaultReader,\n ReadableStreamDefaultReader,\n ReadableStreamDefaultReaderRead,\n type ReadableStreamDefaultReadResult,\n type ReadRequest\n} from './default-reader';\nimport { ReadableStreamReaderGenericCancel, ReadableStreamReaderGenericRelease } from './generic-reader';\nimport assert from '../../stub/assert';\nimport { AsyncIteratorPrototype } from '@@target/stub/async-iterator-prototype';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n queueMicrotask,\n transformPromiseWith\n} from '../helpers/webidl';\n\n/**\n * An async iterator returned by {@link ReadableStream.values}.\n *\n * @public\n */\nexport interface ReadableStreamAsyncIterator extends AsyncIterableIterator {\n next(): Promise>;\n\n return(value?: any): Promise>;\n}\n\nexport class ReadableStreamAsyncIteratorImpl {\n private readonly _reader: ReadableStreamDefaultReader;\n private readonly _preventCancel: boolean;\n private _ongoingPromise: Promise> | undefined = undefined;\n private _isFinished = false;\n\n constructor(reader: ReadableStreamDefaultReader, preventCancel: boolean) {\n this._reader = reader;\n this._preventCancel = preventCancel;\n }\n\n next(): Promise> {\n const nextSteps = () => this._nextSteps();\n this._ongoingPromise = this._ongoingPromise ?\n transformPromiseWith(this._ongoingPromise, nextSteps, nextSteps) :\n nextSteps();\n return this._ongoingPromise;\n }\n\n return(value: any): Promise> {\n const returnSteps = () => this._returnSteps(value);\n return this._ongoingPromise ?\n transformPromiseWith(this._ongoingPromise, returnSteps, returnSteps) :\n returnSteps();\n }\n\n private _nextSteps(): Promise> {\n if (this._isFinished) {\n return Promise.resolve({ value: undefined, done: true });\n }\n\n const reader = this._reader;\n assert(reader._ownerReadableStream !== undefined);\n\n let resolvePromise!: (result: ReadableStreamDefaultReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => {\n this._ongoingPromise = undefined;\n // This needs to be delayed by one microtask, otherwise we stop pulling too early which breaks a test.\n // FIXME Is this a bug in the specification, or in the test?\n queueMicrotask(() => resolvePromise({ value: chunk, done: false }));\n },\n _closeSteps: () => {\n this._ongoingPromise = undefined;\n this._isFinished = true;\n ReadableStreamReaderGenericRelease(reader);\n resolvePromise({ value: undefined, done: true });\n },\n _errorSteps: reason => {\n this._ongoingPromise = undefined;\n this._isFinished = true;\n ReadableStreamReaderGenericRelease(reader);\n rejectPromise(reason);\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n return promise;\n }\n\n private _returnSteps(value: any): Promise> {\n if (this._isFinished) {\n return Promise.resolve({ value, done: true });\n }\n this._isFinished = true;\n\n const reader = this._reader;\n assert(reader._ownerReadableStream !== undefined);\n assert(reader._readRequests.length === 0);\n\n if (!this._preventCancel) {\n const result = ReadableStreamReaderGenericCancel(reader, value);\n ReadableStreamReaderGenericRelease(reader);\n return transformPromiseWith(result, () => ({ value, done: true }));\n }\n\n ReadableStreamReaderGenericRelease(reader);\n return promiseResolvedWith({ value, done: true });\n }\n}\n\ninterface ReadableStreamAsyncIteratorInstance extends ReadableStreamAsyncIterator {\n /** @interal */\n _asyncIteratorImpl: ReadableStreamAsyncIteratorImpl;\n\n next(): Promise>;\n\n return(value?: any): Promise>;\n}\n\nconst ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIteratorInstance = {\n next(this: ReadableStreamAsyncIteratorInstance): Promise> {\n if (!IsReadableStreamAsyncIterator(this)) {\n return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next'));\n }\n return this._asyncIteratorImpl.next();\n },\n\n return(this: ReadableStreamAsyncIteratorInstance, value: any): Promise> {\n if (!IsReadableStreamAsyncIterator(this)) {\n return promiseRejectedWith(streamAsyncIteratorBrandCheckException('return'));\n }\n return this._asyncIteratorImpl.return(value);\n }\n} as any;\nObject.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamAsyncIterator(stream: ReadableStream,\n preventCancel: boolean): ReadableStreamAsyncIterator {\n const reader = AcquireReadableStreamDefaultReader(stream);\n const impl = new ReadableStreamAsyncIteratorImpl(reader, preventCancel);\n const iterator: ReadableStreamAsyncIteratorInstance = Object.create(ReadableStreamAsyncIteratorPrototype);\n iterator._asyncIteratorImpl = impl;\n return iterator;\n}\n\nfunction IsReadableStreamAsyncIterator(x: any): x is ReadableStreamAsyncIterator {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_asyncIteratorImpl')) {\n return false;\n }\n\n try {\n // noinspection SuspiciousTypeOfGuard\n return (x as ReadableStreamAsyncIteratorInstance)._asyncIteratorImpl instanceof\n ReadableStreamAsyncIteratorImpl;\n } catch {\n return false;\n }\n}\n\n// Helper functions for the ReadableStream.\n\nfunction streamAsyncIteratorBrandCheckException(name: string): TypeError {\n return new TypeError(`ReadableStreamAsyncIterator.${name} can only be used on a ReadableSteamAsyncIterator`);\n}\n","/// \n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#Polyfill\nconst NumberIsNaN: typeof Number.isNaN = Number.isNaN || function (x) {\n // eslint-disable-next-line no-self-compare\n return x !== x;\n};\n\nexport default NumberIsNaN;\n","import { reflectCall } from 'lib/helpers/webidl';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport assert from '../../stub/assert';\n\ndeclare global {\n interface ArrayBuffer {\n readonly detached: boolean;\n\n transfer(): ArrayBuffer;\n }\n\n function structuredClone(value: T, options: { transfer: ArrayBuffer[] }): T;\n}\n\nexport function CreateArrayFromList(elements: T): T {\n // We use arrays to represent lists, so this is basically a no-op.\n // Do a slice though just in case we happen to depend on the unique-ness.\n return elements.slice() as T;\n}\n\nexport function CopyDataBlockBytes(dest: ArrayBuffer,\n destOffset: number,\n src: ArrayBuffer,\n srcOffset: number,\n n: number) {\n new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);\n}\n\nexport let TransferArrayBuffer = (O: ArrayBuffer): ArrayBuffer => {\n if (typeof O.transfer === 'function') {\n TransferArrayBuffer = buffer => buffer.transfer();\n } else if (typeof structuredClone === 'function') {\n TransferArrayBuffer = buffer => structuredClone(buffer, { transfer: [buffer] });\n } else {\n // Not implemented correctly\n TransferArrayBuffer = buffer => buffer;\n }\n return TransferArrayBuffer(O);\n};\n\nexport function CanTransferArrayBuffer(O: ArrayBuffer): boolean {\n return !IsDetachedBuffer(O);\n}\n\nexport let IsDetachedBuffer = (O: ArrayBuffer): boolean => {\n if (typeof O.detached === 'boolean') {\n IsDetachedBuffer = buffer => buffer.detached;\n } else {\n // Not implemented correctly\n IsDetachedBuffer = buffer => buffer.byteLength === 0;\n }\n return IsDetachedBuffer(O);\n};\n\nexport function ArrayBufferSlice(buffer: ArrayBuffer, begin: number, end: number): ArrayBuffer {\n // ArrayBuffer.prototype.slice is not available on IE10\n // https://www.caniuse.com/mdn-javascript_builtins_arraybuffer_slice\n if (buffer.slice) {\n return buffer.slice(begin, end);\n }\n const length = end - begin;\n const slice = new ArrayBuffer(length);\n CopyDataBlockBytes(slice, 0, buffer, begin, length);\n return slice;\n}\n\nexport type MethodName = {\n [P in keyof T]: T[P] extends Function | undefined ? P : never;\n}[keyof T];\n\nexport function GetMethod>(receiver: T, prop: K): T[K] | undefined {\n const func = receiver[prop];\n if (func === undefined || func === null) {\n return undefined;\n }\n if (typeof func !== 'function') {\n throw new TypeError(`${String(prop)} is not a function`);\n }\n return func;\n}\n\nexport interface SyncIteratorRecord {\n iterator: Iterator,\n nextMethod: Iterator['next'],\n done: boolean;\n}\n\nexport interface AsyncIteratorRecord {\n iterator: AsyncIterator,\n nextMethod: AsyncIterator['next'],\n done: boolean;\n}\n\nexport type SyncOrAsyncIteratorRecord = SyncIteratorRecord | AsyncIteratorRecord;\n\nexport function CreateAsyncFromSyncIterator(syncIteratorRecord: SyncIteratorRecord): AsyncIteratorRecord {\n // Instead of re-implementing CreateAsyncFromSyncIterator and %AsyncFromSyncIteratorPrototype%,\n // we use yield* inside an async generator function to achieve the same result.\n\n // Wrap the sync iterator inside a sync iterable, so we can use it with yield*.\n const syncIterable = {\n [Symbol.iterator]: () => syncIteratorRecord.iterator\n };\n // Create an async generator function and immediately invoke it.\n const asyncIterator = (async function* () {\n return yield* syncIterable;\n }());\n // Return as an async iterator record.\n const nextMethod = asyncIterator.next;\n return { iterator: asyncIterator, nextMethod, done: false };\n}\n\n// Aligns with core-js/modules/es.symbol.async-iterator.js\nexport const SymbolAsyncIterator: (typeof Symbol)['asyncIterator'] =\n Symbol.asyncIterator ??\n Symbol.for?.('Symbol.asyncIterator') ??\n '@@asyncIterator';\n\nexport type SyncOrAsyncIterable = Iterable | AsyncIterable;\nexport type SyncOrAsyncIteratorMethod = () => (Iterator | AsyncIterator);\n\nfunction GetIterator(\n obj: SyncOrAsyncIterable,\n hint: 'async',\n method?: SyncOrAsyncIteratorMethod\n): AsyncIteratorRecord;\nfunction GetIterator(\n obj: Iterable,\n hint: 'sync',\n method?: SyncOrAsyncIteratorMethod\n): SyncIteratorRecord;\nfunction GetIterator(\n obj: SyncOrAsyncIterable,\n hint = 'sync',\n method?: SyncOrAsyncIteratorMethod\n): SyncOrAsyncIteratorRecord {\n assert(hint === 'sync' || hint === 'async');\n if (method === undefined) {\n if (hint === 'async') {\n method = GetMethod(obj as AsyncIterable, SymbolAsyncIterator);\n if (method === undefined) {\n const syncMethod = GetMethod(obj as Iterable, Symbol.iterator);\n const syncIteratorRecord = GetIterator(obj as Iterable, 'sync', syncMethod);\n return CreateAsyncFromSyncIterator(syncIteratorRecord);\n }\n } else {\n method = GetMethod(obj as Iterable, Symbol.iterator);\n }\n }\n if (method === undefined) {\n throw new TypeError('The object is not iterable');\n }\n const iterator = reflectCall(method, obj, []);\n if (!typeIsObject(iterator)) {\n throw new TypeError('The iterator method must return an object');\n }\n const nextMethod = iterator.next;\n return { iterator, nextMethod, done: false } as SyncOrAsyncIteratorRecord;\n}\n\nexport { GetIterator };\n\nexport function IteratorNext(iteratorRecord: AsyncIteratorRecord): Promise> {\n const result = reflectCall(iteratorRecord.nextMethod, iteratorRecord.iterator, []);\n if (!typeIsObject(result)) {\n throw new TypeError('The iterator.next() method must return an object');\n }\n return result;\n}\n\nexport function IteratorComplete(\n iterResult: IteratorResult\n): iterResult is IteratorReturnResult {\n assert(typeIsObject(iterResult));\n return Boolean(iterResult.done);\n}\n\nexport function IteratorValue(iterResult: IteratorYieldResult): T {\n assert(typeIsObject(iterResult));\n return iterResult.value;\n}\n","import NumberIsNaN from '../../stub/number-isnan';\nimport { ArrayBufferSlice } from './ecmascript';\nimport type { NonShared } from '../helpers/array-buffer-view';\n\nexport function IsNonNegativeNumber(v: number): boolean {\n if (typeof v !== 'number') {\n return false;\n }\n\n if (NumberIsNaN(v)) {\n return false;\n }\n\n if (v < 0) {\n return false;\n }\n\n return true;\n}\n\nexport function CloneAsUint8Array(O: NonShared): NonShared {\n const buffer = ArrayBufferSlice(O.buffer, O.byteOffset, O.byteOffset + O.byteLength);\n return new Uint8Array(buffer) as NonShared;\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport { IsNonNegativeNumber } from './miscellaneous';\n\nexport interface QueueContainer {\n _queue: SimpleQueue;\n _queueTotalSize: number;\n}\n\nexport interface QueuePair {\n value: T;\n size: number;\n}\n\nexport function DequeueValue(container: QueueContainer>): T {\n assert('_queue' in container && '_queueTotalSize' in container);\n assert(container._queue.length > 0);\n\n const pair = container._queue.shift()!;\n container._queueTotalSize -= pair.size;\n if (container._queueTotalSize < 0) {\n container._queueTotalSize = 0;\n }\n\n return pair.value;\n}\n\nexport function EnqueueValueWithSize(container: QueueContainer>, value: T, size: number) {\n assert('_queue' in container && '_queueTotalSize' in container);\n\n if (!IsNonNegativeNumber(size) || size === Infinity) {\n throw new RangeError('Size must be a finite, non-NaN, non-negative number.');\n }\n\n container._queue.push({ value, size });\n container._queueTotalSize += size;\n}\n\nexport function PeekQueueValue(container: QueueContainer>): T {\n assert('_queue' in container && '_queueTotalSize' in container);\n assert(container._queue.length > 0);\n\n const pair = container._queue.peek();\n return pair.value;\n}\n\nexport function ResetQueue(container: QueueContainer) {\n assert('_queue' in container && '_queueTotalSize' in container);\n\n container._queue = new SimpleQueue();\n container._queueTotalSize = 0;\n}\n","export type TypedArray =\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Float32Array\n | Float64Array;\n\nexport type NonShared = T & {\n buffer: ArrayBuffer;\n}\n\nexport interface ArrayBufferViewConstructor {\n new(buffer: ArrayBuffer, byteOffset: number, length?: number): T;\n\n readonly prototype: T;\n}\n\nexport interface TypedArrayConstructor extends ArrayBufferViewConstructor {\n readonly BYTES_PER_ELEMENT: number;\n}\n\nexport type DataViewConstructor = ArrayBufferViewConstructor;\n\nfunction isDataViewConstructor(ctor: Function): ctor is DataViewConstructor {\n return ctor === DataView;\n}\n\nexport function isDataView(view: ArrayBufferView): view is DataView {\n return isDataViewConstructor(view.constructor);\n}\n\nexport function arrayBufferViewElementSize(ctor: ArrayBufferViewConstructor): number {\n if (isDataViewConstructor(ctor)) {\n return 1;\n }\n return (ctor as unknown as TypedArrayConstructor).BYTES_PER_ELEMENT;\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport { ResetQueue } from '../abstract-ops/queue-with-sizes';\nimport {\n IsReadableStreamDefaultReader,\n ReadableStreamAddReadRequest,\n ReadableStreamFulfillReadRequest,\n ReadableStreamGetNumReadRequests,\n ReadableStreamHasDefaultReader,\n type ReadRequest\n} from './default-reader';\nimport {\n ReadableStreamAddReadIntoRequest,\n ReadableStreamFulfillReadIntoRequest,\n ReadableStreamGetNumReadIntoRequests,\n ReadableStreamHasBYOBReader,\n type ReadIntoRequest\n} from './byob-reader';\nimport NumberIsInteger from '../../stub/number-isinteger';\nimport {\n IsReadableStreamLocked,\n type ReadableByteStream,\n ReadableStreamClose,\n ReadableStreamError\n} from '../readable-stream';\nimport type { ValidatedUnderlyingByteSource } from './underlying-source';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport {\n ArrayBufferSlice,\n CanTransferArrayBuffer,\n CopyDataBlockBytes,\n IsDetachedBuffer,\n TransferArrayBuffer\n} from '../abstract-ops/ecmascript';\nimport { CancelSteps, PullSteps, ReleaseSteps } from '../abstract-ops/internal-methods';\nimport { promiseResolvedWith, uponPromise } from '../helpers/webidl';\nimport { assertRequiredArgument, convertUnsignedLongLongWithEnforceRange } from '../validators/basic';\nimport {\n type ArrayBufferViewConstructor,\n arrayBufferViewElementSize,\n type NonShared,\n type TypedArrayConstructor\n} from '../helpers/array-buffer-view';\n\n/**\n * A pull-into request in a {@link ReadableByteStreamController}.\n *\n * @public\n */\nexport class ReadableStreamBYOBRequest {\n /** @internal */\n _associatedReadableByteStreamController!: ReadableByteStreamController;\n /** @internal */\n _view!: NonShared | null;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the view for writing in to, or `null` if the BYOB request has already been responded to.\n */\n get view(): ArrayBufferView | null {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('view');\n }\n\n return this._view;\n }\n\n /**\n * Indicates to the associated readable byte stream that `bytesWritten` bytes were written into\n * {@link ReadableStreamBYOBRequest.view | view}, causing the result be surfaced to the consumer.\n *\n * After this method is called, {@link ReadableStreamBYOBRequest.view | view} will be transferred and no longer\n * modifiable.\n */\n respond(bytesWritten: number): void;\n respond(bytesWritten: number | undefined): void {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('respond');\n }\n assertRequiredArgument(bytesWritten, 1, 'respond');\n bytesWritten = convertUnsignedLongLongWithEnforceRange(bytesWritten, 'First parameter');\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n if (IsDetachedBuffer(this._view!.buffer)) {\n throw new TypeError(`The BYOB request's buffer has been detached and so cannot be used as a response`);\n }\n\n assert(this._view!.byteLength > 0);\n assert(this._view!.buffer.byteLength > 0);\n\n ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);\n }\n\n /**\n * Indicates to the associated readable byte stream that instead of writing into\n * {@link ReadableStreamBYOBRequest.view | view}, the underlying byte source is providing a new `ArrayBufferView`,\n * which will be given to the consumer of the readable byte stream.\n *\n * After this method is called, `view` will be transferred and no longer modifiable.\n */\n respondWithNewView(view: ArrayBufferView): void;\n respondWithNewView(view: NonShared): void {\n if (!IsReadableStreamBYOBRequest(this)) {\n throw byobRequestBrandCheckException('respondWithNewView');\n }\n assertRequiredArgument(view, 1, 'respondWithNewView');\n\n if (!ArrayBuffer.isView(view)) {\n throw new TypeError('You can only respond with array buffer views');\n }\n\n if (this._associatedReadableByteStreamController === undefined) {\n throw new TypeError('This BYOB request has been invalidated');\n }\n\n if (IsDetachedBuffer(view.buffer)) {\n throw new TypeError('The given view\\'s buffer has been detached and so cannot be used as a response');\n }\n\n ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);\n }\n}\n\nObject.defineProperties(ReadableStreamBYOBRequest.prototype, {\n respond: { enumerable: true },\n respondWithNewView: { enumerable: true },\n view: { enumerable: true }\n});\nsetFunctionName(ReadableStreamBYOBRequest.prototype.respond, 'respond');\nsetFunctionName(ReadableStreamBYOBRequest.prototype.respondWithNewView, 'respondWithNewView');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamBYOBRequest.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamBYOBRequest',\n configurable: true\n });\n}\n\ninterface ByteQueueElement {\n buffer: ArrayBuffer;\n byteOffset: number;\n byteLength: number;\n}\n\ntype PullIntoDescriptor = NonShared> =\n DefaultPullIntoDescriptor\n | BYOBPullIntoDescriptor;\n\ninterface DefaultPullIntoDescriptor {\n buffer: ArrayBuffer;\n bufferByteLength: number;\n byteOffset: number;\n byteLength: number;\n bytesFilled: number;\n minimumFill: number;\n elementSize: number;\n viewConstructor: TypedArrayConstructor;\n readerType: 'default' | 'none';\n}\n\ninterface BYOBPullIntoDescriptor = NonShared> {\n buffer: ArrayBuffer;\n bufferByteLength: number;\n byteOffset: number;\n byteLength: number;\n bytesFilled: number;\n minimumFill: number;\n elementSize: number;\n viewConstructor: ArrayBufferViewConstructor;\n readerType: 'byob' | 'none';\n}\n\n/**\n * Allows control of a {@link ReadableStream | readable byte stream}'s state and internal queue.\n *\n * @public\n */\nexport class ReadableByteStreamController {\n /** @internal */\n _controlledReadableByteStream!: ReadableByteStream;\n /** @internal */\n _queue!: SimpleQueue;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _closeRequested!: boolean;\n /** @internal */\n _pullAgain!: boolean;\n /** @internal */\n _pulling !: boolean;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _pullAlgorithm!: () => Promise;\n /** @internal */\n _cancelAlgorithm!: (reason: any) => Promise;\n /** @internal */\n _autoAllocateChunkSize: number | undefined;\n /** @internal */\n _byobRequest: ReadableStreamBYOBRequest | null;\n /** @internal */\n _pendingPullIntos!: SimpleQueue;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the current BYOB pull request, or `null` if there isn't one.\n */\n get byobRequest(): ReadableStreamBYOBRequest | null {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('byobRequest');\n }\n\n return ReadableByteStreamControllerGetBYOBRequest(this);\n }\n\n /**\n * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is\n * over-full. An underlying byte source ought to use this information to determine when and how to apply backpressure.\n */\n get desiredSize(): number | null {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('desiredSize');\n }\n\n return ReadableByteStreamControllerGetDesiredSize(this);\n }\n\n /**\n * Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from\n * the stream, but once those are read, the stream will become closed.\n */\n close(): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('close');\n }\n\n if (this._closeRequested) {\n throw new TypeError('The stream has already been closed; do not close it again!');\n }\n\n const state = this._controlledReadableByteStream._state;\n if (state !== 'readable') {\n throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be closed`);\n }\n\n ReadableByteStreamControllerClose(this);\n }\n\n /**\n * Enqueues the given chunk chunk in the controlled readable stream.\n * The chunk has to be an `ArrayBufferView` instance, or else a `TypeError` will be thrown.\n */\n enqueue(chunk: ArrayBufferView): void;\n enqueue(chunk: NonShared): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('enqueue');\n }\n\n assertRequiredArgument(chunk, 1, 'enqueue');\n if (!ArrayBuffer.isView(chunk)) {\n throw new TypeError('chunk must be an array buffer view');\n }\n if (chunk.byteLength === 0) {\n throw new TypeError('chunk must have non-zero byteLength');\n }\n if (chunk.buffer.byteLength === 0) {\n throw new TypeError(`chunk's buffer must have non-zero byteLength`);\n }\n\n if (this._closeRequested) {\n throw new TypeError('stream is closed or draining');\n }\n\n const state = this._controlledReadableByteStream._state;\n if (state !== 'readable') {\n throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be enqueued to`);\n }\n\n ReadableByteStreamControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.\n */\n error(e: any = undefined): void {\n if (!IsReadableByteStreamController(this)) {\n throw byteStreamControllerBrandCheckException('error');\n }\n\n ReadableByteStreamControllerError(this, e);\n }\n\n /** @internal */\n [CancelSteps](reason: any): Promise {\n ReadableByteStreamControllerClearPendingPullIntos(this);\n\n ResetQueue(this);\n\n const result = this._cancelAlgorithm(reason);\n ReadableByteStreamControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [PullSteps](readRequest: ReadRequest>): void {\n const stream = this._controlledReadableByteStream;\n assert(ReadableStreamHasDefaultReader(stream));\n\n if (this._queueTotalSize > 0) {\n assert(ReadableStreamGetNumReadRequests(stream) === 0);\n\n ReadableByteStreamControllerFillReadRequestFromQueue(this, readRequest);\n return;\n }\n\n const autoAllocateChunkSize = this._autoAllocateChunkSize;\n if (autoAllocateChunkSize !== undefined) {\n let buffer: ArrayBuffer;\n try {\n buffer = new ArrayBuffer(autoAllocateChunkSize);\n } catch (bufferE) {\n readRequest._errorSteps(bufferE);\n return;\n }\n\n const pullIntoDescriptor: DefaultPullIntoDescriptor = {\n buffer,\n bufferByteLength: autoAllocateChunkSize,\n byteOffset: 0,\n byteLength: autoAllocateChunkSize,\n bytesFilled: 0,\n minimumFill: 1,\n elementSize: 1,\n viewConstructor: Uint8Array,\n readerType: 'default'\n };\n\n this._pendingPullIntos.push(pullIntoDescriptor);\n }\n\n ReadableStreamAddReadRequest(stream, readRequest);\n ReadableByteStreamControllerCallPullIfNeeded(this);\n }\n\n /** @internal */\n [ReleaseSteps](): void {\n if (this._pendingPullIntos.length > 0) {\n const firstPullInto = this._pendingPullIntos.peek();\n firstPullInto.readerType = 'none';\n\n this._pendingPullIntos = new SimpleQueue();\n this._pendingPullIntos.push(firstPullInto);\n }\n }\n}\n\nObject.defineProperties(ReadableByteStreamController.prototype, {\n close: { enumerable: true },\n enqueue: { enumerable: true },\n error: { enumerable: true },\n byobRequest: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(ReadableByteStreamController.prototype.close, 'close');\nsetFunctionName(ReadableByteStreamController.prototype.enqueue, 'enqueue');\nsetFunctionName(ReadableByteStreamController.prototype.error, 'error');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableByteStreamController.prototype, Symbol.toStringTag, {\n value: 'ReadableByteStreamController',\n configurable: true\n });\n}\n\n// Abstract operations for the ReadableByteStreamController.\n\nexport function IsReadableByteStreamController(x: any): x is ReadableByteStreamController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableByteStream')) {\n return false;\n }\n\n return x instanceof ReadableByteStreamController;\n}\n\nfunction IsReadableStreamBYOBRequest(x: any): x is ReadableStreamBYOBRequest {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {\n return false;\n }\n\n return x instanceof ReadableStreamBYOBRequest;\n}\n\nfunction ReadableByteStreamControllerCallPullIfNeeded(controller: ReadableByteStreamController): void {\n const shouldPull = ReadableByteStreamControllerShouldCallPull(controller);\n if (!shouldPull) {\n return;\n }\n\n if (controller._pulling) {\n controller._pullAgain = true;\n return;\n }\n\n assert(!controller._pullAgain);\n\n controller._pulling = true;\n\n // TODO: Test controller argument\n const pullPromise = controller._pullAlgorithm();\n uponPromise(\n pullPromise,\n () => {\n controller._pulling = false;\n\n if (controller._pullAgain) {\n controller._pullAgain = false;\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n\n return null;\n },\n e => {\n ReadableByteStreamControllerError(controller, e);\n return null;\n }\n );\n}\n\nfunction ReadableByteStreamControllerClearPendingPullIntos(controller: ReadableByteStreamController) {\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n controller._pendingPullIntos = new SimpleQueue();\n}\n\nfunction ReadableByteStreamControllerCommitPullIntoDescriptor>(\n stream: ReadableByteStream,\n pullIntoDescriptor: PullIntoDescriptor\n) {\n assert(stream._state !== 'errored');\n assert(pullIntoDescriptor.readerType !== 'none');\n\n let done = false;\n if (stream._state === 'closed') {\n assert(pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize === 0);\n done = true;\n }\n\n const filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n if (pullIntoDescriptor.readerType === 'default') {\n ReadableStreamFulfillReadRequest(stream, filledView as unknown as NonShared, done);\n } else {\n assert(pullIntoDescriptor.readerType === 'byob');\n ReadableStreamFulfillReadIntoRequest(stream, filledView, done);\n }\n}\n\nfunction ReadableByteStreamControllerConvertPullIntoDescriptor>(\n pullIntoDescriptor: PullIntoDescriptor\n): T {\n const bytesFilled = pullIntoDescriptor.bytesFilled;\n const elementSize = pullIntoDescriptor.elementSize;\n\n assert(bytesFilled <= pullIntoDescriptor.byteLength);\n assert(bytesFilled % elementSize === 0);\n\n return new pullIntoDescriptor.viewConstructor(\n pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize) as T;\n}\n\nfunction ReadableByteStreamControllerEnqueueChunkToQueue(controller: ReadableByteStreamController,\n buffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number) {\n controller._queue.push({ buffer, byteOffset, byteLength });\n controller._queueTotalSize += byteLength;\n}\n\nfunction ReadableByteStreamControllerEnqueueClonedChunkToQueue(controller: ReadableByteStreamController,\n buffer: ArrayBuffer,\n byteOffset: number,\n byteLength: number) {\n let clonedChunk;\n try {\n clonedChunk = ArrayBufferSlice(buffer, byteOffset, byteOffset + byteLength);\n } catch (cloneE) {\n ReadableByteStreamControllerError(controller, cloneE);\n throw cloneE;\n }\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, clonedChunk, 0, byteLength);\n}\n\nfunction ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller: ReadableByteStreamController,\n firstDescriptor: PullIntoDescriptor) {\n assert(firstDescriptor.readerType === 'none');\n if (firstDescriptor.bytesFilled > 0) {\n ReadableByteStreamControllerEnqueueClonedChunkToQueue(\n controller,\n firstDescriptor.buffer,\n firstDescriptor.byteOffset,\n firstDescriptor.bytesFilled\n );\n }\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n}\n\nfunction ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller: ReadableByteStreamController,\n pullIntoDescriptor: PullIntoDescriptor) {\n const maxBytesToCopy = Math.min(controller._queueTotalSize,\n pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);\n const maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;\n\n let totalBytesToCopyRemaining = maxBytesToCopy;\n let ready = false;\n assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill);\n const remainderBytes = maxBytesFilled % pullIntoDescriptor.elementSize;\n const maxAlignedBytes = maxBytesFilled - remainderBytes;\n // A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head\n // of the queue, so the underlying source can keep filling it.\n if (maxAlignedBytes >= pullIntoDescriptor.minimumFill) {\n totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;\n ready = true;\n }\n\n const queue = controller._queue;\n\n while (totalBytesToCopyRemaining > 0) {\n const headOfQueue = queue.peek();\n\n const bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);\n\n const destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n CopyDataBlockBytes(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);\n\n if (headOfQueue.byteLength === bytesToCopy) {\n queue.shift();\n } else {\n headOfQueue.byteOffset += bytesToCopy;\n headOfQueue.byteLength -= bytesToCopy;\n }\n controller._queueTotalSize -= bytesToCopy;\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);\n\n totalBytesToCopyRemaining -= bytesToCopy;\n }\n\n if (!ready) {\n assert(controller._queueTotalSize === 0);\n assert(pullIntoDescriptor.bytesFilled > 0);\n assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill);\n }\n\n return ready;\n}\n\nfunction ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller: ReadableByteStreamController,\n size: number,\n pullIntoDescriptor: PullIntoDescriptor) {\n assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos.peek() === pullIntoDescriptor);\n assert(controller._byobRequest === null);\n pullIntoDescriptor.bytesFilled += size;\n}\n\nfunction ReadableByteStreamControllerHandleQueueDrain(controller: ReadableByteStreamController) {\n assert(controller._controlledReadableByteStream._state === 'readable');\n\n if (controller._queueTotalSize === 0 && controller._closeRequested) {\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamClose(controller._controlledReadableByteStream);\n } else {\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n }\n}\n\nfunction ReadableByteStreamControllerInvalidateBYOBRequest(controller: ReadableByteStreamController) {\n if (controller._byobRequest === null) {\n return;\n }\n\n controller._byobRequest._associatedReadableByteStreamController = undefined!;\n controller._byobRequest._view = null!;\n controller._byobRequest = null;\n}\n\nfunction ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller: ReadableByteStreamController) {\n assert(!controller._closeRequested);\n\n while (controller._pendingPullIntos.length > 0) {\n if (controller._queueTotalSize === 0) {\n return;\n }\n\n const pullIntoDescriptor = controller._pendingPullIntos.peek();\n assert(pullIntoDescriptor.readerType !== 'none');\n\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor)) {\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n ReadableByteStreamControllerCommitPullIntoDescriptor(\n controller._controlledReadableByteStream,\n pullIntoDescriptor\n );\n }\n }\n}\n\nfunction ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller: ReadableByteStreamController) {\n const reader = controller._controlledReadableByteStream._reader;\n assert(IsReadableStreamDefaultReader(reader));\n while (reader._readRequests.length > 0) {\n if (controller._queueTotalSize === 0) {\n return;\n }\n const readRequest = reader._readRequests.shift();\n ReadableByteStreamControllerFillReadRequestFromQueue(controller, readRequest);\n }\n}\n\nexport function ReadableByteStreamControllerPullInto>(\n controller: ReadableByteStreamController,\n view: T,\n min: number,\n readIntoRequest: ReadIntoRequest\n): void {\n const stream = controller._controlledReadableByteStream;\n\n const ctor = view.constructor as ArrayBufferViewConstructor;\n const elementSize = arrayBufferViewElementSize(ctor);\n\n const { byteOffset, byteLength } = view;\n\n const minimumFill = min * elementSize;\n assert(minimumFill >= elementSize && minimumFill <= byteLength);\n assert(minimumFill % elementSize === 0);\n\n let buffer: ArrayBuffer;\n try {\n buffer = TransferArrayBuffer(view.buffer);\n } catch (e) {\n readIntoRequest._errorSteps(e);\n return;\n }\n\n const pullIntoDescriptor: BYOBPullIntoDescriptor = {\n buffer,\n bufferByteLength: buffer.byteLength,\n byteOffset,\n byteLength,\n bytesFilled: 0,\n minimumFill,\n elementSize,\n viewConstructor: ctor,\n readerType: 'byob'\n };\n\n if (controller._pendingPullIntos.length > 0) {\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n // No ReadableByteStreamControllerCallPullIfNeeded() call since:\n // - No change happens on desiredSize\n // - The source has already been notified of that there's at least 1 pending read(view)\n\n ReadableStreamAddReadIntoRequest(stream, readIntoRequest);\n return;\n }\n\n if (stream._state === 'closed') {\n const emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);\n readIntoRequest._closeSteps(emptyView);\n return;\n }\n\n if (controller._queueTotalSize > 0) {\n if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor)) {\n const filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);\n\n ReadableByteStreamControllerHandleQueueDrain(controller);\n\n readIntoRequest._chunkSteps(filledView);\n return;\n }\n\n if (controller._closeRequested) {\n const e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n readIntoRequest._errorSteps(e);\n return;\n }\n }\n\n controller._pendingPullIntos.push(pullIntoDescriptor);\n\n ReadableStreamAddReadIntoRequest(stream, readIntoRequest);\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nfunction ReadableByteStreamControllerRespondInClosedState(controller: ReadableByteStreamController,\n firstDescriptor: PullIntoDescriptor) {\n assert(firstDescriptor.bytesFilled % firstDescriptor.elementSize === 0);\n\n if (firstDescriptor.readerType === 'none') {\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n }\n\n const stream = controller._controlledReadableByteStream;\n if (ReadableStreamHasBYOBReader(stream)) {\n while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n const pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);\n ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);\n }\n }\n}\n\nfunction ReadableByteStreamControllerRespondInReadableState(controller: ReadableByteStreamController,\n bytesWritten: number,\n pullIntoDescriptor: PullIntoDescriptor) {\n assert(pullIntoDescriptor.bytesFilled + bytesWritten <= pullIntoDescriptor.byteLength);\n\n ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);\n\n if (pullIntoDescriptor.readerType === 'none') {\n ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, pullIntoDescriptor);\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n return;\n }\n\n if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.minimumFill) {\n // A descriptor for a read() request that is not yet filled up to its minimum length will stay at the head\n // of the queue, so the underlying source can keep filling it.\n return;\n }\n\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n\n const remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;\n if (remainderSize > 0) {\n const end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;\n ReadableByteStreamControllerEnqueueClonedChunkToQueue(\n controller,\n pullIntoDescriptor.buffer,\n end - remainderSize,\n remainderSize\n );\n }\n\n pullIntoDescriptor.bytesFilled -= remainderSize;\n ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);\n\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n}\n\nfunction ReadableByteStreamControllerRespondInternal(controller: ReadableByteStreamController, bytesWritten: number) {\n const firstDescriptor = controller._pendingPullIntos.peek();\n assert(CanTransferArrayBuffer(firstDescriptor.buffer));\n\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n\n const state = controller._controlledReadableByteStream._state;\n if (state === 'closed') {\n assert(bytesWritten === 0);\n ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);\n } else {\n assert(state === 'readable');\n assert(bytesWritten > 0);\n ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);\n }\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nfunction ReadableByteStreamControllerShiftPendingPullInto(\n controller: ReadableByteStreamController\n): PullIntoDescriptor {\n assert(controller._byobRequest === null);\n const descriptor = controller._pendingPullIntos.shift()!;\n return descriptor;\n}\n\nfunction ReadableByteStreamControllerShouldCallPull(controller: ReadableByteStreamController): boolean {\n const stream = controller._controlledReadableByteStream;\n\n if (stream._state !== 'readable') {\n return false;\n }\n\n if (controller._closeRequested) {\n return false;\n }\n\n if (!controller._started) {\n return false;\n }\n\n if (ReadableStreamHasDefaultReader(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n if (ReadableStreamHasBYOBReader(stream) && ReadableStreamGetNumReadIntoRequests(stream) > 0) {\n return true;\n }\n\n const desiredSize = ReadableByteStreamControllerGetDesiredSize(controller);\n assert(desiredSize !== null);\n if (desiredSize! > 0) {\n return true;\n }\n\n return false;\n}\n\nfunction ReadableByteStreamControllerClearAlgorithms(controller: ReadableByteStreamController) {\n controller._pullAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n}\n\n// A client of ReadableByteStreamController may use these functions directly to bypass state check.\n\nexport function ReadableByteStreamControllerClose(controller: ReadableByteStreamController) {\n const stream = controller._controlledReadableByteStream;\n\n if (controller._closeRequested || stream._state !== 'readable') {\n return;\n }\n\n if (controller._queueTotalSize > 0) {\n controller._closeRequested = true;\n\n return;\n }\n\n if (controller._pendingPullIntos.length > 0) {\n const firstPendingPullInto = controller._pendingPullIntos.peek();\n if (firstPendingPullInto.bytesFilled % firstPendingPullInto.elementSize !== 0) {\n const e = new TypeError('Insufficient bytes to fill elements in the given buffer');\n ReadableByteStreamControllerError(controller, e);\n\n throw e;\n }\n }\n\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamClose(stream);\n}\n\nexport function ReadableByteStreamControllerEnqueue(\n controller: ReadableByteStreamController,\n chunk: NonShared\n) {\n const stream = controller._controlledReadableByteStream;\n\n if (controller._closeRequested || stream._state !== 'readable') {\n return;\n }\n\n const { buffer, byteOffset, byteLength } = chunk;\n if (IsDetachedBuffer(buffer)) {\n throw new TypeError('chunk\\'s buffer is detached and so cannot be enqueued');\n }\n const transferredBuffer = TransferArrayBuffer(buffer);\n\n if (controller._pendingPullIntos.length > 0) {\n const firstPendingPullInto = controller._pendingPullIntos.peek();\n if (IsDetachedBuffer(firstPendingPullInto.buffer)) {\n throw new TypeError(\n 'The BYOB request\\'s buffer has been detached and so cannot be filled with an enqueued chunk'\n );\n }\n ReadableByteStreamControllerInvalidateBYOBRequest(controller);\n firstPendingPullInto.buffer = TransferArrayBuffer(firstPendingPullInto.buffer);\n if (firstPendingPullInto.readerType === 'none') {\n ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto);\n }\n }\n\n if (ReadableStreamHasDefaultReader(stream)) {\n ReadableByteStreamControllerProcessReadRequestsUsingQueue(controller);\n if (ReadableStreamGetNumReadRequests(stream) === 0) {\n assert(controller._pendingPullIntos.length === 0);\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n } else {\n assert(controller._queue.length === 0);\n if (controller._pendingPullIntos.length > 0) {\n assert(controller._pendingPullIntos.peek().readerType === 'default');\n ReadableByteStreamControllerShiftPendingPullInto(controller);\n }\n const transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);\n ReadableStreamFulfillReadRequest(stream, transferredView as NonShared, false);\n }\n } else if (ReadableStreamHasBYOBReader(stream)) {\n // TODO: Ideally in this branch detaching should happen only if the buffer is not consumed fully.\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);\n } else {\n assert(!IsReadableStreamLocked(stream));\n ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);\n }\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n}\n\nexport function ReadableByteStreamControllerError(controller: ReadableByteStreamController, e: any) {\n const stream = controller._controlledReadableByteStream;\n\n if (stream._state !== 'readable') {\n return;\n }\n\n ReadableByteStreamControllerClearPendingPullIntos(controller);\n\n ResetQueue(controller);\n ReadableByteStreamControllerClearAlgorithms(controller);\n ReadableStreamError(stream, e);\n}\n\nexport function ReadableByteStreamControllerFillReadRequestFromQueue(\n controller: ReadableByteStreamController,\n readRequest: ReadRequest>\n) {\n assert(controller._queueTotalSize > 0);\n\n const entry = controller._queue.shift();\n controller._queueTotalSize -= entry.byteLength;\n\n ReadableByteStreamControllerHandleQueueDrain(controller);\n\n const view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);\n readRequest._chunkSteps(view as NonShared);\n}\n\nexport function ReadableByteStreamControllerGetBYOBRequest(\n controller: ReadableByteStreamController\n): ReadableStreamBYOBRequest | null {\n if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {\n const firstDescriptor = controller._pendingPullIntos.peek();\n const view = new Uint8Array(firstDescriptor.buffer,\n firstDescriptor.byteOffset + firstDescriptor.bytesFilled,\n firstDescriptor.byteLength - firstDescriptor.bytesFilled);\n\n const byobRequest: ReadableStreamBYOBRequest = Object.create(ReadableStreamBYOBRequest.prototype);\n SetUpReadableStreamBYOBRequest(byobRequest, controller, view as NonShared);\n controller._byobRequest = byobRequest;\n }\n return controller._byobRequest;\n}\n\nfunction ReadableByteStreamControllerGetDesiredSize(controller: ReadableByteStreamController): number | null {\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nexport function ReadableByteStreamControllerRespond(controller: ReadableByteStreamController, bytesWritten: number) {\n assert(controller._pendingPullIntos.length > 0);\n\n const firstDescriptor = controller._pendingPullIntos.peek();\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'closed') {\n if (bytesWritten !== 0) {\n throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');\n }\n } else {\n assert(state === 'readable');\n if (bytesWritten === 0) {\n throw new TypeError('bytesWritten must be greater than 0 when calling respond() on a readable stream');\n }\n if (firstDescriptor.bytesFilled + bytesWritten > firstDescriptor.byteLength) {\n throw new RangeError('bytesWritten out of range');\n }\n }\n\n firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);\n\n ReadableByteStreamControllerRespondInternal(controller, bytesWritten);\n}\n\nexport function ReadableByteStreamControllerRespondWithNewView(controller: ReadableByteStreamController,\n view: NonShared) {\n assert(controller._pendingPullIntos.length > 0);\n assert(!IsDetachedBuffer(view.buffer));\n\n const firstDescriptor = controller._pendingPullIntos.peek();\n const state = controller._controlledReadableByteStream._state;\n\n if (state === 'closed') {\n if (view.byteLength !== 0) {\n throw new TypeError('The view\\'s length must be 0 when calling respondWithNewView() on a closed stream');\n }\n } else {\n assert(state === 'readable');\n if (view.byteLength === 0) {\n throw new TypeError(\n 'The view\\'s length must be greater than 0 when calling respondWithNewView() on a readable stream'\n );\n }\n }\n\n if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {\n throw new RangeError('The region specified by view does not match byobRequest');\n }\n if (firstDescriptor.bufferByteLength !== view.buffer.byteLength) {\n throw new RangeError('The buffer of view has different capacity than byobRequest');\n }\n if (firstDescriptor.bytesFilled + view.byteLength > firstDescriptor.byteLength) {\n throw new RangeError('The region specified by view is larger than byobRequest');\n }\n\n const viewByteLength = view.byteLength;\n firstDescriptor.buffer = TransferArrayBuffer(view.buffer);\n ReadableByteStreamControllerRespondInternal(controller, viewByteLength);\n}\n\nexport function SetUpReadableByteStreamController(stream: ReadableByteStream,\n controller: ReadableByteStreamController,\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n autoAllocateChunkSize: number | undefined) {\n assert(stream._readableStreamController === undefined);\n if (autoAllocateChunkSize !== undefined) {\n assert(NumberIsInteger(autoAllocateChunkSize));\n assert(autoAllocateChunkSize > 0);\n }\n\n controller._controlledReadableByteStream = stream;\n\n controller._pullAgain = false;\n controller._pulling = false;\n\n controller._byobRequest = null;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n controller._queue = controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._closeRequested = false;\n controller._started = false;\n\n controller._strategyHWM = highWaterMark;\n\n controller._pullAlgorithm = pullAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n controller._autoAllocateChunkSize = autoAllocateChunkSize;\n\n controller._pendingPullIntos = new SimpleQueue();\n\n stream._readableStreamController = controller;\n\n const startResult = startAlgorithm();\n uponPromise(\n promiseResolvedWith(startResult),\n () => {\n controller._started = true;\n\n assert(!controller._pulling);\n assert(!controller._pullAgain);\n\n ReadableByteStreamControllerCallPullIfNeeded(controller);\n return null;\n },\n r => {\n ReadableByteStreamControllerError(controller, r);\n return null;\n }\n );\n}\n\nexport function SetUpReadableByteStreamControllerFromUnderlyingSource(\n stream: ReadableByteStream,\n underlyingByteSource: ValidatedUnderlyingByteSource,\n highWaterMark: number\n) {\n const controller: ReadableByteStreamController = Object.create(ReadableByteStreamController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let pullAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (underlyingByteSource.start !== undefined) {\n startAlgorithm = () => underlyingByteSource.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingByteSource.pull !== undefined) {\n pullAlgorithm = () => underlyingByteSource.pull!(controller);\n } else {\n pullAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingByteSource.cancel !== undefined) {\n cancelAlgorithm = reason => underlyingByteSource.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n const autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;\n if (autoAllocateChunkSize === 0) {\n throw new TypeError('autoAllocateChunkSize must be greater than 0');\n }\n\n SetUpReadableByteStreamController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize\n );\n}\n\nfunction SetUpReadableStreamBYOBRequest(request: ReadableStreamBYOBRequest,\n controller: ReadableByteStreamController,\n view: NonShared) {\n assert(IsReadableByteStreamController(controller));\n assert(typeof view === 'object');\n assert(ArrayBuffer.isView(view));\n assert(!IsDetachedBuffer(view.buffer));\n request._associatedReadableByteStreamController = controller;\n request._view = view;\n}\n\n// Helper functions for the ReadableStreamBYOBRequest.\n\nfunction byobRequestBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamBYOBRequest.prototype.${name} can only be used on a ReadableStreamBYOBRequest`);\n}\n\n// Helper functions for the ReadableByteStreamController.\n\nfunction byteStreamControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableByteStreamController.prototype.${name} can only be used on a ReadableByteStreamController`);\n}\n","import { assertDictionary, convertUnsignedLongLongWithEnforceRange } from './basic';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ReadableStreamGetReaderOptions,\n ValidatedReadableStreamBYOBReaderReadOptions\n} from '../readable-stream/reader-options';\n\nexport function convertReaderOptions(options: ReadableStreamGetReaderOptions | null | undefined,\n context: string): ReadableStreamGetReaderOptions {\n assertDictionary(options, context);\n const mode = options?.mode;\n return {\n mode: mode === undefined ? undefined : convertReadableStreamReaderMode(mode, `${context} has member 'mode' that`)\n };\n}\n\nfunction convertReadableStreamReaderMode(mode: string, context: string): 'byob' {\n mode = `${mode}`;\n if (mode !== 'byob') {\n throw new TypeError(`${context} '${mode}' is not a valid enumeration value for ReadableStreamReaderMode`);\n }\n return mode;\n}\n\nexport function convertByobReadOptions(\n options: ReadableStreamBYOBReaderReadOptions | null | undefined,\n context: string\n): ValidatedReadableStreamBYOBReaderReadOptions {\n assertDictionary(options, context);\n const min = options?.min ?? 1;\n return {\n min: convertUnsignedLongLongWithEnforceRange(\n min,\n `${context} has member 'min' that`\n )\n };\n}\n","import assert from '../../stub/assert';\nimport { SimpleQueue } from '../simple-queue';\nimport {\n ReadableStreamReaderGenericCancel,\n ReadableStreamReaderGenericInitialize,\n ReadableStreamReaderGenericRelease,\n readerLockException\n} from './generic-reader';\nimport { IsReadableStreamLocked, type ReadableByteStream, type ReadableStream } from '../readable-stream';\nimport {\n IsReadableByteStreamController,\n ReadableByteStreamController,\n ReadableByteStreamControllerPullInto\n} from './byte-stream-controller';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { newPromise, promiseRejectedWith } from '../helpers/webidl';\nimport { assertRequiredArgument } from '../validators/basic';\nimport { assertReadableStream } from '../validators/readable-stream';\nimport { IsDetachedBuffer } from '../abstract-ops/ecmascript';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ValidatedReadableStreamBYOBReaderReadOptions\n} from './reader-options';\nimport { convertByobReadOptions } from '../validators/reader-options';\nimport { isDataView, type NonShared, type TypedArray } from '../helpers/array-buffer-view';\n\n/**\n * A result returned by {@link ReadableStreamBYOBReader.read}.\n *\n * @public\n */\nexport type ReadableStreamBYOBReadResult = {\n done: false;\n value: T;\n} | {\n done: true;\n value: T | undefined;\n};\n\n// Abstract operations for the ReadableStream.\n\nexport function AcquireReadableStreamBYOBReader(stream: ReadableByteStream): ReadableStreamBYOBReader {\n return new ReadableStreamBYOBReader(stream as ReadableStream);\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamAddReadIntoRequest>(\n stream: ReadableByteStream,\n readIntoRequest: ReadIntoRequest\n): void {\n assert(IsReadableStreamBYOBReader(stream._reader));\n assert(stream._state === 'readable' || stream._state === 'closed');\n\n (stream._reader! as ReadableStreamBYOBReader)._readIntoRequests.push(readIntoRequest);\n}\n\nexport function ReadableStreamFulfillReadIntoRequest(stream: ReadableByteStream,\n chunk: ArrayBufferView,\n done: boolean) {\n const reader = stream._reader as ReadableStreamBYOBReader;\n\n assert(reader._readIntoRequests.length > 0);\n\n const readIntoRequest = reader._readIntoRequests.shift()!;\n if (done) {\n readIntoRequest._closeSteps(chunk);\n } else {\n readIntoRequest._chunkSteps(chunk);\n }\n}\n\nexport function ReadableStreamGetNumReadIntoRequests(stream: ReadableByteStream): number {\n return (stream._reader as ReadableStreamBYOBReader)._readIntoRequests.length;\n}\n\nexport function ReadableStreamHasBYOBReader(stream: ReadableByteStream): boolean {\n const reader = stream._reader;\n\n if (reader === undefined) {\n return false;\n }\n\n if (!IsReadableStreamBYOBReader(reader)) {\n return false;\n }\n\n return true;\n}\n\n// Readers\n\nexport interface ReadIntoRequest> {\n _chunkSteps(chunk: T): void;\n\n _closeSteps(chunk: T | undefined): void;\n\n _errorSteps(e: any): void;\n}\n\n/**\n * A BYOB reader vended by a {@link ReadableStream}.\n *\n * @public\n */\nexport class ReadableStreamBYOBReader {\n /** @internal */\n _ownerReadableStream!: ReadableByteStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _readIntoRequests: SimpleQueue>;\n\n constructor(stream: ReadableStream) {\n assertRequiredArgument(stream, 1, 'ReadableStreamBYOBReader');\n assertReadableStream(stream, 'First parameter');\n\n if (IsReadableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive reading by another reader');\n }\n\n if (!IsReadableByteStreamController(stream._readableStreamController)) {\n throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' +\n 'source');\n }\n\n ReadableStreamReaderGenericInitialize(this, stream);\n\n this._readIntoRequests = new SimpleQueue();\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or\n * the reader's lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('cancel'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('cancel'));\n }\n\n return ReadableStreamReaderGenericCancel(this, reason);\n }\n\n /**\n * Attempts to reads bytes into view, and returns a promise resolved with the result.\n *\n * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.\n */\n read(\n view: T,\n options?: ReadableStreamBYOBReaderReadOptions\n ): Promise>;\n read>(\n view: T,\n rawOptions: ReadableStreamBYOBReaderReadOptions | null | undefined = {}\n ): Promise> {\n if (!IsReadableStreamBYOBReader(this)) {\n return promiseRejectedWith(byobReaderBrandCheckException('read'));\n }\n\n if (!ArrayBuffer.isView(view)) {\n return promiseRejectedWith(new TypeError('view must be an array buffer view'));\n }\n if (view.byteLength === 0) {\n return promiseRejectedWith(new TypeError('view must have non-zero byteLength'));\n }\n if (view.buffer.byteLength === 0) {\n return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`));\n }\n if (IsDetachedBuffer(view.buffer)) {\n return promiseRejectedWith(new TypeError('view\\'s buffer has been detached'));\n }\n\n let options: ValidatedReadableStreamBYOBReaderReadOptions;\n try {\n options = convertByobReadOptions(rawOptions, 'options');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const min = options.min;\n if (min === 0) {\n return promiseRejectedWith(new TypeError('options.min must be greater than 0'));\n }\n if (!isDataView(view)) {\n if (min > (view as unknown as TypedArray).length) {\n return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\\'s length'));\n }\n } else if (min > view.byteLength) {\n return promiseRejectedWith(new RangeError('options.min must be less than or equal to view\\'s byteLength'));\n }\n\n if (this._ownerReadableStream === undefined) {\n return promiseRejectedWith(readerLockException('read from'));\n }\n\n let resolvePromise!: (result: ReadableStreamBYOBReadResult) => void;\n let rejectPromise!: (reason: any) => void;\n const promise = newPromise>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const readIntoRequest: ReadIntoRequest = {\n _chunkSteps: chunk => resolvePromise({ value: chunk, done: false }),\n _closeSteps: chunk => resolvePromise({ value: chunk, done: true }),\n _errorSteps: e => rejectPromise(e)\n };\n ReadableStreamBYOBReaderRead(this, view, min, readIntoRequest);\n return promise;\n }\n\n /**\n * Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active.\n * If the associated stream is errored when the lock is released, the reader will appear errored in the same way\n * from now on; otherwise, the reader will appear closed.\n *\n * A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by\n * the reader's {@link ReadableStreamBYOBReader.read | read()} method has not yet been settled. Attempting to\n * do so will throw a `TypeError` and leave the reader locked to the stream.\n */\n releaseLock(): void {\n if (!IsReadableStreamBYOBReader(this)) {\n throw byobReaderBrandCheckException('releaseLock');\n }\n\n if (this._ownerReadableStream === undefined) {\n return;\n }\n\n ReadableStreamBYOBReaderRelease(this);\n }\n}\n\nObject.defineProperties(ReadableStreamBYOBReader.prototype, {\n cancel: { enumerable: true },\n read: { enumerable: true },\n releaseLock: { enumerable: true },\n closed: { enumerable: true }\n});\nsetFunctionName(ReadableStreamBYOBReader.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStreamBYOBReader.prototype.read, 'read');\nsetFunctionName(ReadableStreamBYOBReader.prototype.releaseLock, 'releaseLock');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamBYOBReader.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamBYOBReader',\n configurable: true\n });\n}\n\n// Abstract operations for the readers.\n\nexport function IsReadableStreamBYOBReader(x: any): x is ReadableStreamBYOBReader {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {\n return false;\n }\n\n return x instanceof ReadableStreamBYOBReader;\n}\n\nexport function ReadableStreamBYOBReaderRead>(\n reader: ReadableStreamBYOBReader,\n view: T,\n min: number,\n readIntoRequest: ReadIntoRequest\n): void {\n const stream = reader._ownerReadableStream;\n\n assert(stream !== undefined);\n\n stream._disturbed = true;\n\n if (stream._state === 'errored') {\n readIntoRequest._errorSteps(stream._storedError);\n } else {\n ReadableByteStreamControllerPullInto(\n stream._readableStreamController as ReadableByteStreamController,\n view,\n min,\n readIntoRequest\n );\n }\n}\n\nexport function ReadableStreamBYOBReaderRelease(reader: ReadableStreamBYOBReader) {\n ReadableStreamReaderGenericRelease(reader);\n const e = new TypeError('Reader was released');\n ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);\n}\n\nexport function ReadableStreamBYOBReaderErrorReadIntoRequests(reader: ReadableStreamBYOBReader, e: any) {\n const readIntoRequests = reader._readIntoRequests;\n reader._readIntoRequests = new SimpleQueue();\n readIntoRequests.forEach(readIntoRequest => {\n readIntoRequest._errorSteps(e);\n });\n}\n\n// Helper functions for the ReadableStreamBYOBReader.\n\nfunction byobReaderBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamBYOBReader.prototype.${name} can only be used on a ReadableStreamBYOBReader`);\n}\n","import type { QueuingStrategy, QueuingStrategySizeCallback } from '../queuing-strategy';\nimport NumberIsNaN from '../../stub/number-isnan';\n\nexport function ExtractHighWaterMark(strategy: QueuingStrategy, defaultHWM: number): number {\n const { highWaterMark } = strategy;\n\n if (highWaterMark === undefined) {\n return defaultHWM;\n }\n\n if (NumberIsNaN(highWaterMark) || highWaterMark < 0) {\n throw new RangeError('Invalid highWaterMark');\n }\n\n return highWaterMark;\n}\n\nexport function ExtractSizeAlgorithm(strategy: QueuingStrategy): QueuingStrategySizeCallback {\n const { size } = strategy;\n\n if (!size) {\n return () => 1;\n }\n\n return size;\n}\n","import type { QueuingStrategy, QueuingStrategySizeCallback } from '../queuing-strategy';\nimport { assertDictionary, assertFunction, convertUnrestrictedDouble } from './basic';\n\nexport function convertQueuingStrategy(init: QueuingStrategy | null | undefined,\n context: string): QueuingStrategy {\n assertDictionary(init, context);\n const highWaterMark = init?.highWaterMark;\n const size = init?.size;\n return {\n highWaterMark: highWaterMark === undefined ? undefined : convertUnrestrictedDouble(highWaterMark),\n size: size === undefined ? undefined : convertQueuingStrategySize(size, `${context} has member 'size' that`)\n };\n}\n\nfunction convertQueuingStrategySize(fn: QueuingStrategySizeCallback,\n context: string): QueuingStrategySizeCallback {\n assertFunction(fn, context);\n return chunk => convertUnrestrictedDouble(fn(chunk));\n}\n","import { assertDictionary, assertFunction } from './basic';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\nimport type {\n UnderlyingSink,\n UnderlyingSinkAbortCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n ValidatedUnderlyingSink\n} from '../writable-stream/underlying-sink';\nimport { WritableStreamDefaultController } from '../writable-stream';\n\nexport function convertUnderlyingSink(original: UnderlyingSink | null,\n context: string): ValidatedUnderlyingSink {\n assertDictionary(original, context);\n const abort = original?.abort;\n const close = original?.close;\n const start = original?.start;\n const type = original?.type;\n const write = original?.write;\n return {\n abort: abort === undefined ?\n undefined :\n convertUnderlyingSinkAbortCallback(abort, original!, `${context} has member 'abort' that`),\n close: close === undefined ?\n undefined :\n convertUnderlyingSinkCloseCallback(close, original!, `${context} has member 'close' that`),\n start: start === undefined ?\n undefined :\n convertUnderlyingSinkStartCallback(start, original!, `${context} has member 'start' that`),\n write: write === undefined ?\n undefined :\n convertUnderlyingSinkWriteCallback(write, original!, `${context} has member 'write' that`),\n type\n };\n}\n\nfunction convertUnderlyingSinkAbortCallback(\n fn: UnderlyingSinkAbortCallback,\n original: UnderlyingSink,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n\nfunction convertUnderlyingSinkCloseCallback(\n fn: UnderlyingSinkCloseCallback,\n original: UnderlyingSink,\n context: string\n): () => Promise {\n assertFunction(fn, context);\n return () => promiseCall(fn, original, []);\n}\n\nfunction convertUnderlyingSinkStartCallback(\n fn: UnderlyingSinkStartCallback,\n original: UnderlyingSink,\n context: string\n): UnderlyingSinkStartCallback {\n assertFunction(fn, context);\n return (controller: WritableStreamDefaultController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertUnderlyingSinkWriteCallback(\n fn: UnderlyingSinkWriteCallback,\n original: UnderlyingSink,\n context: string\n): (chunk: W, controller: WritableStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (chunk: W, controller: WritableStreamDefaultController) => promiseCall(fn, original, [chunk, controller]);\n}\n","import { IsWritableStream, WritableStream } from '../writable-stream';\n\nexport function assertWritableStream(x: unknown, context: string): asserts x is WritableStream {\n if (!IsWritableStream(x)) {\n throw new TypeError(`${context} is not a WritableStream.`);\n }\n}\n","/**\n * A signal object that allows you to communicate with a request and abort it if required\n * via its associated `AbortController` object.\n *\n * @remarks\n * This interface is compatible with the `AbortSignal` interface defined in TypeScript's DOM types.\n * It is redefined here, so it can be polyfilled without a DOM, for example with\n * {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.\n *\n * @public\n */\nexport interface AbortSignal {\n /**\n * Whether the request is aborted.\n */\n readonly aborted: boolean;\n\n /**\n * If aborted, returns the reason for aborting.\n */\n readonly reason?: any;\n\n /**\n * Add an event listener to be triggered when this signal becomes aborted.\n */\n addEventListener(type: 'abort', listener: () => void): void;\n\n /**\n * Remove an event listener that was previously added with {@link AbortSignal.addEventListener}.\n */\n removeEventListener(type: 'abort', listener: () => void): void;\n}\n\nexport function isAbortSignal(value: unknown): value is AbortSignal {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n try {\n return typeof (value as AbortSignal).aborted === 'boolean';\n } catch {\n // AbortSignal.prototype.aborted throws if its brand check fails\n return false;\n }\n}\n\n/**\n * A controller object that allows you to abort an `AbortSignal` when desired.\n *\n * @remarks\n * This interface is compatible with the `AbortController` interface defined in TypeScript's DOM types.\n * It is redefined here, so it can be polyfilled without a DOM, for example with\n * {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.\n *\n * @internal\n */\nexport interface AbortController {\n readonly signal: AbortSignal;\n\n abort(reason?: any): void;\n}\n\ninterface AbortControllerConstructor {\n new(): AbortController;\n}\n\nconst supportsAbortController = typeof (AbortController as any) === 'function';\n\n/**\n * Construct a new AbortController, if supported by the platform.\n *\n * @internal\n */\nexport function createAbortController(): AbortController | undefined {\n if (supportsAbortController) {\n return new (AbortController as AbortControllerConstructor)();\n }\n return undefined;\n}\n","import assert from '../stub/assert';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n uponPromise\n} from './helpers/webidl';\nimport {\n DequeueValue,\n EnqueueValueWithSize,\n PeekQueueValue,\n type QueuePair,\n ResetQueue\n} from './abstract-ops/queue-with-sizes';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { SimpleQueue } from './simple-queue';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { AbortSteps, ErrorSteps } from './abstract-ops/internal-methods';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport type {\n UnderlyingSink,\n UnderlyingSinkAbortCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n ValidatedUnderlyingSink\n} from './writable-stream/underlying-sink';\nimport { assertObject, assertRequiredArgument } from './validators/basic';\nimport { convertUnderlyingSink } from './validators/underlying-sink';\nimport { assertWritableStream } from './validators/writable-stream';\nimport { type AbortController, type AbortSignal, createAbortController } from './abort-signal';\n\ntype WritableStreamState = 'writable' | 'closed' | 'erroring' | 'errored';\n\ninterface WriteOrCloseRequest {\n _resolve: (value?: undefined) => void;\n _reject: (reason: any) => void;\n}\n\ntype WriteRequest = WriteOrCloseRequest;\ntype CloseRequest = WriteOrCloseRequest;\n\ninterface PendingAbortRequest {\n _promise: Promise;\n _resolve: (value?: undefined) => void;\n _reject: (reason: any) => void;\n _reason: any;\n _wasAlreadyErroring: boolean;\n}\n\n/**\n * A writable stream represents a destination for data, into which you can write.\n *\n * @public\n */\nclass WritableStream {\n /** @internal */\n _state!: WritableStreamState;\n /** @internal */\n _storedError: any;\n /** @internal */\n _writer: WritableStreamDefaultWriter | undefined;\n /** @internal */\n _writableStreamController!: WritableStreamDefaultController;\n /** @internal */\n _writeRequests!: SimpleQueue;\n /** @internal */\n _inFlightWriteRequest: WriteRequest | undefined;\n /** @internal */\n _closeRequest: CloseRequest | undefined;\n /** @internal */\n _inFlightCloseRequest: CloseRequest | undefined;\n /** @internal */\n _pendingAbortRequest: PendingAbortRequest | undefined;\n /** @internal */\n _backpressure!: boolean;\n\n constructor(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy);\n constructor(rawUnderlyingSink: UnderlyingSink | null | undefined = {},\n rawStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawUnderlyingSink === undefined) {\n rawUnderlyingSink = null;\n } else {\n assertObject(rawUnderlyingSink, 'First parameter');\n }\n\n const strategy = convertQueuingStrategy(rawStrategy, 'Second parameter');\n const underlyingSink = convertUnderlyingSink(rawUnderlyingSink, 'First parameter');\n\n InitializeWritableStream(this);\n\n const type = underlyingSink.type;\n if (type !== undefined) {\n throw new RangeError('Invalid type is specified');\n }\n\n const sizeAlgorithm = ExtractSizeAlgorithm(strategy);\n const highWaterMark = ExtractHighWaterMark(strategy, 1);\n\n SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, highWaterMark, sizeAlgorithm);\n }\n\n /**\n * Returns whether or not the writable stream is locked to a writer.\n */\n get locked(): boolean {\n if (!IsWritableStream(this)) {\n throw streamBrandCheckException('locked');\n }\n\n return IsWritableStreamLocked(this);\n }\n\n /**\n * Aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be\n * immediately moved to an errored state, with any queued-up writes discarded. This will also execute any abort\n * mechanism of the underlying sink.\n *\n * The returned promise will fulfill if the stream shuts down successfully, or reject if the underlying sink signaled\n * that there was an error doing so. Additionally, it will reject with a `TypeError` (without attempting to cancel\n * the stream) if the stream is currently locked.\n */\n abort(reason: any = undefined): Promise {\n if (!IsWritableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('abort'));\n }\n\n if (IsWritableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));\n }\n\n return WritableStreamAbort(this, reason);\n }\n\n /**\n * Closes the stream. The underlying sink will finish processing any previously-written chunks, before invoking its\n * close behavior. During this time any further attempts to write will fail (without erroring the stream).\n *\n * The method returns a promise that will fulfill if all remaining chunks are successfully written and the stream\n * successfully closes, or rejects if an error is encountered during this process. Additionally, it will reject with\n * a `TypeError` (without attempting to cancel the stream) if the stream is currently locked.\n */\n close() {\n if (!IsWritableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('close'));\n }\n\n if (IsWritableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));\n }\n\n if (WritableStreamCloseQueuedOrInFlight(this)) {\n return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));\n }\n\n return WritableStreamClose(this);\n }\n\n /**\n * Creates a {@link WritableStreamDefaultWriter | writer} and locks the stream to the new writer. While the stream\n * is locked, no other writer can be acquired until this one is released.\n *\n * This functionality is especially useful for creating abstractions that desire the ability to write to a stream\n * without interruption or interleaving. By getting a writer for the stream, you can ensure nobody else can write at\n * the same time, which would cause the resulting written data to be unpredictable and probably useless.\n */\n getWriter(): WritableStreamDefaultWriter {\n if (!IsWritableStream(this)) {\n throw streamBrandCheckException('getWriter');\n }\n\n return AcquireWritableStreamDefaultWriter(this);\n }\n}\n\nObject.defineProperties(WritableStream.prototype, {\n abort: { enumerable: true },\n close: { enumerable: true },\n getWriter: { enumerable: true },\n locked: { enumerable: true }\n});\nsetFunctionName(WritableStream.prototype.abort, 'abort');\nsetFunctionName(WritableStream.prototype.close, 'close');\nsetFunctionName(WritableStream.prototype.getWriter, 'getWriter');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStream.prototype, Symbol.toStringTag, {\n value: 'WritableStream',\n configurable: true\n });\n}\n\nexport {\n AcquireWritableStreamDefaultWriter,\n CreateWritableStream,\n IsWritableStream,\n IsWritableStreamLocked,\n WritableStream,\n WritableStreamAbort,\n WritableStreamDefaultControllerErrorIfNeeded,\n WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite,\n WritableStreamCloseQueuedOrInFlight\n};\n\nexport type {\n UnderlyingSink,\n UnderlyingSinkStartCallback,\n UnderlyingSinkWriteCallback,\n UnderlyingSinkCloseCallback,\n UnderlyingSinkAbortCallback\n};\n\n// Abstract operations for the WritableStream.\n\nfunction AcquireWritableStreamDefaultWriter(stream: WritableStream): WritableStreamDefaultWriter {\n return new WritableStreamDefaultWriter(stream);\n}\n\n// Throws if and only if startAlgorithm throws.\nfunction CreateWritableStream(startAlgorithm: () => void | PromiseLike,\n writeAlgorithm: (chunk: W) => Promise,\n closeAlgorithm: () => Promise,\n abortAlgorithm: (reason: any) => Promise,\n highWaterMark = 1,\n sizeAlgorithm: QueuingStrategySizeCallback = () => 1) {\n assert(IsNonNegativeNumber(highWaterMark));\n\n const stream: WritableStream = Object.create(WritableStream.prototype);\n InitializeWritableStream(stream);\n\n const controller: WritableStreamDefaultController = Object.create(WritableStreamDefaultController.prototype);\n\n SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm,\n abortAlgorithm, highWaterMark, sizeAlgorithm);\n return stream;\n}\n\nfunction InitializeWritableStream(stream: WritableStream) {\n stream._state = 'writable';\n\n // The error that will be reported by new method calls once the state becomes errored. Only set when [[state]] is\n // 'erroring' or 'errored'. May be set to an undefined value.\n stream._storedError = undefined;\n\n stream._writer = undefined;\n\n // Initialize to undefined first because the constructor of the controller checks this\n // variable to validate the caller.\n stream._writableStreamController = undefined!;\n\n // This queue is placed here instead of the writer class in order to allow for passing a writer to the next data\n // producer without waiting for the queued writes to finish.\n stream._writeRequests = new SimpleQueue();\n\n // Write requests are removed from _writeRequests when write() is called on the underlying sink. This prevents\n // them from being erroneously rejected on error. If a write() call is in-flight, the request is stored here.\n stream._inFlightWriteRequest = undefined;\n\n // The promise that was returned from writer.close(). Stored here because it may be fulfilled after the writer\n // has been detached.\n stream._closeRequest = undefined;\n\n // Close request is removed from _closeRequest when close() is called on the underlying sink. This prevents it\n // from being erroneously rejected on error. If a close() call is in-flight, the request is stored here.\n stream._inFlightCloseRequest = undefined;\n\n // The promise that was returned from writer.abort(). This may also be fulfilled after the writer has detached.\n stream._pendingAbortRequest = undefined;\n\n // The backpressure signal set by the controller.\n stream._backpressure = false;\n}\n\nfunction IsWritableStream(x: unknown): x is WritableStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {\n return false;\n }\n\n return x instanceof WritableStream;\n}\n\nfunction IsWritableStreamLocked(stream: WritableStream): boolean {\n assert(IsWritableStream(stream));\n\n if (stream._writer === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamAbort(stream: WritableStream, reason: any): Promise {\n if (stream._state === 'closed' || stream._state === 'errored') {\n return promiseResolvedWith(undefined);\n }\n stream._writableStreamController._abortReason = reason;\n stream._writableStreamController._abortController?.abort(reason);\n\n // TypeScript narrows the type of `stream._state` down to 'writable' | 'erroring',\n // but it doesn't know that signaling abort runs author code that might have changed the state.\n // Widen the type again by casting to WritableStreamState.\n const state = stream._state as WritableStreamState;\n\n if (state === 'closed' || state === 'errored') {\n return promiseResolvedWith(undefined);\n }\n if (stream._pendingAbortRequest !== undefined) {\n return stream._pendingAbortRequest._promise;\n }\n\n assert(state === 'writable' || state === 'erroring');\n\n let wasAlreadyErroring = false;\n if (state === 'erroring') {\n wasAlreadyErroring = true;\n // reason will not be used, so don't keep a reference to it.\n reason = undefined;\n }\n\n const promise = newPromise((resolve, reject) => {\n stream._pendingAbortRequest = {\n _promise: undefined!,\n _resolve: resolve,\n _reject: reject,\n _reason: reason,\n _wasAlreadyErroring: wasAlreadyErroring\n };\n });\n stream._pendingAbortRequest!._promise = promise;\n\n if (!wasAlreadyErroring) {\n WritableStreamStartErroring(stream, reason);\n }\n\n return promise;\n}\n\nfunction WritableStreamClose(stream: WritableStream): Promise {\n const state = stream._state;\n if (state === 'closed' || state === 'errored') {\n return promiseRejectedWith(new TypeError(\n `The stream (in ${state} state) is not in the writable state and cannot be closed`));\n }\n\n assert(state === 'writable' || state === 'erroring');\n assert(!WritableStreamCloseQueuedOrInFlight(stream));\n\n const promise = newPromise((resolve, reject) => {\n const closeRequest: CloseRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._closeRequest = closeRequest;\n });\n\n const writer = stream._writer;\n if (writer !== undefined && stream._backpressure && state === 'writable') {\n defaultWriterReadyPromiseResolve(writer);\n }\n\n WritableStreamDefaultControllerClose(stream._writableStreamController);\n\n return promise;\n}\n\n// WritableStream API exposed for controllers.\n\nfunction WritableStreamAddWriteRequest(stream: WritableStream): Promise {\n assert(IsWritableStreamLocked(stream));\n assert(stream._state === 'writable');\n\n const promise = newPromise((resolve, reject) => {\n const writeRequest: WriteRequest = {\n _resolve: resolve,\n _reject: reject\n };\n\n stream._writeRequests.push(writeRequest);\n });\n\n return promise;\n}\n\nfunction WritableStreamDealWithRejection(stream: WritableStream, error: any) {\n const state = stream._state;\n\n if (state === 'writable') {\n WritableStreamStartErroring(stream, error);\n return;\n }\n\n assert(state === 'erroring');\n WritableStreamFinishErroring(stream);\n}\n\nfunction WritableStreamStartErroring(stream: WritableStream, reason: any) {\n assert(stream._storedError === undefined);\n assert(stream._state === 'writable');\n\n const controller = stream._writableStreamController;\n assert(controller !== undefined);\n\n stream._state = 'erroring';\n stream._storedError = reason;\n const writer = stream._writer;\n if (writer !== undefined) {\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);\n }\n\n if (!WritableStreamHasOperationMarkedInFlight(stream) && controller._started) {\n WritableStreamFinishErroring(stream);\n }\n}\n\nfunction WritableStreamFinishErroring(stream: WritableStream) {\n assert(stream._state === 'erroring');\n assert(!WritableStreamHasOperationMarkedInFlight(stream));\n stream._state = 'errored';\n stream._writableStreamController[ErrorSteps]();\n\n const storedError = stream._storedError;\n stream._writeRequests.forEach(writeRequest => {\n writeRequest._reject(storedError);\n });\n stream._writeRequests = new SimpleQueue();\n\n if (stream._pendingAbortRequest === undefined) {\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n const abortRequest = stream._pendingAbortRequest;\n stream._pendingAbortRequest = undefined;\n\n if (abortRequest._wasAlreadyErroring) {\n abortRequest._reject(storedError);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return;\n }\n\n const promise = stream._writableStreamController[AbortSteps](abortRequest._reason);\n uponPromise(\n promise,\n () => {\n abortRequest._resolve();\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return null;\n },\n (reason: any) => {\n abortRequest._reject(reason);\n WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);\n return null;\n });\n}\n\nfunction WritableStreamFinishInFlightWrite(stream: WritableStream) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest!._resolve(undefined);\n stream._inFlightWriteRequest = undefined;\n}\n\nfunction WritableStreamFinishInFlightWriteWithError(stream: WritableStream, error: any) {\n assert(stream._inFlightWriteRequest !== undefined);\n stream._inFlightWriteRequest!._reject(error);\n stream._inFlightWriteRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n WritableStreamDealWithRejection(stream, error);\n}\n\nfunction WritableStreamFinishInFlightClose(stream: WritableStream) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest!._resolve(undefined);\n stream._inFlightCloseRequest = undefined;\n\n const state = stream._state;\n\n assert(state === 'writable' || state === 'erroring');\n\n if (state === 'erroring') {\n // The error was too late to do anything, so it is ignored.\n stream._storedError = undefined;\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._resolve();\n stream._pendingAbortRequest = undefined;\n }\n }\n\n stream._state = 'closed';\n\n const writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseResolve(writer);\n }\n\n assert(stream._pendingAbortRequest === undefined);\n assert(stream._storedError === undefined);\n}\n\nfunction WritableStreamFinishInFlightCloseWithError(stream: WritableStream, error: any) {\n assert(stream._inFlightCloseRequest !== undefined);\n stream._inFlightCloseRequest!._reject(error);\n stream._inFlightCloseRequest = undefined;\n\n assert(stream._state === 'writable' || stream._state === 'erroring');\n\n // Never execute sink abort() after sink close().\n if (stream._pendingAbortRequest !== undefined) {\n stream._pendingAbortRequest._reject(error);\n stream._pendingAbortRequest = undefined;\n }\n WritableStreamDealWithRejection(stream, error);\n}\n\n// TODO(ricea): Fix alphabetical order.\nfunction WritableStreamCloseQueuedOrInFlight(stream: WritableStream): boolean {\n if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamHasOperationMarkedInFlight(stream: WritableStream): boolean {\n if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {\n return false;\n }\n\n return true;\n}\n\nfunction WritableStreamMarkCloseRequestInFlight(stream: WritableStream) {\n assert(stream._inFlightCloseRequest === undefined);\n assert(stream._closeRequest !== undefined);\n stream._inFlightCloseRequest = stream._closeRequest;\n stream._closeRequest = undefined;\n}\n\nfunction WritableStreamMarkFirstWriteRequestInFlight(stream: WritableStream) {\n assert(stream._inFlightWriteRequest === undefined);\n assert(stream._writeRequests.length !== 0);\n stream._inFlightWriteRequest = stream._writeRequests.shift();\n}\n\nfunction WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream: WritableStream) {\n assert(stream._state === 'errored');\n if (stream._closeRequest !== undefined) {\n assert(stream._inFlightCloseRequest === undefined);\n\n stream._closeRequest._reject(stream._storedError);\n stream._closeRequest = undefined;\n }\n const writer = stream._writer;\n if (writer !== undefined) {\n defaultWriterClosedPromiseReject(writer, stream._storedError);\n }\n}\n\nfunction WritableStreamUpdateBackpressure(stream: WritableStream, backpressure: boolean) {\n assert(stream._state === 'writable');\n assert(!WritableStreamCloseQueuedOrInFlight(stream));\n\n const writer = stream._writer;\n if (writer !== undefined && backpressure !== stream._backpressure) {\n if (backpressure) {\n defaultWriterReadyPromiseReset(writer);\n } else {\n assert(!backpressure);\n\n defaultWriterReadyPromiseResolve(writer);\n }\n }\n\n stream._backpressure = backpressure;\n}\n\n/**\n * A default writer vended by a {@link WritableStream}.\n *\n * @public\n */\nexport class WritableStreamDefaultWriter {\n /** @internal */\n _ownerWritableStream: WritableStream;\n /** @internal */\n _closedPromise!: Promise;\n /** @internal */\n _closedPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _closedPromise_reject?: (reason: any) => void;\n /** @internal */\n _closedPromiseState!: 'pending' | 'resolved' | 'rejected';\n /** @internal */\n _readyPromise!: Promise;\n /** @internal */\n _readyPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _readyPromise_reject?: (reason: any) => void;\n /** @internal */\n _readyPromiseState!: 'pending' | 'fulfilled' | 'rejected';\n\n constructor(stream: WritableStream) {\n assertRequiredArgument(stream, 1, 'WritableStreamDefaultWriter');\n assertWritableStream(stream, 'First parameter');\n\n if (IsWritableStreamLocked(stream)) {\n throw new TypeError('This stream has already been locked for exclusive writing by another writer');\n }\n\n this._ownerWritableStream = stream;\n stream._writer = this;\n\n const state = stream._state;\n\n if (state === 'writable') {\n if (!WritableStreamCloseQueuedOrInFlight(stream) && stream._backpressure) {\n defaultWriterReadyPromiseInitialize(this);\n } else {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n }\n\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'erroring') {\n defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);\n defaultWriterClosedPromiseInitialize(this);\n } else if (state === 'closed') {\n defaultWriterReadyPromiseInitializeAsResolved(this);\n defaultWriterClosedPromiseInitializeAsResolved(this);\n } else {\n assert(state === 'errored');\n\n const storedError = stream._storedError;\n defaultWriterReadyPromiseInitializeAsRejected(this, storedError);\n defaultWriterClosedPromiseInitializeAsRejected(this, storedError);\n }\n }\n\n /**\n * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or\n * the writer’s lock is released before the stream finishes closing.\n */\n get closed(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('closed'));\n }\n\n return this._closedPromise;\n }\n\n /**\n * Returns the desired size to fill the stream’s internal queue. It can be negative, if the queue is over-full.\n * A producer can use this information to determine the right amount of data to write.\n *\n * It will be `null` if the stream cannot be successfully written to (due to either being errored, or having an abort\n * queued up). It will return zero if the stream is closed. And the getter will throw an exception if invoked when\n * the writer’s lock is released.\n */\n get desiredSize(): number | null {\n if (!IsWritableStreamDefaultWriter(this)) {\n throw defaultWriterBrandCheckException('desiredSize');\n }\n\n if (this._ownerWritableStream === undefined) {\n throw defaultWriterLockException('desiredSize');\n }\n\n return WritableStreamDefaultWriterGetDesiredSize(this);\n }\n\n /**\n * Returns a promise that will be fulfilled when the desired size to fill the stream’s internal queue transitions\n * from non-positive to positive, signaling that it is no longer applying backpressure. Once the desired size dips\n * back to zero or below, the getter will return a new promise that stays pending until the next transition.\n *\n * If the stream becomes errored or aborted, or the writer’s lock is released, the returned promise will become\n * rejected.\n */\n get ready(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('ready'));\n }\n\n return this._readyPromise;\n }\n\n /**\n * If the reader is active, behaves the same as {@link WritableStream.abort | stream.abort(reason)}.\n */\n abort(reason: any = undefined): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('abort'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('abort'));\n }\n\n return WritableStreamDefaultWriterAbort(this, reason);\n }\n\n /**\n * If the reader is active, behaves the same as {@link WritableStream.close | stream.close()}.\n */\n close(): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('close'));\n }\n\n const stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('close'));\n }\n\n if (WritableStreamCloseQueuedOrInFlight(stream)) {\n return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));\n }\n\n return WritableStreamDefaultWriterClose(this);\n }\n\n /**\n * Releases the writer’s lock on the corresponding stream. After the lock is released, the writer is no longer active.\n * If the associated stream is errored when the lock is released, the writer will appear errored in the same way from\n * now on; otherwise, the writer will appear closed.\n *\n * Note that the lock can still be released even if some ongoing writes have not yet finished (i.e. even if the\n * promises returned from previous calls to {@link WritableStreamDefaultWriter.write | write()} have not yet settled).\n * It’s not necessary to hold the lock on the writer for the duration of the write; the lock instead simply prevents\n * other producers from writing in an interleaved manner.\n */\n releaseLock(): void {\n if (!IsWritableStreamDefaultWriter(this)) {\n throw defaultWriterBrandCheckException('releaseLock');\n }\n\n const stream = this._ownerWritableStream;\n\n if (stream === undefined) {\n return;\n }\n\n assert(stream._writer !== undefined);\n\n WritableStreamDefaultWriterRelease(this);\n }\n\n /**\n * Writes the given chunk to the writable stream, by waiting until any previous writes have finished successfully,\n * and then sending the chunk to the underlying sink's {@link UnderlyingSink.write | write()} method. It will return\n * a promise that fulfills with undefined upon a successful write, or rejects if the write fails or stream becomes\n * errored before the writing process is initiated.\n *\n * Note that what \"success\" means is up to the underlying sink; it might indicate simply that the chunk has been\n * accepted, and not necessarily that it is safely saved to its ultimate destination.\n */\n write(chunk: W): Promise;\n write(chunk: W = undefined!): Promise {\n if (!IsWritableStreamDefaultWriter(this)) {\n return promiseRejectedWith(defaultWriterBrandCheckException('write'));\n }\n\n if (this._ownerWritableStream === undefined) {\n return promiseRejectedWith(defaultWriterLockException('write to'));\n }\n\n return WritableStreamDefaultWriterWrite(this, chunk);\n }\n}\n\nObject.defineProperties(WritableStreamDefaultWriter.prototype, {\n abort: { enumerable: true },\n close: { enumerable: true },\n releaseLock: { enumerable: true },\n write: { enumerable: true },\n closed: { enumerable: true },\n desiredSize: { enumerable: true },\n ready: { enumerable: true }\n});\nsetFunctionName(WritableStreamDefaultWriter.prototype.abort, 'abort');\nsetFunctionName(WritableStreamDefaultWriter.prototype.close, 'close');\nsetFunctionName(WritableStreamDefaultWriter.prototype.releaseLock, 'releaseLock');\nsetFunctionName(WritableStreamDefaultWriter.prototype.write, 'write');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStreamDefaultWriter.prototype, Symbol.toStringTag, {\n value: 'WritableStreamDefaultWriter',\n configurable: true\n });\n}\n\n// Abstract operations for the WritableStreamDefaultWriter.\n\nfunction IsWritableStreamDefaultWriter(x: any): x is WritableStreamDefaultWriter {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {\n return false;\n }\n\n return x instanceof WritableStreamDefaultWriter;\n}\n\n// A client of WritableStreamDefaultWriter may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultWriterAbort(writer: WritableStreamDefaultWriter, reason: any) {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n return WritableStreamAbort(stream, reason);\n}\n\nfunction WritableStreamDefaultWriterClose(writer: WritableStreamDefaultWriter): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n return WritableStreamClose(stream);\n}\n\nfunction WritableStreamDefaultWriterCloseWithErrorPropagation(writer: WritableStreamDefaultWriter): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n const state = stream._state;\n if (WritableStreamCloseQueuedOrInFlight(stream) || state === 'closed') {\n return promiseResolvedWith(undefined);\n }\n\n if (state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n\n assert(state === 'writable' || state === 'erroring');\n\n return WritableStreamDefaultWriterClose(writer);\n}\n\nfunction WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer: WritableStreamDefaultWriter, error: any) {\n if (writer._closedPromiseState === 'pending') {\n defaultWriterClosedPromiseReject(writer, error);\n } else {\n defaultWriterClosedPromiseResetToRejected(writer, error);\n }\n}\n\nfunction WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer: WritableStreamDefaultWriter, error: any) {\n if (writer._readyPromiseState === 'pending') {\n defaultWriterReadyPromiseReject(writer, error);\n } else {\n defaultWriterReadyPromiseResetToRejected(writer, error);\n }\n}\n\nfunction WritableStreamDefaultWriterGetDesiredSize(writer: WritableStreamDefaultWriter): number | null {\n const stream = writer._ownerWritableStream;\n const state = stream._state;\n\n if (state === 'errored' || state === 'erroring') {\n return null;\n }\n\n if (state === 'closed') {\n return 0;\n }\n\n return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);\n}\n\nfunction WritableStreamDefaultWriterRelease(writer: WritableStreamDefaultWriter) {\n const stream = writer._ownerWritableStream;\n assert(stream !== undefined);\n assert(stream._writer === writer);\n\n const releasedError = new TypeError(\n `Writer was released and can no longer be used to monitor the stream's closedness`);\n\n WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);\n\n // The state transitions to \"errored\" before the sink abort() method runs, but the writer.closed promise is not\n // rejected until afterwards. This means that simply testing state will not work.\n WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);\n\n stream._writer = undefined;\n writer._ownerWritableStream = undefined!;\n}\n\nfunction WritableStreamDefaultWriterWrite(writer: WritableStreamDefaultWriter, chunk: W): Promise {\n const stream = writer._ownerWritableStream;\n\n assert(stream !== undefined);\n\n const controller = stream._writableStreamController;\n\n const chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);\n\n if (stream !== writer._ownerWritableStream) {\n return promiseRejectedWith(defaultWriterLockException('write to'));\n }\n\n const state = stream._state;\n if (state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n if (WritableStreamCloseQueuedOrInFlight(stream) || state === 'closed') {\n return promiseRejectedWith(new TypeError('The stream is closing or closed and cannot be written to'));\n }\n if (state === 'erroring') {\n return promiseRejectedWith(stream._storedError);\n }\n\n assert(state === 'writable');\n\n const promise = WritableStreamAddWriteRequest(stream);\n\n WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);\n\n return promise;\n}\n\nconst closeSentinel: unique symbol = {} as any;\n\ntype QueueRecord = W | typeof closeSentinel;\n\n/**\n * Allows control of a {@link WritableStream | writable stream}'s state and internal queue.\n *\n * @public\n */\nexport class WritableStreamDefaultController {\n /** @internal */\n _controlledWritableStream!: WritableStream;\n /** @internal */\n _queue!: SimpleQueue>>;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _abortReason: any;\n /** @internal */\n _abortController: AbortController | undefined;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _strategySizeAlgorithm!: QueuingStrategySizeCallback;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _writeAlgorithm!: (chunk: W) => Promise;\n /** @internal */\n _closeAlgorithm!: () => Promise;\n /** @internal */\n _abortAlgorithm!: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.\n *\n * @deprecated\n * This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.\n * Use {@link WritableStreamDefaultController.signal}'s `reason` instead.\n */\n get abortReason(): any {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('abortReason');\n }\n return this._abortReason;\n }\n\n /**\n * An `AbortSignal` that can be used to abort the pending write or close operation when the stream is aborted.\n */\n get signal(): AbortSignal {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('signal');\n }\n if (this._abortController === undefined) {\n // Older browsers or older Node versions may not support `AbortController` or `AbortSignal`.\n // We don't want to bundle and ship an `AbortController` polyfill together with our polyfill,\n // so instead we only implement support for `signal` if we find a global `AbortController` constructor.\n throw new TypeError('WritableStreamDefaultController.prototype.signal is not supported');\n }\n return this._abortController.signal;\n }\n\n /**\n * Closes the controlled writable stream, making all future interactions with it fail with the given error `e`.\n *\n * This method is rarely used, since usually it suffices to return a rejected promise from one of the underlying\n * sink's methods. However, it can be useful for suddenly shutting down a stream in response to an event outside the\n * normal lifecycle of interactions with the underlying sink.\n */\n error(e: any = undefined): void {\n if (!IsWritableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n const state = this._controlledWritableStream._state;\n if (state !== 'writable') {\n // The stream is closed, errored or will be soon. The sink can't do anything useful if it gets an error here, so\n // just treat it as a no-op.\n return;\n }\n\n WritableStreamDefaultControllerError(this, e);\n }\n\n /** @internal */\n [AbortSteps](reason: any): Promise {\n const result = this._abortAlgorithm(reason);\n WritableStreamDefaultControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [ErrorSteps]() {\n ResetQueue(this);\n }\n}\n\nObject.defineProperties(WritableStreamDefaultController.prototype, {\n abortReason: { enumerable: true },\n signal: { enumerable: true },\n error: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(WritableStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'WritableStreamDefaultController',\n configurable: true\n });\n}\n\n// Abstract operations implementing interface required by the WritableStream.\n\nfunction IsWritableStreamDefaultController(x: any): x is WritableStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledWritableStream')) {\n return false;\n }\n\n return x instanceof WritableStreamDefaultController;\n}\n\nfunction SetUpWritableStreamDefaultController(stream: WritableStream,\n controller: WritableStreamDefaultController,\n startAlgorithm: () => void | PromiseLike,\n writeAlgorithm: (chunk: W) => Promise,\n closeAlgorithm: () => Promise,\n abortAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n assert(IsWritableStream(stream));\n assert(stream._writableStreamController === undefined);\n\n controller._controlledWritableStream = stream;\n stream._writableStreamController = controller;\n\n // Need to set the slots so that the assert doesn't fire. In the spec the slots already exist implicitly.\n controller._queue = undefined!;\n controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._abortReason = undefined;\n controller._abortController = createAbortController();\n controller._started = false;\n\n controller._strategySizeAlgorithm = sizeAlgorithm;\n controller._strategyHWM = highWaterMark;\n\n controller._writeAlgorithm = writeAlgorithm;\n controller._closeAlgorithm = closeAlgorithm;\n controller._abortAlgorithm = abortAlgorithm;\n\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n\n const startResult = startAlgorithm();\n const startPromise = promiseResolvedWith(startResult);\n uponPromise(\n startPromise,\n () => {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n controller._started = true;\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n return null;\n },\n r => {\n assert(stream._state === 'writable' || stream._state === 'erroring');\n controller._started = true;\n WritableStreamDealWithRejection(stream, r);\n return null;\n }\n );\n}\n\nfunction SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream: WritableStream,\n underlyingSink: ValidatedUnderlyingSink,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n const controller = Object.create(WritableStreamDefaultController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let writeAlgorithm: (chunk: W) => Promise;\n let closeAlgorithm: () => Promise;\n let abortAlgorithm: (reason: any) => Promise;\n\n if (underlyingSink.start !== undefined) {\n startAlgorithm = () => underlyingSink.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingSink.write !== undefined) {\n writeAlgorithm = chunk => underlyingSink.write!(chunk, controller);\n } else {\n writeAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSink.close !== undefined) {\n closeAlgorithm = () => underlyingSink.close!();\n } else {\n closeAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSink.abort !== undefined) {\n abortAlgorithm = reason => underlyingSink.abort!(reason);\n } else {\n abortAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpWritableStreamDefaultController(\n stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm\n );\n}\n\n// ClearAlgorithms may be called twice. Erroring the same stream in multiple ways will often result in redundant calls.\nfunction WritableStreamDefaultControllerClearAlgorithms(controller: WritableStreamDefaultController) {\n controller._writeAlgorithm = undefined!;\n controller._closeAlgorithm = undefined!;\n controller._abortAlgorithm = undefined!;\n controller._strategySizeAlgorithm = undefined!;\n}\n\nfunction WritableStreamDefaultControllerClose(controller: WritableStreamDefaultController) {\n EnqueueValueWithSize(controller, closeSentinel, 0);\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\nfunction WritableStreamDefaultControllerGetChunkSize(controller: WritableStreamDefaultController,\n chunk: W): number {\n try {\n return controller._strategySizeAlgorithm(chunk);\n } catch (chunkSizeE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);\n return 1;\n }\n}\n\nfunction WritableStreamDefaultControllerGetDesiredSize(controller: WritableStreamDefaultController): number {\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\nfunction WritableStreamDefaultControllerWrite(controller: WritableStreamDefaultController,\n chunk: W,\n chunkSize: number) {\n try {\n EnqueueValueWithSize(controller, chunk, chunkSize);\n } catch (enqueueE) {\n WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);\n return;\n }\n\n const stream = controller._controlledWritableStream;\n if (!WritableStreamCloseQueuedOrInFlight(stream) && stream._state === 'writable') {\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n}\n\n// Abstract operations for the WritableStreamDefaultController.\n\nfunction WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller: WritableStreamDefaultController) {\n const stream = controller._controlledWritableStream;\n\n if (!controller._started) {\n return;\n }\n\n if (stream._inFlightWriteRequest !== undefined) {\n return;\n }\n\n const state = stream._state;\n assert(state !== 'closed' && state !== 'errored');\n if (state === 'erroring') {\n WritableStreamFinishErroring(stream);\n return;\n }\n\n if (controller._queue.length === 0) {\n return;\n }\n\n const value = PeekQueueValue(controller);\n if (value === closeSentinel) {\n WritableStreamDefaultControllerProcessClose(controller);\n } else {\n WritableStreamDefaultControllerProcessWrite(controller, value);\n }\n}\n\nfunction WritableStreamDefaultControllerErrorIfNeeded(controller: WritableStreamDefaultController, error: any) {\n if (controller._controlledWritableStream._state === 'writable') {\n WritableStreamDefaultControllerError(controller, error);\n }\n}\n\nfunction WritableStreamDefaultControllerProcessClose(controller: WritableStreamDefaultController) {\n const stream = controller._controlledWritableStream;\n\n WritableStreamMarkCloseRequestInFlight(stream);\n\n DequeueValue(controller);\n assert(controller._queue.length === 0);\n\n const sinkClosePromise = controller._closeAlgorithm();\n WritableStreamDefaultControllerClearAlgorithms(controller);\n uponPromise(\n sinkClosePromise,\n () => {\n WritableStreamFinishInFlightClose(stream);\n return null;\n },\n reason => {\n WritableStreamFinishInFlightCloseWithError(stream, reason);\n return null;\n }\n );\n}\n\nfunction WritableStreamDefaultControllerProcessWrite(controller: WritableStreamDefaultController, chunk: W) {\n const stream = controller._controlledWritableStream;\n\n WritableStreamMarkFirstWriteRequestInFlight(stream);\n\n const sinkWritePromise = controller._writeAlgorithm(chunk);\n uponPromise(\n sinkWritePromise,\n () => {\n WritableStreamFinishInFlightWrite(stream);\n\n const state = stream._state;\n assert(state === 'writable' || state === 'erroring');\n\n DequeueValue(controller);\n\n if (!WritableStreamCloseQueuedOrInFlight(stream) && state === 'writable') {\n const backpressure = WritableStreamDefaultControllerGetBackpressure(controller);\n WritableStreamUpdateBackpressure(stream, backpressure);\n }\n\n WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);\n return null;\n },\n reason => {\n if (stream._state === 'writable') {\n WritableStreamDefaultControllerClearAlgorithms(controller);\n }\n WritableStreamFinishInFlightWriteWithError(stream, reason);\n return null;\n }\n );\n}\n\nfunction WritableStreamDefaultControllerGetBackpressure(controller: WritableStreamDefaultController): boolean {\n const desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);\n return desiredSize <= 0;\n}\n\n// A client of WritableStreamDefaultController may use these functions directly to bypass state check.\n\nfunction WritableStreamDefaultControllerError(controller: WritableStreamDefaultController, error: any) {\n const stream = controller._controlledWritableStream;\n\n assert(stream._state === 'writable');\n\n WritableStreamDefaultControllerClearAlgorithms(controller);\n WritableStreamStartErroring(stream, error);\n}\n\n// Helper functions for the WritableStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`);\n}\n\n// Helper functions for the WritableStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `WritableStreamDefaultController.prototype.${name} can only be used on a WritableStreamDefaultController`);\n}\n\n\n// Helper functions for the WritableStreamDefaultWriter.\n\nfunction defaultWriterBrandCheckException(name: string): TypeError {\n return new TypeError(\n `WritableStreamDefaultWriter.prototype.${name} can only be used on a WritableStreamDefaultWriter`);\n}\n\nfunction defaultWriterLockException(name: string): TypeError {\n return new TypeError('Cannot ' + name + ' a stream using a released writer');\n}\n\nfunction defaultWriterClosedPromiseInitialize(writer: WritableStreamDefaultWriter) {\n writer._closedPromise = newPromise((resolve, reject) => {\n writer._closedPromise_resolve = resolve;\n writer._closedPromise_reject = reject;\n writer._closedPromiseState = 'pending';\n });\n}\n\nfunction defaultWriterClosedPromiseInitializeAsRejected(writer: WritableStreamDefaultWriter, reason: any) {\n defaultWriterClosedPromiseInitialize(writer);\n defaultWriterClosedPromiseReject(writer, reason);\n}\n\nfunction defaultWriterClosedPromiseInitializeAsResolved(writer: WritableStreamDefaultWriter) {\n defaultWriterClosedPromiseInitialize(writer);\n defaultWriterClosedPromiseResolve(writer);\n}\n\nfunction defaultWriterClosedPromiseReject(writer: WritableStreamDefaultWriter, reason: any) {\n if (writer._closedPromise_reject === undefined) {\n return;\n }\n assert(writer._closedPromiseState === 'pending');\n\n setPromiseIsHandledToTrue(writer._closedPromise);\n writer._closedPromise_reject(reason);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'rejected';\n}\n\nfunction defaultWriterClosedPromiseResetToRejected(writer: WritableStreamDefaultWriter, reason: any) {\n assert(writer._closedPromise_resolve === undefined);\n assert(writer._closedPromise_reject === undefined);\n assert(writer._closedPromiseState !== 'pending');\n\n defaultWriterClosedPromiseInitializeAsRejected(writer, reason);\n}\n\nfunction defaultWriterClosedPromiseResolve(writer: WritableStreamDefaultWriter) {\n if (writer._closedPromise_resolve === undefined) {\n return;\n }\n assert(writer._closedPromiseState === 'pending');\n\n writer._closedPromise_resolve(undefined);\n writer._closedPromise_resolve = undefined;\n writer._closedPromise_reject = undefined;\n writer._closedPromiseState = 'resolved';\n}\n\nfunction defaultWriterReadyPromiseInitialize(writer: WritableStreamDefaultWriter) {\n writer._readyPromise = newPromise((resolve, reject) => {\n writer._readyPromise_resolve = resolve;\n writer._readyPromise_reject = reject;\n });\n writer._readyPromiseState = 'pending';\n}\n\nfunction defaultWriterReadyPromiseInitializeAsRejected(writer: WritableStreamDefaultWriter, reason: any) {\n defaultWriterReadyPromiseInitialize(writer);\n defaultWriterReadyPromiseReject(writer, reason);\n}\n\nfunction defaultWriterReadyPromiseInitializeAsResolved(writer: WritableStreamDefaultWriter) {\n defaultWriterReadyPromiseInitialize(writer);\n defaultWriterReadyPromiseResolve(writer);\n}\n\nfunction defaultWriterReadyPromiseReject(writer: WritableStreamDefaultWriter, reason: any) {\n if (writer._readyPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(writer._readyPromise);\n writer._readyPromise_reject(reason);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'rejected';\n}\n\nfunction defaultWriterReadyPromiseReset(writer: WritableStreamDefaultWriter) {\n assert(writer._readyPromise_resolve === undefined);\n assert(writer._readyPromise_reject === undefined);\n\n defaultWriterReadyPromiseInitialize(writer);\n}\n\nfunction defaultWriterReadyPromiseResetToRejected(writer: WritableStreamDefaultWriter, reason: any) {\n assert(writer._readyPromise_resolve === undefined);\n assert(writer._readyPromise_reject === undefined);\n\n defaultWriterReadyPromiseInitializeAsRejected(writer, reason);\n}\n\nfunction defaultWriterReadyPromiseResolve(writer: WritableStreamDefaultWriter) {\n if (writer._readyPromise_resolve === undefined) {\n return;\n }\n\n writer._readyPromise_resolve(undefined);\n writer._readyPromise_resolve = undefined;\n writer._readyPromise_reject = undefined;\n writer._readyPromiseState = 'fulfilled';\n}\n","/// \n\nfunction getGlobals(): typeof globalThis | undefined {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n } else if (typeof self !== 'undefined') {\n return self;\n } else if (typeof global !== 'undefined') {\n return global;\n }\n return undefined;\n}\n\nexport const globals = getGlobals();\n","/// \nimport { globals } from '../globals';\nimport { setFunctionName } from '../lib/helpers/miscellaneous';\n\ninterface DOMException extends Error {\n name: string;\n message: string;\n}\n\ntype DOMExceptionConstructor = new (message?: string, name?: string) => DOMException;\n\nfunction isDOMExceptionConstructor(ctor: unknown): ctor is DOMExceptionConstructor {\n if (!(typeof ctor === 'function' || typeof ctor === 'object')) {\n return false;\n }\n if ((ctor as DOMExceptionConstructor).name !== 'DOMException') {\n return false;\n }\n try {\n new (ctor as DOMExceptionConstructor)();\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Support:\n * - Web browsers\n * - Node 18 and higher (https://github.com/nodejs/node/commit/e4b1fb5e6422c1ff151234bb9de792d45dd88d87)\n */\nfunction getFromGlobal(): DOMExceptionConstructor | undefined {\n const ctor = globals?.DOMException;\n return isDOMExceptionConstructor(ctor) ? ctor : undefined;\n}\n\n/**\n * Support:\n * - All platforms\n */\nfunction createPolyfill(): DOMExceptionConstructor {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const ctor = function DOMException(this: DOMException, message?: string, name?: string) {\n this.message = message || '';\n this.name = name || 'Error';\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n } as any;\n setFunctionName(ctor, 'DOMException');\n ctor.prototype = Object.create(Error.prototype);\n Object.defineProperty(ctor.prototype, 'constructor', { value: ctor, writable: true, configurable: true });\n return ctor;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nconst DOMException: DOMExceptionConstructor = getFromGlobal() || createPolyfill();\n\nexport { DOMException };\n","import { IsReadableStream, IsReadableStreamLocked, ReadableStream, ReadableStreamCancel } from '../readable-stream';\nimport { AcquireReadableStreamDefaultReader, ReadableStreamDefaultReaderRead } from './default-reader';\nimport { ReadableStreamReaderGenericRelease } from './generic-reader';\nimport {\n AcquireWritableStreamDefaultWriter,\n IsWritableStream,\n IsWritableStreamLocked,\n WritableStream,\n WritableStreamAbort,\n WritableStreamCloseQueuedOrInFlight,\n WritableStreamDefaultWriterCloseWithErrorPropagation,\n WritableStreamDefaultWriterRelease,\n WritableStreamDefaultWriterWrite\n} from '../writable-stream';\nimport assert from '../../stub/assert';\nimport {\n newPromise,\n PerformPromiseThen,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n uponFulfillment,\n uponPromise,\n uponRejection\n} from '../helpers/webidl';\nimport { noop } from '../../utils';\nimport { type AbortSignal, isAbortSignal } from '../abort-signal';\nimport { DOMException } from '../../stub/dom-exception';\n\nexport function ReadableStreamPipeTo(source: ReadableStream,\n dest: WritableStream,\n preventClose: boolean,\n preventAbort: boolean,\n preventCancel: boolean,\n signal: AbortSignal | undefined): Promise {\n assert(IsReadableStream(source));\n assert(IsWritableStream(dest));\n assert(typeof preventClose === 'boolean');\n assert(typeof preventAbort === 'boolean');\n assert(typeof preventCancel === 'boolean');\n assert(signal === undefined || isAbortSignal(signal));\n assert(!IsReadableStreamLocked(source));\n assert(!IsWritableStreamLocked(dest));\n\n const reader = AcquireReadableStreamDefaultReader(source);\n const writer = AcquireWritableStreamDefaultWriter(dest);\n\n source._disturbed = true;\n\n let shuttingDown = false;\n\n // This is used to keep track of the spec's requirement that we wait for ongoing writes during shutdown.\n let currentWrite = promiseResolvedWith(undefined);\n\n return newPromise((resolve, reject) => {\n let abortAlgorithm: () => void;\n if (signal !== undefined) {\n abortAlgorithm = () => {\n const error = signal.reason !== undefined ? signal.reason : new DOMException('Aborted', 'AbortError');\n const actions: Array<() => Promise> = [];\n if (!preventAbort) {\n actions.push(() => {\n if (dest._state === 'writable') {\n return WritableStreamAbort(dest, error);\n }\n return promiseResolvedWith(undefined);\n });\n }\n if (!preventCancel) {\n actions.push(() => {\n if (source._state === 'readable') {\n return ReadableStreamCancel(source, error);\n }\n return promiseResolvedWith(undefined);\n });\n }\n shutdownWithAction(() => Promise.all(actions.map(action => action())), true, error);\n };\n\n if (signal.aborted) {\n abortAlgorithm();\n return;\n }\n\n signal.addEventListener('abort', abortAlgorithm);\n }\n\n // Using reader and writer, read all chunks from this and write them to dest\n // - Backpressure must be enforced\n // - Shutdown must stop all activity\n function pipeLoop() {\n return newPromise((resolveLoop, rejectLoop) => {\n function next(done: boolean) {\n if (done) {\n resolveLoop();\n } else {\n // Use `PerformPromiseThen` instead of `uponPromise` to avoid\n // adding unnecessary `.catch(rethrowAssertionErrorRejection)` handlers\n PerformPromiseThen(pipeStep(), next, rejectLoop);\n }\n }\n\n next(false);\n });\n }\n\n function pipeStep(): Promise {\n if (shuttingDown) {\n return promiseResolvedWith(true);\n }\n\n return PerformPromiseThen(writer._readyPromise, () => {\n return newPromise((resolveRead, rejectRead) => {\n ReadableStreamDefaultReaderRead(\n reader,\n {\n _chunkSteps: chunk => {\n currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, chunk), undefined, noop);\n resolveRead(false);\n },\n _closeSteps: () => resolveRead(true),\n _errorSteps: rejectRead\n }\n );\n });\n });\n }\n\n // Errors must be propagated forward\n isOrBecomesErrored(source, reader._closedPromise, storedError => {\n if (!preventAbort) {\n shutdownWithAction(() => WritableStreamAbort(dest, storedError), true, storedError);\n } else {\n shutdown(true, storedError);\n }\n return null;\n });\n\n // Errors must be propagated backward\n isOrBecomesErrored(dest, writer._closedPromise, storedError => {\n if (!preventCancel) {\n shutdownWithAction(() => ReadableStreamCancel(source, storedError), true, storedError);\n } else {\n shutdown(true, storedError);\n }\n return null;\n });\n\n // Closing must be propagated forward\n isOrBecomesClosed(source, reader._closedPromise, () => {\n if (!preventClose) {\n shutdownWithAction(() => WritableStreamDefaultWriterCloseWithErrorPropagation(writer));\n } else {\n shutdown();\n }\n return null;\n });\n\n // Closing must be propagated backward\n if (WritableStreamCloseQueuedOrInFlight(dest) || dest._state === 'closed') {\n const destClosed = new TypeError('the destination writable stream closed before all data could be piped to it');\n\n if (!preventCancel) {\n shutdownWithAction(() => ReadableStreamCancel(source, destClosed), true, destClosed);\n } else {\n shutdown(true, destClosed);\n }\n }\n\n setPromiseIsHandledToTrue(pipeLoop());\n\n function waitForWritesToFinish(): Promise {\n // Another write may have started while we were waiting on this currentWrite, so we have to be sure to wait\n // for that too.\n const oldCurrentWrite = currentWrite;\n return PerformPromiseThen(\n currentWrite,\n () => oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined\n );\n }\n\n function isOrBecomesErrored(stream: ReadableStream | WritableStream,\n promise: Promise,\n action: (reason: any) => null) {\n if (stream._state === 'errored') {\n action(stream._storedError);\n } else {\n uponRejection(promise, action);\n }\n }\n\n function isOrBecomesClosed(stream: ReadableStream | WritableStream, promise: Promise, action: () => null) {\n if (stream._state === 'closed') {\n action();\n } else {\n uponFulfillment(promise, action);\n }\n }\n\n function shutdownWithAction(action: () => Promise, originalIsError?: boolean, originalError?: any) {\n if (shuttingDown) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && !WritableStreamCloseQueuedOrInFlight(dest)) {\n uponFulfillment(waitForWritesToFinish(), doTheRest);\n } else {\n doTheRest();\n }\n\n function doTheRest(): null {\n uponPromise(\n action(),\n () => finalize(originalIsError, originalError),\n newError => finalize(true, newError)\n );\n return null;\n }\n }\n\n function shutdown(isError?: boolean, error?: any) {\n if (shuttingDown) {\n return;\n }\n shuttingDown = true;\n\n if (dest._state === 'writable' && !WritableStreamCloseQueuedOrInFlight(dest)) {\n uponFulfillment(waitForWritesToFinish(), () => finalize(isError, error));\n } else {\n finalize(isError, error);\n }\n }\n\n function finalize(isError?: boolean, error?: any): null {\n WritableStreamDefaultWriterRelease(writer);\n ReadableStreamReaderGenericRelease(reader);\n\n if (signal !== undefined) {\n signal.removeEventListener('abort', abortAlgorithm);\n }\n if (isError) {\n reject(error);\n } else {\n resolve(undefined);\n }\n\n return null;\n }\n });\n}\n","import type { QueuingStrategySizeCallback } from '../queuing-strategy';\nimport assert from '../../stub/assert';\nimport { DequeueValue, EnqueueValueWithSize, type QueuePair, ResetQueue } from '../abstract-ops/queue-with-sizes';\nimport {\n ReadableStreamAddReadRequest,\n ReadableStreamFulfillReadRequest,\n ReadableStreamGetNumReadRequests,\n type ReadRequest\n} from './default-reader';\nimport { SimpleQueue } from '../simple-queue';\nimport { IsReadableStreamLocked, ReadableStream, ReadableStreamClose, ReadableStreamError } from '../readable-stream';\nimport type { ValidatedUnderlyingSource } from './underlying-source';\nimport { setFunctionName, typeIsObject } from '../helpers/miscellaneous';\nimport { CancelSteps, PullSteps, ReleaseSteps } from '../abstract-ops/internal-methods';\nimport { promiseResolvedWith, uponPromise } from '../helpers/webidl';\n\n/**\n * Allows control of a {@link ReadableStream | readable stream}'s state and internal queue.\n *\n * @public\n */\nexport class ReadableStreamDefaultController {\n /** @internal */\n _controlledReadableStream!: ReadableStream;\n /** @internal */\n _queue!: SimpleQueue>;\n /** @internal */\n _queueTotalSize!: number;\n /** @internal */\n _started!: boolean;\n /** @internal */\n _closeRequested!: boolean;\n /** @internal */\n _pullAgain!: boolean;\n /** @internal */\n _pulling !: boolean;\n /** @internal */\n _strategySizeAlgorithm!: QueuingStrategySizeCallback;\n /** @internal */\n _strategyHWM!: number;\n /** @internal */\n _pullAlgorithm!: () => Promise;\n /** @internal */\n _cancelAlgorithm!: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is\n * over-full. An underlying source ought to use this information to determine when and how to apply backpressure.\n */\n get desiredSize(): number | null {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n return ReadableStreamDefaultControllerGetDesiredSize(this);\n }\n\n /**\n * Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from\n * the stream, but once those are read, the stream will become closed.\n */\n close(): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('close');\n }\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {\n throw new TypeError('The stream is not in a state that permits close');\n }\n\n ReadableStreamDefaultControllerClose(this);\n }\n\n /**\n * Enqueues the given chunk `chunk` in the controlled readable stream.\n */\n enqueue(chunk: R): void;\n enqueue(chunk: R = undefined!): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)) {\n throw new TypeError('The stream is not in a state that permits enqueue');\n }\n\n return ReadableStreamDefaultControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.\n */\n error(e: any = undefined): void {\n if (!IsReadableStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n\n ReadableStreamDefaultControllerError(this, e);\n }\n\n /** @internal */\n [CancelSteps](reason: any): Promise {\n ResetQueue(this);\n const result = this._cancelAlgorithm(reason);\n ReadableStreamDefaultControllerClearAlgorithms(this);\n return result;\n }\n\n /** @internal */\n [PullSteps](readRequest: ReadRequest): void {\n const stream = this._controlledReadableStream;\n\n if (this._queue.length > 0) {\n const chunk = DequeueValue(this);\n\n if (this._closeRequested && this._queue.length === 0) {\n ReadableStreamDefaultControllerClearAlgorithms(this);\n ReadableStreamClose(stream);\n } else {\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n }\n\n readRequest._chunkSteps(chunk);\n } else {\n ReadableStreamAddReadRequest(stream, readRequest);\n ReadableStreamDefaultControllerCallPullIfNeeded(this);\n }\n }\n\n /** @internal */\n [ReleaseSteps](): void {\n // Do nothing.\n }\n}\n\nObject.defineProperties(ReadableStreamDefaultController.prototype, {\n close: { enumerable: true },\n enqueue: { enumerable: true },\n error: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(ReadableStreamDefaultController.prototype.close, 'close');\nsetFunctionName(ReadableStreamDefaultController.prototype.enqueue, 'enqueue');\nsetFunctionName(ReadableStreamDefaultController.prototype.error, 'error');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'ReadableStreamDefaultController',\n configurable: true\n });\n}\n\n// Abstract operations for the ReadableStreamDefaultController.\n\nfunction IsReadableStreamDefaultController(x: any): x is ReadableStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableStream')) {\n return false;\n }\n\n return x instanceof ReadableStreamDefaultController;\n}\n\nfunction ReadableStreamDefaultControllerCallPullIfNeeded(controller: ReadableStreamDefaultController): void {\n const shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);\n if (!shouldPull) {\n return;\n }\n\n if (controller._pulling) {\n controller._pullAgain = true;\n return;\n }\n\n assert(!controller._pullAgain);\n\n controller._pulling = true;\n\n const pullPromise = controller._pullAlgorithm();\n uponPromise(\n pullPromise,\n () => {\n controller._pulling = false;\n\n if (controller._pullAgain) {\n controller._pullAgain = false;\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n }\n\n return null;\n },\n e => {\n ReadableStreamDefaultControllerError(controller, e);\n return null;\n }\n );\n}\n\nfunction ReadableStreamDefaultControllerShouldCallPull(controller: ReadableStreamDefaultController): boolean {\n const stream = controller._controlledReadableStream;\n\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return false;\n }\n\n if (!controller._started) {\n return false;\n }\n\n if (IsReadableStreamLocked(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n return true;\n }\n\n const desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);\n assert(desiredSize !== null);\n if (desiredSize! > 0) {\n return true;\n }\n\n return false;\n}\n\nfunction ReadableStreamDefaultControllerClearAlgorithms(controller: ReadableStreamDefaultController) {\n controller._pullAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n controller._strategySizeAlgorithm = undefined!;\n}\n\n// A client of ReadableStreamDefaultController may use these functions directly to bypass state check.\n\nexport function ReadableStreamDefaultControllerClose(controller: ReadableStreamDefaultController) {\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return;\n }\n\n const stream = controller._controlledReadableStream;\n\n controller._closeRequested = true;\n\n if (controller._queue.length === 0) {\n ReadableStreamDefaultControllerClearAlgorithms(controller);\n ReadableStreamClose(stream);\n }\n}\n\nexport function ReadableStreamDefaultControllerEnqueue(\n controller: ReadableStreamDefaultController,\n chunk: R\n): void {\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(controller)) {\n return;\n }\n\n const stream = controller._controlledReadableStream;\n\n if (IsReadableStreamLocked(stream) && ReadableStreamGetNumReadRequests(stream) > 0) {\n ReadableStreamFulfillReadRequest(stream, chunk, false);\n } else {\n let chunkSize;\n try {\n chunkSize = controller._strategySizeAlgorithm(chunk);\n } catch (chunkSizeE) {\n ReadableStreamDefaultControllerError(controller, chunkSizeE);\n throw chunkSizeE;\n }\n\n try {\n EnqueueValueWithSize(controller, chunk, chunkSize);\n } catch (enqueueE) {\n ReadableStreamDefaultControllerError(controller, enqueueE);\n throw enqueueE;\n }\n }\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n}\n\nexport function ReadableStreamDefaultControllerError(controller: ReadableStreamDefaultController, e: any) {\n const stream = controller._controlledReadableStream;\n\n if (stream._state !== 'readable') {\n return;\n }\n\n ResetQueue(controller);\n\n ReadableStreamDefaultControllerClearAlgorithms(controller);\n ReadableStreamError(stream, e);\n}\n\nexport function ReadableStreamDefaultControllerGetDesiredSize(\n controller: ReadableStreamDefaultController\n): number | null {\n const state = controller._controlledReadableStream._state;\n\n if (state === 'errored') {\n return null;\n }\n if (state === 'closed') {\n return 0;\n }\n\n return controller._strategyHWM - controller._queueTotalSize;\n}\n\n// This is used in the implementation of TransformStream.\nexport function ReadableStreamDefaultControllerHasBackpressure(\n controller: ReadableStreamDefaultController\n): boolean {\n if (ReadableStreamDefaultControllerShouldCallPull(controller)) {\n return false;\n }\n\n return true;\n}\n\nexport function ReadableStreamDefaultControllerCanCloseOrEnqueue(\n controller: ReadableStreamDefaultController\n): boolean {\n const state = controller._controlledReadableStream._state;\n\n if (!controller._closeRequested && state === 'readable') {\n return true;\n }\n\n return false;\n}\n\nexport function SetUpReadableStreamDefaultController(stream: ReadableStream,\n controller: ReadableStreamDefaultController,\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback) {\n assert(stream._readableStreamController === undefined);\n\n controller._controlledReadableStream = stream;\n\n controller._queue = undefined!;\n controller._queueTotalSize = undefined!;\n ResetQueue(controller);\n\n controller._started = false;\n controller._closeRequested = false;\n controller._pullAgain = false;\n controller._pulling = false;\n\n controller._strategySizeAlgorithm = sizeAlgorithm;\n controller._strategyHWM = highWaterMark;\n\n controller._pullAlgorithm = pullAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n stream._readableStreamController = controller;\n\n const startResult = startAlgorithm();\n uponPromise(\n promiseResolvedWith(startResult),\n () => {\n controller._started = true;\n\n assert(!controller._pulling);\n assert(!controller._pullAgain);\n\n ReadableStreamDefaultControllerCallPullIfNeeded(controller);\n return null;\n },\n r => {\n ReadableStreamDefaultControllerError(controller, r);\n return null;\n }\n );\n}\n\nexport function SetUpReadableStreamDefaultControllerFromUnderlyingSource(\n stream: ReadableStream,\n underlyingSource: ValidatedUnderlyingSource,\n highWaterMark: number,\n sizeAlgorithm: QueuingStrategySizeCallback\n) {\n const controller: ReadableStreamDefaultController = Object.create(ReadableStreamDefaultController.prototype);\n\n let startAlgorithm: () => void | PromiseLike;\n let pullAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (underlyingSource.start !== undefined) {\n startAlgorithm = () => underlyingSource.start!(controller);\n } else {\n startAlgorithm = () => undefined;\n }\n if (underlyingSource.pull !== undefined) {\n pullAlgorithm = () => underlyingSource.pull!(controller);\n } else {\n pullAlgorithm = () => promiseResolvedWith(undefined);\n }\n if (underlyingSource.cancel !== undefined) {\n cancelAlgorithm = reason => underlyingSource.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpReadableStreamDefaultController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm\n );\n}\n\n// Helper functions for the ReadableStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `ReadableStreamDefaultController.prototype.${name} can only be used on a ReadableStreamDefaultController`);\n}\n","import {\n CreateReadableByteStream,\n CreateReadableStream,\n type DefaultReadableStream,\n IsReadableStream,\n type ReadableByteStream,\n ReadableStream,\n ReadableStreamCancel,\n type ReadableStreamReader\n} from '../readable-stream';\nimport { ReadableStreamReaderGenericRelease } from './generic-reader';\nimport {\n AcquireReadableStreamDefaultReader,\n IsReadableStreamDefaultReader,\n ReadableStreamDefaultReaderRead,\n type ReadRequest\n} from './default-reader';\nimport {\n AcquireReadableStreamBYOBReader,\n IsReadableStreamBYOBReader,\n ReadableStreamBYOBReaderRead,\n type ReadIntoRequest\n} from './byob-reader';\nimport assert from '../../stub/assert';\nimport { newPromise, promiseResolvedWith, queueMicrotask, uponRejection } from '../helpers/webidl';\nimport {\n ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError\n} from './default-controller';\nimport {\n IsReadableByteStreamController,\n ReadableByteStreamControllerClose,\n ReadableByteStreamControllerEnqueue,\n ReadableByteStreamControllerError,\n ReadableByteStreamControllerGetBYOBRequest,\n ReadableByteStreamControllerRespond,\n ReadableByteStreamControllerRespondWithNewView\n} from './byte-stream-controller';\nimport { CreateArrayFromList } from '../abstract-ops/ecmascript';\nimport { CloneAsUint8Array } from '../abstract-ops/miscellaneous';\nimport type { NonShared } from '../helpers/array-buffer-view';\n\nexport function ReadableStreamTee(stream: ReadableStream,\n cloneForBranch2: boolean): [ReadableStream, ReadableStream] {\n assert(IsReadableStream(stream));\n assert(typeof cloneForBranch2 === 'boolean');\n if (IsReadableByteStreamController(stream._readableStreamController)) {\n return ReadableByteStreamTee(stream as unknown as ReadableByteStream) as\n unknown as [ReadableStream, ReadableStream];\n }\n return ReadableStreamDefaultTee(stream, cloneForBranch2);\n}\n\nexport function ReadableStreamDefaultTee(\n stream: ReadableStream,\n cloneForBranch2: boolean\n): [DefaultReadableStream, DefaultReadableStream] {\n assert(IsReadableStream(stream));\n assert(typeof cloneForBranch2 === 'boolean');\n\n const reader = AcquireReadableStreamDefaultReader(stream);\n\n let reading = false;\n let readAgain = false;\n let canceled1 = false;\n let canceled2 = false;\n let reason1: any;\n let reason2: any;\n let branch1: DefaultReadableStream;\n let branch2: DefaultReadableStream;\n\n let resolveCancelPromise: (value: undefined | Promise) => void;\n const cancelPromise = newPromise(resolve => {\n resolveCancelPromise = resolve;\n });\n\n function pullAlgorithm(): Promise {\n if (reading) {\n readAgain = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const readRequest: ReadRequest = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgain = false;\n const chunk1 = chunk;\n const chunk2 = chunk;\n\n // There is no way to access the cloning code right now in the reference implementation.\n // If we add one then we'll need an implementation for serializable objects.\n // if (!canceled2 && cloneForBranch2) {\n // chunk2 = StructuredDeserialize(StructuredSerialize(chunk2));\n // }\n\n if (!canceled1) {\n ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, chunk1);\n }\n if (!canceled2) {\n ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, chunk2);\n }\n\n reading = false;\n if (readAgain) {\n pullAlgorithm();\n }\n });\n },\n _closeSteps: () => {\n reading = false;\n if (!canceled1) {\n ReadableStreamDefaultControllerClose(branch1._readableStreamController);\n }\n if (!canceled2) {\n ReadableStreamDefaultControllerClose(branch2._readableStreamController);\n }\n\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n\n return promiseResolvedWith(undefined);\n }\n\n function cancel1Algorithm(reason: any): Promise {\n canceled1 = true;\n reason1 = reason;\n if (canceled2) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function cancel2Algorithm(reason: any): Promise {\n canceled2 = true;\n reason2 = reason;\n if (canceled1) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function startAlgorithm() {\n // do nothing\n }\n\n branch1 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel1Algorithm);\n branch2 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel2Algorithm);\n\n uponRejection(reader._closedPromise, (r: any) => {\n ReadableStreamDefaultControllerError(branch1._readableStreamController, r);\n ReadableStreamDefaultControllerError(branch2._readableStreamController, r);\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n return null;\n });\n\n return [branch1, branch2];\n}\n\nexport function ReadableByteStreamTee(stream: ReadableByteStream): [ReadableByteStream, ReadableByteStream] {\n assert(IsReadableStream(stream));\n assert(IsReadableByteStreamController(stream._readableStreamController));\n\n let reader: ReadableStreamReader> = AcquireReadableStreamDefaultReader(stream);\n let reading = false;\n let readAgainForBranch1 = false;\n let readAgainForBranch2 = false;\n let canceled1 = false;\n let canceled2 = false;\n let reason1: any;\n let reason2: any;\n let branch1: ReadableByteStream;\n let branch2: ReadableByteStream;\n\n let resolveCancelPromise: (value: undefined | Promise) => void;\n const cancelPromise = newPromise(resolve => {\n resolveCancelPromise = resolve;\n });\n\n function forwardReaderError(thisReader: ReadableStreamReader>) {\n uponRejection(thisReader._closedPromise, r => {\n if (thisReader !== reader) {\n return null;\n }\n ReadableByteStreamControllerError(branch1._readableStreamController, r);\n ReadableByteStreamControllerError(branch2._readableStreamController, r);\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n return null;\n });\n }\n\n function pullWithDefaultReader() {\n if (IsReadableStreamBYOBReader(reader)) {\n assert(reader._readIntoRequests.length === 0);\n ReadableStreamReaderGenericRelease(reader);\n\n reader = AcquireReadableStreamDefaultReader(stream);\n forwardReaderError(reader);\n }\n\n const readRequest: ReadRequest> = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgainForBranch1 = false;\n readAgainForBranch2 = false;\n\n const chunk1 = chunk;\n let chunk2 = chunk;\n if (!canceled1 && !canceled2) {\n try {\n chunk2 = CloneAsUint8Array(chunk);\n } catch (cloneE) {\n ReadableByteStreamControllerError(branch1._readableStreamController, cloneE);\n ReadableByteStreamControllerError(branch2._readableStreamController, cloneE);\n resolveCancelPromise(ReadableStreamCancel(stream, cloneE));\n return;\n }\n }\n\n if (!canceled1) {\n ReadableByteStreamControllerEnqueue(branch1._readableStreamController, chunk1);\n }\n if (!canceled2) {\n ReadableByteStreamControllerEnqueue(branch2._readableStreamController, chunk2);\n }\n\n reading = false;\n if (readAgainForBranch1) {\n pull1Algorithm();\n } else if (readAgainForBranch2) {\n pull2Algorithm();\n }\n });\n },\n _closeSteps: () => {\n reading = false;\n if (!canceled1) {\n ReadableByteStreamControllerClose(branch1._readableStreamController);\n }\n if (!canceled2) {\n ReadableByteStreamControllerClose(branch2._readableStreamController);\n }\n if (branch1._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(branch1._readableStreamController, 0);\n }\n if (branch2._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(branch2._readableStreamController, 0);\n }\n if (!canceled1 || !canceled2) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamDefaultReaderRead(reader, readRequest);\n }\n\n function pullWithBYOBReader(view: NonShared, forBranch2: boolean) {\n if (IsReadableStreamDefaultReader>(reader)) {\n assert(reader._readRequests.length === 0);\n ReadableStreamReaderGenericRelease(reader);\n\n reader = AcquireReadableStreamBYOBReader(stream);\n forwardReaderError(reader);\n }\n\n const byobBranch = forBranch2 ? branch2 : branch1;\n const otherBranch = forBranch2 ? branch1 : branch2;\n\n const readIntoRequest: ReadIntoRequest> = {\n _chunkSteps: chunk => {\n // This needs to be delayed a microtask because it takes at least a microtask to detect errors (using\n // reader._closedPromise below), and we want errors in stream to error both branches immediately. We cannot let\n // successful synchronously-available reads get ahead of asynchronously-available errors.\n queueMicrotask(() => {\n readAgainForBranch1 = false;\n readAgainForBranch2 = false;\n\n const byobCanceled = forBranch2 ? canceled2 : canceled1;\n const otherCanceled = forBranch2 ? canceled1 : canceled2;\n\n if (!otherCanceled) {\n let clonedChunk;\n try {\n clonedChunk = CloneAsUint8Array(chunk);\n } catch (cloneE) {\n ReadableByteStreamControllerError(byobBranch._readableStreamController, cloneE);\n ReadableByteStreamControllerError(otherBranch._readableStreamController, cloneE);\n resolveCancelPromise(ReadableStreamCancel(stream, cloneE));\n return;\n }\n if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n ReadableByteStreamControllerEnqueue(otherBranch._readableStreamController, clonedChunk);\n } else if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n\n reading = false;\n if (readAgainForBranch1) {\n pull1Algorithm();\n } else if (readAgainForBranch2) {\n pull2Algorithm();\n }\n });\n },\n _closeSteps: chunk => {\n reading = false;\n\n const byobCanceled = forBranch2 ? canceled2 : canceled1;\n const otherCanceled = forBranch2 ? canceled1 : canceled2;\n\n if (!byobCanceled) {\n ReadableByteStreamControllerClose(byobBranch._readableStreamController);\n }\n if (!otherCanceled) {\n ReadableByteStreamControllerClose(otherBranch._readableStreamController);\n }\n\n if (chunk !== undefined) {\n assert(chunk.byteLength === 0);\n\n if (!byobCanceled) {\n ReadableByteStreamControllerRespondWithNewView(byobBranch._readableStreamController, chunk);\n }\n if (!otherCanceled && otherBranch._readableStreamController._pendingPullIntos.length > 0) {\n ReadableByteStreamControllerRespond(otherBranch._readableStreamController, 0);\n }\n }\n\n if (!byobCanceled || !otherCanceled) {\n resolveCancelPromise(undefined);\n }\n },\n _errorSteps: () => {\n reading = false;\n }\n };\n ReadableStreamBYOBReaderRead(reader, view, 1, readIntoRequest);\n }\n\n function pull1Algorithm(): Promise {\n if (reading) {\n readAgainForBranch1 = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch1._readableStreamController);\n if (byobRequest === null) {\n pullWithDefaultReader();\n } else {\n pullWithBYOBReader(byobRequest._view!, false);\n }\n\n return promiseResolvedWith(undefined);\n }\n\n function pull2Algorithm(): Promise {\n if (reading) {\n readAgainForBranch2 = true;\n return promiseResolvedWith(undefined);\n }\n\n reading = true;\n\n const byobRequest = ReadableByteStreamControllerGetBYOBRequest(branch2._readableStreamController);\n if (byobRequest === null) {\n pullWithDefaultReader();\n } else {\n pullWithBYOBReader(byobRequest._view!, true);\n }\n\n return promiseResolvedWith(undefined);\n }\n\n function cancel1Algorithm(reason: any): Promise {\n canceled1 = true;\n reason1 = reason;\n if (canceled2) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function cancel2Algorithm(reason: any): Promise {\n canceled2 = true;\n reason2 = reason;\n if (canceled1) {\n const compositeReason = CreateArrayFromList([reason1, reason2]);\n const cancelResult = ReadableStreamCancel(stream, compositeReason);\n resolveCancelPromise(cancelResult);\n }\n return cancelPromise;\n }\n\n function startAlgorithm(): void {\n return;\n }\n\n branch1 = CreateReadableByteStream(startAlgorithm, pull1Algorithm, cancel1Algorithm);\n branch2 = CreateReadableByteStream(startAlgorithm, pull2Algorithm, cancel2Algorithm);\n\n forwardReaderError(reader);\n\n return [branch1, branch2];\n}\n","import { typeIsObject } from '../helpers/miscellaneous';\nimport type { ReadableStreamDefaultReadResult } from './default-reader';\n\n/**\n * A common interface for a `ReadadableStream` implementation.\n *\n * @public\n */\nexport interface ReadableStreamLike {\n readonly locked: boolean;\n\n getReader(): ReadableStreamDefaultReaderLike;\n}\n\n/**\n * A common interface for a `ReadableStreamDefaultReader` implementation.\n *\n * @public\n */\nexport interface ReadableStreamDefaultReaderLike {\n readonly closed: Promise;\n\n cancel(reason?: any): Promise;\n\n read(): Promise>;\n\n releaseLock(): void;\n}\n\nexport function isReadableStreamLike(stream: unknown): stream is ReadableStreamLike {\n return typeIsObject(stream) && typeof (stream as ReadableStreamLike).getReader !== 'undefined';\n}\n","import { CreateReadableStream, type DefaultReadableStream } from '../readable-stream';\nimport {\n isReadableStreamLike,\n type ReadableStreamDefaultReaderLike,\n type ReadableStreamLike\n} from './readable-stream-like';\nimport { ReadableStreamDefaultControllerClose, ReadableStreamDefaultControllerEnqueue } from './default-controller';\nimport { GetIterator, GetMethod, IteratorComplete, IteratorNext, IteratorValue } from '../abstract-ops/ecmascript';\nimport { promiseRejectedWith, promiseResolvedWith, reflectCall, transformPromiseWith } from '../helpers/webidl';\nimport { typeIsObject } from '../helpers/miscellaneous';\nimport { noop } from '../../utils';\n\nexport function ReadableStreamFrom(\n source: Iterable | AsyncIterable | ReadableStreamLike\n): DefaultReadableStream {\n if (isReadableStreamLike(source)) {\n return ReadableStreamFromDefaultReader(source.getReader());\n }\n return ReadableStreamFromIterable(source);\n}\n\nexport function ReadableStreamFromIterable(asyncIterable: Iterable | AsyncIterable): DefaultReadableStream {\n let stream: DefaultReadableStream;\n const iteratorRecord = GetIterator(asyncIterable, 'async');\n\n const startAlgorithm = noop;\n\n function pullAlgorithm(): Promise {\n let nextResult;\n try {\n nextResult = IteratorNext(iteratorRecord);\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const nextPromise = promiseResolvedWith(nextResult);\n return transformPromiseWith(nextPromise, iterResult => {\n if (!typeIsObject(iterResult)) {\n throw new TypeError('The promise returned by the iterator.next() method must fulfill with an object');\n }\n const done = IteratorComplete(iterResult);\n if (done) {\n ReadableStreamDefaultControllerClose(stream._readableStreamController);\n } else {\n const value = IteratorValue(iterResult);\n ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);\n }\n });\n }\n\n function cancelAlgorithm(reason: any): Promise {\n const iterator = iteratorRecord.iterator;\n let returnMethod: (typeof iterator)['return'] | undefined;\n try {\n returnMethod = GetMethod(iterator, 'return');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n if (returnMethod === undefined) {\n return promiseResolvedWith(undefined);\n }\n let returnResult: IteratorResult | Promise>;\n try {\n returnResult = reflectCall(returnMethod, iterator, [reason]);\n } catch (e) {\n return promiseRejectedWith(e);\n }\n const returnPromise = promiseResolvedWith(returnResult);\n return transformPromiseWith(returnPromise, iterResult => {\n if (!typeIsObject(iterResult)) {\n throw new TypeError('The promise returned by the iterator.return() method must fulfill with an object');\n }\n return undefined;\n });\n }\n\n stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);\n return stream;\n}\n\nexport function ReadableStreamFromDefaultReader(\n reader: ReadableStreamDefaultReaderLike\n): DefaultReadableStream {\n let stream: DefaultReadableStream;\n\n const startAlgorithm = noop;\n\n function pullAlgorithm(): Promise {\n let readPromise;\n try {\n readPromise = reader.read();\n } catch (e) {\n return promiseRejectedWith(e);\n }\n return transformPromiseWith(readPromise, readResult => {\n if (!typeIsObject(readResult)) {\n throw new TypeError('The promise returned by the reader.read() method must fulfill with an object');\n }\n if (readResult.done) {\n ReadableStreamDefaultControllerClose(stream._readableStreamController);\n } else {\n const value = readResult.value;\n ReadableStreamDefaultControllerEnqueue(stream._readableStreamController, value);\n }\n });\n }\n\n function cancelAlgorithm(reason: any): Promise {\n try {\n return promiseResolvedWith(reader.cancel(reason));\n } catch (e) {\n return promiseRejectedWith(e);\n }\n }\n\n stream = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, 0);\n return stream;\n}\n","import { assertDictionary, assertFunction, convertUnsignedLongLongWithEnforceRange } from './basic';\nimport type {\n ReadableStreamController,\n UnderlyingByteSource,\n UnderlyingDefaultOrByteSource,\n UnderlyingDefaultOrByteSourcePullCallback,\n UnderlyingDefaultOrByteSourceStartCallback,\n UnderlyingSource,\n UnderlyingSourceCancelCallback,\n ValidatedUnderlyingDefaultOrByteSource\n} from '../readable-stream/underlying-source';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\n\nexport function convertUnderlyingDefaultOrByteSource(\n source: UnderlyingSource | UnderlyingByteSource | null,\n context: string\n): ValidatedUnderlyingDefaultOrByteSource {\n assertDictionary(source, context);\n const original = source as (UnderlyingDefaultOrByteSource | null);\n const autoAllocateChunkSize = original?.autoAllocateChunkSize;\n const cancel = original?.cancel;\n const pull = original?.pull;\n const start = original?.start;\n const type = original?.type;\n return {\n autoAllocateChunkSize: autoAllocateChunkSize === undefined ?\n undefined :\n convertUnsignedLongLongWithEnforceRange(\n autoAllocateChunkSize,\n `${context} has member 'autoAllocateChunkSize' that`\n ),\n cancel: cancel === undefined ?\n undefined :\n convertUnderlyingSourceCancelCallback(cancel, original!, `${context} has member 'cancel' that`),\n pull: pull === undefined ?\n undefined :\n convertUnderlyingSourcePullCallback(pull, original!, `${context} has member 'pull' that`),\n start: start === undefined ?\n undefined :\n convertUnderlyingSourceStartCallback(start, original!, `${context} has member 'start' that`),\n type: type === undefined ? undefined : convertReadableStreamType(type, `${context} has member 'type' that`)\n };\n}\n\nfunction convertUnderlyingSourceCancelCallback(\n fn: UnderlyingSourceCancelCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n\nfunction convertUnderlyingSourcePullCallback(\n fn: UnderlyingDefaultOrByteSourcePullCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): (controller: ReadableStreamController) => Promise {\n assertFunction(fn, context);\n return (controller: ReadableStreamController) => promiseCall(fn, original, [controller]);\n}\n\nfunction convertUnderlyingSourceStartCallback(\n fn: UnderlyingDefaultOrByteSourceStartCallback,\n original: UnderlyingDefaultOrByteSource,\n context: string\n): UnderlyingDefaultOrByteSourceStartCallback {\n assertFunction(fn, context);\n return (controller: ReadableStreamController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertReadableStreamType(type: string, context: string): 'bytes' {\n type = `${type}`;\n if (type !== 'bytes') {\n throw new TypeError(`${context} '${type}' is not a valid enumeration value for ReadableStreamType`);\n }\n return type;\n}\n","import { assertDictionary } from './basic';\nimport type {\n ReadableStreamIteratorOptions,\n ValidatedReadableStreamIteratorOptions\n} from '../readable-stream/iterator-options';\n\nexport function convertIteratorOptions(options: ReadableStreamIteratorOptions | null | undefined,\n context: string): ValidatedReadableStreamIteratorOptions {\n assertDictionary(options, context);\n const preventCancel = options?.preventCancel;\n return { preventCancel: Boolean(preventCancel) };\n}\n","import { assertDictionary } from './basic';\nimport type { StreamPipeOptions, ValidatedStreamPipeOptions } from '../readable-stream/pipe-options';\nimport { type AbortSignal, isAbortSignal } from '../abort-signal';\n\nexport function convertPipeOptions(options: StreamPipeOptions | null | undefined,\n context: string): ValidatedStreamPipeOptions {\n assertDictionary(options, context);\n const preventAbort = options?.preventAbort;\n const preventCancel = options?.preventCancel;\n const preventClose = options?.preventClose;\n const signal = options?.signal;\n if (signal !== undefined) {\n assertAbortSignal(signal, `${context} has member 'signal' that`);\n }\n return {\n preventAbort: Boolean(preventAbort),\n preventCancel: Boolean(preventCancel),\n preventClose: Boolean(preventClose),\n signal\n };\n}\n\nfunction assertAbortSignal(signal: unknown, context: string): asserts signal is AbortSignal {\n if (!isAbortSignal(signal)) {\n throw new TypeError(`${context} is not an AbortSignal.`);\n }\n}\n","import { assertDictionary, assertRequiredField } from './basic';\nimport { ReadableStream } from '../readable-stream';\nimport { WritableStream } from '../writable-stream';\nimport { assertReadableStream } from './readable-stream';\nimport { assertWritableStream } from './writable-stream';\n\nexport function convertReadableWritablePair(\n pair: { readable: RS; writable: WS } | null | undefined,\n context: string\n): { readable: RS; writable: WS } {\n assertDictionary(pair, context);\n\n const readable = pair?.readable;\n assertRequiredField(readable, 'readable', 'ReadableWritablePair');\n assertReadableStream(readable, `${context} has member 'readable' that`);\n\n const writable = pair?.writable;\n assertRequiredField(writable, 'writable', 'ReadableWritablePair');\n assertWritableStream(writable, `${context} has member 'writable' that`);\n\n return { readable, writable };\n}\n","import assert from '../stub/assert';\nimport {\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n transformPromiseWith\n} from './helpers/webidl';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { AcquireReadableStreamAsyncIterator, type ReadableStreamAsyncIterator } from './readable-stream/async-iterator';\nimport { defaultReaderClosedPromiseReject, defaultReaderClosedPromiseResolve } from './readable-stream/generic-reader';\nimport {\n AcquireReadableStreamDefaultReader,\n IsReadableStreamDefaultReader,\n ReadableStreamDefaultReader,\n ReadableStreamDefaultReaderErrorReadRequests,\n type ReadableStreamDefaultReadResult\n} from './readable-stream/default-reader';\nimport {\n AcquireReadableStreamBYOBReader,\n IsReadableStreamBYOBReader,\n ReadableStreamBYOBReader,\n ReadableStreamBYOBReaderErrorReadIntoRequests,\n type ReadableStreamBYOBReadResult\n} from './readable-stream/byob-reader';\nimport { ReadableStreamPipeTo } from './readable-stream/pipe';\nimport { ReadableStreamTee } from './readable-stream/tee';\nimport { ReadableStreamFrom } from './readable-stream/from';\nimport { IsWritableStream, IsWritableStreamLocked, WritableStream } from './writable-stream';\nimport { SimpleQueue } from './simple-queue';\nimport {\n ReadableByteStreamController,\n ReadableStreamBYOBRequest,\n SetUpReadableByteStreamController,\n SetUpReadableByteStreamControllerFromUnderlyingSource\n} from './readable-stream/byte-stream-controller';\nimport {\n ReadableStreamDefaultController,\n SetUpReadableStreamDefaultController,\n SetUpReadableStreamDefaultControllerFromUnderlyingSource\n} from './readable-stream/default-controller';\nimport type {\n UnderlyingByteSource,\n UnderlyingByteSourcePullCallback,\n UnderlyingByteSourceStartCallback,\n UnderlyingSource,\n UnderlyingSourceCancelCallback,\n UnderlyingSourcePullCallback,\n UnderlyingSourceStartCallback\n} from './readable-stream/underlying-source';\nimport { noop } from '../utils';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { CreateArrayFromList, SymbolAsyncIterator } from './abstract-ops/ecmascript';\nimport { CancelSteps } from './abstract-ops/internal-methods';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { assertObject, assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport { convertUnderlyingDefaultOrByteSource } from './validators/underlying-source';\nimport type {\n ReadableStreamBYOBReaderReadOptions,\n ReadableStreamGetReaderOptions\n} from './readable-stream/reader-options';\nimport { convertReaderOptions } from './validators/reader-options';\nimport type { StreamPipeOptions, ValidatedStreamPipeOptions } from './readable-stream/pipe-options';\nimport type { ReadableStreamIteratorOptions } from './readable-stream/iterator-options';\nimport { convertIteratorOptions } from './validators/iterator-options';\nimport { convertPipeOptions } from './validators/pipe-options';\nimport type { ReadableWritablePair } from './readable-stream/readable-writable-pair';\nimport { convertReadableWritablePair } from './validators/readable-writable-pair';\nimport type { ReadableStreamDefaultReaderLike, ReadableStreamLike } from './readable-stream/readable-stream-like';\nimport type { NonShared } from './helpers/array-buffer-view';\n\nexport type DefaultReadableStream = ReadableStream & {\n _readableStreamController: ReadableStreamDefaultController\n};\n\nexport type ReadableByteStream = ReadableStream> & {\n _readableStreamController: ReadableByteStreamController\n};\n\ntype ReadableStreamState = 'readable' | 'closed' | 'errored';\n\n/**\n * A readable stream represents a source of data, from which you can read.\n *\n * @public\n */\nexport class ReadableStream implements AsyncIterable {\n /** @internal */\n _state!: ReadableStreamState;\n /** @internal */\n _reader: ReadableStreamReader | undefined;\n /** @internal */\n _storedError: any;\n /** @internal */\n _disturbed!: boolean;\n /** @internal */\n _readableStreamController!: ReadableStreamDefaultController | ReadableByteStreamController;\n\n constructor(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number; size?: undefined });\n constructor(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy);\n constructor(rawUnderlyingSource: UnderlyingSource | UnderlyingByteSource | null | undefined = {},\n rawStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawUnderlyingSource === undefined) {\n rawUnderlyingSource = null;\n } else {\n assertObject(rawUnderlyingSource, 'First parameter');\n }\n\n const strategy = convertQueuingStrategy(rawStrategy, 'Second parameter');\n const underlyingSource = convertUnderlyingDefaultOrByteSource(rawUnderlyingSource, 'First parameter');\n\n InitializeReadableStream(this);\n\n if (underlyingSource.type === 'bytes') {\n if (strategy.size !== undefined) {\n throw new RangeError('The strategy for a byte stream cannot have a size function');\n }\n const highWaterMark = ExtractHighWaterMark(strategy, 0);\n SetUpReadableByteStreamControllerFromUnderlyingSource(\n this as unknown as ReadableByteStream,\n underlyingSource,\n highWaterMark\n );\n } else {\n assert(underlyingSource.type === undefined);\n const sizeAlgorithm = ExtractSizeAlgorithm(strategy);\n const highWaterMark = ExtractHighWaterMark(strategy, 1);\n SetUpReadableStreamDefaultControllerFromUnderlyingSource(\n this,\n underlyingSource,\n highWaterMark,\n sizeAlgorithm\n );\n }\n }\n\n /**\n * Whether or not the readable stream is locked to a {@link ReadableStreamDefaultReader | reader}.\n */\n get locked(): boolean {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('locked');\n }\n\n return IsReadableStreamLocked(this);\n }\n\n /**\n * Cancels the stream, signaling a loss of interest in the stream by a consumer.\n *\n * The supplied `reason` argument will be given to the underlying source's {@link UnderlyingSource.cancel | cancel()}\n * method, which might or might not use it.\n */\n cancel(reason: any = undefined): Promise {\n if (!IsReadableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('cancel'));\n }\n\n if (IsReadableStreamLocked(this)) {\n return promiseRejectedWith(new TypeError('Cannot cancel a stream that already has a reader'));\n }\n\n return ReadableStreamCancel(this, reason);\n }\n\n /**\n * Creates a {@link ReadableStreamBYOBReader} and locks the stream to the new reader.\n *\n * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams,\n * i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading.\n * The returned BYOB reader provides the ability to directly read individual chunks from the stream via its\n * {@link ReadableStreamBYOBReader.read | read()} method, into developer-supplied buffers, allowing more precise\n * control over allocation.\n */\n getReader({ mode }: { mode: 'byob' }): ReadableStreamBYOBReader;\n /**\n * Creates a {@link ReadableStreamDefaultReader} and locks the stream to the new reader.\n * While the stream is locked, no other reader can be acquired until this one is released.\n *\n * This functionality is especially useful for creating abstractions that desire the ability to consume a stream\n * in its entirety. By getting a reader for the stream, you can ensure nobody else can interleave reads with yours\n * or cancel the stream, which would interfere with your abstraction.\n */\n getReader(): ReadableStreamDefaultReader;\n getReader(\n rawOptions: ReadableStreamGetReaderOptions | null | undefined = undefined\n ): ReadableStreamDefaultReader | ReadableStreamBYOBReader {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('getReader');\n }\n\n const options = convertReaderOptions(rawOptions, 'First parameter');\n\n if (options.mode === undefined) {\n return AcquireReadableStreamDefaultReader(this);\n }\n\n assert(options.mode === 'byob');\n return AcquireReadableStreamBYOBReader(this as unknown as ReadableByteStream);\n }\n\n /**\n * Provides a convenient, chainable way of piping this readable stream through a transform stream\n * (or any other `{ writable, readable }` pair). It simply {@link ReadableStream.pipeTo | pipes} the stream\n * into the writable side of the supplied pair, and returns the readable side for further use.\n *\n * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n */\n pipeThrough(\n transform: { readable: RS; writable: WritableStream },\n options?: StreamPipeOptions\n ): RS;\n pipeThrough(\n rawTransform: { readable: RS; writable: WritableStream } | null | undefined,\n rawOptions: StreamPipeOptions | null | undefined = {}\n ): RS {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('pipeThrough');\n }\n assertRequiredArgument(rawTransform, 1, 'pipeThrough');\n\n const transform = convertReadableWritablePair(rawTransform, 'First parameter');\n const options = convertPipeOptions(rawOptions, 'Second parameter');\n\n if (IsReadableStreamLocked(this)) {\n throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream');\n }\n if (IsWritableStreamLocked(transform.writable)) {\n throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream');\n }\n\n const promise = ReadableStreamPipeTo(\n this, transform.writable, options.preventClose, options.preventAbort, options.preventCancel, options.signal\n );\n\n setPromiseIsHandledToTrue(promise);\n\n return transform.readable;\n }\n\n /**\n * Pipes this readable stream to a given writable stream. The way in which the piping process behaves under\n * various error conditions can be customized with a number of passed options. It returns a promise that fulfills\n * when the piping process completes successfully, or rejects if any errors were encountered.\n *\n * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n */\n pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise;\n pipeTo(destination: WritableStream | null | undefined,\n rawOptions: StreamPipeOptions | null | undefined = {}): Promise {\n if (!IsReadableStream(this)) {\n return promiseRejectedWith(streamBrandCheckException('pipeTo'));\n }\n\n if (destination === undefined) {\n return promiseRejectedWith(`Parameter 1 is required in 'pipeTo'.`);\n }\n if (!IsWritableStream(destination)) {\n return promiseRejectedWith(\n new TypeError(`ReadableStream.prototype.pipeTo's first argument must be a WritableStream`)\n );\n }\n\n let options: ValidatedStreamPipeOptions;\n try {\n options = convertPipeOptions(rawOptions, 'Second parameter');\n } catch (e) {\n return promiseRejectedWith(e);\n }\n\n if (IsReadableStreamLocked(this)) {\n return promiseRejectedWith(\n new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream')\n );\n }\n if (IsWritableStreamLocked(destination)) {\n return promiseRejectedWith(\n new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream')\n );\n }\n\n return ReadableStreamPipeTo(\n this, destination, options.preventClose, options.preventAbort, options.preventCancel, options.signal\n );\n }\n\n /**\n * Tees this readable stream, returning a two-element array containing the two resulting branches as\n * new {@link ReadableStream} instances.\n *\n * Teeing a stream will lock it, preventing any other consumer from acquiring a reader.\n * To cancel the stream, cancel both of the resulting branches; a composite cancellation reason will then be\n * propagated to the stream's underlying source.\n *\n * Note that the chunks seen in each branch will be the same object. If the chunks are not immutable,\n * this could allow interference between the two branches.\n */\n tee(): [ReadableStream, ReadableStream] {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('tee');\n }\n\n const branches = ReadableStreamTee(this, false);\n return CreateArrayFromList(branches);\n }\n\n /**\n * Asynchronously iterates over the chunks in the stream's internal queue.\n *\n * Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader.\n * The lock will be released if the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method\n * is called, e.g. by breaking out of the loop.\n *\n * By default, calling the async iterator's {@link ReadableStreamAsyncIterator.return | return()} method will also\n * cancel the stream. To prevent this, use the stream's {@link ReadableStream.values | values()} method, passing\n * `true` for the `preventCancel` option.\n */\n values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator;\n values(rawOptions: ReadableStreamIteratorOptions | null | undefined = undefined): ReadableStreamAsyncIterator {\n if (!IsReadableStream(this)) {\n throw streamBrandCheckException('values');\n }\n\n const options = convertIteratorOptions(rawOptions, 'First parameter');\n return AcquireReadableStreamAsyncIterator(this, options.preventCancel);\n }\n\n /**\n * {@inheritDoc ReadableStream.values}\n */\n [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator;\n\n [SymbolAsyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator {\n // Stub implementation, overridden below\n return this.values(options);\n }\n\n /**\n * Creates a new ReadableStream wrapping the provided iterable or async iterable.\n *\n * This can be used to adapt various kinds of objects into a readable stream,\n * such as an array, an async generator, or a Node.js readable stream.\n */\n static from(asyncIterable: Iterable | AsyncIterable | ReadableStreamLike): ReadableStream {\n return ReadableStreamFrom(asyncIterable);\n }\n}\n\nObject.defineProperties(ReadableStream, {\n from: { enumerable: true }\n});\nObject.defineProperties(ReadableStream.prototype, {\n cancel: { enumerable: true },\n getReader: { enumerable: true },\n pipeThrough: { enumerable: true },\n pipeTo: { enumerable: true },\n tee: { enumerable: true },\n values: { enumerable: true },\n locked: { enumerable: true }\n});\nsetFunctionName(ReadableStream.from, 'from');\nsetFunctionName(ReadableStream.prototype.cancel, 'cancel');\nsetFunctionName(ReadableStream.prototype.getReader, 'getReader');\nsetFunctionName(ReadableStream.prototype.pipeThrough, 'pipeThrough');\nsetFunctionName(ReadableStream.prototype.pipeTo, 'pipeTo');\nsetFunctionName(ReadableStream.prototype.tee, 'tee');\nsetFunctionName(ReadableStream.prototype.values, 'values');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ReadableStream.prototype, Symbol.toStringTag, {\n value: 'ReadableStream',\n configurable: true\n });\n}\nObject.defineProperty(ReadableStream.prototype, SymbolAsyncIterator, {\n value: ReadableStream.prototype.values,\n writable: true,\n configurable: true\n});\n\nexport type {\n ReadableStreamAsyncIterator,\n ReadableStreamDefaultReadResult,\n ReadableStreamBYOBReadResult,\n ReadableStreamBYOBReaderReadOptions,\n UnderlyingByteSource,\n UnderlyingSource,\n UnderlyingSourceStartCallback,\n UnderlyingSourcePullCallback,\n UnderlyingSourceCancelCallback,\n UnderlyingByteSourceStartCallback,\n UnderlyingByteSourcePullCallback,\n StreamPipeOptions,\n ReadableWritablePair,\n ReadableStreamIteratorOptions,\n ReadableStreamLike,\n ReadableStreamDefaultReaderLike\n};\n\n// Abstract operations for the ReadableStream.\n\n// Throws if and only if startAlgorithm throws.\nexport function CreateReadableStream(\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n highWaterMark = 1,\n sizeAlgorithm: QueuingStrategySizeCallback = () => 1\n): DefaultReadableStream {\n assert(IsNonNegativeNumber(highWaterMark));\n\n const stream: DefaultReadableStream = Object.create(ReadableStream.prototype);\n InitializeReadableStream(stream);\n\n const controller: ReadableStreamDefaultController = Object.create(ReadableStreamDefaultController.prototype);\n SetUpReadableStreamDefaultController(\n stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm\n );\n\n return stream;\n}\n\n// Throws if and only if startAlgorithm throws.\nexport function CreateReadableByteStream(\n startAlgorithm: () => void | PromiseLike,\n pullAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise\n): ReadableByteStream {\n const stream: ReadableByteStream = Object.create(ReadableStream.prototype);\n InitializeReadableStream(stream);\n\n const controller: ReadableByteStreamController = Object.create(ReadableByteStreamController.prototype);\n SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, 0, undefined);\n\n return stream;\n}\n\nfunction InitializeReadableStream(stream: ReadableStream) {\n stream._state = 'readable';\n stream._reader = undefined;\n stream._storedError = undefined;\n stream._disturbed = false;\n}\n\nexport function IsReadableStream(x: unknown): x is ReadableStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {\n return false;\n }\n\n return x instanceof ReadableStream;\n}\n\nexport function IsReadableStreamDisturbed(stream: ReadableStream): boolean {\n assert(IsReadableStream(stream));\n\n return stream._disturbed;\n}\n\nexport function IsReadableStreamLocked(stream: ReadableStream): boolean {\n assert(IsReadableStream(stream));\n\n if (stream._reader === undefined) {\n return false;\n }\n\n return true;\n}\n\n// ReadableStream API exposed for controllers.\n\nexport function ReadableStreamCancel(stream: ReadableStream, reason: any): Promise {\n stream._disturbed = true;\n\n if (stream._state === 'closed') {\n return promiseResolvedWith(undefined);\n }\n if (stream._state === 'errored') {\n return promiseRejectedWith(stream._storedError);\n }\n\n ReadableStreamClose(stream);\n\n const reader = stream._reader;\n if (reader !== undefined && IsReadableStreamBYOBReader(reader)) {\n const readIntoRequests = reader._readIntoRequests;\n reader._readIntoRequests = new SimpleQueue();\n readIntoRequests.forEach(readIntoRequest => {\n readIntoRequest._closeSteps(undefined);\n });\n }\n\n const sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);\n return transformPromiseWith(sourceCancelPromise, noop);\n}\n\nexport function ReadableStreamClose(stream: ReadableStream): void {\n assert(stream._state === 'readable');\n\n stream._state = 'closed';\n\n const reader = stream._reader;\n\n if (reader === undefined) {\n return;\n }\n\n defaultReaderClosedPromiseResolve(reader);\n\n if (IsReadableStreamDefaultReader(reader)) {\n const readRequests = reader._readRequests;\n reader._readRequests = new SimpleQueue();\n readRequests.forEach(readRequest => {\n readRequest._closeSteps();\n });\n }\n}\n\nexport function ReadableStreamError(stream: ReadableStream, e: any): void {\n assert(IsReadableStream(stream));\n assert(stream._state === 'readable');\n\n stream._state = 'errored';\n stream._storedError = e;\n\n const reader = stream._reader;\n\n if (reader === undefined) {\n return;\n }\n\n defaultReaderClosedPromiseReject(reader, e);\n\n if (IsReadableStreamDefaultReader(reader)) {\n ReadableStreamDefaultReaderErrorReadRequests(reader, e);\n } else {\n assert(IsReadableStreamBYOBReader(reader));\n ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);\n }\n}\n\n// Readers\n\nexport type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader;\n\nexport {\n ReadableStreamDefaultReader,\n ReadableStreamBYOBReader\n};\n\n// Controllers\n\nexport {\n ReadableStreamDefaultController,\n ReadableStreamBYOBRequest,\n ReadableByteStreamController\n};\n\n// Helper functions for the ReadableStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(`ReadableStream.prototype.${name} can only be used on a ReadableStream`);\n}\n","import type { QueuingStrategyInit } from '../queuing-strategy';\nimport { assertDictionary, assertRequiredField, convertUnrestrictedDouble } from './basic';\n\nexport function convertQueuingStrategyInit(init: QueuingStrategyInit | null | undefined,\n context: string): QueuingStrategyInit {\n assertDictionary(init, context);\n const highWaterMark = init?.highWaterMark;\n assertRequiredField(highWaterMark, 'highWaterMark', 'QueuingStrategyInit');\n return {\n highWaterMark: convertUnrestrictedDouble(highWaterMark)\n };\n}\n","import type { QueuingStrategy, QueuingStrategyInit } from './queuing-strategy';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategyInit } from './validators/queuing-strategy-init';\n\n// The size function must not have a prototype property nor be a constructor\nconst byteLengthSizeFunction = (chunk: ArrayBufferView): number => {\n return chunk.byteLength;\n};\nsetFunctionName(byteLengthSizeFunction, 'size');\n\n/**\n * A queuing strategy that counts the number of bytes in each chunk.\n *\n * @public\n */\nexport default class ByteLengthQueuingStrategy implements QueuingStrategy {\n /** @internal */\n readonly _byteLengthQueuingStrategyHighWaterMark: number;\n\n constructor(options: QueuingStrategyInit) {\n assertRequiredArgument(options, 1, 'ByteLengthQueuingStrategy');\n options = convertQueuingStrategyInit(options, 'First parameter');\n this._byteLengthQueuingStrategyHighWaterMark = options.highWaterMark;\n }\n\n /**\n * Returns the high water mark provided to the constructor.\n */\n get highWaterMark(): number {\n if (!IsByteLengthQueuingStrategy(this)) {\n throw byteLengthBrandCheckException('highWaterMark');\n }\n return this._byteLengthQueuingStrategyHighWaterMark;\n }\n\n /**\n * Measures the size of `chunk` by returning the value of its `byteLength` property.\n */\n get size(): (chunk: ArrayBufferView) => number {\n if (!IsByteLengthQueuingStrategy(this)) {\n throw byteLengthBrandCheckException('size');\n }\n return byteLengthSizeFunction;\n }\n}\n\nObject.defineProperties(ByteLengthQueuingStrategy.prototype, {\n highWaterMark: { enumerable: true },\n size: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(ByteLengthQueuingStrategy.prototype, Symbol.toStringTag, {\n value: 'ByteLengthQueuingStrategy',\n configurable: true\n });\n}\n\n// Helper functions for the ByteLengthQueuingStrategy.\n\nfunction byteLengthBrandCheckException(name: string): TypeError {\n return new TypeError(`ByteLengthQueuingStrategy.prototype.${name} can only be used on a ByteLengthQueuingStrategy`);\n}\n\nexport function IsByteLengthQueuingStrategy(x: any): x is ByteLengthQueuingStrategy {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_byteLengthQueuingStrategyHighWaterMark')) {\n return false;\n }\n\n return x instanceof ByteLengthQueuingStrategy;\n}\n","import type { QueuingStrategy, QueuingStrategyInit } from './queuing-strategy';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { assertRequiredArgument } from './validators/basic';\nimport { convertQueuingStrategyInit } from './validators/queuing-strategy-init';\n\n// The size function must not have a prototype property nor be a constructor\nconst countSizeFunction = (): 1 => {\n return 1;\n};\nsetFunctionName(countSizeFunction, 'size');\n\n/**\n * A queuing strategy that counts the number of chunks.\n *\n * @public\n */\nexport default class CountQueuingStrategy implements QueuingStrategy {\n /** @internal */\n readonly _countQueuingStrategyHighWaterMark!: number;\n\n constructor(options: QueuingStrategyInit) {\n assertRequiredArgument(options, 1, 'CountQueuingStrategy');\n options = convertQueuingStrategyInit(options, 'First parameter');\n this._countQueuingStrategyHighWaterMark = options.highWaterMark;\n }\n\n /**\n * Returns the high water mark provided to the constructor.\n */\n get highWaterMark(): number {\n if (!IsCountQueuingStrategy(this)) {\n throw countBrandCheckException('highWaterMark');\n }\n return this._countQueuingStrategyHighWaterMark;\n }\n\n /**\n * Measures the size of `chunk` by always returning 1.\n * This ensures that the total queue size is a count of the number of chunks in the queue.\n */\n get size(): (chunk: any) => 1 {\n if (!IsCountQueuingStrategy(this)) {\n throw countBrandCheckException('size');\n }\n return countSizeFunction;\n }\n}\n\nObject.defineProperties(CountQueuingStrategy.prototype, {\n highWaterMark: { enumerable: true },\n size: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(CountQueuingStrategy.prototype, Symbol.toStringTag, {\n value: 'CountQueuingStrategy',\n configurable: true\n });\n}\n\n// Helper functions for the CountQueuingStrategy.\n\nfunction countBrandCheckException(name: string): TypeError {\n return new TypeError(`CountQueuingStrategy.prototype.${name} can only be used on a CountQueuingStrategy`);\n}\n\nexport function IsCountQueuingStrategy(x: any): x is CountQueuingStrategy {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_countQueuingStrategyHighWaterMark')) {\n return false;\n }\n\n return x instanceof CountQueuingStrategy;\n}\n","import { assertDictionary, assertFunction } from './basic';\nimport { promiseCall, reflectCall } from '../helpers/webidl';\nimport type {\n Transformer,\n TransformerCancelCallback,\n TransformerFlushCallback,\n TransformerStartCallback,\n TransformerTransformCallback,\n ValidatedTransformer\n} from '../transform-stream/transformer';\nimport { TransformStreamDefaultController } from '../transform-stream';\n\nexport function convertTransformer(original: Transformer | null,\n context: string): ValidatedTransformer {\n assertDictionary(original, context);\n const cancel = original?.cancel;\n const flush = original?.flush;\n const readableType = original?.readableType;\n const start = original?.start;\n const transform = original?.transform;\n const writableType = original?.writableType;\n return {\n cancel: cancel === undefined ?\n undefined :\n convertTransformerCancelCallback(cancel, original!, `${context} has member 'cancel' that`),\n flush: flush === undefined ?\n undefined :\n convertTransformerFlushCallback(flush, original!, `${context} has member 'flush' that`),\n readableType,\n start: start === undefined ?\n undefined :\n convertTransformerStartCallback(start, original!, `${context} has member 'start' that`),\n transform: transform === undefined ?\n undefined :\n convertTransformerTransformCallback(transform, original!, `${context} has member 'transform' that`),\n writableType\n };\n}\n\nfunction convertTransformerFlushCallback(\n fn: TransformerFlushCallback,\n original: Transformer,\n context: string\n): (controller: TransformStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (controller: TransformStreamDefaultController) => promiseCall(fn, original, [controller]);\n}\n\nfunction convertTransformerStartCallback(\n fn: TransformerStartCallback,\n original: Transformer,\n context: string\n): TransformerStartCallback {\n assertFunction(fn, context);\n return (controller: TransformStreamDefaultController) => reflectCall(fn, original, [controller]);\n}\n\nfunction convertTransformerTransformCallback(\n fn: TransformerTransformCallback,\n original: Transformer,\n context: string\n): (chunk: I, controller: TransformStreamDefaultController) => Promise {\n assertFunction(fn, context);\n return (chunk: I, controller: TransformStreamDefaultController) => promiseCall(fn, original, [chunk, controller]);\n}\n\nfunction convertTransformerCancelCallback(\n fn: TransformerCancelCallback,\n original: Transformer,\n context: string\n): (reason: any) => Promise {\n assertFunction(fn, context);\n return (reason: any) => promiseCall(fn, original, [reason]);\n}\n","import assert from '../stub/assert';\nimport {\n newPromise,\n promiseRejectedWith,\n promiseResolvedWith,\n setPromiseIsHandledToTrue,\n transformPromiseWith,\n uponPromise\n} from './helpers/webidl';\nimport { CreateReadableStream, type DefaultReadableStream, ReadableStream } from './readable-stream';\nimport {\n ReadableStreamDefaultControllerCanCloseOrEnqueue,\n ReadableStreamDefaultControllerClose,\n ReadableStreamDefaultControllerEnqueue,\n ReadableStreamDefaultControllerError,\n ReadableStreamDefaultControllerGetDesiredSize,\n ReadableStreamDefaultControllerHasBackpressure\n} from './readable-stream/default-controller';\nimport type { QueuingStrategy, QueuingStrategySizeCallback } from './queuing-strategy';\nimport { CreateWritableStream, WritableStream, WritableStreamDefaultControllerErrorIfNeeded } from './writable-stream';\nimport { setFunctionName, typeIsObject } from './helpers/miscellaneous';\nimport { IsNonNegativeNumber } from './abstract-ops/miscellaneous';\nimport { convertQueuingStrategy } from './validators/queuing-strategy';\nimport { ExtractHighWaterMark, ExtractSizeAlgorithm } from './abstract-ops/queuing-strategy';\nimport type {\n Transformer,\n TransformerCancelCallback,\n TransformerFlushCallback,\n TransformerStartCallback,\n TransformerTransformCallback,\n ValidatedTransformer\n} from './transform-stream/transformer';\nimport { convertTransformer } from './validators/transformer';\n\n// Class TransformStream\n\n/**\n * A transform stream consists of a pair of streams: a {@link WritableStream | writable stream},\n * known as its writable side, and a {@link ReadableStream | readable stream}, known as its readable side.\n * In a manner specific to the transform stream in question, writes to the writable side result in new data being\n * made available for reading from the readable side.\n *\n * @public\n */\nexport class TransformStream {\n /** @internal */\n _writable!: WritableStream;\n /** @internal */\n _readable!: DefaultReadableStream;\n /** @internal */\n _backpressure!: boolean;\n /** @internal */\n _backpressureChangePromise!: Promise;\n /** @internal */\n _backpressureChangePromise_resolve!: () => void;\n /** @internal */\n _transformStreamController!: TransformStreamDefaultController;\n\n constructor(\n transformer?: Transformer,\n writableStrategy?: QueuingStrategy,\n readableStrategy?: QueuingStrategy\n );\n constructor(rawTransformer: Transformer | null | undefined = {},\n rawWritableStrategy: QueuingStrategy | null | undefined = {},\n rawReadableStrategy: QueuingStrategy | null | undefined = {}) {\n if (rawTransformer === undefined) {\n rawTransformer = null;\n }\n\n const writableStrategy = convertQueuingStrategy(rawWritableStrategy, 'Second parameter');\n const readableStrategy = convertQueuingStrategy(rawReadableStrategy, 'Third parameter');\n\n const transformer = convertTransformer(rawTransformer, 'First parameter');\n if (transformer.readableType !== undefined) {\n throw new RangeError('Invalid readableType specified');\n }\n if (transformer.writableType !== undefined) {\n throw new RangeError('Invalid writableType specified');\n }\n\n const readableHighWaterMark = ExtractHighWaterMark(readableStrategy, 0);\n const readableSizeAlgorithm = ExtractSizeAlgorithm(readableStrategy);\n const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);\n const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);\n\n let startPromise_resolve!: (value: void | PromiseLike) => void;\n const startPromise = newPromise(resolve => {\n startPromise_resolve = resolve;\n });\n\n InitializeTransformStream(\n this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm\n );\n SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);\n\n if (transformer.start !== undefined) {\n startPromise_resolve(transformer.start(this._transformStreamController));\n } else {\n startPromise_resolve(undefined);\n }\n }\n\n /**\n * The readable side of the transform stream.\n */\n get readable(): ReadableStream {\n if (!IsTransformStream(this)) {\n throw streamBrandCheckException('readable');\n }\n\n return this._readable;\n }\n\n /**\n * The writable side of the transform stream.\n */\n get writable(): WritableStream {\n if (!IsTransformStream(this)) {\n throw streamBrandCheckException('writable');\n }\n\n return this._writable;\n }\n}\n\nObject.defineProperties(TransformStream.prototype, {\n readable: { enumerable: true },\n writable: { enumerable: true }\n});\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(TransformStream.prototype, Symbol.toStringTag, {\n value: 'TransformStream',\n configurable: true\n });\n}\n\nexport type {\n Transformer,\n TransformerCancelCallback,\n TransformerStartCallback,\n TransformerFlushCallback,\n TransformerTransformCallback\n};\n\n// Transform Stream Abstract Operations\n\nexport function CreateTransformStream(startAlgorithm: () => void | PromiseLike,\n transformAlgorithm: (chunk: I) => Promise,\n flushAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise,\n writableHighWaterMark = 1,\n writableSizeAlgorithm: QueuingStrategySizeCallback = () => 1,\n readableHighWaterMark = 0,\n readableSizeAlgorithm: QueuingStrategySizeCallback = () => 1) {\n assert(IsNonNegativeNumber(writableHighWaterMark));\n assert(IsNonNegativeNumber(readableHighWaterMark));\n\n const stream: TransformStream = Object.create(TransformStream.prototype);\n\n let startPromise_resolve!: (value: void | PromiseLike) => void;\n const startPromise = newPromise(resolve => {\n startPromise_resolve = resolve;\n });\n\n InitializeTransformStream(stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark,\n readableSizeAlgorithm);\n\n const controller: TransformStreamDefaultController = Object.create(TransformStreamDefaultController.prototype);\n\n SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);\n\n const startResult = startAlgorithm();\n startPromise_resolve(startResult);\n return stream;\n}\n\nfunction InitializeTransformStream(stream: TransformStream,\n startPromise: Promise,\n writableHighWaterMark: number,\n writableSizeAlgorithm: QueuingStrategySizeCallback,\n readableHighWaterMark: number,\n readableSizeAlgorithm: QueuingStrategySizeCallback) {\n function startAlgorithm(): Promise {\n return startPromise;\n }\n\n function writeAlgorithm(chunk: I): Promise {\n return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk);\n }\n\n function abortAlgorithm(reason: any): Promise {\n return TransformStreamDefaultSinkAbortAlgorithm(stream, reason);\n }\n\n function closeAlgorithm(): Promise {\n return TransformStreamDefaultSinkCloseAlgorithm(stream);\n }\n\n stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm,\n writableHighWaterMark, writableSizeAlgorithm);\n\n function pullAlgorithm(): Promise {\n return TransformStreamDefaultSourcePullAlgorithm(stream);\n }\n\n function cancelAlgorithm(reason: any): Promise {\n return TransformStreamDefaultSourceCancelAlgorithm(stream, reason);\n }\n\n stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark,\n readableSizeAlgorithm);\n\n // The [[backpressure]] slot is set to undefined so that it can be initialised by TransformStreamSetBackpressure.\n stream._backpressure = undefined!;\n stream._backpressureChangePromise = undefined!;\n stream._backpressureChangePromise_resolve = undefined!;\n TransformStreamSetBackpressure(stream, true);\n\n stream._transformStreamController = undefined!;\n}\n\nfunction IsTransformStream(x: unknown): x is TransformStream {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {\n return false;\n }\n\n return x instanceof TransformStream;\n}\n\n// This is a no-op if both sides are already errored.\nfunction TransformStreamError(stream: TransformStream, e: any) {\n ReadableStreamDefaultControllerError(stream._readable._readableStreamController, e);\n TransformStreamErrorWritableAndUnblockWrite(stream, e);\n}\n\nfunction TransformStreamErrorWritableAndUnblockWrite(stream: TransformStream, e: any) {\n TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);\n WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e);\n TransformStreamUnblockWrite(stream);\n}\n\nfunction TransformStreamUnblockWrite(stream: TransformStream) {\n if (stream._backpressure) {\n // Pretend that pull() was called to permit any pending write() calls to complete. TransformStreamSetBackpressure()\n // cannot be called from enqueue() or pull() once the ReadableStream is errored, so this will will be the final time\n // _backpressure is set.\n TransformStreamSetBackpressure(stream, false);\n }\n}\n\nfunction TransformStreamSetBackpressure(stream: TransformStream, backpressure: boolean) {\n // Passes also when called during construction.\n assert(stream._backpressure !== backpressure);\n\n if (stream._backpressureChangePromise !== undefined) {\n stream._backpressureChangePromise_resolve();\n }\n\n stream._backpressureChangePromise = newPromise(resolve => {\n stream._backpressureChangePromise_resolve = resolve;\n });\n\n stream._backpressure = backpressure;\n}\n\n// Class TransformStreamDefaultController\n\n/**\n * Allows control of the {@link ReadableStream} and {@link WritableStream} of the associated {@link TransformStream}.\n *\n * @public\n */\nexport class TransformStreamDefaultController {\n /** @internal */\n _controlledTransformStream: TransformStream;\n /** @internal */\n _finishPromise: Promise | undefined;\n /** @internal */\n _finishPromise_resolve?: (value?: undefined) => void;\n /** @internal */\n _finishPromise_reject?: (reason: any) => void;\n /** @internal */\n _transformAlgorithm: (chunk: any) => Promise;\n /** @internal */\n _flushAlgorithm: () => Promise;\n /** @internal */\n _cancelAlgorithm: (reason: any) => Promise;\n\n private constructor() {\n throw new TypeError('Illegal constructor');\n }\n\n /**\n * Returns the desired size to fill the readable side’s internal queue. It can be negative, if the queue is over-full.\n */\n get desiredSize(): number | null {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('desiredSize');\n }\n\n const readableController = this._controlledTransformStream._readable._readableStreamController;\n return ReadableStreamDefaultControllerGetDesiredSize(readableController);\n }\n\n /**\n * Enqueues the given chunk `chunk` in the readable side of the controlled transform stream.\n */\n enqueue(chunk: O): void;\n enqueue(chunk: O = undefined!): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('enqueue');\n }\n\n TransformStreamDefaultControllerEnqueue(this, chunk);\n }\n\n /**\n * Errors both the readable side and the writable side of the controlled transform stream, making all future\n * interactions with it fail with the given error `e`. Any chunks queued for transformation will be discarded.\n */\n error(reason: any = undefined): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('error');\n }\n\n TransformStreamDefaultControllerError(this, reason);\n }\n\n /**\n * Closes the readable side and errors the writable side of the controlled transform stream. This is useful when the\n * transformer only needs to consume a portion of the chunks written to the writable side.\n */\n terminate(): void {\n if (!IsTransformStreamDefaultController(this)) {\n throw defaultControllerBrandCheckException('terminate');\n }\n\n TransformStreamDefaultControllerTerminate(this);\n }\n}\n\nObject.defineProperties(TransformStreamDefaultController.prototype, {\n enqueue: { enumerable: true },\n error: { enumerable: true },\n terminate: { enumerable: true },\n desiredSize: { enumerable: true }\n});\nsetFunctionName(TransformStreamDefaultController.prototype.enqueue, 'enqueue');\nsetFunctionName(TransformStreamDefaultController.prototype.error, 'error');\nsetFunctionName(TransformStreamDefaultController.prototype.terminate, 'terminate');\nif (typeof Symbol.toStringTag === 'symbol') {\n Object.defineProperty(TransformStreamDefaultController.prototype, Symbol.toStringTag, {\n value: 'TransformStreamDefaultController',\n configurable: true\n });\n}\n\n// Transform Stream Default Controller Abstract Operations\n\nfunction IsTransformStreamDefaultController(x: any): x is TransformStreamDefaultController {\n if (!typeIsObject(x)) {\n return false;\n }\n\n if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {\n return false;\n }\n\n return x instanceof TransformStreamDefaultController;\n}\n\nfunction SetUpTransformStreamDefaultController(stream: TransformStream,\n controller: TransformStreamDefaultController,\n transformAlgorithm: (chunk: I) => Promise,\n flushAlgorithm: () => Promise,\n cancelAlgorithm: (reason: any) => Promise) {\n assert(IsTransformStream(stream));\n assert(stream._transformStreamController === undefined);\n\n controller._controlledTransformStream = stream;\n stream._transformStreamController = controller;\n\n controller._transformAlgorithm = transformAlgorithm;\n controller._flushAlgorithm = flushAlgorithm;\n controller._cancelAlgorithm = cancelAlgorithm;\n\n controller._finishPromise = undefined;\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\nfunction SetUpTransformStreamDefaultControllerFromTransformer(stream: TransformStream,\n transformer: ValidatedTransformer) {\n const controller: TransformStreamDefaultController = Object.create(TransformStreamDefaultController.prototype);\n\n let transformAlgorithm: (chunk: I) => Promise;\n let flushAlgorithm: () => Promise;\n let cancelAlgorithm: (reason: any) => Promise;\n\n if (transformer.transform !== undefined) {\n transformAlgorithm = chunk => transformer.transform!(chunk, controller);\n } else {\n transformAlgorithm = chunk => {\n try {\n TransformStreamDefaultControllerEnqueue(controller, chunk as unknown as O);\n return promiseResolvedWith(undefined);\n } catch (transformResultE) {\n return promiseRejectedWith(transformResultE);\n }\n };\n }\n\n if (transformer.flush !== undefined) {\n flushAlgorithm = () => transformer.flush!(controller);\n } else {\n flushAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n if (transformer.cancel !== undefined) {\n cancelAlgorithm = reason => transformer.cancel!(reason);\n } else {\n cancelAlgorithm = () => promiseResolvedWith(undefined);\n }\n\n SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm);\n}\n\nfunction TransformStreamDefaultControllerClearAlgorithms(controller: TransformStreamDefaultController) {\n controller._transformAlgorithm = undefined!;\n controller._flushAlgorithm = undefined!;\n controller._cancelAlgorithm = undefined!;\n}\n\nfunction TransformStreamDefaultControllerEnqueue(controller: TransformStreamDefaultController, chunk: O) {\n const stream = controller._controlledTransformStream;\n const readableController = stream._readable._readableStreamController;\n if (!ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController)) {\n throw new TypeError('Readable side is not in a state that permits enqueue');\n }\n\n // We throttle transform invocations based on the backpressure of the ReadableStream, but we still\n // accept TransformStreamDefaultControllerEnqueue() calls.\n\n try {\n ReadableStreamDefaultControllerEnqueue(readableController, chunk);\n } catch (e) {\n // This happens when readableStrategy.size() throws.\n TransformStreamErrorWritableAndUnblockWrite(stream, e);\n\n throw stream._readable._storedError;\n }\n\n const backpressure = ReadableStreamDefaultControllerHasBackpressure(readableController);\n if (backpressure !== stream._backpressure) {\n assert(backpressure);\n TransformStreamSetBackpressure(stream, true);\n }\n}\n\nfunction TransformStreamDefaultControllerError(controller: TransformStreamDefaultController, e: any) {\n TransformStreamError(controller._controlledTransformStream, e);\n}\n\nfunction TransformStreamDefaultControllerPerformTransform(controller: TransformStreamDefaultController,\n chunk: I) {\n const transformPromise = controller._transformAlgorithm(chunk);\n return transformPromiseWith(transformPromise, undefined, r => {\n TransformStreamError(controller._controlledTransformStream, r);\n throw r;\n });\n}\n\nfunction TransformStreamDefaultControllerTerminate(controller: TransformStreamDefaultController) {\n const stream = controller._controlledTransformStream;\n const readableController = stream._readable._readableStreamController;\n\n ReadableStreamDefaultControllerClose(readableController);\n\n const error = new TypeError('TransformStream terminated');\n TransformStreamErrorWritableAndUnblockWrite(stream, error);\n}\n\n// TransformStreamDefaultSink Algorithms\n\nfunction TransformStreamDefaultSinkWriteAlgorithm(stream: TransformStream, chunk: I): Promise {\n assert(stream._writable._state === 'writable');\n\n const controller = stream._transformStreamController;\n\n if (stream._backpressure) {\n const backpressureChangePromise = stream._backpressureChangePromise;\n assert(backpressureChangePromise !== undefined);\n return transformPromiseWith(backpressureChangePromise, () => {\n const writable = stream._writable;\n const state = writable._state;\n if (state === 'erroring') {\n throw writable._storedError;\n }\n assert(state === 'writable');\n return TransformStreamDefaultControllerPerformTransform(controller, chunk);\n });\n }\n\n return TransformStreamDefaultControllerPerformTransform(controller, chunk);\n}\n\nfunction TransformStreamDefaultSinkAbortAlgorithm(stream: TransformStream, reason: any): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._readable cannot change after construction, so caching it across a call to user code is safe.\n const readable = stream._readable;\n\n // Assign the _finishPromise now so that if _cancelAlgorithm calls readable.cancel() internally,\n // we don't run the _cancelAlgorithm again.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const cancelPromise = controller._cancelAlgorithm(reason);\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(cancelPromise, () => {\n if (readable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, readable._storedError);\n } else {\n ReadableStreamDefaultControllerError(readable._readableStreamController, reason);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n ReadableStreamDefaultControllerError(readable._readableStreamController, r);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\nfunction TransformStreamDefaultSinkCloseAlgorithm(stream: TransformStream): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._readable cannot change after construction, so caching it across a call to user code is safe.\n const readable = stream._readable;\n\n // Assign the _finishPromise now so that if _flushAlgorithm calls readable.cancel() internally,\n // we don't also run the _cancelAlgorithm.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const flushPromise = controller._flushAlgorithm();\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(flushPromise, () => {\n if (readable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, readable._storedError);\n } else {\n ReadableStreamDefaultControllerClose(readable._readableStreamController);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n ReadableStreamDefaultControllerError(readable._readableStreamController, r);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\n// TransformStreamDefaultSource Algorithms\n\nfunction TransformStreamDefaultSourcePullAlgorithm(stream: TransformStream): Promise {\n // Invariant. Enforced by the promises returned by start() and pull().\n assert(stream._backpressure);\n\n assert(stream._backpressureChangePromise !== undefined);\n\n TransformStreamSetBackpressure(stream, false);\n\n // Prevent the next pull() call until there is backpressure.\n return stream._backpressureChangePromise;\n}\n\nfunction TransformStreamDefaultSourceCancelAlgorithm(stream: TransformStream, reason: any): Promise {\n const controller = stream._transformStreamController;\n if (controller._finishPromise !== undefined) {\n return controller._finishPromise;\n }\n\n // stream._writable cannot change after construction, so caching it across a call to user code is safe.\n const writable = stream._writable;\n\n // Assign the _finishPromise now so that if _flushAlgorithm calls writable.abort() or\n // writable.cancel() internally, we don't run the _cancelAlgorithm again, or also run the\n // _flushAlgorithm.\n controller._finishPromise = newPromise((resolve, reject) => {\n controller._finishPromise_resolve = resolve;\n controller._finishPromise_reject = reject;\n });\n\n const cancelPromise = controller._cancelAlgorithm(reason);\n TransformStreamDefaultControllerClearAlgorithms(controller);\n\n uponPromise(cancelPromise, () => {\n if (writable._state === 'errored') {\n defaultControllerFinishPromiseReject(controller, writable._storedError);\n } else {\n WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, reason);\n TransformStreamUnblockWrite(stream);\n defaultControllerFinishPromiseResolve(controller);\n }\n return null;\n }, r => {\n WritableStreamDefaultControllerErrorIfNeeded(writable._writableStreamController, r);\n TransformStreamUnblockWrite(stream);\n defaultControllerFinishPromiseReject(controller, r);\n return null;\n });\n\n return controller._finishPromise;\n}\n\n// Helper functions for the TransformStreamDefaultController.\n\nfunction defaultControllerBrandCheckException(name: string): TypeError {\n return new TypeError(\n `TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`);\n}\n\nexport function defaultControllerFinishPromiseResolve(controller: TransformStreamDefaultController) {\n if (controller._finishPromise_resolve === undefined) {\n return;\n }\n\n controller._finishPromise_resolve();\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\nexport function defaultControllerFinishPromiseReject(controller: TransformStreamDefaultController, reason: any) {\n if (controller._finishPromise_reject === undefined) {\n return;\n }\n\n setPromiseIsHandledToTrue(controller._finishPromise!);\n controller._finishPromise_reject(reason);\n controller._finishPromise_resolve = undefined;\n controller._finishPromise_reject = undefined;\n}\n\n// Helper functions for the TransformStream.\n\nfunction streamBrandCheckException(name: string): TypeError {\n return new TypeError(\n `TransformStream.prototype.${name} can only be used on a TransformStream`);\n}\n","/* c8 ignore start */\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\nif (!globalThis.ReadableStream) {\n // `node:stream/web` got introduced in v16.5.0 as experimental\n // and it's preferred over the polyfilled version. So we also\n // suppress the warning that gets emitted by NodeJS for using it.\n try {\n const process = require('node:process')\n const { emitWarning } = process\n try {\n process.emitWarning = () => {}\n Object.assign(globalThis, require('node:stream/web'))\n process.emitWarning = emitWarning\n } catch (error) {\n process.emitWarning = emitWarning\n throw error\n }\n } catch (error) {\n // fallback to polyfill implementation\n Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js'))\n }\n}\n\ntry {\n // Don't use node: prefix for this, require+node: is not supported until node v14.14\n // Only `import()` can use prefix in 12.20 and later\n const { Blob } = require('buffer')\n if (Blob && !Blob.prototype.stream) {\n Blob.prototype.stream = function name (params) {\n let position = 0\n const blob = this\n\n return new ReadableStream({\n type: 'bytes',\n async pull (ctrl) {\n const chunk = blob.slice(position, Math.min(blob.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n ctrl.enqueue(new Uint8Array(buffer))\n\n if (position === blob.size) {\n ctrl.close()\n }\n }\n })\n }\n }\n} catch (error) {}\n/* c8 ignore end */\n","/*! fetch-blob. MIT License. Jimmy Wärting */\n\n// TODO (jimmywarting): in the feature use conditional loading with top level await (requires 14.x)\n// Node has recently added whatwg stream into core\n\nimport './streams.cjs'\n\n// 64 KiB (same size chrome slice theirs blob into Uint8array's)\nconst POOL_SIZE = 65536\n\n/** @param {(Blob | Uint8Array)[]} parts */\nasync function * toIterator (parts, clone = true) {\n for (const part of parts) {\n if ('stream' in part) {\n yield * (/** @type {AsyncIterableIterator} */ (part.stream()))\n } else if (ArrayBuffer.isView(part)) {\n if (clone) {\n let position = part.byteOffset\n const end = part.byteOffset + part.byteLength\n while (position !== end) {\n const size = Math.min(end - position, POOL_SIZE)\n const chunk = part.buffer.slice(position, position + size)\n position += chunk.byteLength\n yield new Uint8Array(chunk)\n }\n } else {\n yield part\n }\n /* c8 ignore next 10 */\n } else {\n // For blobs that have arrayBuffer but no stream method (nodes buffer.Blob)\n let position = 0, b = (/** @type {Blob} */ (part))\n while (position !== b.size) {\n const chunk = b.slice(position, Math.min(b.size, position + POOL_SIZE))\n const buffer = await chunk.arrayBuffer()\n position += buffer.byteLength\n yield new Uint8Array(buffer)\n }\n }\n }\n}\n\nconst _Blob = class Blob {\n /** @type {Array.<(Blob|Uint8Array)>} */\n #parts = []\n #type = ''\n #size = 0\n #endings = 'transparent'\n\n /**\n * The Blob() constructor returns a new Blob object. The content\n * of the blob consists of the concatenation of the values given\n * in the parameter array.\n *\n * @param {*} blobParts\n * @param {{ type?: string, endings?: string }} [options]\n */\n constructor (blobParts = [], options = {}) {\n if (typeof blobParts !== 'object' || blobParts === null) {\n throw new TypeError('Failed to construct \\'Blob\\': The provided value cannot be converted to a sequence.')\n }\n\n if (typeof blobParts[Symbol.iterator] !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': The object must have a callable @@iterator property.')\n }\n\n if (typeof options !== 'object' && typeof options !== 'function') {\n throw new TypeError('Failed to construct \\'Blob\\': parameter 2 cannot convert to dictionary.')\n }\n\n if (options === null) options = {}\n\n const encoder = new TextEncoder()\n for (const element of blobParts) {\n let part\n if (ArrayBuffer.isView(element)) {\n part = new Uint8Array(element.buffer.slice(element.byteOffset, element.byteOffset + element.byteLength))\n } else if (element instanceof ArrayBuffer) {\n part = new Uint8Array(element.slice(0))\n } else if (element instanceof Blob) {\n part = element\n } else {\n part = encoder.encode(`${element}`)\n }\n\n this.#size += ArrayBuffer.isView(part) ? part.byteLength : part.size\n this.#parts.push(part)\n }\n\n this.#endings = `${options.endings === undefined ? 'transparent' : options.endings}`\n const type = options.type === undefined ? '' : String(options.type)\n this.#type = /^[\\x20-\\x7E]*$/.test(type) ? type : ''\n }\n\n /**\n * The Blob interface's size property returns the\n * size of the Blob in bytes.\n */\n get size () {\n return this.#size\n }\n\n /**\n * The type property of a Blob object returns the MIME type of the file.\n */\n get type () {\n return this.#type\n }\n\n /**\n * The text() method in the Blob interface returns a Promise\n * that resolves with a string containing the contents of\n * the blob, interpreted as UTF-8.\n *\n * @return {Promise}\n */\n async text () {\n // More optimized than using this.arrayBuffer()\n // that requires twice as much ram\n const decoder = new TextDecoder()\n let str = ''\n for await (const part of toIterator(this.#parts, false)) {\n str += decoder.decode(part, { stream: true })\n }\n // Remaining\n str += decoder.decode()\n return str\n }\n\n /**\n * The arrayBuffer() method in the Blob interface returns a\n * Promise that resolves with the contents of the blob as\n * binary data contained in an ArrayBuffer.\n *\n * @return {Promise}\n */\n async arrayBuffer () {\n // Easier way... Just a unnecessary overhead\n // const view = new Uint8Array(this.size);\n // await this.stream().getReader({mode: 'byob'}).read(view);\n // return view.buffer;\n\n const data = new Uint8Array(this.size)\n let offset = 0\n for await (const chunk of toIterator(this.#parts, false)) {\n data.set(chunk, offset)\n offset += chunk.length\n }\n\n return data.buffer\n }\n\n stream () {\n const it = toIterator(this.#parts, true)\n\n return new globalThis.ReadableStream({\n // @ts-ignore\n type: 'bytes',\n async pull (ctrl) {\n const chunk = await it.next()\n chunk.done ? ctrl.close() : ctrl.enqueue(chunk.value)\n },\n\n async cancel () {\n await it.return()\n }\n })\n }\n\n /**\n * The Blob interface's slice() method creates and returns a\n * new Blob object which contains data from a subset of the\n * blob on which it's called.\n *\n * @param {number} [start]\n * @param {number} [end]\n * @param {string} [type]\n */\n slice (start = 0, end = this.size, type = '') {\n const { size } = this\n\n let relativeStart = start < 0 ? Math.max(size + start, 0) : Math.min(start, size)\n let relativeEnd = end < 0 ? Math.max(size + end, 0) : Math.min(end, size)\n\n const span = Math.max(relativeEnd - relativeStart, 0)\n const parts = this.#parts\n const blobParts = []\n let added = 0\n\n for (const part of parts) {\n // don't add the overflow to new blobParts\n if (added >= span) {\n break\n }\n\n const size = ArrayBuffer.isView(part) ? part.byteLength : part.size\n if (relativeStart && size <= relativeStart) {\n // Skip the beginning and change the relative\n // start & end position as we skip the unwanted parts\n relativeStart -= size\n relativeEnd -= size\n } else {\n let chunk\n if (ArrayBuffer.isView(part)) {\n chunk = part.subarray(relativeStart, Math.min(size, relativeEnd))\n added += chunk.byteLength\n } else {\n chunk = part.slice(relativeStart, Math.min(size, relativeEnd))\n added += chunk.size\n }\n relativeEnd -= size\n blobParts.push(chunk)\n relativeStart = 0 // All next sequential parts should start at 0\n }\n }\n\n const blob = new Blob([], { type: String(type).toLowerCase() })\n blob.#size = span\n blob.#parts = blobParts\n\n return blob\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n\n static [Symbol.hasInstance] (object) {\n return (\n object &&\n typeof object === 'object' &&\n typeof object.constructor === 'function' &&\n (\n typeof object.stream === 'function' ||\n typeof object.arrayBuffer === 'function'\n ) &&\n /^(Blob|File)$/.test(object[Symbol.toStringTag])\n )\n }\n}\n\nObject.defineProperties(_Blob.prototype, {\n size: { enumerable: true },\n type: { enumerable: true },\n slice: { enumerable: true }\n})\n\n/** @type {typeof globalThis.Blob} */\nexport const Blob = _Blob\nexport default Blob\n","import Blob from './index.js'\n\nconst _File = class File extends Blob {\n #lastModified = 0\n #name = ''\n\n /**\n * @param {*[]} fileBits\n * @param {string} fileName\n * @param {{lastModified?: number, type?: string}} options\n */// @ts-ignore\n constructor (fileBits, fileName, options = {}) {\n if (arguments.length < 2) {\n throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)\n }\n super(fileBits, options)\n\n if (options === null) options = {}\n\n // Simulate WebIDL type casting for NaN value in lastModified option.\n const lastModified = options.lastModified === undefined ? Date.now() : Number(options.lastModified)\n if (!Number.isNaN(lastModified)) {\n this.#lastModified = lastModified\n }\n\n this.#name = String(fileName)\n }\n\n get name () {\n return this.#name\n }\n\n get lastModified () {\n return this.#lastModified\n }\n\n get [Symbol.toStringTag] () {\n return 'File'\n }\n\n static [Symbol.hasInstance] (object) {\n return !!object && object instanceof Blob &&\n /^(File)$/.test(object[Symbol.toStringTag])\n }\n}\n\n/** @type {typeof globalThis.File} */// @ts-ignore\nexport const File = _File\nexport default File\n","/*! formdata-polyfill. MIT License. Jimmy Wärting */\n\nimport C from 'fetch-blob'\nimport F from 'fetch-blob/file.js'\n\nvar {toStringTag:t,iterator:i,hasInstance:h}=Symbol,\nr=Math.random,\nm='append,set,get,getAll,delete,keys,values,entries,forEach,constructor'.split(','),\nf=(a,b,c)=>(a+='',/^(Blob|File)$/.test(b && b[t])?[(c=c!==void 0?c+'':b[t]=='File'?b.name:'blob',a),b.name!==c||b[t]=='blob'?new F([b],c,b):b]:[a,b+'']),\ne=(c,f)=>(f?c:c.replace(/\\r?\\n|\\r/g,'\\r\\n')).replace(/\\n/g,'%0A').replace(/\\r/g,'%0D').replace(/\"/g,'%22'),\nx=(n, a, e)=>{if(a.lengthtypeof o[m]!='function')}\nappend(...a){x('append',arguments,2);this.#d.push(f(...a))}\ndelete(a){x('delete',arguments,1);a+='';this.#d=this.#d.filter(([b])=>b!==a)}\nget(a){x('get',arguments,1);a+='';for(var b=this.#d,l=b.length,c=0;cc[0]===a&&b.push(c[1]));return b}\nhas(a){x('has',arguments,1);a+='';return this.#d.some(b=>b[0]===a)}\nforEach(a,b){x('forEach',arguments,1);for(var [c,d]of this)a.call(b,d,c,this)}\nset(...a){x('set',arguments,2);var b=[],c=!0;a=f(...a);this.#d.forEach(d=>{d[0]===a[0]?c&&(c=!b.push(a)):b.push(d)});c&&b.push(a);this.#d=b}\n*entries(){yield*this.#d}\n*keys(){for(var[a]of this)yield a}\n*values(){for(var[,a]of this)yield a}}\n\n/** @param {FormData} F */\nexport function formDataToBlob (F,B=C){\nvar b=`${r()}${r()}`.replace(/\\./g, '').slice(-28).padStart(32, '-'),c=[],p=`--${b}\\r\\nContent-Disposition: form-data; name=\"`\nF.forEach((v,n)=>typeof v=='string'\n?c.push(p+e(n)+`\"\\r\\n\\r\\n${v.replace(/\\r(?!\\n)|(? {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.append === 'function' &&\n\t\ttypeof object.delete === 'function' &&\n\t\ttypeof object.get === 'function' &&\n\t\ttypeof object.getAll === 'function' &&\n\t\ttypeof object.has === 'function' &&\n\t\ttypeof object.set === 'function' &&\n\t\ttypeof object.sort === 'function' &&\n\t\tobject[NAME] === 'URLSearchParams'\n\t);\n};\n\n/**\n * Check if `object` is a W3C `Blob` object (which `File` inherits from)\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isBlob = object => {\n\treturn (\n\t\tobject &&\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.arrayBuffer === 'function' &&\n\t\ttypeof object.type === 'string' &&\n\t\ttypeof object.stream === 'function' &&\n\t\ttypeof object.constructor === 'function' &&\n\t\t/^(Blob|File)$/.test(object[NAME])\n\t);\n};\n\n/**\n * Check if `obj` is an instance of AbortSignal.\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isAbortSignal = object => {\n\treturn (\n\t\ttypeof object === 'object' && (\n\t\t\tobject[NAME] === 'AbortSignal' ||\n\t\t\tobject[NAME] === 'EventTarget'\n\t\t)\n\t);\n};\n\n/**\n * isDomainOrSubdomain reports whether sub is a subdomain (or exact match) of\n * the parent domain.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isDomainOrSubdomain = (destination, original) => {\n\tconst orig = new URL(original).hostname;\n\tconst dest = new URL(destination).hostname;\n\n\treturn orig === dest || orig.endsWith(`.${dest}`);\n};\n\n/**\n * isSameProtocol reports whether the two provided URLs use the same protocol.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isSameProtocol = (destination, original) => {\n\tconst orig = new URL(original).protocol;\n\tconst dest = new URL(destination).protocol;\n\n\treturn orig === dest;\n};\n","/*! node-domexception. MIT License. Jimmy Wärting */\n\nif (!globalThis.DOMException) {\n try {\n const { MessageChannel } = require('worker_threads'),\n port = new MessageChannel().port1,\n ab = new ArrayBuffer()\n port.postMessage(ab, [ab, ab])\n } catch (err) {\n err.constructor.name === 'DOMException' && (\n globalThis.DOMException = err.constructor\n )\n }\n}\n\nmodule.exports = globalThis.DOMException\n","import { statSync, createReadStream, promises as fs } from 'node:fs'\nimport { basename } from 'node:path'\nimport DOMException from 'node-domexception'\n\nimport File from './file.js'\nimport Blob from './index.js'\n\nconst { stat } = fs\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n */\nconst blobFromSync = (path, type) => fromBlob(statSync(path), path, type)\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n * @returns {Promise}\n */\nconst blobFrom = (path, type) => stat(path).then(stat => fromBlob(stat, path, type))\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n * @returns {Promise}\n */\nconst fileFrom = (path, type) => stat(path).then(stat => fromFile(stat, path, type))\n\n/**\n * @param {string} path filepath on the disk\n * @param {string} [type] mimetype to use\n */\nconst fileFromSync = (path, type) => fromFile(statSync(path), path, type)\n\n// @ts-ignore\nconst fromBlob = (stat, path, type = '') => new Blob([new BlobDataItem({\n path,\n size: stat.size,\n lastModified: stat.mtimeMs,\n start: 0\n})], { type })\n\n// @ts-ignore\nconst fromFile = (stat, path, type = '') => new File([new BlobDataItem({\n path,\n size: stat.size,\n lastModified: stat.mtimeMs,\n start: 0\n})], basename(path), { type, lastModified: stat.mtimeMs })\n\n/**\n * This is a blob backed up by a file on the disk\n * with minium requirement. Its wrapped around a Blob as a blobPart\n * so you have no direct access to this.\n *\n * @private\n */\nclass BlobDataItem {\n #path\n #start\n\n constructor (options) {\n this.#path = options.path\n this.#start = options.start\n this.size = options.size\n this.lastModified = options.lastModified\n }\n\n /**\n * Slicing arguments is first validated and formatted\n * to not be out of range by Blob.prototype.slice\n */\n slice (start, end) {\n return new BlobDataItem({\n path: this.#path,\n lastModified: this.lastModified,\n size: end - start,\n start: this.#start + start\n })\n }\n\n async * stream () {\n const { mtimeMs } = await stat(this.#path)\n if (mtimeMs > this.lastModified) {\n throw new DOMException('The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.', 'NotReadableError')\n }\n yield * createReadStream(this.#path, {\n start: this.#start,\n end: this.#start + this.size - 1\n })\n }\n\n get [Symbol.toStringTag] () {\n return 'Blob'\n }\n}\n\nexport default blobFromSync\nexport { File, Blob, blobFrom, blobFromSync, fileFrom, fileFromSync }\n","import {File} from 'fetch-blob/from.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\n\nlet s = 0;\nconst S = {\n\tSTART_BOUNDARY: s++,\n\tHEADER_FIELD_START: s++,\n\tHEADER_FIELD: s++,\n\tHEADER_VALUE_START: s++,\n\tHEADER_VALUE: s++,\n\tHEADER_VALUE_ALMOST_DONE: s++,\n\tHEADERS_ALMOST_DONE: s++,\n\tPART_DATA_START: s++,\n\tPART_DATA: s++,\n\tEND: s++\n};\n\nlet f = 1;\nconst F = {\n\tPART_BOUNDARY: f,\n\tLAST_BOUNDARY: f *= 2\n};\n\nconst LF = 10;\nconst CR = 13;\nconst SPACE = 32;\nconst HYPHEN = 45;\nconst COLON = 58;\nconst A = 97;\nconst Z = 122;\n\nconst lower = c => c | 0x20;\n\nconst noop = () => {};\n\nclass MultipartParser {\n\t/**\n\t * @param {string} boundary\n\t */\n\tconstructor(boundary) {\n\t\tthis.index = 0;\n\t\tthis.flags = 0;\n\n\t\tthis.onHeaderEnd = noop;\n\t\tthis.onHeaderField = noop;\n\t\tthis.onHeadersEnd = noop;\n\t\tthis.onHeaderValue = noop;\n\t\tthis.onPartBegin = noop;\n\t\tthis.onPartData = noop;\n\t\tthis.onPartEnd = noop;\n\n\t\tthis.boundaryChars = {};\n\n\t\tboundary = '\\r\\n--' + boundary;\n\t\tconst ui8a = new Uint8Array(boundary.length);\n\t\tfor (let i = 0; i < boundary.length; i++) {\n\t\t\tui8a[i] = boundary.charCodeAt(i);\n\t\t\tthis.boundaryChars[ui8a[i]] = true;\n\t\t}\n\n\t\tthis.boundary = ui8a;\n\t\tthis.lookbehind = new Uint8Array(this.boundary.length + 8);\n\t\tthis.state = S.START_BOUNDARY;\n\t}\n\n\t/**\n\t * @param {Uint8Array} data\n\t */\n\twrite(data) {\n\t\tlet i = 0;\n\t\tconst length_ = data.length;\n\t\tlet previousIndex = this.index;\n\t\tlet {lookbehind, boundary, boundaryChars, index, state, flags} = this;\n\t\tconst boundaryLength = this.boundary.length;\n\t\tconst boundaryEnd = boundaryLength - 1;\n\t\tconst bufferLength = data.length;\n\t\tlet c;\n\t\tlet cl;\n\n\t\tconst mark = name => {\n\t\t\tthis[name + 'Mark'] = i;\n\t\t};\n\n\t\tconst clear = name => {\n\t\t\tdelete this[name + 'Mark'];\n\t\t};\n\n\t\tconst callback = (callbackSymbol, start, end, ui8a) => {\n\t\t\tif (start === undefined || start !== end) {\n\t\t\t\tthis[callbackSymbol](ui8a && ui8a.subarray(start, end));\n\t\t\t}\n\t\t};\n\n\t\tconst dataCallback = (name, clear) => {\n\t\t\tconst markSymbol = name + 'Mark';\n\t\t\tif (!(markSymbol in this)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (clear) {\n\t\t\t\tcallback(name, this[markSymbol], i, data);\n\t\t\t\tdelete this[markSymbol];\n\t\t\t} else {\n\t\t\t\tcallback(name, this[markSymbol], data.length, data);\n\t\t\t\tthis[markSymbol] = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (i = 0; i < length_; i++) {\n\t\t\tc = data[i];\n\n\t\t\tswitch (state) {\n\t\t\t\tcase S.START_BOUNDARY:\n\t\t\t\t\tif (index === boundary.length - 2) {\n\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else if (c !== CR) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if (index - 1 === boundary.length - 2) {\n\t\t\t\t\t\tif (flags & F.LAST_BOUNDARY && c === HYPHEN) {\n\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c !== boundary[index + 2]) {\n\t\t\t\t\t\tindex = -2;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === boundary[index + 2]) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_FIELD_START:\n\t\t\t\t\tstate = S.HEADER_FIELD;\n\t\t\t\t\tmark('onHeaderField');\n\t\t\t\t\tindex = 0;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_FIELD:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tclear('onHeaderField');\n\t\t\t\t\t\tstate = S.HEADERS_ALMOST_DONE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === COLON) {\n\t\t\t\t\t\tif (index === 1) {\n\t\t\t\t\t\t\t// empty header field\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdataCallback('onHeaderField', true);\n\t\t\t\t\t\tstate = S.HEADER_VALUE_START;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcl = lower(c);\n\t\t\t\t\tif (cl < A || cl > Z) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_START:\n\t\t\t\t\tif (c === SPACE) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tmark('onHeaderValue');\n\t\t\t\t\tstate = S.HEADER_VALUE;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_VALUE:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tdataCallback('onHeaderValue', true);\n\t\t\t\t\t\tcallback('onHeaderEnd');\n\t\t\t\t\t\tstate = S.HEADER_VALUE_ALMOST_DONE;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADERS_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tcallback('onHeadersEnd');\n\t\t\t\t\tstate = S.PART_DATA_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.PART_DATA_START:\n\t\t\t\t\tstate = S.PART_DATA;\n\t\t\t\t\tmark('onPartData');\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.PART_DATA:\n\t\t\t\t\tpreviousIndex = index;\n\n\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t// boyer-moore derrived algorithm to safely skip non-boundary data\n\t\t\t\t\t\ti += boundaryEnd;\n\t\t\t\t\t\twhile (i < bufferLength && !(data[i] in boundaryChars)) {\n\t\t\t\t\t\t\ti += boundaryLength;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ti -= boundaryEnd;\n\t\t\t\t\t\tc = data[i];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index < boundary.length) {\n\t\t\t\t\t\tif (boundary[index] === c) {\n\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\tdataCallback('onPartData', true);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === boundary.length) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\t\t// CR = part boundary\n\t\t\t\t\t\t\tflags |= F.PART_BOUNDARY;\n\t\t\t\t\t\t} else if (c === HYPHEN) {\n\t\t\t\t\t\t\t// HYPHEN = end boundary\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index - 1 === boundary.length) {\n\t\t\t\t\t\tif (flags & F.PART_BOUNDARY) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tif (c === LF) {\n\t\t\t\t\t\t\t\t// unset the PART_BOUNDARY flag\n\t\t\t\t\t\t\t\tflags &= ~F.PART_BOUNDARY;\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (flags & F.LAST_BOUNDARY) {\n\t\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index > 0) {\n\t\t\t\t\t\t// when matching a possible boundary, keep a lookbehind reference\n\t\t\t\t\t\t// in case it turns out to be a false lead\n\t\t\t\t\t\tlookbehind[index - 1] = c;\n\t\t\t\t\t} else if (previousIndex > 0) {\n\t\t\t\t\t\t// if our boundary turned out to be rubbish, the captured lookbehind\n\t\t\t\t\t\t// belongs to partData\n\t\t\t\t\t\tconst _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);\n\t\t\t\t\t\tcallback('onPartData', 0, previousIndex, _lookbehind);\n\t\t\t\t\t\tpreviousIndex = 0;\n\t\t\t\t\t\tmark('onPartData');\n\n\t\t\t\t\t\t// reconsider the current character even so it interrupted the sequence\n\t\t\t\t\t\t// it could be the beginning of a new sequence\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.END:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Unexpected state entered: ${state}`);\n\t\t\t}\n\t\t}\n\n\t\tdataCallback('onHeaderField');\n\t\tdataCallback('onHeaderValue');\n\t\tdataCallback('onPartData');\n\n\t\t// Update properties for the next call\n\t\tthis.index = index;\n\t\tthis.state = state;\n\t\tthis.flags = flags;\n\t}\n\n\tend() {\n\t\tif ((this.state === S.HEADER_FIELD_START && this.index === 0) ||\n\t\t\t(this.state === S.PART_DATA && this.index === this.boundary.length)) {\n\t\t\tthis.onPartEnd();\n\t\t} else if (this.state !== S.END) {\n\t\t\tthrow new Error('MultipartParser.end(): stream ended unexpectedly');\n\t\t}\n\t}\n}\n\nfunction _fileName(headerValue) {\n\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\tconst m = headerValue.match(/\\bfilename=(\"(.*?)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))($|;\\s)/i);\n\tif (!m) {\n\t\treturn;\n\t}\n\n\tconst match = m[2] || m[3] || '';\n\tlet filename = match.slice(match.lastIndexOf('\\\\') + 1);\n\tfilename = filename.replace(/%22/g, '\"');\n\tfilename = filename.replace(/&#(\\d{4});/g, (m, code) => {\n\t\treturn String.fromCharCode(code);\n\t});\n\treturn filename;\n}\n\nexport async function toFormData(Body, ct) {\n\tif (!/multipart/i.test(ct)) {\n\t\tthrow new TypeError('Failed to fetch');\n\t}\n\n\tconst m = ct.match(/boundary=(?:\"([^\"]+)\"|([^;]+))/i);\n\n\tif (!m) {\n\t\tthrow new TypeError('no or bad content-type header, no multipart boundary');\n\t}\n\n\tconst parser = new MultipartParser(m[1] || m[2]);\n\n\tlet headerField;\n\tlet headerValue;\n\tlet entryValue;\n\tlet entryName;\n\tlet contentType;\n\tlet filename;\n\tconst entryChunks = [];\n\tconst formData = new FormData();\n\n\tconst onPartData = ui8a => {\n\t\tentryValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tconst appendToFile = ui8a => {\n\t\tentryChunks.push(ui8a);\n\t};\n\n\tconst appendFileToFormData = () => {\n\t\tconst file = new File(entryChunks, filename, {type: contentType});\n\t\tformData.append(entryName, file);\n\t};\n\n\tconst appendEntryToFormData = () => {\n\t\tformData.append(entryName, entryValue);\n\t};\n\n\tconst decoder = new TextDecoder('utf-8');\n\tdecoder.decode();\n\n\tparser.onPartBegin = function () {\n\t\tparser.onPartData = onPartData;\n\t\tparser.onPartEnd = appendEntryToFormData;\n\n\t\theaderField = '';\n\t\theaderValue = '';\n\t\tentryValue = '';\n\t\tentryName = '';\n\t\tcontentType = '';\n\t\tfilename = null;\n\t\tentryChunks.length = 0;\n\t};\n\n\tparser.onHeaderField = function (ui8a) {\n\t\theaderField += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderValue = function (ui8a) {\n\t\theaderValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderEnd = function () {\n\t\theaderValue += decoder.decode();\n\t\theaderField = headerField.toLowerCase();\n\n\t\tif (headerField === 'content-disposition') {\n\t\t\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\t\t\tconst m = headerValue.match(/\\bname=(\"([^\"]*)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))/i);\n\n\t\t\tif (m) {\n\t\t\t\tentryName = m[2] || m[3] || '';\n\t\t\t}\n\n\t\t\tfilename = _fileName(headerValue);\n\n\t\t\tif (filename) {\n\t\t\t\tparser.onPartData = appendToFile;\n\t\t\t\tparser.onPartEnd = appendFileToFormData;\n\t\t\t}\n\t\t} else if (headerField === 'content-type') {\n\t\t\tcontentType = headerValue;\n\t\t}\n\n\t\theaderValue = '';\n\t\theaderField = '';\n\t};\n\n\tfor await (const chunk of Body) {\n\t\tparser.write(chunk);\n\t}\n\n\tparser.end();\n\n\treturn formData;\n}\n","\n/**\n * Body.js\n *\n * Body interface provides common methods for Request and Response\n */\n\nimport Stream, {PassThrough} from 'node:stream';\nimport {types, deprecate, promisify} from 'node:util';\nimport {Buffer} from 'node:buffer';\n\nimport Blob from 'fetch-blob';\nimport {FormData, formDataToBlob} from 'formdata-polyfill/esm.min.js';\n\nimport {FetchError} from './errors/fetch-error.js';\nimport {FetchBaseError} from './errors/base.js';\nimport {isBlob, isURLSearchParameters} from './utils/is.js';\n\nconst pipeline = promisify(Stream.pipeline);\nconst INTERNALS = Symbol('Body internals');\n\n/**\n * Body mixin\n *\n * Ref: https://fetch.spec.whatwg.org/#body\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Body {\n\tconstructor(body, {\n\t\tsize = 0\n\t} = {}) {\n\t\tlet boundary = null;\n\n\t\tif (body === null) {\n\t\t\t// Body is undefined or null\n\t\t\tbody = null;\n\t\t} else if (isURLSearchParameters(body)) {\n\t\t\t// Body is a URLSearchParams\n\t\t\tbody = Buffer.from(body.toString());\n\t\t} else if (isBlob(body)) {\n\t\t\t// Body is blob\n\t\t} else if (Buffer.isBuffer(body)) {\n\t\t\t// Body is Buffer\n\t\t} else if (types.isAnyArrayBuffer(body)) {\n\t\t\t// Body is ArrayBuffer\n\t\t\tbody = Buffer.from(body);\n\t\t} else if (ArrayBuffer.isView(body)) {\n\t\t\t// Body is ArrayBufferView\n\t\t\tbody = Buffer.from(body.buffer, body.byteOffset, body.byteLength);\n\t\t} else if (body instanceof Stream) {\n\t\t\t// Body is stream\n\t\t} else if (body instanceof FormData) {\n\t\t\t// Body is FormData\n\t\t\tbody = formDataToBlob(body);\n\t\t\tboundary = body.type.split('=')[1];\n\t\t} else {\n\t\t\t// None of the above\n\t\t\t// coerce to string then buffer\n\t\t\tbody = Buffer.from(String(body));\n\t\t}\n\n\t\tlet stream = body;\n\n\t\tif (Buffer.isBuffer(body)) {\n\t\t\tstream = Stream.Readable.from(body);\n\t\t} else if (isBlob(body)) {\n\t\t\tstream = Stream.Readable.from(body.stream());\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\tbody,\n\t\t\tstream,\n\t\t\tboundary,\n\t\t\tdisturbed: false,\n\t\t\terror: null\n\t\t};\n\t\tthis.size = size;\n\n\t\tif (body instanceof Stream) {\n\t\t\tbody.on('error', error_ => {\n\t\t\t\tconst error = error_ instanceof FetchBaseError ?\n\t\t\t\t\terror_ :\n\t\t\t\t\tnew FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, 'system', error_);\n\t\t\t\tthis[INTERNALS].error = error;\n\t\t\t});\n\t\t}\n\t}\n\n\tget body() {\n\t\treturn this[INTERNALS].stream;\n\t}\n\n\tget bodyUsed() {\n\t\treturn this[INTERNALS].disturbed;\n\t}\n\n\t/**\n\t * Decode response as ArrayBuffer\n\t *\n\t * @return Promise\n\t */\n\tasync arrayBuffer() {\n\t\tconst {buffer, byteOffset, byteLength} = await consumeBody(this);\n\t\treturn buffer.slice(byteOffset, byteOffset + byteLength);\n\t}\n\n\tasync formData() {\n\t\tconst ct = this.headers.get('content-type');\n\n\t\tif (ct.startsWith('application/x-www-form-urlencoded')) {\n\t\t\tconst formData = new FormData();\n\t\t\tconst parameters = new URLSearchParams(await this.text());\n\n\t\t\tfor (const [name, value] of parameters) {\n\t\t\t\tformData.append(name, value);\n\t\t\t}\n\n\t\t\treturn formData;\n\t\t}\n\n\t\tconst {toFormData} = await import('./utils/multipart-parser.js');\n\t\treturn toFormData(this.body, ct);\n\t}\n\n\t/**\n\t * Return raw response as Blob\n\t *\n\t * @return Promise\n\t */\n\tasync blob() {\n\t\tconst ct = (this.headers && this.headers.get('content-type')) || (this[INTERNALS].body && this[INTERNALS].body.type) || '';\n\t\tconst buf = await this.arrayBuffer();\n\n\t\treturn new Blob([buf], {\n\t\t\ttype: ct\n\t\t});\n\t}\n\n\t/**\n\t * Decode response as json\n\t *\n\t * @return Promise\n\t */\n\tasync json() {\n\t\tconst text = await this.text();\n\t\treturn JSON.parse(text);\n\t}\n\n\t/**\n\t * Decode response as text\n\t *\n\t * @return Promise\n\t */\n\tasync text() {\n\t\tconst buffer = await consumeBody(this);\n\t\treturn new TextDecoder().decode(buffer);\n\t}\n\n\t/**\n\t * Decode response as buffer (non-spec api)\n\t *\n\t * @return Promise\n\t */\n\tbuffer() {\n\t\treturn consumeBody(this);\n\t}\n}\n\nBody.prototype.buffer = deprecate(Body.prototype.buffer, 'Please use \\'response.arrayBuffer()\\' instead of \\'response.buffer()\\'', 'node-fetch#buffer');\n\n// In browsers, all properties are enumerable.\nObject.defineProperties(Body.prototype, {\n\tbody: {enumerable: true},\n\tbodyUsed: {enumerable: true},\n\tarrayBuffer: {enumerable: true},\n\tblob: {enumerable: true},\n\tjson: {enumerable: true},\n\ttext: {enumerable: true},\n\tdata: {get: deprecate(() => {},\n\t\t'data doesn\\'t exist, use json(), text(), arrayBuffer(), or body instead',\n\t\t'https://github.com/node-fetch/node-fetch/issues/1000 (response)')}\n});\n\n/**\n * Consume and convert an entire Body to a Buffer.\n *\n * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body\n *\n * @return Promise\n */\nasync function consumeBody(data) {\n\tif (data[INTERNALS].disturbed) {\n\t\tthrow new TypeError(`body used already for: ${data.url}`);\n\t}\n\n\tdata[INTERNALS].disturbed = true;\n\n\tif (data[INTERNALS].error) {\n\t\tthrow data[INTERNALS].error;\n\t}\n\n\tconst {body} = data;\n\n\t// Body is null\n\tif (body === null) {\n\t\treturn Buffer.alloc(0);\n\t}\n\n\t/* c8 ignore next 3 */\n\tif (!(body instanceof Stream)) {\n\t\treturn Buffer.alloc(0);\n\t}\n\n\t// Body is stream\n\t// get ready to actually consume the body\n\tconst accum = [];\n\tlet accumBytes = 0;\n\n\ttry {\n\t\tfor await (const chunk of body) {\n\t\t\tif (data.size > 0 && accumBytes + chunk.length > data.size) {\n\t\t\t\tconst error = new FetchError(`content size at ${data.url} over limit: ${data.size}`, 'max-size');\n\t\t\t\tbody.destroy(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\taccumBytes += chunk.length;\n\t\t\taccum.push(chunk);\n\t\t}\n\t} catch (error) {\n\t\tconst error_ = error instanceof FetchBaseError ? error : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`, 'system', error);\n\t\tthrow error_;\n\t}\n\n\tif (body.readableEnded === true || body._readableState.ended === true) {\n\t\ttry {\n\t\t\tif (accum.every(c => typeof c === 'string')) {\n\t\t\t\treturn Buffer.from(accum.join(''));\n\t\t\t}\n\n\t\t\treturn Buffer.concat(accum, accumBytes);\n\t\t} catch (error) {\n\t\t\tthrow new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`, 'system', error);\n\t\t}\n\t} else {\n\t\tthrow new FetchError(`Premature close of server response while trying to fetch ${data.url}`);\n\t}\n}\n\n/**\n * Clone body given Res/Req instance\n *\n * @param Mixed instance Response or Request instance\n * @param String highWaterMark highWaterMark for both PassThrough body streams\n * @return Mixed\n */\nexport const clone = (instance, highWaterMark) => {\n\tlet p1;\n\tlet p2;\n\tlet {body} = instance[INTERNALS];\n\n\t// Don't allow cloning a used body\n\tif (instance.bodyUsed) {\n\t\tthrow new Error('cannot clone body after it is used');\n\t}\n\n\t// Check that body is a stream and not form-data object\n\t// note: we can't clone the form-data object without having it as a dependency\n\tif ((body instanceof Stream) && (typeof body.getBoundary !== 'function')) {\n\t\t// Tee instance body\n\t\tp1 = new PassThrough({highWaterMark});\n\t\tp2 = new PassThrough({highWaterMark});\n\t\tbody.pipe(p1);\n\t\tbody.pipe(p2);\n\t\t// Set instance body to teed body and return the other teed body\n\t\tinstance[INTERNALS].stream = p1;\n\t\tbody = p2;\n\t}\n\n\treturn body;\n};\n\nconst getNonSpecFormDataBoundary = deprecate(\n\tbody => body.getBoundary(),\n\t'form-data doesn\\'t follow the spec and requires special treatment. Use alternative package',\n\t'https://github.com/node-fetch/node-fetch/issues/1167'\n);\n\n/**\n * Performs the operation \"extract a `Content-Type` value from |object|\" as\n * specified in the specification:\n * https://fetch.spec.whatwg.org/#concept-bodyinit-extract\n *\n * This function assumes that instance.body is present.\n *\n * @param {any} body Any options.body input\n * @returns {string | null}\n */\nexport const extractContentType = (body, request) => {\n\t// Body is null or undefined\n\tif (body === null) {\n\t\treturn null;\n\t}\n\n\t// Body is string\n\tif (typeof body === 'string') {\n\t\treturn 'text/plain;charset=UTF-8';\n\t}\n\n\t// Body is a URLSearchParams\n\tif (isURLSearchParameters(body)) {\n\t\treturn 'application/x-www-form-urlencoded;charset=UTF-8';\n\t}\n\n\t// Body is blob\n\tif (isBlob(body)) {\n\t\treturn body.type || null;\n\t}\n\n\t// Body is a Buffer (Buffer, ArrayBuffer or ArrayBufferView)\n\tif (Buffer.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {\n\t\treturn null;\n\t}\n\n\tif (body instanceof FormData) {\n\t\treturn `multipart/form-data; boundary=${request[INTERNALS].boundary}`;\n\t}\n\n\t// Detect form data input from form-data module\n\tif (body && typeof body.getBoundary === 'function') {\n\t\treturn `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`;\n\t}\n\n\t// Body is stream - can't really do much about this\n\tif (body instanceof Stream) {\n\t\treturn null;\n\t}\n\n\t// Body constructor defaults other things to string\n\treturn 'text/plain;charset=UTF-8';\n};\n\n/**\n * The Fetch Standard treats this as if \"total bytes\" is a property on the body.\n * For us, we have to explicitly get it with a function.\n *\n * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes\n *\n * @param {any} obj.body Body object from the Body instance.\n * @returns {number | null}\n */\nexport const getTotalBytes = request => {\n\tconst {body} = request[INTERNALS];\n\n\t// Body is null or undefined\n\tif (body === null) {\n\t\treturn 0;\n\t}\n\n\t// Body is Blob\n\tif (isBlob(body)) {\n\t\treturn body.size;\n\t}\n\n\t// Body is Buffer\n\tif (Buffer.isBuffer(body)) {\n\t\treturn body.length;\n\t}\n\n\t// Detect form data input from form-data module\n\tif (body && typeof body.getLengthSync === 'function') {\n\t\treturn body.hasKnownLength && body.hasKnownLength() ? body.getLengthSync() : null;\n\t}\n\n\t// Body is stream\n\treturn null;\n};\n\n/**\n * Write a Body to a Node.js WritableStream (e.g. http.Request) object.\n *\n * @param {Stream.Writable} dest The stream to write to.\n * @param obj.body Body object from the Body instance.\n * @returns {Promise}\n */\nexport const writeToStream = async (dest, {body}) => {\n\tif (body === null) {\n\t\t// Body is null\n\t\tdest.end();\n\t} else {\n\t\t// Body is stream\n\t\tawait pipeline(body, dest);\n\t}\n};\n","/**\n * Headers.js\n *\n * Headers class offers convenient helpers\n */\n\nimport {types} from 'node:util';\nimport http from 'node:http';\n\n/* c8 ignore next 9 */\nconst validateHeaderName = typeof http.validateHeaderName === 'function' ?\n\thttp.validateHeaderName :\n\tname => {\n\t\tif (!/^[\\^`\\-\\w!#$%&'*+.|~]+$/.test(name)) {\n\t\t\tconst error = new TypeError(`Header name must be a valid HTTP token [${name}]`);\n\t\t\tObject.defineProperty(error, 'code', {value: 'ERR_INVALID_HTTP_TOKEN'});\n\t\t\tthrow error;\n\t\t}\n\t};\n\n/* c8 ignore next 9 */\nconst validateHeaderValue = typeof http.validateHeaderValue === 'function' ?\n\thttp.validateHeaderValue :\n\t(name, value) => {\n\t\tif (/[^\\t\\u0020-\\u007E\\u0080-\\u00FF]/.test(value)) {\n\t\t\tconst error = new TypeError(`Invalid character in header content [\"${name}\"]`);\n\t\t\tObject.defineProperty(error, 'code', {value: 'ERR_INVALID_CHAR'});\n\t\t\tthrow error;\n\t\t}\n\t};\n\n/**\n * @typedef {Headers | Record | Iterable | Iterable>} HeadersInit\n */\n\n/**\n * This Fetch API interface allows you to perform various actions on HTTP request and response headers.\n * These actions include retrieving, setting, adding to, and removing.\n * A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.\n * You can add to this using methods like append() (see Examples.)\n * In all methods of this interface, header names are matched by case-insensitive byte sequence.\n *\n */\nexport default class Headers extends URLSearchParams {\n\t/**\n\t * Headers class\n\t *\n\t * @constructor\n\t * @param {HeadersInit} [init] - Response headers\n\t */\n\tconstructor(init) {\n\t\t// Validate and normalize init object in [name, value(s)][]\n\t\t/** @type {string[][]} */\n\t\tlet result = [];\n\t\tif (init instanceof Headers) {\n\t\t\tconst raw = init.raw();\n\t\t\tfor (const [name, values] of Object.entries(raw)) {\n\t\t\t\tresult.push(...values.map(value => [name, value]));\n\t\t\t}\n\t\t} else if (init == null) { // eslint-disable-line no-eq-null, eqeqeq\n\t\t\t// No op\n\t\t} else if (typeof init === 'object' && !types.isBoxedPrimitive(init)) {\n\t\t\tconst method = init[Symbol.iterator];\n\t\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\t\tif (method == null) {\n\t\t\t\t// Record\n\t\t\t\tresult.push(...Object.entries(init));\n\t\t\t} else {\n\t\t\t\tif (typeof method !== 'function') {\n\t\t\t\t\tthrow new TypeError('Header pairs must be iterable');\n\t\t\t\t}\n\n\t\t\t\t// Sequence>\n\t\t\t\t// Note: per spec we have to first exhaust the lists then process them\n\t\t\t\tresult = [...init]\n\t\t\t\t\t.map(pair => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof pair !== 'object' || types.isBoxedPrimitive(pair)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new TypeError('Each header pair must be an iterable object');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn [...pair];\n\t\t\t\t\t}).map(pair => {\n\t\t\t\t\t\tif (pair.length !== 2) {\n\t\t\t\t\t\t\tthrow new TypeError('Each header pair must be a name/value tuple');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn [...pair];\n\t\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new TypeError('Failed to construct \\'Headers\\': The provided value is not of type \\'(sequence> or record)');\n\t\t}\n\n\t\t// Validate and lowercase\n\t\tresult =\n\t\t\tresult.length > 0 ?\n\t\t\t\tresult.map(([name, value]) => {\n\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\treturn [String(name).toLowerCase(), String(value)];\n\t\t\t\t}) :\n\t\t\t\tundefined;\n\n\t\tsuper(result);\n\n\t\t// Returning a Proxy that will lowercase key names, validate parameters and sort keys\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn new Proxy(this, {\n\t\t\tget(target, p, receiver) {\n\t\t\t\tswitch (p) {\n\t\t\t\t\tcase 'append':\n\t\t\t\t\tcase 'set':\n\t\t\t\t\t\treturn (name, value) => {\n\t\t\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\t\t\treturn URLSearchParams.prototype[p].call(\n\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\tString(name).toLowerCase(),\n\t\t\t\t\t\t\t\tString(value)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase 'delete':\n\t\t\t\t\tcase 'has':\n\t\t\t\t\tcase 'getAll':\n\t\t\t\t\t\treturn name => {\n\t\t\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\t\t\treturn URLSearchParams.prototype[p].call(\n\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\tString(name).toLowerCase()\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t};\n\n\t\t\t\t\tcase 'keys':\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\ttarget.sort();\n\t\t\t\t\t\t\treturn new Set(URLSearchParams.prototype.keys.call(target)).keys();\n\t\t\t\t\t\t};\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn Reflect.get(target, p, receiver);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t/* c8 ignore next */\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn this.constructor.name;\n\t}\n\n\ttoString() {\n\t\treturn Object.prototype.toString.call(this);\n\t}\n\n\tget(name) {\n\t\tconst values = this.getAll(name);\n\t\tif (values.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet value = values.join(', ');\n\t\tif (/^content-encoding$/i.test(name)) {\n\t\t\tvalue = value.toLowerCase();\n\t\t}\n\n\t\treturn value;\n\t}\n\n\tforEach(callback, thisArg = undefined) {\n\t\tfor (const name of this.keys()) {\n\t\t\tReflect.apply(callback, thisArg, [this.get(name), name, this]);\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const name of this.keys()) {\n\t\t\tyield this.get(name);\n\t\t}\n\t}\n\n\t/**\n\t * @type {() => IterableIterator<[string, string]>}\n\t */\n\t* entries() {\n\t\tfor (const name of this.keys()) {\n\t\t\tyield [name, this.get(name)];\n\t\t}\n\t}\n\n\t[Symbol.iterator]() {\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Node-fetch non-spec method\n\t * returning all headers and their values as array\n\t * @returns {Record}\n\t */\n\traw() {\n\t\treturn [...this.keys()].reduce((result, key) => {\n\t\t\tresult[key] = this.getAll(key);\n\t\t\treturn result;\n\t\t}, {});\n\t}\n\n\t/**\n\t * For better console.log(headers) and also to convert Headers into Node.js Request compatible format\n\t */\n\t[Symbol.for('nodejs.util.inspect.custom')]() {\n\t\treturn [...this.keys()].reduce((result, key) => {\n\t\t\tconst values = this.getAll(key);\n\t\t\t// Http.request() only supports string as Host header.\n\t\t\t// This hack makes specifying custom Host header possible.\n\t\t\tif (key === 'host') {\n\t\t\t\tresult[key] = values[0];\n\t\t\t} else {\n\t\t\t\tresult[key] = values.length > 1 ? values : values[0];\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}, {});\n\t}\n}\n\n/**\n * Re-shaping object for Web IDL tests\n * Only need to do it for overridden methods\n */\nObject.defineProperties(\n\tHeaders.prototype,\n\t['get', 'entries', 'forEach', 'values'].reduce((result, property) => {\n\t\tresult[property] = {enumerable: true};\n\t\treturn result;\n\t}, {})\n);\n\n/**\n * Create a Headers object from an http.IncomingMessage.rawHeaders, ignoring those that do\n * not conform to HTTP grammar productions.\n * @param {import('http').IncomingMessage['rawHeaders']} headers\n */\nexport function fromRawHeaders(headers = []) {\n\treturn new Headers(\n\t\theaders\n\t\t\t// Split into pairs\n\t\t\t.reduce((result, value, index, array) => {\n\t\t\t\tif (index % 2 === 0) {\n\t\t\t\t\tresult.push(array.slice(index, index + 2));\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}, [])\n\t\t\t.filter(([name, value]) => {\n\t\t\t\ttry {\n\t\t\t\t\tvalidateHeaderName(name);\n\t\t\t\t\tvalidateHeaderValue(name, String(value));\n\t\t\t\t\treturn true;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t})\n\n\t);\n}\n","const redirectStatus = new Set([301, 302, 303, 307, 308]);\n\n/**\n * Redirect code matching\n *\n * @param {number} code - Status code\n * @return {boolean}\n */\nexport const isRedirect = code => {\n\treturn redirectStatus.has(code);\n};\n","/**\n * Response.js\n *\n * Response class provides content decoding\n */\n\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType} from './body.js';\nimport {isRedirect} from './utils/is-redirect.js';\n\nconst INTERNALS = Symbol('Response internals');\n\n/**\n * Response class\n *\n * Ref: https://fetch.spec.whatwg.org/#response-class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Response extends Body {\n\tconstructor(body = null, options = {}) {\n\t\tsuper(body, options);\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq, no-negated-condition\n\t\tconst status = options.status != null ? options.status : 200;\n\n\t\tconst headers = new Headers(options.headers);\n\n\t\tif (body !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\ttype: 'default',\n\t\t\turl: options.url,\n\t\t\tstatus,\n\t\t\tstatusText: options.statusText || '',\n\t\t\theaders,\n\t\t\tcounter: options.counter,\n\t\t\thighWaterMark: options.highWaterMark\n\t\t};\n\t}\n\n\tget type() {\n\t\treturn this[INTERNALS].type;\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS].status;\n\t}\n\n\t/**\n\t * Convenience property representing if the request ended normally\n\t */\n\tget ok() {\n\t\treturn this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget highWaterMark() {\n\t\treturn this[INTERNALS].highWaterMark;\n\t}\n\n\t/**\n\t * Clone this response\n\t *\n\t * @return Response\n\t */\n\tclone() {\n\t\treturn new Response(clone(this, this.highWaterMark), {\n\t\t\ttype: this.type,\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected,\n\t\t\tsize: this.size,\n\t\t\thighWaterMark: this.highWaterMark\n\t\t});\n\t}\n\n\t/**\n\t * @param {string} url The URL that the new response is to originate from.\n\t * @param {number} status An optional status code for the response (e.g., 302.)\n\t * @returns {Response} A Response object.\n\t */\n\tstatic redirect(url, status = 302) {\n\t\tif (!isRedirect(status)) {\n\t\t\tthrow new RangeError('Failed to execute \"redirect\" on \"response\": Invalid status code');\n\t\t}\n\n\t\treturn new Response(null, {\n\t\t\theaders: {\n\t\t\t\tlocation: new URL(url).toString()\n\t\t\t},\n\t\t\tstatus\n\t\t});\n\t}\n\n\tstatic error() {\n\t\tconst response = new Response(null, {status: 0, statusText: ''});\n\t\tresponse[INTERNALS].type = 'error';\n\t\treturn response;\n\t}\n\n\tstatic json(data = undefined, init = {}) {\n\t\tconst body = JSON.stringify(data);\n\n\t\tif (body === undefined) {\n\t\t\tthrow new TypeError('data is not JSON serializable');\n\t\t}\n\n\t\tconst headers = new Headers(init && init.headers);\n\n\t\tif (!headers.has('content-type')) {\n\t\t\theaders.set('content-type', 'application/json');\n\t\t}\n\n\t\treturn new Response(body, {\n\t\t\t...init,\n\t\t\theaders\n\t\t});\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Response';\n\t}\n}\n\nObject.defineProperties(Response.prototype, {\n\ttype: {enumerable: true},\n\turl: {enumerable: true},\n\tstatus: {enumerable: true},\n\tok: {enumerable: true},\n\tredirected: {enumerable: true},\n\tstatusText: {enumerable: true},\n\theaders: {enumerable: true},\n\tclone: {enumerable: true}\n});\n","export const getSearch = parsedURL => {\n\tif (parsedURL.search) {\n\t\treturn parsedURL.search;\n\t}\n\n\tconst lastOffset = parsedURL.href.length - 1;\n\tconst hash = parsedURL.hash || (parsedURL.href[lastOffset] === '#' ? '#' : '');\n\treturn parsedURL.href[lastOffset - hash.length] === '?' ? '?' : '';\n};\n","import {isIP} from 'node:net';\n\n/**\n * @external URL\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/URL|URL}\n */\n\n/**\n * @module utils/referrer\n * @private\n */\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#strip-url|Referrer Policy §8.4. Strip url for use as a referrer}\n * @param {string} URL\n * @param {boolean} [originOnly=false]\n */\nexport function stripURLForUseAsAReferrer(url, originOnly = false) {\n\t// 1. If url is null, return no referrer.\n\tif (url == null) { // eslint-disable-line no-eq-null, eqeqeq\n\t\treturn 'no-referrer';\n\t}\n\n\turl = new URL(url);\n\n\t// 2. If url's scheme is a local scheme, then return no referrer.\n\tif (/^(about|blob|data):$/.test(url.protocol)) {\n\t\treturn 'no-referrer';\n\t}\n\n\t// 3. Set url's username to the empty string.\n\turl.username = '';\n\n\t// 4. Set url's password to null.\n\t// Note: `null` appears to be a mistake as this actually results in the password being `\"null\"`.\n\turl.password = '';\n\n\t// 5. Set url's fragment to null.\n\t// Note: `null` appears to be a mistake as this actually results in the fragment being `\"#null\"`.\n\turl.hash = '';\n\n\t// 6. If the origin-only flag is true, then:\n\tif (originOnly) {\n\t\t// 6.1. Set url's path to null.\n\t\t// Note: `null` appears to be a mistake as this actually results in the path being `\"/null\"`.\n\t\turl.pathname = '';\n\n\t\t// 6.2. Set url's query to null.\n\t\t// Note: `null` appears to be a mistake as this actually results in the query being `\"?null\"`.\n\t\turl.search = '';\n\t}\n\n\t// 7. Return url.\n\treturn url;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#enumdef-referrerpolicy|enum ReferrerPolicy}\n */\nexport const ReferrerPolicy = new Set([\n\t'',\n\t'no-referrer',\n\t'no-referrer-when-downgrade',\n\t'same-origin',\n\t'origin',\n\t'strict-origin',\n\t'origin-when-cross-origin',\n\t'strict-origin-when-cross-origin',\n\t'unsafe-url'\n]);\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#default-referrer-policy|default referrer policy}\n */\nexport const DEFAULT_REFERRER_POLICY = 'strict-origin-when-cross-origin';\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#referrer-policies|Referrer Policy §3. Referrer Policies}\n * @param {string} referrerPolicy\n * @returns {string} referrerPolicy\n */\nexport function validateReferrerPolicy(referrerPolicy) {\n\tif (!ReferrerPolicy.has(referrerPolicy)) {\n\t\tthrow new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);\n\t}\n\n\treturn referrerPolicy;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy|Referrer Policy §3.2. Is origin potentially trustworthy?}\n * @param {external:URL} url\n * @returns `true`: \"Potentially Trustworthy\", `false`: \"Not Trustworthy\"\n */\nexport function isOriginPotentiallyTrustworthy(url) {\n\t// 1. If origin is an opaque origin, return \"Not Trustworthy\".\n\t// Not applicable\n\n\t// 2. Assert: origin is a tuple origin.\n\t// Not for implementations\n\n\t// 3. If origin's scheme is either \"https\" or \"wss\", return \"Potentially Trustworthy\".\n\tif (/^(http|ws)s:$/.test(url.protocol)) {\n\t\treturn true;\n\t}\n\n\t// 4. If origin's host component matches one of the CIDR notations 127.0.0.0/8 or ::1/128 [RFC4632], return \"Potentially Trustworthy\".\n\tconst hostIp = url.host.replace(/(^\\[)|(]$)/g, '');\n\tconst hostIPVersion = isIP(hostIp);\n\n\tif (hostIPVersion === 4 && /^127\\./.test(hostIp)) {\n\t\treturn true;\n\t}\n\n\tif (hostIPVersion === 6 && /^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)) {\n\t\treturn true;\n\t}\n\n\t// 5. If origin's host component is \"localhost\" or falls within \".localhost\", and the user agent conforms to the name resolution rules in [let-localhost-be-localhost], return \"Potentially Trustworthy\".\n\t// We are returning FALSE here because we cannot ensure conformance to\n\t// let-localhost-be-loalhost (https://tools.ietf.org/html/draft-west-let-localhost-be-localhost)\n\tif (url.host === 'localhost' || url.host.endsWith('.localhost')) {\n\t\treturn false;\n\t}\n\n\t// 6. If origin's scheme component is file, return \"Potentially Trustworthy\".\n\tif (url.protocol === 'file:') {\n\t\treturn true;\n\t}\n\n\t// 7. If origin's scheme component is one which the user agent considers to be authenticated, return \"Potentially Trustworthy\".\n\t// Not supported\n\n\t// 8. If origin has been configured as a trustworthy origin, return \"Potentially Trustworthy\".\n\t// Not supported\n\n\t// 9. Return \"Not Trustworthy\".\n\treturn false;\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-secure-contexts/#is-url-trustworthy|Referrer Policy §3.3. Is url potentially trustworthy?}\n * @param {external:URL} url\n * @returns `true`: \"Potentially Trustworthy\", `false`: \"Not Trustworthy\"\n */\nexport function isUrlPotentiallyTrustworthy(url) {\n\t// 1. If url is \"about:blank\" or \"about:srcdoc\", return \"Potentially Trustworthy\".\n\tif (/^about:(blank|srcdoc)$/.test(url)) {\n\t\treturn true;\n\t}\n\n\t// 2. If url's scheme is \"data\", return \"Potentially Trustworthy\".\n\tif (url.protocol === 'data:') {\n\t\treturn true;\n\t}\n\n\t// Note: The origin of blob: and filesystem: URLs is the origin of the context in which they were\n\t// created. Therefore, blobs created in a trustworthy origin will themselves be potentially\n\t// trustworthy.\n\tif (/^(blob|filesystem):$/.test(url.protocol)) {\n\t\treturn true;\n\t}\n\n\t// 3. Return the result of executing §3.2 Is origin potentially trustworthy? on url's origin.\n\treturn isOriginPotentiallyTrustworthy(url);\n}\n\n/**\n * Modifies the referrerURL to enforce any extra security policy considerations.\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7\n * @callback module:utils/referrer~referrerURLCallback\n * @param {external:URL} referrerURL\n * @returns {external:URL} modified referrerURL\n */\n\n/**\n * Modifies the referrerOrigin to enforce any extra security policy considerations.\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}, step 7\n * @callback module:utils/referrer~referrerOriginCallback\n * @param {external:URL} referrerOrigin\n * @returns {external:URL} modified referrerOrigin\n */\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer|Referrer Policy §8.3. Determine request's Referrer}\n * @param {Request} request\n * @param {object} o\n * @param {module:utils/referrer~referrerURLCallback} o.referrerURLCallback\n * @param {module:utils/referrer~referrerOriginCallback} o.referrerOriginCallback\n * @returns {external:URL} Request's referrer\n */\nexport function determineRequestsReferrer(request, {referrerURLCallback, referrerOriginCallback} = {}) {\n\t// There are 2 notes in the specification about invalid pre-conditions. We return null, here, for\n\t// these cases:\n\t// > Note: If request's referrer is \"no-referrer\", Fetch will not call into this algorithm.\n\t// > Note: If request's referrer policy is the empty string, Fetch will not call into this\n\t// > algorithm.\n\tif (request.referrer === 'no-referrer' || request.referrerPolicy === '') {\n\t\treturn null;\n\t}\n\n\t// 1. Let policy be request's associated referrer policy.\n\tconst policy = request.referrerPolicy;\n\n\t// 2. Let environment be request's client.\n\t// not applicable to node.js\n\n\t// 3. Switch on request's referrer:\n\tif (request.referrer === 'about:client') {\n\t\treturn 'no-referrer';\n\t}\n\n\t// \"a URL\": Let referrerSource be request's referrer.\n\tconst referrerSource = request.referrer;\n\n\t// 4. Let request's referrerURL be the result of stripping referrerSource for use as a referrer.\n\tlet referrerURL = stripURLForUseAsAReferrer(referrerSource);\n\n\t// 5. Let referrerOrigin be the result of stripping referrerSource for use as a referrer, with the\n\t// origin-only flag set to true.\n\tlet referrerOrigin = stripURLForUseAsAReferrer(referrerSource, true);\n\n\t// 6. If the result of serializing referrerURL is a string whose length is greater than 4096, set\n\t// referrerURL to referrerOrigin.\n\tif (referrerURL.toString().length > 4096) {\n\t\treferrerURL = referrerOrigin;\n\t}\n\n\t// 7. The user agent MAY alter referrerURL or referrerOrigin at this point to enforce arbitrary\n\t// policy considerations in the interests of minimizing data leakage. For example, the user\n\t// agent could strip the URL down to an origin, modify its host, replace it with an empty\n\t// string, etc.\n\tif (referrerURLCallback) {\n\t\treferrerURL = referrerURLCallback(referrerURL);\n\t}\n\n\tif (referrerOriginCallback) {\n\t\treferrerOrigin = referrerOriginCallback(referrerOrigin);\n\t}\n\n\t// 8.Execute the statements corresponding to the value of policy:\n\tconst currentURL = new URL(request.url);\n\n\tswitch (policy) {\n\t\tcase 'no-referrer':\n\t\t\treturn 'no-referrer';\n\n\t\tcase 'origin':\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'unsafe-url':\n\t\t\treturn referrerURL;\n\n\t\tcase 'strict-origin':\n\t\t\t// 1. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 2. Return referrerOrigin.\n\t\t\treturn referrerOrigin.toString();\n\n\t\tcase 'strict-origin-when-cross-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// 2. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 3. Return referrerOrigin.\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'same-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// 2. Return no referrer.\n\t\t\treturn 'no-referrer';\n\n\t\tcase 'origin-when-cross-origin':\n\t\t\t// 1. If the origin of referrerURL and the origin of request's current URL are the same, then\n\t\t\t// return referrerURL.\n\t\t\tif (referrerURL.origin === currentURL.origin) {\n\t\t\t\treturn referrerURL;\n\t\t\t}\n\n\t\t\t// Return referrerOrigin.\n\t\t\treturn referrerOrigin;\n\n\t\tcase 'no-referrer-when-downgrade':\n\t\t\t// 1. If referrerURL is a potentially trustworthy URL and request's current URL is not a\n\t\t\t// potentially trustworthy URL, then return no referrer.\n\t\t\tif (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {\n\t\t\t\treturn 'no-referrer';\n\t\t\t}\n\n\t\t\t// 2. Return referrerURL.\n\t\t\treturn referrerURL;\n\n\t\tdefault:\n\t\t\tthrow new TypeError(`Invalid referrerPolicy: ${policy}`);\n\t}\n}\n\n/**\n * @see {@link https://w3c.github.io/webappsec-referrer-policy/#parse-referrer-policy-from-header|Referrer Policy §8.1. Parse a referrer policy from a Referrer-Policy header}\n * @param {Headers} headers Response headers\n * @returns {string} policy\n */\nexport function parseReferrerPolicyFromHeader(headers) {\n\t// 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy`\n\t// and response’s header list.\n\tconst policyTokens = (headers.get('referrer-policy') || '').split(/[,\\s]+/);\n\n\t// 2. Let policy be the empty string.\n\tlet policy = '';\n\n\t// 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty\n\t// string, then set policy to token.\n\t// Note: This algorithm loops over multiple policy values to allow deployment of new policy\n\t// values with fallbacks for older user agents, as described in § 11.1 Unknown Policy Values.\n\tfor (const token of policyTokens) {\n\t\tif (token && ReferrerPolicy.has(token)) {\n\t\t\tpolicy = token;\n\t\t}\n\t}\n\n\t// 4. Return policy.\n\treturn policy;\n}\n","/**\n * Request.js\n *\n * Request class contains server only options\n *\n * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.\n */\n\nimport {format as formatUrl} from 'node:url';\nimport {deprecate} from 'node:util';\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType, getTotalBytes} from './body.js';\nimport {isAbortSignal} from './utils/is.js';\nimport {getSearch} from './utils/get-search.js';\nimport {\n\tvalidateReferrerPolicy, determineRequestsReferrer, DEFAULT_REFERRER_POLICY\n} from './utils/referrer.js';\n\nconst INTERNALS = Symbol('Request internals');\n\n/**\n * Check if `obj` is an instance of Request.\n *\n * @param {*} object\n * @return {boolean}\n */\nconst isRequest = object => {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object[INTERNALS] === 'object'\n\t);\n};\n\nconst doBadDataWarn = deprecate(() => {},\n\t'.data is not a valid RequestInit property, use .body instead',\n\t'https://github.com/node-fetch/node-fetch/issues/1000 (request)');\n\n/**\n * Request class\n *\n * Ref: https://fetch.spec.whatwg.org/#request-class\n *\n * @param Mixed input Url or Request instance\n * @param Object init Custom options\n * @return Void\n */\nexport default class Request extends Body {\n\tconstructor(input, init = {}) {\n\t\tlet parsedURL;\n\n\t\t// Normalize input and force URL to be encoded as UTF-8 (https://github.com/node-fetch/node-fetch/issues/245)\n\t\tif (isRequest(input)) {\n\t\t\tparsedURL = new URL(input.url);\n\t\t} else {\n\t\t\tparsedURL = new URL(input);\n\t\t\tinput = {};\n\t\t}\n\n\t\tif (parsedURL.username !== '' || parsedURL.password !== '') {\n\t\t\tthrow new TypeError(`${parsedURL} is an url with embedded credentials.`);\n\t\t}\n\n\t\tlet method = init.method || input.method || 'GET';\n\t\tif (/^(delete|get|head|options|post|put)$/i.test(method)) {\n\t\t\tmethod = method.toUpperCase();\n\t\t}\n\n\t\tif (!isRequest(init) && 'data' in init) {\n\t\t\tdoBadDataWarn();\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif ((init.body != null || (isRequest(input) && input.body !== null)) &&\n\t\t\t(method === 'GET' || method === 'HEAD')) {\n\t\t\tthrow new TypeError('Request with GET/HEAD method cannot have body');\n\t\t}\n\n\t\tconst inputBody = init.body ?\n\t\t\tinit.body :\n\t\t\t(isRequest(input) && input.body !== null ?\n\t\t\t\tclone(input) :\n\t\t\t\tnull);\n\n\t\tsuper(inputBody, {\n\t\t\tsize: init.size || input.size || 0\n\t\t});\n\n\t\tconst headers = new Headers(init.headers || input.headers || {});\n\n\t\tif (inputBody !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(inputBody, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.set('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tlet signal = isRequest(input) ?\n\t\t\tinput.signal :\n\t\t\tnull;\n\t\tif ('signal' in init) {\n\t\t\tsignal = init.signal;\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif (signal != null && !isAbortSignal(signal)) {\n\t\t\tthrow new TypeError('Expected signal to be an instanceof AbortSignal or EventTarget');\n\t\t}\n\n\t\t// §5.4, Request constructor steps, step 15.1\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tlet referrer = init.referrer == null ? input.referrer : init.referrer;\n\t\tif (referrer === '') {\n\t\t\t// §5.4, Request constructor steps, step 15.2\n\t\t\treferrer = 'no-referrer';\n\t\t} else if (referrer) {\n\t\t\t// §5.4, Request constructor steps, step 15.3.1, 15.3.2\n\t\t\tconst parsedReferrer = new URL(referrer);\n\t\t\t// §5.4, Request constructor steps, step 15.3.3, 15.3.4\n\t\t\treferrer = /^about:(\\/\\/)?client$/.test(parsedReferrer) ? 'client' : parsedReferrer;\n\t\t} else {\n\t\t\treferrer = undefined;\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\tmethod,\n\t\t\tredirect: init.redirect || input.redirect || 'follow',\n\t\t\theaders,\n\t\t\tparsedURL,\n\t\t\tsignal,\n\t\t\treferrer\n\t\t};\n\n\t\t// Node-fetch-only options\n\t\tthis.follow = init.follow === undefined ? (input.follow === undefined ? 20 : input.follow) : init.follow;\n\t\tthis.compress = init.compress === undefined ? (input.compress === undefined ? true : input.compress) : init.compress;\n\t\tthis.counter = init.counter || input.counter || 0;\n\t\tthis.agent = init.agent || input.agent;\n\t\tthis.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;\n\t\tthis.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;\n\n\t\t// §5.4, Request constructor steps, step 16.\n\t\t// Default is empty string per https://fetch.spec.whatwg.org/#concept-request-referrer-policy\n\t\tthis.referrerPolicy = init.referrerPolicy || input.referrerPolicy || '';\n\t}\n\n\t/** @returns {string} */\n\tget method() {\n\t\treturn this[INTERNALS].method;\n\t}\n\n\t/** @returns {string} */\n\tget url() {\n\t\treturn formatUrl(this[INTERNALS].parsedURL);\n\t}\n\n\t/** @returns {Headers} */\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget redirect() {\n\t\treturn this[INTERNALS].redirect;\n\t}\n\n\t/** @returns {AbortSignal} */\n\tget signal() {\n\t\treturn this[INTERNALS].signal;\n\t}\n\n\t// https://fetch.spec.whatwg.org/#dom-request-referrer\n\tget referrer() {\n\t\tif (this[INTERNALS].referrer === 'no-referrer') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer === 'client') {\n\t\t\treturn 'about:client';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer) {\n\t\t\treturn this[INTERNALS].referrer.toString();\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tget referrerPolicy() {\n\t\treturn this[INTERNALS].referrerPolicy;\n\t}\n\n\tset referrerPolicy(referrerPolicy) {\n\t\tthis[INTERNALS].referrerPolicy = validateReferrerPolicy(referrerPolicy);\n\t}\n\n\t/**\n\t * Clone this request\n\t *\n\t * @return Request\n\t */\n\tclone() {\n\t\treturn new Request(this);\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Request';\n\t}\n}\n\nObject.defineProperties(Request.prototype, {\n\tmethod: {enumerable: true},\n\turl: {enumerable: true},\n\theaders: {enumerable: true},\n\tredirect: {enumerable: true},\n\tclone: {enumerable: true},\n\tsignal: {enumerable: true},\n\treferrer: {enumerable: true},\n\treferrerPolicy: {enumerable: true}\n});\n\n/**\n * Convert a Request to Node.js http request options.\n *\n * @param {Request} request - A Request instance\n * @return The options object to be passed to http.request\n */\nexport const getNodeRequestOptions = request => {\n\tconst {parsedURL} = request[INTERNALS];\n\tconst headers = new Headers(request[INTERNALS].headers);\n\n\t// Fetch step 1.3\n\tif (!headers.has('Accept')) {\n\t\theaders.set('Accept', '*/*');\n\t}\n\n\t// HTTP-network-or-cache fetch steps 2.4-2.7\n\tlet contentLengthValue = null;\n\tif (request.body === null && /^(post|put)$/i.test(request.method)) {\n\t\tcontentLengthValue = '0';\n\t}\n\n\tif (request.body !== null) {\n\t\tconst totalBytes = getTotalBytes(request);\n\t\t// Set Content-Length if totalBytes is a number (that is not NaN)\n\t\tif (typeof totalBytes === 'number' && !Number.isNaN(totalBytes)) {\n\t\t\tcontentLengthValue = String(totalBytes);\n\t\t}\n\t}\n\n\tif (contentLengthValue) {\n\t\theaders.set('Content-Length', contentLengthValue);\n\t}\n\n\t// 4.1. Main fetch, step 2.6\n\t// > If request's referrer policy is the empty string, then set request's referrer policy to the\n\t// > default referrer policy.\n\tif (request.referrerPolicy === '') {\n\t\trequest.referrerPolicy = DEFAULT_REFERRER_POLICY;\n\t}\n\n\t// 4.1. Main fetch, step 2.7\n\t// > If request's referrer is not \"no-referrer\", set request's referrer to the result of invoking\n\t// > determine request's referrer.\n\tif (request.referrer && request.referrer !== 'no-referrer') {\n\t\trequest[INTERNALS].referrer = determineRequestsReferrer(request);\n\t} else {\n\t\trequest[INTERNALS].referrer = 'no-referrer';\n\t}\n\n\t// 4.5. HTTP-network-or-cache fetch, step 6.9\n\t// > If httpRequest's referrer is a URL, then append `Referer`/httpRequest's referrer, serialized\n\t// > and isomorphic encoded, to httpRequest's header list.\n\tif (request[INTERNALS].referrer instanceof URL) {\n\t\theaders.set('Referer', request.referrer);\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.11\n\tif (!headers.has('User-Agent')) {\n\t\theaders.set('User-Agent', 'node-fetch');\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.15\n\tif (request.compress && !headers.has('Accept-Encoding')) {\n\t\theaders.set('Accept-Encoding', 'gzip, deflate, br');\n\t}\n\n\tlet {agent} = request;\n\tif (typeof agent === 'function') {\n\t\tagent = agent(parsedURL);\n\t}\n\n\t// HTTP-network fetch step 4.2\n\t// chunked encoding is handled by Node.js\n\n\tconst search = getSearch(parsedURL);\n\n\t// Pass the full URL directly to request(), but overwrite the following\n\t// options:\n\tconst options = {\n\t\t// Overwrite search to retain trailing ? (issue #776)\n\t\tpath: parsedURL.pathname + search,\n\t\t// The following options are not expressed in the URL\n\t\tmethod: request.method,\n\t\theaders: headers[Symbol.for('nodejs.util.inspect.custom')](),\n\t\tinsecureHTTPParser: request.insecureHTTPParser,\n\t\tagent\n\t};\n\n\treturn {\n\t\t/** @type {URL} */\n\t\tparsedURL,\n\t\toptions\n\t};\n};\n","import {FetchBaseError} from './base.js';\n\n/**\n * AbortError interface for cancelled requests\n */\nexport class AbortError extends FetchBaseError {\n\tconstructor(message, type = 'aborted') {\n\t\tsuper(message, type);\n\t}\n}\n","/**\n * Index.js\n *\n * a request API compatible with window.fetch\n *\n * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.\n */\n\nimport http from 'node:http';\nimport https from 'node:https';\nimport zlib from 'node:zlib';\nimport Stream, {PassThrough, pipeline as pump} from 'node:stream';\nimport {Buffer} from 'node:buffer';\n\nimport dataUriToBuffer from 'data-uri-to-buffer';\n\nimport {writeToStream, clone} from './body.js';\nimport Response from './response.js';\nimport Headers, {fromRawHeaders} from './headers.js';\nimport Request, {getNodeRequestOptions} from './request.js';\nimport {FetchError} from './errors/fetch-error.js';\nimport {AbortError} from './errors/abort-error.js';\nimport {isRedirect} from './utils/is-redirect.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\nimport {isDomainOrSubdomain, isSameProtocol} from './utils/is.js';\nimport {parseReferrerPolicyFromHeader} from './utils/referrer.js';\nimport {\n\tBlob,\n\tFile,\n\tfileFromSync,\n\tfileFrom,\n\tblobFromSync,\n\tblobFrom\n} from 'fetch-blob/from.js';\n\nexport {FormData, Headers, Request, Response, FetchError, AbortError, isRedirect};\nexport {Blob, File, fileFromSync, fileFrom, blobFromSync, blobFrom};\n\nconst supportedSchemas = new Set(['data:', 'http:', 'https:']);\n\n/**\n * Fetch function\n *\n * @param {string | URL | import('./request').default} url - Absolute url or Request instance\n * @param {*} [options_] - Fetch options\n * @return {Promise}\n */\nexport default async function fetch(url, options_) {\n\treturn new Promise((resolve, reject) => {\n\t\t// Build request object\n\t\tconst request = new Request(url, options_);\n\t\tconst {parsedURL, options} = getNodeRequestOptions(request);\n\t\tif (!supportedSchemas.has(parsedURL.protocol)) {\n\t\t\tthrow new TypeError(`node-fetch cannot load ${url}. URL scheme \"${parsedURL.protocol.replace(/:$/, '')}\" is not supported.`);\n\t\t}\n\n\t\tif (parsedURL.protocol === 'data:') {\n\t\t\tconst data = dataUriToBuffer(request.url);\n\t\t\tconst response = new Response(data, {headers: {'Content-Type': data.typeFull}});\n\t\t\tresolve(response);\n\t\t\treturn;\n\t\t}\n\n\t\t// Wrap http.request into fetch\n\t\tconst send = (parsedURL.protocol === 'https:' ? https : http).request;\n\t\tconst {signal} = request;\n\t\tlet response = null;\n\n\t\tconst abort = () => {\n\t\t\tconst error = new AbortError('The operation was aborted.');\n\t\t\treject(error);\n\t\t\tif (request.body && request.body instanceof Stream.Readable) {\n\t\t\t\trequest.body.destroy(error);\n\t\t\t}\n\n\t\t\tif (!response || !response.body) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tresponse.body.emit('error', error);\n\t\t};\n\n\t\tif (signal && signal.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\n\t\tconst abortAndFinalize = () => {\n\t\t\tabort();\n\t\t\tfinalize();\n\t\t};\n\n\t\t// Send request\n\t\tconst request_ = send(parsedURL.toString(), options);\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', abortAndFinalize);\n\t\t}\n\n\t\tconst finalize = () => {\n\t\t\trequest_.abort();\n\t\t\tif (signal) {\n\t\t\t\tsignal.removeEventListener('abort', abortAndFinalize);\n\t\t\t}\n\t\t};\n\n\t\trequest_.on('error', error => {\n\t\t\treject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, 'system', error));\n\t\t\tfinalize();\n\t\t});\n\n\t\tfixResponseChunkedTransferBadEnding(request_, error => {\n\t\t\tif (response && response.body) {\n\t\t\t\tresponse.body.destroy(error);\n\t\t\t}\n\t\t});\n\n\t\t/* c8 ignore next 18 */\n\t\tif (process.version < 'v14') {\n\t\t\t// Before Node.js 14, pipeline() does not fully support async iterators and does not always\n\t\t\t// properly handle when the socket close/end events are out of order.\n\t\t\trequest_.on('socket', s => {\n\t\t\t\tlet endedWithEventsCount;\n\t\t\t\ts.prependListener('end', () => {\n\t\t\t\t\tendedWithEventsCount = s._eventsCount;\n\t\t\t\t});\n\t\t\t\ts.prependListener('close', hadError => {\n\t\t\t\t\t// if end happened before close but the socket didn't emit an error, do it now\n\t\t\t\t\tif (response && endedWithEventsCount < s._eventsCount && !hadError) {\n\t\t\t\t\t\tconst error = new Error('Premature close');\n\t\t\t\t\t\terror.code = 'ERR_STREAM_PREMATURE_CLOSE';\n\t\t\t\t\t\tresponse.body.emit('error', error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\trequest_.on('response', response_ => {\n\t\t\trequest_.setTimeout(0);\n\t\t\tconst headers = fromRawHeaders(response_.rawHeaders);\n\n\t\t\t// HTTP fetch step 5\n\t\t\tif (isRedirect(response_.statusCode)) {\n\t\t\t\t// HTTP fetch step 5.2\n\t\t\t\tconst location = headers.get('Location');\n\n\t\t\t\t// HTTP fetch step 5.3\n\t\t\t\tlet locationURL = null;\n\t\t\t\ttry {\n\t\t\t\t\tlocationURL = location === null ? null : new URL(location, request.url);\n\t\t\t\t} catch {\n\t\t\t\t\t// error here can only be invalid URL in Location: header\n\t\t\t\t\t// do not throw when options.redirect == manual\n\t\t\t\t\t// let the user extract the errorneous redirect URL\n\t\t\t\t\tif (request.redirect !== 'manual') {\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// HTTP fetch step 5.5\n\t\t\t\tswitch (request.redirect) {\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase 'manual':\n\t\t\t\t\t\t// Nothing to do\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'follow': {\n\t\t\t\t\t\t// HTTP-redirect fetch step 2\n\t\t\t\t\t\tif (locationURL === null) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 5\n\t\t\t\t\t\tif (request.counter >= request.follow) {\n\t\t\t\t\t\t\treject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 6 (counter increment)\n\t\t\t\t\t\t// Create a new Request object.\n\t\t\t\t\t\tconst requestOptions = {\n\t\t\t\t\t\t\theaders: new Headers(request.headers),\n\t\t\t\t\t\t\tfollow: request.follow,\n\t\t\t\t\t\t\tcounter: request.counter + 1,\n\t\t\t\t\t\t\tagent: request.agent,\n\t\t\t\t\t\t\tcompress: request.compress,\n\t\t\t\t\t\t\tmethod: request.method,\n\t\t\t\t\t\t\tbody: clone(request),\n\t\t\t\t\t\t\tsignal: request.signal,\n\t\t\t\t\t\t\tsize: request.size,\n\t\t\t\t\t\t\treferrer: request.referrer,\n\t\t\t\t\t\t\treferrerPolicy: request.referrerPolicy\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// when forwarding sensitive headers like \"Authorization\",\n\t\t\t\t\t\t// \"WWW-Authenticate\", and \"Cookie\" to untrusted targets,\n\t\t\t\t\t\t// headers will be ignored when following a redirect to a domain\n\t\t\t\t\t\t// that is not a subdomain match or exact match of the initial domain.\n\t\t\t\t\t\t// For example, a redirect from \"foo.com\" to either \"foo.com\" or \"sub.foo.com\"\n\t\t\t\t\t\t// will forward the sensitive headers, but a redirect to \"bar.com\" will not.\n\t\t\t\t\t\t// headers will also be ignored when following a redirect to a domain using\n\t\t\t\t\t\t// a different protocol. For example, a redirect from \"https://foo.com\" to \"http://foo.com\"\n\t\t\t\t\t\t// will not forward the sensitive headers\n\t\t\t\t\t\tif (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {\n\t\t\t\t\t\t\tfor (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {\n\t\t\t\t\t\t\t\trequestOptions.headers.delete(name);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 9\n\t\t\t\t\t\tif (response_.statusCode !== 303 && request.body && options_.body instanceof Stream.Readable) {\n\t\t\t\t\t\t\treject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 11\n\t\t\t\t\t\tif (response_.statusCode === 303 || ((response_.statusCode === 301 || response_.statusCode === 302) && request.method === 'POST')) {\n\t\t\t\t\t\t\trequestOptions.method = 'GET';\n\t\t\t\t\t\t\trequestOptions.body = undefined;\n\t\t\t\t\t\t\trequestOptions.headers.delete('content-length');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 14\n\t\t\t\t\t\tconst responseReferrerPolicy = parseReferrerPolicyFromHeader(headers);\n\t\t\t\t\t\tif (responseReferrerPolicy) {\n\t\t\t\t\t\t\trequestOptions.referrerPolicy = responseReferrerPolicy;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 15\n\t\t\t\t\t\tresolve(fetch(new Request(locationURL, requestOptions)));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Prepare response\n\t\t\tif (signal) {\n\t\t\t\tresponse_.once('end', () => {\n\t\t\t\t\tsignal.removeEventListener('abort', abortAndFinalize);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet body = pump(response_, new PassThrough(), error => {\n\t\t\t\tif (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\t\t\t});\n\t\t\t// see https://github.com/nodejs/node/pull/29376\n\t\t\t/* c8 ignore next 3 */\n\t\t\tif (process.version < 'v12.10') {\n\t\t\t\tresponse_.on('aborted', abortAndFinalize);\n\t\t\t}\n\n\t\t\tconst responseOptions = {\n\t\t\t\turl: request.url,\n\t\t\t\tstatus: response_.statusCode,\n\t\t\t\tstatusText: response_.statusMessage,\n\t\t\t\theaders,\n\t\t\t\tsize: request.size,\n\t\t\t\tcounter: request.counter,\n\t\t\t\thighWaterMark: request.highWaterMark\n\t\t\t};\n\n\t\t\t// HTTP-network fetch step 12.1.1.3\n\t\t\tconst codings = headers.get('Content-Encoding');\n\n\t\t\t// HTTP-network fetch step 12.1.1.4: handle content codings\n\n\t\t\t// in following scenarios we ignore compression support\n\t\t\t// 1. compression support is disabled\n\t\t\t// 2. HEAD request\n\t\t\t// 3. no Content-Encoding header\n\t\t\t// 4. no content response (204)\n\t\t\t// 5. content not modified response (304)\n\t\t\tif (!request.compress || request.method === 'HEAD' || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For Node v6+\n\t\t\t// Be less strict when decoding compressed responses, since sometimes\n\t\t\t// servers send slightly invalid responses that are still accepted\n\t\t\t// by common browsers.\n\t\t\t// Always using Z_SYNC_FLUSH is what cURL does.\n\t\t\tconst zlibOptions = {\n\t\t\t\tflush: zlib.Z_SYNC_FLUSH,\n\t\t\t\tfinishFlush: zlib.Z_SYNC_FLUSH\n\t\t\t};\n\n\t\t\t// For gzip\n\t\t\tif (codings === 'gzip' || codings === 'x-gzip') {\n\t\t\t\tbody = pump(body, zlib.createGunzip(zlibOptions), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For deflate\n\t\t\tif (codings === 'deflate' || codings === 'x-deflate') {\n\t\t\t\t// Handle the infamous raw deflate response from old servers\n\t\t\t\t// a hack for old IIS and Apache servers\n\t\t\t\tconst raw = pump(response_, new PassThrough(), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\traw.once('data', chunk => {\n\t\t\t\t\t// See http://stackoverflow.com/questions/37519828\n\t\t\t\t\tif ((chunk[0] & 0x0F) === 0x08) {\n\t\t\t\t\t\tbody = pump(body, zlib.createInflate(), error => {\n\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbody = pump(body, zlib.createInflateRaw(), error => {\n\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\t\tresolve(response);\n\t\t\t\t});\n\t\t\t\traw.once('end', () => {\n\t\t\t\t\t// Some old IIS servers return zero-length OK deflate responses, so\n\t\t\t\t\t// 'data' is never emitted. See https://github.com/node-fetch/node-fetch/pull/903\n\t\t\t\t\tif (!response) {\n\t\t\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\t\t\tresolve(response);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For br\n\t\t\tif (codings === 'br') {\n\t\t\t\tbody = pump(body, zlib.createBrotliDecompress(), error => {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tresponse = new Response(body, responseOptions);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise, use response as-is\n\t\t\tresponse = new Response(body, responseOptions);\n\t\t\tresolve(response);\n\t\t});\n\n\t\t// eslint-disable-next-line promise/prefer-await-to-then\n\t\twriteToStream(request_, request).catch(reject);\n\t});\n}\n\nfunction fixResponseChunkedTransferBadEnding(request, errorCallback) {\n\tconst LAST_CHUNK = Buffer.from('0\\r\\n\\r\\n');\n\n\tlet isChunkedTransfer = false;\n\tlet properLastChunkReceived = false;\n\tlet previousChunk;\n\n\trequest.on('response', response => {\n\t\tconst {headers} = response;\n\t\tisChunkedTransfer = headers['transfer-encoding'] === 'chunked' && !headers['content-length'];\n\t});\n\n\trequest.on('socket', socket => {\n\t\tconst onSocketClose = () => {\n\t\t\tif (isChunkedTransfer && !properLastChunkReceived) {\n\t\t\t\tconst error = new Error('Premature close');\n\t\t\t\terror.code = 'ERR_STREAM_PREMATURE_CLOSE';\n\t\t\t\terrorCallback(error);\n\t\t\t}\n\t\t};\n\n\t\tconst onData = buf => {\n\t\t\tproperLastChunkReceived = Buffer.compare(buf.slice(-5), LAST_CHUNK) === 0;\n\n\t\t\t// Sometimes final 0-length chunk and end of message code are in separate packets\n\t\t\tif (!properLastChunkReceived && previousChunk) {\n\t\t\t\tproperLastChunkReceived = (\n\t\t\t\t\tBuffer.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 &&\n\t\t\t\t\tBuffer.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpreviousChunk = buf;\n\t\t};\n\n\t\tsocket.prependListener('close', onSocketClose);\n\t\tsocket.on('data', onData);\n\n\t\trequest.on('close', () => {\n\t\t\tsocket.removeListener('close', onSocketClose);\n\t\t\tsocket.removeListener('data', onData);\n\t\t});\n\t});\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Environment-aware HTTP client for the X API SDK.\n * \n * This module provides a universal HTTP client that works in both Node.js and browser environments\n * without requiring manual polyfills.\n */\n\n// Environment detection\nconst isNode =\n typeof process !== 'undefined' && process.versions && process.versions.node;\nconst isBrowser =\n typeof window !== 'undefined' && typeof window.fetch === 'function';\n\n// Type definitions\nexport interface RequestOptions {\n method?: string;\n headers?: Record | Headers;\n body?: string | Buffer | ArrayBuffer | ArrayBufferView;\n signal?: AbortSignal;\n timeout?: number;\n}\n\nexport interface HttpResponse {\n ok: boolean;\n status: number;\n statusText: string;\n headers: Headers;\n url: string;\n json(): Promise;\n text(): Promise;\n arrayBuffer(): Promise;\n}\n\n/**\n * Universal HTTP client that works in both Node.js and browser environments\n */\nexport class HttpClient {\n private fetch: any;\n private HeadersClass: any;\n\n constructor() {\n this.initializeEnvironment();\n }\n\n private initializeEnvironment(): void {\n if (isNode) {\n // Node.js environment - set up polyfills synchronously\n this.initializeNodeEnvironment();\n } else if (isBrowser) {\n // Browser environment - use native APIs\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n } else {\n // Fallback for other environments (Deno, etc.)\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n }\n }\n\n private initializeNodeEnvironment(): void {\n // Check if native fetch is available (Node.js 18+)\n if (\n typeof globalThis.fetch === 'function' &&\n typeof globalThis.Headers === 'function'\n ) {\n this.fetch = globalThis.fetch;\n this.HeadersClass = globalThis.Headers;\n return;\n }\n\n // Try to use node-fetch for older Node.js versions\n try {\n const nodeFetch = require('node-fetch');\n const { Headers: NodeHeaders } = nodeFetch;\n\n this.fetch = nodeFetch.default || nodeFetch;\n this.HeadersClass = NodeHeaders;\n } catch (error) {\n // If node-fetch is not available, provide a helpful error\n throw new Error(\n 'X API SDK: node-fetch not found. For Node.js environments, please install node-fetch:\\n' +\n 'npm install node-fetch\\n' +\n 'Or upgrade to Node.js 18+ for native fetch support.'\n );\n }\n }\n\n /**\n * Create a new Headers instance\n */\n createHeaders(init?: Record | Headers): Headers {\n return new this.HeadersClass(init) as Headers;\n }\n\n /**\n * Make an HTTP request\n */\n async request(\n url: string,\n options: RequestOptions = {}\n ): Promise {\n // Convert body to string if it's a Buffer or ArrayBuffer\n let body = options.body;\n if (body && typeof body !== 'string') {\n if (Buffer.isBuffer(body)) {\n body = body.toString();\n } else if (body instanceof ArrayBuffer) {\n body = new TextDecoder().decode(body);\n } else if (ArrayBuffer.isView(body)) {\n body = new TextDecoder().decode(body);\n }\n }\n\n // Handle timeout\n let signal = options.signal;\n if (options.timeout && options.timeout > 0 && !signal) {\n const controller = new AbortController();\n setTimeout(() => controller.abort(), options.timeout);\n signal = controller.signal;\n }\n\n const response = await this.fetch(url, {\n method: options.method || 'GET',\n headers: options.headers as any,\n body: body as any,\n signal: signal,\n });\n\n return response as HttpResponse;\n }\n\n /**\n * Make a GET request\n */\n async get(\n url: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'GET',\n headers,\n });\n }\n\n /**\n * Make a POST request\n */\n async post(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'POST',\n headers,\n body,\n });\n }\n\n /**\n * Make a PUT request\n */\n async put(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'PUT',\n headers,\n body,\n });\n }\n\n /**\n * Make a DELETE request\n */\n async delete(\n url: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'DELETE',\n headers,\n });\n }\n\n /**\n * Make a PATCH request\n */\n async patch(\n url: string,\n body?: string,\n headers?: Record\n ): Promise {\n return this.request(url, {\n method: 'PATCH',\n headers,\n body,\n });\n }\n}\n\n// Export a singleton instance\nexport const httpClient = new HttpClient();\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * activity client for the X API.\n *\n * This module provides a client for interacting with the activity endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetSubscriptionsResponse,\n CreateSubscriptionRequest,\n CreateSubscriptionResponse,\n StreamResponse,\n UpdateSubscriptionRequest,\n UpdateSubscriptionResponse,\n DeleteSubscriptionResponse,\n} from './models.js';\n\n/**\n * Options for createSubscription method\n * \n * @public\n */\nexport interface CreateSubscriptionOptions {\n /** Request body */\n body?: CreateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for stream method\n * \n * @public\n */\nexport interface StreamOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for updateSubscription method\n * \n * @public\n */\nexport interface UpdateSubscriptionOptions {\n /** Request body */\n body?: UpdateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for activity operations\n * \n * This client provides methods for interacting with the activity endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all activity related operations.\n * \n * @category activity\n */\nexport class ActivityClient {\n private client: Client;\n\n /**\n * Creates a new activity client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get X activity subscriptions\n * Get a list of active subscriptions for XAA\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptions(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create X activity subscription\n * Creates a subscription for an X activity event\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubscription(\n options: CreateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Activity Stream\n * Stream of X Activities\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async stream(options: StreamOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update X activity subscription\n * Updates a subscription for an X activity event\n\n\n * @param subscriptionId The ID of the subscription to update.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async updateSubscription(\n subscriptionId: string,\n options: UpdateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions/{subscription_id}';\n\n path = path.replace(\n '{subscription_id}',\n encodeURIComponent(String(subscriptionId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Deletes X activity subscription\n * Deletes a subscription for an X activity event\n\n\n * @param subscriptionId The ID of the subscription to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubscription(\n subscriptionId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/activity/subscriptions/{subscription_id}';\n\n path = path.replace(\n '{subscription_id}',\n encodeURIComponent(String(subscriptionId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for activity operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getSubscriptions\n * \n * @public\n */\nexport type GetSubscriptionsResponse = Schemas.ActivitySubscriptionGetResponse;\n/**\n * Request for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionRequest = Schemas.ActivitySubscriptionCreateRequest;\n/**\n * Response for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionResponse = Schemas.ActivitySubscriptionCreateResponse;\n/**\n * Response for stream\n * \n * @public\n */\nexport type StreamResponse = Schemas.ActivityStreamingResponse;\n/**\n * Request for updateSubscription\n * \n * @public\n */\nexport type UpdateSubscriptionRequest = Schemas.ActivitySubscriptionUpdateRequest;\n/**\n * Response for updateSubscription\n * \n * @public\n */\nexport type UpdateSubscriptionResponse = Schemas.ActivitySubscriptionUpdateResponse;\n/**\n * Response for deleteSubscription\n * \n * @public\n */\nexport type DeleteSubscriptionResponse = Schemas.ActivitySubscriptionDeleteResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * news client for the X API.\n *\n * This module provides a client for interacting with the news endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetResponse, SearchResponse } from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The number of results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** The maximum age of the News story to search for. \n * Also accepts: max_age_hours or proper camelCase (e.g., maxAgeHours) */\n maxAgeHours?: number;\n\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for news operations\n * \n * This client provides methods for interacting with the news endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all news related operations.\n * \n * @category news\n */\nexport class NewsClient {\n private client: Client;\n\n /**\n * Creates a new news client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get news stories by ID\n * Retrieves news story by its ID.\n\n\n * @param id The ID of the news story.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(id: string, options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/news/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search News\n * Retrieves a list of News stories matching the specified search query.\n\n\n\n * @param query The search query.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n max_age_hours: 'maxAgeHours',\n\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n maxAgeHours = undefined,\n\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/news/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (maxAgeHours !== undefined) {\n params.append('max_age_hours', String(maxAgeHours));\n }\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for news operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2NewsIdResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2NewsSearchResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * connections client for the X API.\n *\n * This module provides a client for interacting with the connections endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { DeleteAllResponse } from './models.js';\n\n/**\n * Client for connections operations\n * \n * This client provides methods for interacting with the connections endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all connections related operations.\n * \n * @category connections\n */\nexport class ConnectionsClient {\n private client: Client;\n\n /**\n * Creates a new connections client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Terminate all connections\n * Terminates all active streaming connections for the authenticated application.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteAll(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/connections/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for connections operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for deleteAll\n * \n * @public\n */\nexport type DeleteAllResponse = Schemas.KillAllConnectionsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * account activity client for the X API.\n *\n * This module provides a client for interacting with the account activity endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetSubscriptionsResponse,\n ValidateSubscriptionResponse,\n CreateSubscriptionRequest,\n CreateSubscriptionResponse,\n GetSubscriptionCountResponse,\n DeleteSubscriptionResponse,\n CreateReplayJobResponse,\n} from './models.js';\n\n/**\n * Options for createSubscription method\n * \n * @public\n */\nexport interface CreateSubscriptionOptions {\n /** Request body */\n body?: CreateSubscriptionRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for account activity operations\n * \n * This client provides methods for interacting with the account activity endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all account activity related operations.\n * \n * @category account activity\n */\nexport class AccountActivityClient {\n private client: Client;\n\n /**\n * Creates a new account activity client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get subscriptions\n * Retrieves a list of all active subscriptions for a given webhook.\n\n\n * @param webhookId The webhook ID to pull subscriptions for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptions(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Validate subscription\n * Checks a user’s Account Activity subscription for a given webhook.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async validateSubscription(\n webhookId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create subscription\n * Creates an Account Activity subscription for the user and the given webhook.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubscription(\n webhookId: string,\n options: CreateSubscriptionOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get subscription count\n * Retrieves a count of currently active Account Activity subscriptions.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getSubscriptionCount(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/account_activity/subscriptions/count';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete subscription\n * Deletes an Account Activity subscription for the given webhook and user ID.\n\n\n * @param webhookId The webhook ID to check subscription against.\n\n\n\n * @param userId User ID to unsubscribe from.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubscription(\n webhookId: string,\n userId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n path = path.replace('{user_id}', encodeURIComponent(String(userId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create replay job\n * Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook.\n\n\n * @param webhookId The unique identifier for the webhook configuration.\n\n\n\n\n * @param fromDate The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format.\n\n\n\n * @param toDate The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createReplayJob(\n webhookId: string,\n fromDate: string,\n toDate: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path =\n '/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (fromDate !== undefined) {\n params.append('from_date', String(fromDate));\n }\n\n if (toDate !== undefined) {\n params.append('to_date', String(toDate));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for account activity operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getSubscriptions\n * \n * @public\n */\nexport type GetSubscriptionsResponse = Schemas.SubscriptionsListGetResponse;\n/**\n * Response for validateSubscription\n * \n * @public\n */\nexport type ValidateSubscriptionResponse = Schemas.SubscriptionsGetResponse;\n/**\n * Request for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionRequest = Schemas.SubscriptionsCreateRequest;\n/**\n * Response for createSubscription\n * \n * @public\n */\nexport type CreateSubscriptionResponse = Schemas.SubscriptionsCreateResponse;\n/**\n * Response for getSubscriptionCount\n * \n * @public\n */\nexport type GetSubscriptionCountResponse = Schemas.SubscriptionsCountGetResponse;\n/**\n * Response for deleteSubscription\n * \n * @public\n */\nexport type DeleteSubscriptionResponse = Schemas.SubscriptionsDeleteResponse;\n/**\n * Response for createReplayJob\n * \n * @public\n */\nexport type CreateReplayJobResponse = Schemas.ReplayJobCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * spaces client for the X API.\n *\n * This module provides a client for interacting with the spaces endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetByIdResponse,\n GetBuyersResponse,\n GetPostsResponse,\n GetByCreatorIdsResponse,\n GetByIdsResponse,\n SearchResponse,\n} from './models.js';\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBuyers method\n * \n * @public\n */\nexport interface GetBuyersOptions {\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByCreatorIds method\n * \n * @public\n */\nexport interface GetByCreatorIdsOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The state of Spaces to search for. \n * Also accepts: state or proper camelCase (e.g., state) */\n state?: string;\n\n /** The number of results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Space fields to display. \n * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */\n spaceFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Topic fields to display. \n * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */\n topicFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for spaces operations\n * \n * This client provides methods for interacting with the spaces endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all spaces related operations.\n * \n * @category spaces\n */\nexport class SpacesClient {\n private client: Client;\n\n /**\n * Creates a new spaces client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get space by ID\n * Retrieves details of a specific space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Space ticket buyers\n * Retrieves a list of Users who purchased tickets to a specific Space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBuyers(\n id: string,\n options: GetBuyersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}/buyers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Space Posts\n * Retrieves a list of Posts shared in a specific Space by its ID.\n\n\n * @param id The ID of the Space to be retrieved.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Spaces by creator IDs\n * Retrieves details of Spaces created by specified User IDs.\n\n\n\n * @param userIds The IDs of Users to search through.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByCreatorIds(\n userIds: Array,\n options: GetByCreatorIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/by/creator_ids';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userIds !== undefined && userIds.length > 0) {\n params.append('user_ids', userIds.join(','));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Spaces by IDs\n * Retrieves details of multiple Spaces by their IDs.\n\n\n\n * @param ids The list of Space IDs to return.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Spaces\n * Retrieves a list of Spaces matching the specified search query.\n\n\n\n * @param query The search query.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n 'space.fields': 'spaceFields',\n\n 'user.fields': 'userFields',\n\n 'topic.fields': 'topicFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n state = undefined,\n\n maxResults = undefined,\n\n spaceFields = [],\n\n expansions = [],\n\n userFields = [],\n\n topicFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/spaces/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (state !== undefined) {\n params.append('state', String(state));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (spaceFields !== undefined && spaceFields.length > 0) {\n params.append('space.fields', spaceFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (topicFields !== undefined && topicFields.length > 0) {\n params.append('topic.fields', topicFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for spaces operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2SpacesIdResponse;\n/**\n * Response for getBuyers\n * \n * @public\n */\nexport type GetBuyersResponse = Schemas.Get2SpacesIdBuyersResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2SpacesIdTweetsResponse;\n/**\n * Response for getByCreatorIds\n * \n * @public\n */\nexport type GetByCreatorIdsResponse = Schemas.Get2SpacesByCreatorIdsResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2SpacesResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2SpacesSearchResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * trends client for the X API.\n *\n * This module provides a client for interacting with the trends endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetPersonalizedResponse,\n GetByWoeidResponse,\n GetAiResponse,\n} from './models.js';\n\n/**\n * Options for getPersonalized method\n * \n * @public\n */\nexport interface GetPersonalizedOptions {\n /** A comma separated list of PersonalizedTrend fields to display. \n * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */\n personalizedTrendFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByWoeid method\n * \n * @public\n */\nexport interface GetByWoeidOptions {\n /** The maximum number of results. \n * Also accepts: max_trends or proper camelCase (e.g., maxTrends) */\n maxTrends?: number;\n\n /** A comma separated list of Trend fields to display. \n * Also accepts: trend.fields or proper camelCase (e.g., trendFields) */\n trendFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getAi method\n * \n * @public\n */\nexport interface GetAiOptions {\n /** A comma separated list of News fields to display. \n * Also accepts: news.fields or proper camelCase (e.g., newsFields) */\n newsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for trends operations\n * \n * This client provides methods for interacting with the trends endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all trends related operations.\n * \n * @category trends\n */\nexport class TrendsClient {\n private client: Client;\n\n /**\n * Creates a new trends client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get personalized Trends\n * Retrieves personalized trending topics for the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPersonalized(\n options: GetPersonalizedOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'personalized_trend.fields': 'personalizedTrendFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n personalizedTrendFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/personalized_trends';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (\n personalizedTrendFields !== undefined &&\n personalizedTrendFields.length > 0\n ) {\n params.append(\n 'personalized_trend.fields',\n personalizedTrendFields.join(',')\n );\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Trends by WOEID\n * Retrieves trending topics for a specific location identified by its WOEID.\n\n\n * @param woeid The WOEID of the place to lookup a trend for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByWoeid(\n woeid: number,\n options: GetByWoeidOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_trends: 'maxTrends',\n\n 'trend.fields': 'trendFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxTrends = undefined,\n\n trendFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/trends/by/woeid/{woeid}';\n\n path = path.replace('{woeid}', encodeURIComponent(String(woeid)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxTrends !== undefined) {\n params.append('max_trends', String(maxTrends));\n }\n\n if (trendFields !== undefined && trendFields.length > 0) {\n params.append('trend.fields', trendFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get AI Trends by ID\n * Retrieves an AI trend by its ID.\n\n\n * @param id The ID of the ai trend.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAi(id: string, options: GetAiOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'news.fields': 'newsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n newsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/ai_trends/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (newsFields !== undefined && newsFields.length > 0) {\n params.append('news.fields', newsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for trends operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getPersonalized\n * \n * @public\n */\nexport type GetPersonalizedResponse = Schemas.Get2UsersPersonalizedTrendsResponse;\n/**\n * Response for getByWoeid\n * \n * @public\n */\nexport type GetByWoeidResponse = Schemas.Get2TrendsByWoeidWoeidResponse;\n/**\n * Response for getAi\n * \n * @public\n */\nexport type GetAiResponse = Schemas.Get2AiTrendsIdResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * media client for the X API.\n *\n * This module provides a client for interacting with the media endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetByKeyResponse,\n CreateMetadataRequest,\n CreateMetadataResponse,\n FinalizeUploadResponse,\n AppendUploadRequest,\n AppendUploadResponse,\n InitializeUploadRequest,\n InitializeUploadResponse,\n GetByKeysResponse,\n GetUploadStatusResponse,\n UploadRequest,\n UploadResponse,\n GetAnalyticsResponse,\n CreateSubtitlesRequest,\n CreateSubtitlesResponse,\n DeleteSubtitlesRequest,\n DeleteSubtitlesResponse,\n} from './models.js';\n\n/**\n * Options for getByKey method\n * \n * @public\n */\nexport interface GetByKeyOptions {\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createMetadata method\n * \n * @public\n */\nexport interface CreateMetadataOptions {\n /** Request body */\n body?: CreateMetadataRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for appendUpload method\n * \n * @public\n */\nexport interface AppendUploadOptions {\n /** Request body */\n body?: AppendUploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for initializeUpload method\n * \n * @public\n */\nexport interface InitializeUploadOptions {\n /** Request body */\n body?: InitializeUploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByKeys method\n * \n * @public\n */\nexport interface GetByKeysOptions {\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getUploadStatus method\n * \n * @public\n */\nexport interface GetUploadStatusOptions {\n /** The command for the media upload request. \n * Also accepts: command or proper camelCase (e.g., command) */\n command?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for upload method\n * \n * @public\n */\nexport interface UploadOptions {\n /** Request body */\n body?: UploadRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getAnalytics method\n * \n * @public\n */\nexport interface GetAnalyticsOptions {\n /** A comma separated list of MediaAnalytics fields to display. \n * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */\n mediaAnalyticsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createSubtitles method\n * \n * @public\n */\nexport interface CreateSubtitlesOptions {\n /** Request body */\n body?: CreateSubtitlesRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for deleteSubtitles method\n * \n * @public\n */\nexport interface DeleteSubtitlesOptions {\n /** Request body */\n body?: DeleteSubtitlesRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for media operations\n * \n * This client provides methods for interacting with the media endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all media related operations.\n * \n * @category media\n */\nexport class MediaClient {\n private client: Client;\n\n /**\n * Creates a new media client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Media by media key\n * Retrieves details of a specific Media file by its media key.\n\n\n * @param mediaKey A single Media Key.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByKey(\n mediaKey: string,\n options: GetByKeyOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media.fields': 'mediaFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/{media_key}';\n\n path = path.replace('{media_key}', encodeURIComponent(String(mediaKey)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Media metadata\n * Creates metadata for a Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createMetadata(\n options: CreateMetadataOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/metadata';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Finalize Media upload\n * Finalizes a Media upload request.\n\n\n * @param id The media id of the targeted media to finalize.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async finalizeUpload(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/media/upload/{id}/finalize';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Append Media upload\n * Appends data to a Media upload request.\n\n\n * @param id The media identifier for the media to perform the append operation.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async appendUpload(\n id: string,\n options: AppendUploadOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload/{id}/append';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Initialize media upload\n * Initializes a media upload.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async initializeUpload(\n options: InitializeUploadOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload/initialize';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media by media keys\n * Retrieves details of Media files by their media keys.\n\n\n\n * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByKeys(\n mediaKeys: Array,\n options: GetByKeysOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media.fields': 'mediaFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaKeys !== undefined && mediaKeys.length > 0) {\n params.append('media_keys', mediaKeys.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media upload status\n * Retrieves the status of a Media upload by its ID.\n\n\n\n * @param mediaId Media id for the requested media upload status.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getUploadStatus(\n mediaId: any,\n options: GetUploadStatusOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {};\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n command = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaId !== undefined) {\n params.append('media_id', String(mediaId));\n }\n\n if (command !== undefined) {\n params.append('command', String(command));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Upload media\n * Uploads a media file for use in posts or other content.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async upload(options: UploadOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/upload';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Media analytics\n * Retrieves analytics data for media.\n\n\n\n * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity The granularity for the search counts results.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAnalytics(\n mediaKeys: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n options: GetAnalyticsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'media_analytics.fields': 'mediaAnalyticsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n mediaAnalyticsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/analytics';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (mediaKeys !== undefined && mediaKeys.length > 0) {\n params.append('media_keys', mediaKeys.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (mediaAnalyticsFields !== undefined && mediaAnalyticsFields.length > 0) {\n params.append('media_analytics.fields', mediaAnalyticsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Media subtitles\n * Creates subtitles for a specific Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createSubtitles(\n options: CreateSubtitlesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/subtitles';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Media subtitles\n * Deletes subtitles for a specific Media file.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteSubtitles(\n options: DeleteSubtitlesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/media/subtitles';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['media.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for media operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getByKey\n * \n * @public\n */\nexport type GetByKeyResponse = Schemas.Get2MediaMediaKeyResponse;\n/**\n * Request for createMetadata\n * \n * @public\n */\nexport type CreateMetadataRequest = Schemas.MetadataCreateRequest;\n/**\n * Response for createMetadata\n * \n * @public\n */\nexport type CreateMetadataResponse = Schemas.MetadataCreateResponse;\n/**\n * Response for finalizeUpload\n * \n * @public\n */\nexport type FinalizeUploadResponse = Schemas.MediaUploadResponse;\n/**\n * Request for appendUpload\n * \n * @public\n */\nexport type AppendUploadRequest = Schemas.MediaUploadAppendRequest;\n/**\n * Response for appendUpload\n * \n * @public\n */\nexport type AppendUploadResponse = Schemas.MediaUploadAppendResponse;\n/**\n * Request for initializeUpload\n * \n * @public\n */\nexport type InitializeUploadRequest = Schemas.MediaUploadConfigRequest;\n/**\n * Response for initializeUpload\n * \n * @public\n */\nexport type InitializeUploadResponse = Schemas.MediaUploadResponse;\n/**\n * Response for getByKeys\n * \n * @public\n */\nexport type GetByKeysResponse = Schemas.Get2MediaResponse;\n/**\n * Response for getUploadStatus\n * \n * @public\n */\nexport type GetUploadStatusResponse = Schemas.MediaUploadResponse;\n/**\n * Request for upload\n * \n * @public\n */\nexport type UploadRequest = Schemas.MediaUploadRequestOneShot;\n/**\n * Response for upload\n * \n * @public\n */\nexport type UploadResponse = Schemas.MediaUploadResponse;\n/**\n * Response for getAnalytics\n * \n * @public\n */\nexport type GetAnalyticsResponse = Schemas.MediaAnalytics;\n/**\n * Request for createSubtitles\n * \n * @public\n */\nexport type CreateSubtitlesRequest = Schemas.SubtitlesCreateRequest;\n/**\n * Response for createSubtitles\n * \n * @public\n */\nexport type CreateSubtitlesResponse = Schemas.SubtitlesCreateResponse;\n/**\n * Request for deleteSubtitles\n * \n * @public\n */\nexport type DeleteSubtitlesRequest = Schemas.SubtitlesDeleteRequest;\n/**\n * Response for deleteSubtitles\n * \n * @public\n */\nexport type DeleteSubtitlesResponse = Schemas.SubtitlesDeleteResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * direct messages client for the X API.\n *\n * This module provides a client for interacting with the direct messages endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n CreateByParticipantIdRequest,\n CreateByParticipantIdResponse,\n GetEventsResponse,\n GetEventsByParticipantIdResponse,\n GetEventsByConversationIdResponse,\n GetEventsByIdResponse,\n DeleteEventsResponse,\n CreateByConversationIdRequest,\n CreateByConversationIdResponse,\n CreateConversationRequest,\n CreateConversationResponse,\n} from './models.js';\n\n/**\n * Options for createByParticipantId method\n * \n * @public\n */\nexport interface CreateByParticipantIdOptions {\n /** Request body */\n body?: CreateByParticipantIdRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEvents method\n * \n * @public\n */\nexport interface GetEventsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsByParticipantId method\n * \n * @public\n */\nexport interface GetEventsByParticipantIdOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsByConversationId method\n * \n * @public\n */\nexport interface GetEventsByConversationIdOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of event_types to include in the results. \n * Also accepts: event_types or proper camelCase (e.g., eventTypes) */\n eventTypes?: Array;\n\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getEventsById method\n * \n * @public\n */\nexport interface GetEventsByIdOptions {\n /** A comma separated list of DmEvent fields to display. \n * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */\n dmEventFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createByConversationId method\n * \n * @public\n */\nexport interface CreateByConversationIdOptions {\n /** Request body */\n body?: CreateByConversationIdRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createConversation method\n * \n * @public\n */\nexport interface CreateConversationOptions {\n /** Request body */\n body?: CreateConversationRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for direct messages operations\n * \n * This client provides methods for interacting with the direct messages endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all direct messages related operations.\n * \n * @category direct messages\n */\nexport class DirectMessagesClient {\n private client: Client;\n\n /**\n * Creates a new direct messages client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Create DM message by participant ID\n * Sends a new direct message to a specific participant by their ID.\n\n\n * @param participantId The ID of the recipient user that will receive the DM.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createByParticipantId(\n participantId: string,\n options: CreateByParticipantIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/with/{participant_id}/messages';\n\n path = path.replace(\n '{participant_id}',\n encodeURIComponent(String(participantId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events\n * Retrieves a list of recent direct message events across all conversations.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEvents(options: GetEventsOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_events';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events for a DM conversation\n * Retrieves direct message events for a specific conversation.\n\n\n * @param participantId The ID of the participant user for the One to One DM conversation.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsByParticipantId(\n participantId: string,\n options: GetEventsByParticipantIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/with/{participant_id}/dm_events';\n\n path = path.replace(\n '{participant_id}',\n encodeURIComponent(String(participantId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM events for a DM conversation\n * Retrieves direct message events for a specific conversation.\n\n\n * @param id The DM conversation ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsByConversationId(\n id: string,\n options: GetEventsByConversationIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n event_types: 'eventTypes',\n\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n eventTypes = [],\n\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/{id}/dm_events';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (eventTypes !== undefined && eventTypes.length > 0) {\n params.append('event_types', eventTypes.join(','));\n }\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get DM event by ID\n * Retrieves details of a specific direct message event by its ID.\n\n\n * @param eventId dm event id.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getEventsById(\n eventId: string,\n options: GetEventsByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'dm_event.fields': 'dmEventFields',\n\n 'media.fields': 'mediaFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n dmEventFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n userFields = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_events/{event_id}';\n\n path = path.replace('{event_id}', encodeURIComponent(String(eventId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (dmEventFields !== undefined && dmEventFields.length > 0) {\n params.append('dm_event.fields', dmEventFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete DM event\n * Deletes a specific direct message event by its ID, if owned by the authenticated user.\n\n\n * @param eventId The ID of the direct-message event to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteEvents(eventId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/dm_events/{event_id}';\n\n path = path.replace('{event_id}', encodeURIComponent(String(eventId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.read', 'dm.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM message by conversation ID\n * Sends a new direct message to a specific conversation by its ID.\n\n\n * @param dmConversationId The DM Conversation ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createByConversationId(\n dmConversationId: string,\n options: CreateByConversationIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations/{dm_conversation_id}/messages';\n\n path = path.replace(\n '{dm_conversation_id}',\n encodeURIComponent(String(dmConversationId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create DM conversation\n * Initiates a new direct message conversation with specified participants.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createConversation(\n options: CreateConversationOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/dm_conversations';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for direct messages operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Request for createByParticipantId\n * \n * @public\n */\nexport type CreateByParticipantIdRequest = Schemas.CreateMessageRequest;\n/**\n * Response for createByParticipantId\n * \n * @public\n */\nexport type CreateByParticipantIdResponse = Schemas.CreateDmEventResponse;\n/**\n * Response for getEvents\n * \n * @public\n */\nexport type GetEventsResponse = Schemas.Get2DmEventsResponse;\n/**\n * Response for getEventsByParticipantId\n * \n * @public\n */\nexport type GetEventsByParticipantIdResponse = Schemas.Get2DmConversationsWithParticipantIdDmEventsResponse;\n/**\n * Response for getEventsByConversationId\n * \n * @public\n */\nexport type GetEventsByConversationIdResponse = Schemas.Get2DmConversationsIdDmEventsResponse;\n/**\n * Response for getEventsById\n * \n * @public\n */\nexport type GetEventsByIdResponse = Schemas.Get2DmEventsEventIdResponse;\n/**\n * Response for deleteEvents\n * \n * @public\n */\nexport type DeleteEventsResponse = Schemas.DeleteDmResponse;\n/**\n * Request for createByConversationId\n * \n * @public\n */\nexport type CreateByConversationIdRequest = Schemas.CreateMessageRequest;\n/**\n * Response for createByConversationId\n * \n * @public\n */\nexport type CreateByConversationIdResponse = Schemas.CreateDmEventResponse;\n/**\n * Request for createConversation\n * \n * @public\n */\nexport type CreateConversationRequest = Schemas.CreateDmConversationRequest;\n/**\n * Response for createConversation\n * \n * @public\n */\nexport type CreateConversationResponse = Schemas.CreateDmEventResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * posts client for the X API.\n *\n * This module provides a client for interacting with the posts endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetInsights28hrResponse,\n GetRepostsResponse,\n SearchAllResponse,\n GetInsightsHistoricalResponse,\n GetByIdResponse,\n DeleteResponse,\n GetAnalyticsResponse,\n GetByIdsResponse,\n CreateRequest,\n CreateResponse,\n GetCountsRecentResponse,\n GetCountsAllResponse,\n SearchRecentResponse,\n HideReplyRequest,\n HideReplyResponse,\n GetRepostedByResponse,\n GetQuotedResponse,\n GetLikingUsersResponse,\n} from './models.js';\n\n/**\n * Options for getInsights28hr method\n * \n * @public\n */\nexport interface GetInsights28hrOptions {\n /** A comma separated list of Engagement fields to display. \n * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */\n engagementFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getReposts method\n * \n * @public\n */\nexport interface GetRepostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchAll method\n * \n * @public\n */\nexport interface SearchAllOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** This order in which to return results. \n * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */\n sortOrder?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getInsightsHistorical method\n * \n * @public\n */\nexport interface GetInsightsHistoricalOptions {\n /** A comma separated list of Engagement fields to display. \n * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */\n engagementFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getAnalytics method\n * \n * @public\n */\nexport interface GetAnalyticsOptions {\n /** A comma separated list of Analytics fields to display. \n * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */\n analyticsFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getCountsRecent method\n * \n * @public\n */\nexport interface GetCountsRecentOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The granularity for the search counts results. \n * Also accepts: granularity or proper camelCase (e.g., granularity) */\n granularity?: string;\n\n /** A comma separated list of SearchCount fields to display. \n * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */\n searchCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getCountsAll method\n * \n * @public\n */\nexport interface GetCountsAllOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The granularity for the search counts results. \n * Also accepts: granularity or proper camelCase (e.g., granularity) */\n granularity?: string;\n\n /** A comma separated list of SearchCount fields to display. \n * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */\n searchCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchRecent method\n * \n * @public\n */\nexport interface SearchRecentOptions {\n /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** Returns results with a Post ID less than (that is, older than) the specified ID. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** This order in which to return results. \n * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */\n sortOrder?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for hideReply method\n * \n * @public\n */\nexport interface HideReplyOptions {\n /** Request body */\n body?: HideReplyRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getRepostedBy method\n * \n * @public\n */\nexport interface GetRepostedByOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getQuoted method\n * \n * @public\n */\nexport interface GetQuotedOptions {\n /** The maximum number of results to be returned. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getLikingUsers method\n * \n * @public\n */\nexport interface GetLikingUsersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for posts operations\n * \n * This client provides methods for interacting with the posts endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all posts related operations.\n * \n * @category posts\n */\nexport class PostsClient {\n private client: Client;\n\n /**\n * Creates a new posts client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get 28-hour Post insights\n * Retrieves engagement metrics for specified Posts over the last 28 hours.\n\n\n\n * @param tweetIds List of PostIds for 28hr metrics.\n\n\n\n * @param granularity granularity of metrics response.\n\n\n\n * @param requestedMetrics request metrics for historical request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getInsights28hr(\n tweetIds: Array,\n granularity: string,\n requestedMetrics: Array,\n options: GetInsights28hrOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'engagement.fields': 'engagementFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n engagementFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/insights/28hr';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetIds !== undefined && tweetIds.length > 0) {\n params.append('tweet_ids', tweetIds.join(','));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (requestedMetrics !== undefined && requestedMetrics.length > 0) {\n params.append('requested_metrics', requestedMetrics.join(','));\n }\n\n if (engagementFields !== undefined && engagementFields.length > 0) {\n params.append('engagement.fields', engagementFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposts\n * Retrieves a list of Posts that repost a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getReposts(\n id: string,\n options: GetRepostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/retweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search all Posts\n * Retrieves Posts from the full archive matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchAll(\n query: string,\n options: SearchAllOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n sort_order: 'sortOrder',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n sortOrder = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (sortOrder !== undefined) {\n params.append('sort_order', String(sortOrder));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get historical Post insights\n * Retrieves historical engagement metrics for specified Posts within a defined time range.\n\n\n\n * @param tweetIds List of PostIds for historical metrics.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity granularity of metrics response.\n\n\n\n * @param requestedMetrics request metrics for historical request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getInsightsHistorical(\n tweetIds: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n requestedMetrics: Array,\n options: GetInsightsHistoricalOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'engagement.fields': 'engagementFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n engagementFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/insights/historical';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetIds !== undefined && tweetIds.length > 0) {\n params.append('tweet_ids', tweetIds.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (requestedMetrics !== undefined && requestedMetrics.length > 0) {\n params.append('requested_metrics', requestedMetrics.join(','));\n }\n\n if (engagementFields !== undefined && engagementFields.length > 0) {\n params.append('engagement.fields', engagementFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Post by ID\n * Retrieves details of a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Post\n * Deletes a specific Post by its ID, if owned by the authenticated user.\n\n\n * @param id The ID of the Post to be deleted.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Post analytics\n * Retrieves analytics data for specified Posts within a defined time range.\n\n\n\n * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request.\n\n\n\n * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range.\n\n\n\n * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range.\n\n\n\n * @param granularity The granularity for the search counts results.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getAnalytics(\n ids: Array,\n endTime: string,\n startTime: string,\n granularity: string,\n options: GetAnalyticsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'analytics.fields': 'analyticsFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n analyticsFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/analytics';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (analyticsFields !== undefined && analyticsFields.length > 0) {\n params.append('analytics.fields', analyticsFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Posts by IDs\n * Retrieves details of multiple Posts by their IDs.\n\n\n\n * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create or Edit Post\n * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided.\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(body: CreateRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get count of recent Posts\n * Retrieves the count of Posts from the last 7 days matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getCountsRecent(\n query: string,\n options: GetCountsRecentOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'search_count.fields': 'searchCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n granularity = undefined,\n\n searchCountFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/counts/recent';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (searchCountFields !== undefined && searchCountFields.length > 0) {\n params.append('search_count.fields', searchCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get count of all Posts\n * Retrieves the count of Posts matching a search query from the full archive.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getCountsAll(\n query: string,\n options: GetCountsAllOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'search_count.fields': 'searchCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n granularity = undefined,\n\n searchCountFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/counts/all';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (granularity !== undefined) {\n params.append('granularity', String(granularity));\n }\n\n if (searchCountFields !== undefined && searchCountFields.length > 0) {\n params.append('search_count.fields', searchCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search recent Posts\n * Retrieves Posts from the last 7 days matching a search query.\n\n\n\n * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchRecent(\n query: string,\n options: SearchRecentOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n sort_order: 'sortOrder',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n startTime = undefined,\n\n endTime = undefined,\n\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n sortOrder = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/recent';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (sortOrder !== undefined) {\n params.append('sort_order', String(sortOrder));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Hide reply\n * Hides or unhides a reply to a conversation owned by the authenticated user.\n\n\n * @param tweetId The ID of the reply that you want to hide or unhide.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async hideReply(\n tweetId: string,\n options: HideReplyOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{tweet_id}/hidden';\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.moderate.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposted by\n * Retrieves a list of Users who reposted a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getRepostedBy(\n id: string,\n options: GetRepostedByOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/retweeted_by';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Quoted Posts\n * Retrieves a list of Posts that quote a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getQuoted(\n id: string,\n options: GetQuotedOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/quote_tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Liking Users\n * Retrieves a list of Users who liked a specific Post by its ID.\n\n\n * @param id A single Post ID.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getLikingUsers(\n id: string,\n options: GetLikingUsersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/{id}/liking_users';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for posts operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getInsights28hr\n * \n * @public\n */\nexport type GetInsights28hrResponse = Schemas.Get2Insights28hrResponse;\n/**\n * Response for getReposts\n * \n * @public\n */\nexport type GetRepostsResponse = Schemas.Get2TweetsIdRetweetsResponse;\n/**\n * Response for searchAll\n * \n * @public\n */\nexport type SearchAllResponse = Schemas.Get2TweetsSearchAllResponse;\n/**\n * Response for getInsightsHistorical\n * \n * @public\n */\nexport type GetInsightsHistoricalResponse = Schemas.Get2InsightsHistoricalResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2TweetsIdResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.TweetDeleteResponse;\n/**\n * Response for getAnalytics\n * \n * @public\n */\nexport type GetAnalyticsResponse = Schemas.Analytics;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2TweetsResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.TweetCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.TweetCreateResponse;\n/**\n * Response for getCountsRecent\n * \n * @public\n */\nexport type GetCountsRecentResponse = Schemas.Get2TweetsCountsRecentResponse;\n/**\n * Response for getCountsAll\n * \n * @public\n */\nexport type GetCountsAllResponse = Schemas.Get2TweetsCountsAllResponse;\n/**\n * Response for searchRecent\n * \n * @public\n */\nexport type SearchRecentResponse = Schemas.Get2TweetsSearchRecentResponse;\n/**\n * Request for hideReply\n * \n * @public\n */\nexport type HideReplyRequest = Schemas.TweetHideRequest;\n/**\n * Response for hideReply\n * \n * @public\n */\nexport type HideReplyResponse = Schemas.TweetHideResponse;\n/**\n * Response for getRepostedBy\n * \n * @public\n */\nexport type GetRepostedByResponse = Schemas.Get2TweetsIdRetweetedByResponse;\n/**\n * Response for getQuoted\n * \n * @public\n */\nexport type GetQuotedResponse = Schemas.Get2TweetsIdQuoteTweetsResponse;\n/**\n * Response for getLikingUsers\n * \n * @public\n */\nexport type GetLikingUsersResponse = Schemas.Get2TweetsIdLikingUsersResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * lists client for the X API.\n *\n * This module provides a client for interacting with the lists endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetMembersResponse,\n AddMemberRequest,\n AddMemberResponse,\n GetFollowersResponse,\n GetPostsResponse,\n RemoveMemberByUserIdResponse,\n GetByIdResponse,\n UpdateRequest,\n UpdateResponse,\n DeleteResponse,\n CreateRequest,\n CreateResponse,\n} from './models.js';\n\n/**\n * Options for getMembers method\n * \n * @public\n */\nexport interface GetMembersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for addMember method\n * \n * @public\n */\nexport interface AddMemberOptions {\n /** Request body */\n body?: AddMemberRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowers method\n * \n * @public\n */\nexport interface GetFollowersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for update method\n * \n * @public\n */\nexport interface UpdateOptions {\n /** Request body */\n body?: UpdateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for lists operations\n * \n * This client provides methods for interacting with the lists endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all lists related operations.\n * \n * @category lists\n */\nexport class ListsClient {\n private client: Client;\n\n /**\n * Creates a new lists client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get List members\n * Retrieves a list of Users who are members of a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMembers(\n id: string,\n options: GetMembersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Add List member\n * Adds a User to a specific List by its ID.\n\n\n * @param id The ID of the List for which to add a member.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async addMember(\n id: string,\n options: AddMemberOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List followers\n * Retrieves a list of Users who follow a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowers(\n id: string,\n options: GetFollowersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/followers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List Posts\n * Retrieves a list of Posts associated with a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Remove List member\n * Removes a User from a specific List by its ID and the User’s ID.\n\n\n * @param id The ID of the List to remove a member.\n\n\n\n * @param userId The ID of User that will be removed from the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async removeMemberByUserId(\n id: string,\n userId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/lists/{id}/members/{user_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{user_id}', encodeURIComponent(String(userId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List by ID\n * Retrieves details of a specific List by its ID.\n\n\n * @param id The ID of the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update List\n * Updates the details of a specific List owned by the authenticated user by its ID.\n\n\n * @param id The ID of the List to modify.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async update(\n id: string,\n options: UpdateOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete List\n * Deletes a specific List owned by the authenticated user by its ID.\n\n\n * @param id The ID of the List to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/lists/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create List\n * Creates a new List for the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/lists';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: [\n 'list.read',\n 'list.write',\n 'tweet.read',\n 'users.read',\n ],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for lists operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getMembers\n * \n * @public\n */\nexport type GetMembersResponse = Schemas.Get2ListsIdMembersResponse;\n/**\n * Request for addMember\n * \n * @public\n */\nexport type AddMemberRequest = Schemas.ListAddUserRequest;\n/**\n * Response for addMember\n * \n * @public\n */\nexport type AddMemberResponse = Schemas.ListMutateResponse;\n/**\n * Response for getFollowers\n * \n * @public\n */\nexport type GetFollowersResponse = Schemas.Get2ListsIdFollowersResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2ListsIdTweetsResponse;\n/**\n * Response for removeMemberByUserId\n * \n * @public\n */\nexport type RemoveMemberByUserIdResponse = Schemas.ListMutateResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2ListsIdResponse;\n/**\n * Request for update\n * \n * @public\n */\nexport type UpdateRequest = Schemas.ListUpdateRequest;\n/**\n * Response for update\n * \n * @public\n */\nexport type UpdateResponse = Schemas.ListUpdateResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.ListDeleteResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.ListCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.ListCreateResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * community notes client for the X API.\n *\n * This module provides a client for interacting with the community notes endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n DeleteResponse,\n EvaluateRequest,\n EvaluateResponse,\n SearchWrittenResponse,\n CreateRequest,\n CreateResponse,\n SearchEligiblePostsResponse,\n} from './models.js';\n\n/**\n * Options for evaluate method\n * \n * @public\n */\nexport interface EvaluateOptions {\n /** Request body */\n body?: EvaluateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchWritten method\n * \n * @public\n */\nexport interface SearchWrittenOptions {\n /** Pagination token to get next set of posts eligible for notes. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Max results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** A comma separated list of Note fields to display. \n * Also accepts: note.fields or proper camelCase (e.g., noteFields) */\n noteFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for searchEligiblePosts method\n * \n * @public\n */\nexport interface SearchEligiblePostsOptions {\n /** Pagination token to get next set of posts eligible for notes. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Max results to return. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. \n * Also accepts: post_selection or proper camelCase (e.g., postSelection) */\n postSelection?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for community notes operations\n * \n * This client provides methods for interacting with the community notes endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all community notes related operations.\n * \n * @category community notes\n */\nexport class CommunityNotesClient {\n private client: Client;\n\n /**\n * Creates a new community notes client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Delete a Community Note\n * Deletes a community note.\n\n\n * @param id The community note id to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/notes/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Evaluate a Community Note\n * Endpoint to evaluate a community note.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async evaluate(options: EvaluateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/evaluate_note';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search for Community Notes Written\n * Returns all the community notes written by the user.\n\n\n\n * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchWritten(\n testMode: boolean,\n options: SearchWrittenOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n 'note.fields': 'noteFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n noteFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes/search/notes_written';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (testMode !== undefined) {\n params.append('test_mode', String(testMode));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (noteFields !== undefined && noteFields.length > 0) {\n params.append('note.fields', noteFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create a Community Note\n * Creates a community note endpoint for LLM use case.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.write'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search for Posts Eligible for Community Notes\n * Returns all the posts that are eligible for community notes.\n\n\n\n * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async searchEligiblePosts(\n testMode: boolean,\n options: SearchEligiblePostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n pagination_token: 'paginationToken',\n\n max_results: 'maxResults',\n\n post_selection: 'postSelection',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n paginationToken = undefined,\n\n maxResults = undefined,\n\n postSelection = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/notes/search/posts_eligible_for_notes';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (testMode !== undefined) {\n params.append('test_mode', String(testMode));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (postSelection !== undefined) {\n params.append('post_selection', String(postSelection));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for community notes operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.DeleteNoteResponse;\n/**\n * Request for evaluate\n * \n * @public\n */\nexport type EvaluateRequest = Schemas.EvaluateNoteRequest;\n/**\n * Response for evaluate\n * \n * @public\n */\nexport type EvaluateResponse = Schemas.EvaluateNoteResponse;\n/**\n * Response for searchWritten\n * \n * @public\n */\nexport type SearchWrittenResponse = Schemas.Get2NotesSearchNotesWrittenResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.CreateNoteRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.CreateNoteResponse;\n/**\n * Response for searchEligiblePosts\n * \n * @public\n */\nexport type SearchEligiblePostsResponse = Schemas.Get2NotesSearchPostsEligibleForNotesResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * general client for the X API.\n *\n * This module provides a client for interacting with the general endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetOpenApiSpecResponse } from './models.js';\n\n/**\n * Client for general operations\n * \n * This client provides methods for interacting with the general endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all general related operations.\n * \n * @category general\n */\nexport class GeneralClient {\n private client: Client;\n\n /**\n * Creates a new general client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get OpenAPI Spec.\n * Retrieves the full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md)\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getOpenApiSpec(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/openapi.json';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for general operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n\n/**\n * Response for getOpenApiSpec\n * \n * @public\n */\nexport type GetOpenApiSpecResponse = Record;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * webhooks client for the X API.\n *\n * This module provides a client for interacting with the webhooks endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetResponse,\n CreateRequest,\n CreateResponse,\n ValidateResponse,\n DeleteResponse,\n CreateStreamLinkResponse,\n DeleteStreamLinkResponse,\n GetStreamLinksResponse,\n} from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** A comma separated list of WebhookConfig fields to display. \n * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */\n webhookConfigFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for create method\n * \n * @public\n */\nexport interface CreateOptions {\n /** Request body */\n body?: CreateRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for createStreamLink method\n * \n * @public\n */\nexport interface CreateStreamLinkOptions {\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: string;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: string;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: string;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: string;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: string;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for webhooks operations\n * \n * This client provides methods for interacting with the webhooks endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all webhooks related operations.\n * \n * @category webhooks\n */\nexport class WebhooksClient {\n private client: Client;\n\n /**\n * Creates a new webhooks client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get webhook\n * Get a list of webhook configs associated with a client app.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'webhook_config.fields': 'webhookConfigFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n webhookConfigFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (webhookConfigFields !== undefined && webhookConfigFields.length > 0) {\n params.append('webhook_config.fields', webhookConfigFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create webhook\n * Creates a new webhook configuration.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async create(options: CreateOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Validate webhook\n * Triggers a CRC check for a given webhook.\n\n\n * @param webhookId The ID of the webhook to check.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async validate(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'PUT',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete webhook\n * Deletes an existing webhook configuration.\n\n\n * @param webhookId The ID of the webhook to delete.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async delete(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create stream link\n * Creates a link to deliver FilteredStream events to the given webhook.\n\n\n * @param webhookId The webhook ID to link to your FilteredStream ruleset.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createStreamLink(\n webhookId: string,\n options: CreateStreamLinkOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n tweetFields = undefined,\n\n expansions = undefined,\n\n mediaFields = undefined,\n\n pollFields = undefined,\n\n userFields = undefined,\n\n placeFields = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (tweetFields !== undefined) {\n params.append('tweet.fields', String(tweetFields));\n }\n\n if (expansions !== undefined) {\n params.append('expansions', String(expansions));\n }\n\n if (mediaFields !== undefined) {\n params.append('media.fields', String(mediaFields));\n }\n\n if (pollFields !== undefined) {\n params.append('poll.fields', String(pollFields));\n }\n\n if (userFields !== undefined) {\n params.append('user.fields', String(userFields));\n }\n\n if (placeFields !== undefined) {\n params.append('place.fields', String(placeFields));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete stream link\n * Deletes a link from FilteredStream events to the given webhook.\n\n\n * @param webhookId The webhook ID to link to your FilteredStream ruleset.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteStreamLink(webhookId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks/{webhook_id}';\n\n path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get stream links\n * Get a list of webhook links associated with a filtered stream ruleset.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getStreamLinks(): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/tweets/search/webhooks';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for webhooks operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2WebhooksResponse;\n/**\n * Request for create\n * \n * @public\n */\nexport type CreateRequest = Schemas.WebhookConfigCreateRequest;\n/**\n * Response for create\n * \n * @public\n */\nexport type CreateResponse = Schemas.WebhookConfigCreateResponse;\n/**\n * Response for validate\n * \n * @public\n */\nexport type ValidateResponse = Schemas.WebhookConfigPutResponse;\n/**\n * Response for delete\n * \n * @public\n */\nexport type DeleteResponse = Schemas.WebhookConfigDeleteResponse;\n/**\n * Response for createStreamLink\n * \n * @public\n */\nexport type CreateStreamLinkResponse = Schemas.WebhookLinksCreateResponse;\n/**\n * Response for deleteStreamLink\n * \n * @public\n */\nexport type DeleteStreamLinkResponse = Schemas.WebhookLinksDeleteResponse;\n/**\n * Response for getStreamLinks\n * \n * @public\n */\nexport type GetStreamLinksResponse = Schemas.WebhookLinksGetResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * users client for the X API.\n *\n * This module provides a client for interacting with the users endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetByUsernamesResponse,\n GetListMembershipsResponse,\n UnfollowUserResponse,\n UnfollowListResponse,\n GetByIdsResponse,\n LikePostRequest,\n LikePostResponse,\n BlockDmsResponse,\n GetPostsResponse,\n GetBookmarksByFolderIdResponse,\n GetMutingResponse,\n MuteUserRequest,\n MuteUserResponse,\n GetOwnedListsResponse,\n UnpinListResponse,\n GetByUsernameResponse,\n GetBlockingResponse,\n GetLikedPostsResponse,\n UnlikePostResponse,\n GetFollowedListsResponse,\n FollowListRequest,\n FollowListResponse,\n GetTimelineResponse,\n GetPinnedListsResponse,\n PinListRequest,\n PinListResponse,\n GetRepostsOfMeResponse,\n GetFollowingResponse,\n FollowUserRequest,\n FollowUserResponse,\n UnblockDmsResponse,\n GetMentionsResponse,\n GetBookmarkFoldersResponse,\n UnrepostPostResponse,\n DeleteBookmarkResponse,\n RepostPostRequest,\n RepostPostResponse,\n SearchResponse,\n GetByIdResponse,\n GetBookmarksResponse,\n CreateBookmarkRequest,\n CreateBookmarkResponse,\n GetFollowersResponse,\n GetMeResponse,\n UnmuteUserResponse,\n} from './models.js';\n\n/**\n * Options for getByUsernames method\n * \n * @public\n */\nexport interface GetByUsernamesOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getListMemberships method\n * \n * @public\n */\nexport interface GetListMembershipsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByIds method\n * \n * @public\n */\nexport interface GetByIdsOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for likePost method\n * \n * @public\n */\nexport interface LikePostOptions {\n /** Request body */\n body?: LikePostRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPosts method\n * \n * @public\n */\nexport interface GetPostsOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMuting method\n * \n * @public\n */\nexport interface GetMutingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for muteUser method\n * \n * @public\n */\nexport interface MuteUserOptions {\n /** Request body */\n body?: MuteUserRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getOwnedLists method\n * \n * @public\n */\nexport interface GetOwnedListsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getByUsername method\n * \n * @public\n */\nexport interface GetByUsernameOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBlocking method\n * \n * @public\n */\nexport interface GetBlockingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getLikedPosts method\n * \n * @public\n */\nexport interface GetLikedPostsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowedLists method\n * \n * @public\n */\nexport interface GetFollowedListsOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for followList method\n * \n * @public\n */\nexport interface FollowListOptions {\n /** Request body */\n body?: FollowListRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getTimeline method\n * \n * @public\n */\nexport interface GetTimelineOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** The set of entities to exclude (e.g. 'replies' or 'retweets'). \n * Also accepts: exclude or proper camelCase (e.g., exclude) */\n exclude?: Array;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getPinnedLists method\n * \n * @public\n */\nexport interface GetPinnedListsOptions {\n /** A comma separated list of List fields to display. \n * Also accepts: list.fields or proper camelCase (e.g., listFields) */\n listFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getRepostsOfMe method\n * \n * @public\n */\nexport interface GetRepostsOfMeOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowing method\n * \n * @public\n */\nexport interface GetFollowingOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for followUser method\n * \n * @public\n */\nexport interface FollowUserOptions {\n /** Request body */\n body?: FollowUserRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMentions method\n * \n * @public\n */\nexport interface GetMentionsOptions {\n /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. \n * Also accepts: since_id or proper camelCase (e.g., sinceId) */\n sinceId?: any;\n\n /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. \n * Also accepts: until_id or proper camelCase (e.g., untilId) */\n untilId?: any;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBookmarkFolders method\n * \n * @public\n */\nexport interface GetBookmarkFoldersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for repostPost method\n * \n * @public\n */\nexport interface RepostPostOptions {\n /** Request body */\n body?: RepostPostRequest;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getBookmarks method\n * \n * @public\n */\nexport interface GetBookmarksOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getFollowers method\n * \n * @public\n */\nexport interface GetFollowersOptions {\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get a specified 'page' of results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getMe method\n * \n * @public\n */\nexport interface GetMeOptions {\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for users operations\n * \n * This client provides methods for interacting with the users endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all users related operations.\n * \n * @category users\n */\nexport class UsersClient {\n private client: Client;\n\n /**\n * Creates a new users client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Users by usernames\n * Retrieves details of multiple Users by their usernames.\n\n\n\n * @param usernames A list of usernames, comma-separated.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByUsernames(\n usernames: Array,\n options: GetByUsernamesOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/by';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (usernames !== undefined && usernames.length > 0) {\n params.append('usernames', usernames.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get List memberships\n * Retrieves a list of Lists that a specific User is a member of by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getListMemberships(\n id: string,\n options: GetListMembershipsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/list_memberships';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unfollow User\n * Causes the authenticated user to unfollow a specific user by their ID.\n\n\n * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User.\n\n\n\n * @param targetUserId The ID of the User that the source User is requesting to unfollow.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unfollowUser(\n sourceUserId: string,\n targetUserId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{source_user_id}/following/{target_user_id}';\n\n path = path.replace(\n '{source_user_id}',\n encodeURIComponent(String(sourceUserId))\n );\n\n path = path.replace(\n '{target_user_id}',\n encodeURIComponent(String(targetUserId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unfollow List\n * Causes the authenticated user to unfollow a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will unfollow the List.\n\n\n\n * @param listId The ID of the List to unfollow.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unfollowList(\n id: string,\n listId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists/{list_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{list_id}', encodeURIComponent(String(listId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Users by IDs\n * Retrieves details of multiple Users by their IDs.\n\n\n\n * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByIds(\n ids: Array,\n options: GetByIdsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Like Post\n * Causes the authenticated user to Like a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to like the Post.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async likePost(\n id: string,\n options: LikePostOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/likes';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Block DMs\n * Blocks direct messages to or from a specific User by their ID for the authenticated user.\n\n\n * @param id The ID of the target User that the authenticated user requesting to block dms for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async blockDms(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/dm/block';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Posts\n * Retrieves a list of posts authored by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPosts(\n id: string,\n options: GetPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmarks by folder ID\n * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarksByFolderId(\n id: string,\n folderId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/folders/{folder_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{folder_id}', encodeURIComponent(String(folderId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get muting\n * Retrieves a list of Users muted by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMuting(\n id: string,\n options: GetMutingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/muting';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Mute User\n * Causes the authenticated user to mute a specific User by their ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to mute the target User.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async muteUser(\n id: string,\n options: MuteUserOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/muting';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get owned Lists\n * Retrieves a list of Lists owned by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getOwnedLists(\n id: string,\n options: GetOwnedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/owned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unpin List\n * Causes the authenticated user to unpin a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n * @param listId The ID of the List to unpin.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unpinList(id: string, listId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists/{list_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{list_id}', encodeURIComponent(String(listId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get User by username\n * Retrieves details of a specific User by their username.\n\n\n * @param username A username.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getByUsername(\n username: string,\n options: GetByUsernameOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/by/username/{username}';\n\n path = path.replace('{username}', encodeURIComponent(String(username)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get blocking\n * Retrieves a list of Users blocked by the specified User ID.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBlocking(\n id: string,\n options: GetBlockingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/blocking';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['block.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get liked Posts\n * Retrieves a list of Posts liked by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getLikedPosts(\n id: string,\n options: GetLikedPostsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/liked_tweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unlike Post\n * Causes the authenticated user to Unlike a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to unlike the Post.\n\n\n\n * @param tweetId The ID of the Post that the User is requesting to unlike.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unlikePost(id: string, tweetId: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/likes/{tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get followed Lists\n * Retrieves a list of Lists followed by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowedLists(\n id: string,\n options: GetFollowedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Follow List\n * Causes the authenticated user to follow a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will follow the List.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async followList(\n id: string,\n options: FollowListOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followed_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Timeline\n * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline.\n\n\n * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getTimeline(\n id: string,\n options: GetTimelineOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n exclude = [],\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/timelines/reverse_chronological';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (exclude !== undefined && exclude.length > 0) {\n params.append('exclude', exclude.join(','));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get pinned Lists\n * Retrieves a list of Lists pinned by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getPinnedLists(\n id: string,\n options: GetPinnedListsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'list.fields': 'listFields',\n\n 'user.fields': 'userFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n listFields = [],\n\n expansions = [],\n\n userFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (listFields !== undefined && listFields.length > 0) {\n params.append('list.fields', listFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Pin List\n * Causes the authenticated user to pin a specific List by its ID.\n\n\n * @param id The ID of the authenticated source User that will pin the List.\n\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async pinList(id: string, body: PinListRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/pinned_lists';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Reposts of me\n * Retrieves a list of Posts that repost content from the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getRepostsOfMe(\n options: GetRepostsOfMeOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/reposts_of_me';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['timeline.read', 'tweet.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get following\n * Retrieves a list of Users followed by a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowing(\n id: string,\n options: GetFollowingOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/following';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Follow User\n * Causes the authenticated user to follow a specific user by their ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to follow the target User.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async followUser(\n id: string,\n options: FollowUserOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/following';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unblock DMs\n * Unblocks direct messages to or from a specific User by their ID for the authenticated user.\n\n\n * @param id The ID of the target User that the authenticated user requesting to unblock dms for.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unblockDms(id: string): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/dm/unblock';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get mentions\n * Retrieves a list of Posts that mention a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMentions(\n id: string,\n options: GetMentionsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n since_id: 'sinceId',\n\n until_id: 'untilId',\n\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n sinceId = undefined,\n\n untilId = undefined,\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/mentions';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (sinceId !== undefined) {\n params.append('since_id', String(sinceId));\n }\n\n if (untilId !== undefined) {\n params.append('until_id', String(untilId));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmark folders\n * Retrieves a list of Bookmark folders created by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarkFolders(\n id: string,\n options: GetBookmarkFoldersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/folders';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unrepost Post\n * Causes the authenticated user to unrepost a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to repost the Post.\n\n\n\n * @param sourceTweetId The ID of the Post that the User is requesting to unretweet.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unrepostPost(\n id: string,\n sourceTweetId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/retweets/{source_tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace(\n '{source_tweet_id}',\n encodeURIComponent(String(sourceTweetId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Delete Bookmark\n * Removes a Post from the authenticated user’s Bookmarks by its ID.\n\n\n * @param id The ID of the authenticated source User whose bookmark is to be removed.\n\n\n\n * @param tweetId The ID of the Post that the source User is removing from bookmarks.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async deleteBookmark(\n id: string,\n tweetId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks/{tweet_id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Repost Post\n * Causes the authenticated user to repost a specific Post by its ID.\n\n\n * @param id The ID of the authenticated source User that is requesting to repost the Post.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async repostPost(\n id: string,\n options: RepostPostOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const normalizedOptions = options || {};\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n body,\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/retweets';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: body ? JSON.stringify(body) : undefined,\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Users\n * Retrieves a list of Users matching a search query.\n\n\n\n * @param query TThe the query string by which to query for users.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: any,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n nextToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get User by ID\n * Retrieves details of a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Bookmarks\n * Retrieves a list of Posts bookmarked by the authenticated user.\n\n\n * @param id The ID of the authenticated source User for whom to return results.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getBookmarks(\n id: string,\n options: GetBookmarksOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Bookmark\n * Adds a post to the authenticated user’s bookmarks.\n\n\n * @param id The ID of the authenticated source User for whom to add bookmarks.\n\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createBookmark(\n id: string,\n body: CreateBookmarkRequest\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{id}/bookmarks';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get followers\n * Retrieves a list of Users who follow a specific User by their ID.\n\n\n * @param id The ID of the User to lookup.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getFollowers(\n id: string,\n options: GetFollowersOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n paginationToken = undefined,\n\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/{id}/followers';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get my User\n * Retrieves details of the authenticated user.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getMe(options: GetMeOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n userFields = [],\n\n expansions = [],\n\n tweetFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/me';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Unmute User\n * Causes the authenticated user to unmute a specific user by their ID.\n\n\n * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User.\n\n\n\n * @param targetUserId The ID of the User that the source User is requesting to unmute.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async unmuteUser(\n sourceUserId: string,\n targetUserId: string\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/users/{source_user_id}/muting/{target_user_id}';\n\n path = path.replace(\n '{source_user_id}',\n encodeURIComponent(String(sourceUserId))\n );\n\n path = path.replace(\n '{target_user_id}',\n encodeURIComponent(String(targetUserId))\n );\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'DELETE',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for users operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getByUsernames\n * \n * @public\n */\nexport type GetByUsernamesResponse = Schemas.Get2UsersByResponse;\n/**\n * Response for getListMemberships\n * \n * @public\n */\nexport type GetListMembershipsResponse = Schemas.Get2UsersIdListMembershipsResponse;\n/**\n * Response for unfollowUser\n * \n * @public\n */\nexport type UnfollowUserResponse = Schemas.UsersFollowingDeleteResponse;\n/**\n * Response for unfollowList\n * \n * @public\n */\nexport type UnfollowListResponse = Schemas.ListFollowedResponse;\n/**\n * Response for getByIds\n * \n * @public\n */\nexport type GetByIdsResponse = Schemas.Get2UsersResponse;\n/**\n * Request for likePost\n * \n * @public\n */\nexport type LikePostRequest = Schemas.UsersLikesCreateRequest;\n/**\n * Response for likePost\n * \n * @public\n */\nexport type LikePostResponse = Schemas.UsersLikesCreateResponse;\n/**\n * Response for blockDms\n * \n * @public\n */\nexport type BlockDmsResponse = Schemas.UsersDMBlockCreateResponse;\n/**\n * Response for getPosts\n * \n * @public\n */\nexport type GetPostsResponse = Schemas.Get2UsersIdTweetsResponse;\n/**\n * Response for getBookmarksByFolderId\n * \n * @public\n */\nexport type GetBookmarksByFolderIdResponse = Schemas.BookmarkFolderPostsResponse;\n/**\n * Response for getMuting\n * \n * @public\n */\nexport type GetMutingResponse = Schemas.Get2UsersIdMutingResponse;\n\n/**\n * Request for muteUser\n * \n * @public\n */\nexport type { MuteUserRequest as MuteUserRequest } from '../schemas.js';\n/**\n * Response for muteUser\n * \n * @public\n */\nexport type MuteUserResponse = Schemas.MuteUserMutationResponse;\n/**\n * Response for getOwnedLists\n * \n * @public\n */\nexport type GetOwnedListsResponse = Schemas.Get2UsersIdOwnedListsResponse;\n/**\n * Response for unpinList\n * \n * @public\n */\nexport type UnpinListResponse = Schemas.ListUnpinResponse;\n/**\n * Response for getByUsername\n * \n * @public\n */\nexport type GetByUsernameResponse = Schemas.Get2UsersByUsernameUsernameResponse;\n/**\n * Response for getBlocking\n * \n * @public\n */\nexport type GetBlockingResponse = Schemas.Get2UsersIdBlockingResponse;\n/**\n * Response for getLikedPosts\n * \n * @public\n */\nexport type GetLikedPostsResponse = Schemas.Get2UsersIdLikedTweetsResponse;\n/**\n * Response for unlikePost\n * \n * @public\n */\nexport type UnlikePostResponse = Schemas.UsersLikesDeleteResponse;\n/**\n * Response for getFollowedLists\n * \n * @public\n */\nexport type GetFollowedListsResponse = Schemas.Get2UsersIdFollowedListsResponse;\n/**\n * Request for followList\n * \n * @public\n */\nexport type FollowListRequest = Schemas.ListFollowedRequest;\n/**\n * Response for followList\n * \n * @public\n */\nexport type FollowListResponse = Schemas.ListFollowedResponse;\n/**\n * Response for getTimeline\n * \n * @public\n */\nexport type GetTimelineResponse = Schemas.Get2UsersIdTimelinesReverseChronologicalResponse;\n/**\n * Response for getPinnedLists\n * \n * @public\n */\nexport type GetPinnedListsResponse = Schemas.Get2UsersIdPinnedListsResponse;\n/**\n * Request for pinList\n * \n * @public\n */\nexport type PinListRequest = Schemas.ListPinnedRequest;\n/**\n * Response for pinList\n * \n * @public\n */\nexport type PinListResponse = Schemas.ListPinnedResponse;\n/**\n * Response for getRepostsOfMe\n * \n * @public\n */\nexport type GetRepostsOfMeResponse = Schemas.Get2UsersRepostsOfMeResponse;\n/**\n * Response for getFollowing\n * \n * @public\n */\nexport type GetFollowingResponse = Schemas.Get2UsersIdFollowingResponse;\n/**\n * Request for followUser\n * \n * @public\n */\nexport type FollowUserRequest = Schemas.UsersFollowingCreateRequest;\n/**\n * Response for followUser\n * \n * @public\n */\nexport type FollowUserResponse = Schemas.UsersFollowingCreateResponse;\n/**\n * Response for unblockDms\n * \n * @public\n */\nexport type UnblockDmsResponse = Schemas.UsersDMUnBlockCreateResponse;\n/**\n * Response for getMentions\n * \n * @public\n */\nexport type GetMentionsResponse = Schemas.Get2UsersIdMentionsResponse;\n/**\n * Response for getBookmarkFolders\n * \n * @public\n */\nexport type GetBookmarkFoldersResponse = Schemas.BookmarkFoldersResponse;\n/**\n * Response for unrepostPost\n * \n * @public\n */\nexport type UnrepostPostResponse = Schemas.UsersRetweetsDeleteResponse;\n/**\n * Response for deleteBookmark\n * \n * @public\n */\nexport type DeleteBookmarkResponse = Schemas.BookmarkMutationResponse;\n/**\n * Request for repostPost\n * \n * @public\n */\nexport type RepostPostRequest = Schemas.UsersRetweetsCreateRequest;\n/**\n * Response for repostPost\n * \n * @public\n */\nexport type RepostPostResponse = Schemas.UsersRetweetsCreateResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2UsersSearchResponse;\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2UsersIdResponse;\n/**\n * Response for getBookmarks\n * \n * @public\n */\nexport type GetBookmarksResponse = Schemas.Get2UsersIdBookmarksResponse;\n/**\n * Request for createBookmark\n * \n * @public\n */\nexport type CreateBookmarkRequest = Schemas.BookmarkAddRequest;\n/**\n * Response for createBookmark\n * \n * @public\n */\nexport type CreateBookmarkResponse = Schemas.BookmarkMutationResponse;\n/**\n * Response for getFollowers\n * \n * @public\n */\nexport type GetFollowersResponse = Schemas.Get2UsersIdFollowersResponse;\n/**\n * Response for getMe\n * \n * @public\n */\nexport type GetMeResponse = Schemas.Get2UsersMeResponse;\n/**\n * Response for unmuteUser\n * \n * @public\n */\nexport type UnmuteUserResponse = Schemas.MuteUserMutationResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * communities client for the X API.\n *\n * This module provides a client for interacting with the communities endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetByIdResponse, SearchResponse } from './models.js';\n\n/**\n * Options for getById method\n * \n * @public\n */\nexport interface GetByIdOptions {\n /** A comma separated list of Community fields to display. \n * Also accepts: community.fields or proper camelCase (e.g., communityFields) */\n communityFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for search method\n * \n * @public\n */\nexport interface SearchOptions {\n /** The maximum number of search results to be returned by a request. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: next_token or proper camelCase (e.g., nextToken) */\n nextToken?: any;\n\n /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: any;\n\n /** A comma separated list of Community fields to display. \n * Also accepts: community.fields or proper camelCase (e.g., communityFields) */\n communityFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for communities operations\n * \n * This client provides methods for interacting with the communities endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all communities related operations.\n * \n * @category communities\n */\nexport class CommunitiesClient {\n private client: Client;\n\n /**\n * Creates a new communities client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Community by ID\n * Retrieves details of a specific Community by its ID.\n\n\n * @param id The ID of the Community.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getById(\n id: string,\n options: GetByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'community.fields': 'communityFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n communityFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/communities/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (communityFields !== undefined && communityFields.length > 0) {\n params.append('community.fields', communityFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n\n {\n OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Search Communities\n * Retrieves a list of Communities matching the specified search query.\n\n\n\n * @param query Query to search communities.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async search(\n query: string,\n options: SearchOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n next_token: 'nextToken',\n\n pagination_token: 'paginationToken',\n\n 'community.fields': 'communityFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n maxResults = undefined,\n\n nextToken = undefined,\n\n paginationToken = undefined,\n\n communityFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/communities/search';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (query !== undefined) {\n params.append('query', String(query));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (nextToken !== undefined) {\n params.append('next_token', String(nextToken));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n if (communityFields !== undefined && communityFields.length > 0) {\n params.append('community.fields', communityFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n OAuth2UserToken: ['tweet.read', 'users.read'],\n },\n\n {\n UserToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for communities operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getById\n * \n * @public\n */\nexport type GetByIdResponse = Schemas.Get2CommunitiesIdResponse;\n/**\n * Response for search\n * \n * @public\n */\nexport type SearchResponse = Schemas.Get2CommunitiesSearchResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Event-driven streaming utilities for the X API.\n * \n * This module provides event-driven streaming interfaces that are more user-friendly\n * than manual ReadableStream management.\n */\n\n// Event types for the stream (using string literals for simplicity)\n// Based on actual Twitter API behavior from documentation\nexport const StreamEvent = {\n Data: 'data', // When JSON data arrives\n KeepAlive: 'keepAlive', // 20-second heartbeat (newline character)\n Error: 'error', // HTTP errors, ConnectionException, operational-disconnect\n Close: 'close', // When stream ends\n};\n\n// Event data types\nexport interface StreamDataEvent {\n data: any;\n includes?: any;\n matching_rules?: any[];\n}\n\nexport interface StreamErrorEvent {\n error: Error;\n // Additional error details from the API response\n code?: string;\n status?: number;\n}\n\n/**\n * Event-driven stream class for handling streaming data from the X API.\n * \n * This class provides an event-driven interface for working with streaming endpoints,\n * allowing you to listen to 'data', 'keepAlive', 'error', and 'close' events.\n * \n * @public\n */\nexport class EventDrivenStream {\n private webStream: ReadableStream | null = null;\n private reader: ReadableStreamDefaultReader | null = null;\n private decoder: TextDecoder;\n private isConnected: boolean = false;\n private isClosed: boolean = false;\n private buffer: string = '';\n private eventListeners: Map = new Map();\n private autoReconnect: boolean = false;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = 5;\n private reconnectDelay: number = 1000;\n\n constructor() {\n this.decoder = new TextDecoder();\n this.setupEventListeners();\n }\n\n /**\n * Initialize the stream with a Web ReadableStream\n */\n async connect(webStream: ReadableStream): Promise {\n if (this.isConnected) {\n throw new Error('Stream is already connected');\n }\n\n this.webStream = webStream;\n this.isConnected = true;\n this.isClosed = false;\n this.reconnectAttempts = 0;\n\n this.emit(StreamEvent.Data, { message: 'Stream connected' });\n this.startReading(); // Don't await this - it runs in the background\n }\n\n /**\n * Start reading from the stream\n */\n private async startReading(): Promise {\n if (!this.webStream || !this.isConnected) {\n return;\n }\n\n this.reader = this.webStream.getReader();\n\n try {\n while (this.isConnected && !this.isClosed) {\n const { done, value } = await this.reader.read();\n\n if (done) {\n this.handleConnectionClosed();\n break;\n }\n\n if (value) {\n await this.processChunk(value);\n }\n }\n } catch (error) {\n this.handleConnectionError(error as Error);\n } finally {\n this.cleanup();\n }\n }\n\n /**\n * Process incoming data chunks\n */\n private async processChunk(value: Uint8Array): Promise {\n const chunk = this.decoder.decode(value, { stream: true });\n this.buffer += chunk;\n\n // Process complete lines (ending with newline)\n let boundary;\n while ((boundary = this.buffer.indexOf('\\n')) !== -1) {\n const line = this.buffer.substring(0, boundary);\n this.buffer = this.buffer.substring(boundary + 1);\n\n if (line.trim()) {\n try {\n const data = JSON.parse(line);\n\n // Check if it's a keep-alive signal (20-second heartbeat)\n if (this.isKeepAlive(data)) {\n this.emit(StreamEvent.KeepAlive, { data });\n continue;\n }\n\n // Emit data event for actual content\n this.emit(StreamEvent.Data, data);\n } catch (parseError) {\n // Skip invalid JSON lines - these are usually incomplete chunks\n console.warn('Skipping invalid JSON:', line.substring(0, 100));\n }\n }\n }\n }\n\n /**\n * Check if data is a keep-alive signal (20-second heartbeat)\n * Twitter sends newline characters every 20 seconds to prevent timeouts\n */\n private isKeepAlive(data: any): boolean {\n // Twitter sends empty objects or just newline characters as keep-alive\n return !data.data && !data.includes && !data.matching_rules && !data.errors;\n }\n\n /**\n * Handle connection errors\n */\n private handleConnectionError(error: Error): void {\n this.isConnected = false;\n\n // Emit the error as-is (API returns the actual error details)\n this.emit(StreamEvent.Error, { error });\n\n if (\n this.autoReconnect &&\n this.reconnectAttempts < this.maxReconnectAttempts\n ) {\n this.attemptReconnect();\n }\n }\n\n /**\n * Handle connection closed\n */\n private handleConnectionClosed(): void {\n this.isConnected = false;\n this.emit(StreamEvent.Close, { message: 'Connection closed' });\n }\n\n /**\n * Attempt to reconnect\n */\n private async attemptReconnect(): Promise {\n this.reconnectAttempts++;\n this.emit(StreamEvent.Data, {\n message: `Reconnect attempt ${this.reconnectAttempts}/${this\n .maxReconnectAttempts}`,\n });\n\n // Wait before reconnecting\n await new Promise(resolve =>\n setTimeout(resolve, this.reconnectDelay * this.reconnectAttempts)\n );\n\n try {\n // This would need to be implemented based on how you get a new stream\n // For now, we'll just emit the events\n this.emit(StreamEvent.Error, {\n error: new Error('Reconnect not implemented in this example'),\n });\n } catch (error) {\n this.emit(StreamEvent.Error, { error: error as Error });\n }\n }\n\n /**\n * Clean up resources\n */\n private cleanup(): void {\n if (this.reader) {\n try {\n // Try to release the lock - it will throw if already released\n this.reader.releaseLock();\n } catch (error) {\n // Ignore errors when releasing the lock (already released)\n console.debug('Reader lock already released or error:', error);\n }\n this.reader = null;\n }\n this.buffer = '';\n }\n\n /**\n * Close the stream\n */\n close(): void {\n this.isClosed = true;\n this.isConnected = false;\n this.cleanup();\n this.emit(StreamEvent.Close, { message: 'Stream closed by user' });\n }\n\n /**\n * Add event listener\n */\n on(event: string, listener: Function): this {\n if (!this.eventListeners.has(event)) {\n this.eventListeners.set(event, []);\n }\n this.eventListeners.get(event)!.push(listener);\n return this;\n }\n\n /**\n * Remove event listener\n */\n off(event: string, listener: Function): this {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n const index = listeners.indexOf(listener);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n }\n return this;\n }\n\n /**\n * Emit event to listeners\n */\n private emit(event: string, data: any): void {\n const listeners = this.eventListeners.get(event);\n if (listeners) {\n listeners.forEach(listener => {\n try {\n listener(data);\n } catch (error) {\n console.error(`Error in ${event} listener:`, error);\n }\n });\n }\n }\n\n /**\n * Setup default event listeners\n */\n private setupEventListeners(): void {\n // Default error handling\n this.on(StreamEvent.Error, (eventData: StreamErrorEvent) => {\n console.error('Stream error:', eventData.error);\n });\n }\n\n /**\n * Enable/disable auto-reconnect\n */\n set autoReconnectEnabled(enabled: boolean) {\n this.autoReconnect = enabled;\n }\n\n get autoReconnectEnabled(): boolean {\n return this.autoReconnect;\n }\n\n /**\n * Set max reconnect attempts\n */\n set maxReconnectAttemptsCount(count: number) {\n this.maxReconnectAttempts = count;\n }\n\n get maxReconnectAttemptsCount(): number {\n return this.maxReconnectAttempts;\n }\n\n /**\n * Async iterator for tweets\n */\n async *[Symbol.asyncIterator](): AsyncGenerator<\n StreamDataEvent,\n void,\n unknown\n > {\n const dataQueue: StreamDataEvent[] = [];\n let isComplete = false;\n let hasError = false;\n let error: Error | null = null;\n\n // Set up listeners\n const dataListener = (eventData: any) => {\n dataQueue.push(eventData);\n };\n\n const errorListener = (eventData: StreamErrorEvent) => {\n hasError = true;\n error = eventData.error;\n };\n\n const closeListener = () => {\n isComplete = true;\n };\n\n this.on(StreamEvent.Data, dataListener);\n this.on(StreamEvent.Error, errorListener);\n this.on(StreamEvent.Close, closeListener);\n\n try {\n while (!isComplete && !hasError) {\n if (dataQueue.length > 0) {\n yield dataQueue.shift()!;\n } else {\n // Wait a bit for more data\n await new Promise(resolve => setTimeout(resolve, 10));\n }\n }\n\n if (hasError && error) {\n throw error;\n }\n } finally {\n // Clean up listeners\n this.off(StreamEvent.Data, dataListener);\n this.off(StreamEvent.Error, errorListener);\n this.off(StreamEvent.Close, closeListener);\n }\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Stream client for the X API.\n *\n * This module provides a client for interacting with the streaming endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport { EventDrivenStream, StreamEvent } from './event_driven_stream.js';\nimport {\n PostsSampleResponse,\n PostsFirehosePtResponse,\n PostsFirehoseJaResponse,\n PostsSample10Response,\n PostsFirehoseKoResponse,\n LikesComplianceResponse,\n PostsComplianceResponse,\n GetRuleCountsResponse,\n LikesFirehoseResponse,\n PostsFirehoseEnResponse,\n PostsResponse,\n UsersComplianceResponse,\n PostsFirehoseResponse,\n LikesSample10Response,\n GetRulesResponse,\n UpdateRulesResponse,\n LabelsComplianceResponse,\n} from './models.js';\n\n/**\n * Options for postsSample method\n * \n * @public\n */\nexport interface PostsSampleStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehosePt method\n * \n * @public\n */\nexport interface PostsFirehosePtStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseJa method\n * \n * @public\n */\nexport interface PostsFirehoseJaStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsSample10 method\n * \n * @public\n */\nexport interface PostsSample10StreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseKo method\n * \n * @public\n */\nexport interface PostsFirehoseKoStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesCompliance method\n * \n * @public\n */\nexport interface LikesComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsCompliance method\n * \n * @public\n */\nexport interface PostsComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for getRuleCounts method\n * \n * @public\n */\nexport interface GetRuleCountsStreamingOptions {\n /** A comma separated list of RulesCount fields to display. \n * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */\n rulesCountFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesFirehose method\n * \n * @public\n */\nexport interface LikesFirehoseStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of LikeWithTweetAuthor fields to display. \n * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */\n likeWithTweetAuthorFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehoseEn method\n * \n * @public\n */\nexport interface PostsFirehoseEnStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for posts method\n * \n * @public\n */\nexport interface PostsStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for usersCompliance method\n * \n * @public\n */\nexport interface UsersComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for postsFirehose method\n * \n * @public\n */\nexport interface PostsFirehoseStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of Media fields to display. \n * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */\n mediaFields?: Array;\n\n /** A comma separated list of Poll fields to display. \n * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */\n pollFields?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Place fields to display. \n * Also accepts: place.fields or proper camelCase (e.g., placeFields) */\n placeFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for likesSample10 method\n * \n * @public\n */\nexport interface LikesSample10StreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** A comma separated list of LikeWithTweetAuthor fields to display. \n * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */\n likeWithTweetAuthorFields?: Array;\n\n /** A comma separated list of fields to expand. \n * Also accepts: expansions or proper camelCase (e.g., expansions) */\n expansions?: Array;\n\n /** A comma separated list of User fields to display. \n * Also accepts: user.fields or proper camelCase (e.g., userFields) */\n userFields?: Array;\n\n /** A comma separated list of Tweet fields to display. \n * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */\n tweetFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for getRules method\n * \n * @public\n */\nexport interface GetRulesStreamingOptions {\n /** A comma-separated list of Rule IDs. \n * Also accepts: ids or proper camelCase (e.g., ids) */\n ids?: Array;\n\n /** The maximum number of results. \n * Also accepts: max_results or proper camelCase (e.g., maxResults) */\n maxResults?: number;\n\n /** This value is populated by passing the 'next_token' returned in a request to paginate through results. \n * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */\n paginationToken?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for updateRules method\n * \n * @public\n */\nexport interface UpdateRulesStreamingOptions {\n /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. \n * Also accepts: dry_run or proper camelCase (e.g., dryRun) */\n dryRun?: boolean;\n\n /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. \n * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */\n deleteAll?: boolean;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n/**\n * Options for labelsCompliance method\n * \n * @public\n */\nexport interface LabelsComplianceStreamingOptions {\n /** The number of minutes of backfill requested. \n * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */\n backfillMinutes?: number;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. \n * Also accepts: start_time or proper camelCase (e.g., startTime) */\n startTime?: string;\n\n /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. \n * Also accepts: end_time or proper camelCase (e.g., endTime) */\n endTime?: string;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Additional headers */\n headers?: Record;\n /** AbortSignal for cancelling the request */\n signal?: AbortSignal;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\nexport class StreamClient {\n private client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Stream sampled Posts\n * Streams a 1% sample of public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsSample(\n options: PostsSampleStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsSample');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/sample/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Portuguese Posts\n * Streams all public Portuguese-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehosePt(\n partition: number,\n options: PostsFirehosePtStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehosePt');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/pt';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Japanese Posts\n * Streams all public Japanese-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseJa(\n partition: number,\n options: PostsFirehoseJaStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseJa');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/ja';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream 10% sampled Posts\n * Streams a 10% sample of public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsSample10(\n partition: number,\n options: PostsSample10StreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsSample10');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/sample10/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Korean Posts\n * Streams all public Korean-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseKo(\n partition: number,\n options: PostsFirehoseKoStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseKo');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/ko';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Likes compliance data\n * Streams all compliance data related to Likes for Users.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesCompliance(\n options: LikesComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Posts compliance data\n * Streams all compliance data related to Posts.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsCompliance(\n partition: number,\n options: PostsComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream all Likes\n * Streams all public Likes in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesFirehose(\n partition: number,\n options: LikesFirehoseStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesFirehose');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n likeWithTweetAuthorFields = [],\n\n expansions = [],\n\n userFields = [],\n\n tweetFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/firehose/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (\n likeWithTweetAuthorFields !== undefined &&\n likeWithTweetAuthorFields.length > 0\n ) {\n params.append(\n 'like_with_tweet_author.fields',\n likeWithTweetAuthorFields.join(',')\n );\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream English Posts\n * Streams all public English-language Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehoseEn(\n partition: number,\n options: PostsFirehoseEnStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseEn');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream/lang/en';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream filtered Posts\n * Streams Posts in real-time matching the active rule set.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async posts(options: PostsStreamingOptions = {}): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'posts');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Users compliance data\n * Streams all compliance data related to Users.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async usersCompliance(\n partition: number,\n options: UsersComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'usersCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/users/compliance/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream all Posts\n * Streams all public Posts in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async postsFirehose(\n partition: number,\n options: PostsFirehoseStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'postsFirehose');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'tweet.fields': 'tweetFields',\n\n 'media.fields': 'mediaFields',\n\n 'poll.fields': 'pollFields',\n\n 'user.fields': 'userFields',\n\n 'place.fields': 'placeFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n tweetFields = [],\n\n expansions = [],\n\n mediaFields = [],\n\n pollFields = [],\n\n userFields = [],\n\n placeFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/firehose/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (mediaFields !== undefined && mediaFields.length > 0) {\n params.append('media.fields', mediaFields.join(','));\n }\n\n if (pollFields !== undefined && pollFields.length > 0) {\n params.append('poll.fields', pollFields.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (placeFields !== undefined && placeFields.length > 0) {\n params.append('place.fields', placeFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream sampled Likes\n * Streams a 10% sample of public Likes in real-time.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @param partition The partition number.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async likesSample10(\n partition: number,\n options: LikesSample10StreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'likesSample10');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n\n 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields',\n\n 'user.fields': 'userFields',\n\n 'tweet.fields': 'tweetFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n likeWithTweetAuthorFields = [],\n\n expansions = [],\n\n userFields = [],\n\n tweetFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/likes/sample10/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (partition !== undefined) {\n params.append('partition', String(partition));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n if (\n likeWithTweetAuthorFields !== undefined &&\n likeWithTweetAuthorFields.length > 0\n ) {\n params.append(\n 'like_with_tweet_author.fields',\n likeWithTweetAuthorFields.join(',')\n );\n }\n\n if (expansions !== undefined && expansions.length > 0) {\n params.append('expansions', expansions.join(','));\n }\n\n if (userFields !== undefined && userFields.length > 0) {\n params.append('user.fields', userFields.join(','));\n }\n\n if (tweetFields !== undefined && tweetFields.length > 0) {\n params.append('tweet.fields', tweetFields.join(','));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Stream Post labels\n * Streams all labeling events applied to Posts.\n * \n * Returns an event-driven stream that's easy to use.\n * Use .on() to listen for events like 'data', 'error', 'close'.\n * Also supports async iteration with for await...of.\n\n\n\n * @returns {Promise} Event-driven stream for handling streaming data\n */\n async labelsCompliance(\n options: LabelsComplianceStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'labelsCompliance');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n backfill_minutes: 'backfillMinutes',\n\n start_time: 'startTime',\n\n end_time: 'endTime',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n backfillMinutes = undefined,\n\n startTime = undefined,\n\n endTime = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/label/stream';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (backfillMinutes !== undefined) {\n params.append('backfill_minutes', String(backfillMinutes));\n }\n\n if (startTime !== undefined) {\n params.append('start_time', String(startTime));\n }\n\n if (endTime !== undefined) {\n params.append('end_time', String(endTime));\n }\n\n // Make the authenticated request using the main client's request method\n // We need raw: true to get the raw Response object for streaming\n const url = path + (params.toString() ? `?${params.toString()}` : '');\n\n // For streaming requests, we don't want to timeout the initial connection\n // Instead, we'll handle timeouts at the stream level\n const response = (await this.client.request('GET', url, {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n signal: signal,\n raw: true, // Get raw Response object for streaming\n timeout: 0, // Disable timeout for streaming requests\n ...requestOptions,\n })) as Response;\n\n // Handle errors\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n // Return the readable stream\n // The response.body is the actual ReadableStream for streaming\n if (!response.body) {\n throw new Error('Response body is not available for streaming');\n }\n\n // Wrap the ReadableStream in an event-driven interface\n const eventStream = new EventDrivenStream();\n await eventStream.connect(response.body);\n return eventStream;\n }\n\n /**\n * Get stream rule counts\n * Retrieves the count of rules in the active rule set for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async getRuleCounts(\n options: GetRuleCountsStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'getRuleCounts');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'rules_count.fields': 'rulesCountFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n rulesCountFields = [],\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules/counts';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (rulesCountFields !== undefined && rulesCountFields.length > 0) {\n params.append('rules_count.fields', rulesCountFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get stream rules\n * Retrieves the active rule set or a subset of rules for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async getRules(\n options: GetRulesStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'getRules');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n max_results: 'maxResults',\n\n pagination_token: 'paginationToken',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n ids = [],\n\n maxResults = undefined,\n\n paginationToken = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (ids !== undefined && ids.length > 0) {\n params.append('ids', ids.join(','));\n }\n\n if (maxResults !== undefined) {\n params.append('max_results', String(maxResults));\n }\n\n if (paginationToken !== undefined) {\n params.append('pagination_token', String(paginationToken));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Update stream rules\n * Adds or deletes rules from the active rule set for the filtered stream.\n * \n * @returns Promise with the API response\n */\n async updateRules(\n body: any,\n options: UpdateRulesStreamingOptions = {}\n ): Promise {\n // Validate authentication requirements\n\n const requiredAuthTypes = [];\n\n requiredAuthTypes.push('BearerToken');\n\n this.client.validateAuthentication(requiredAuthTypes, 'updateRules');\n\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n dry_run: 'dryRun',\n\n delete_all: 'deleteAll',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n\n const {\n dryRun = undefined,\n\n deleteAll = undefined,\n\n headers = {},\n signal,\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/tweets/search/stream/rules';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (dryRun !== undefined) {\n params.append('dry_run', String(dryRun));\n }\n\n if (deleteAll !== undefined) {\n params.append('delete_all', String(deleteAll));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n signal: signal,\n\n body: JSON.stringify(body),\n\n ...requestOptions,\n };\n\n // Make the request\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * compliance client for the X API.\n *\n * This module provides a client for interacting with the compliance endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport {\n GetJobsResponse,\n CreateJobsRequest,\n CreateJobsResponse,\n GetJobsByIdResponse,\n} from './models.js';\n\n/**\n * Options for getJobs method\n * \n * @public\n */\nexport interface GetJobsOptions {\n /** Status of Compliance Job to list. \n * Also accepts: status or proper camelCase (e.g., status) */\n status?: string;\n\n /** A comma separated list of ComplianceJob fields to display. \n * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */\n complianceJobFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Options for getJobsById method\n * \n * @public\n */\nexport interface GetJobsByIdOptions {\n /** A comma separated list of ComplianceJob fields to display. \n * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */\n complianceJobFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for compliance operations\n * \n * This client provides methods for interacting with the compliance endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all compliance related operations.\n * \n * @category compliance\n */\nexport class ComplianceClient {\n private client: Client;\n\n /**\n * Creates a new compliance client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get Compliance Jobs\n * Retrieves a list of Compliance Jobs filtered by job type and optional status.\n\n\n\n * @param type Type of Compliance Job to list.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getJobs(\n type: string,\n options: GetJobsOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'compliance_job.fields': 'complianceJobFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n status = undefined,\n\n complianceJobFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (type !== undefined) {\n params.append('type', String(type));\n }\n\n if (status !== undefined) {\n params.append('status', String(status));\n }\n\n if (complianceJobFields !== undefined && complianceJobFields.length > 0) {\n params.append('compliance_job.fields', complianceJobFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Create Compliance Job\n * Creates a new Compliance Job for the specified job type.\n\n\n\n * @param body Request body\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async createJobs(body: CreateJobsRequest): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const requestOptions = {};\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n body: JSON.stringify(body || {}),\n\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n // No optional parameters, using empty request options\n };\n\n return this.client.request(\n 'POST',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n\n /**\n * Get Compliance Job by ID\n * Retrieves details of a specific Compliance Job by its ID.\n\n\n * @param id The ID of the Compliance Job to retrieve.\n\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async getJobsById(\n id: string,\n options: GetJobsByIdOptions = {}\n ): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'compliance_job.fields': 'complianceJobFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n complianceJobFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/compliance/jobs/{id}';\n\n path = path.replace('{id}', encodeURIComponent(String(id)));\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (complianceJobFields !== undefined && complianceJobFields.length > 0) {\n params.append('compliance_job.fields', complianceJobFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for compliance operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for getJobs\n * \n * @public\n */\nexport type GetJobsResponse = Schemas.Get2ComplianceJobsResponse;\n/**\n * Request for createJobs\n * \n * @public\n */\nexport type CreateJobsRequest = Schemas.CreateComplianceJobRequest;\n/**\n * Response for createJobs\n * \n * @public\n */\nexport type CreateJobsResponse = Schemas.CreateComplianceJobResponse;\n/**\n * Response for getJobsById\n * \n * @public\n */\nexport type GetJobsByIdResponse = Schemas.Get2ComplianceJobsIdResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n\n/**\n * usage client for the X API.\n *\n * This module provides a client for interacting with the usage endpoints of the X API.\n */\n\nimport { Client, ApiResponse, RequestOptions } from '../client.js';\nimport {\n Paginator,\n PostPaginator,\n UserPaginator,\n EventPaginator,\n} from '../paginator.js';\nimport { GetResponse } from './models.js';\n\n/**\n * Options for get method\n * \n * @public\n */\nexport interface GetOptions {\n /** The number of days for which you need usage for. \n * Also accepts: days or proper camelCase (e.g., days) */\n days?: number;\n\n /** A comma separated list of Usage fields to display. \n * Also accepts: usage.fields or proper camelCase (e.g., usageFields) */\n usageFields?: Array;\n\n /** Additional request options */\n requestOptions?: RequestOptions;\n /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */\n [key: string]: any;\n}\n\n/**\n * Client for usage operations\n * \n * This client provides methods for interacting with the usage endpoints\n * of the X API. It handles authentication, request formatting, and response\n * parsing for all usage related operations.\n * \n * @category usage\n */\nexport class UsageClient {\n private client: Client;\n\n /**\n * Creates a new usage client instance\n * \n * @param client - The main X API client instance\n */\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Normalize options object to handle both camelCase and original API parameter names\n * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields)\n */\n private _normalizeOptions>(\n options: T,\n paramMappings: Record\n ): T {\n if (!options || typeof options !== 'object') {\n return options;\n }\n\n const normalized: any = { ...options };\n\n // For each parameter mapping (original -> proper camelCase)\n for (const [originalName, camelName] of Object.entries(paramMappings)) {\n // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields')\n if (originalName in normalized && !(camelName in normalized)) {\n normalized[camelName] = normalized[originalName];\n delete normalized[originalName];\n }\n // Also check for proper camelCase (e.g., 'tweetFields')\n // If it's already in proper camelCase, keep it (no conversion needed)\n // The camelName is already the proper camelCase format\n }\n\n return normalized as T;\n }\n\n /**\n * Get usage\n * Retrieves usage statistics for Posts over a specified number of days.\n\n\n\n * @returns {Promise} Promise resolving to the API response\n */\n // Overload 1: Default behavior (unwrapped response)\n async get(options: GetOptions = {}): Promise {\n // Normalize options to handle both camelCase and original API parameter names\n\n const paramMappings: Record = {\n 'usage.fields': 'usageFields',\n };\n const normalizedOptions = this._normalizeOptions(\n options || {},\n paramMappings\n );\n\n // Destructure options (exclude path parameters, they're already function params)\n const {\n days = undefined,\n\n usageFields = [],\n\n requestOptions: requestOptions = {},\n } = normalizedOptions;\n\n // Build the path with path parameters\n let path = '/2/usage/tweets';\n\n // Build query parameters\n const params = new URLSearchParams();\n\n if (days !== undefined) {\n params.append('days', String(days));\n }\n\n if (usageFields !== undefined && usageFields.length > 0) {\n params.append('usage.fields', usageFields.join(','));\n }\n\n // Prepare request options\n const finalRequestOptions: RequestOptions = {\n // Pass security requirements for smart auth selection\n security: [\n {\n BearerToken: [],\n },\n ],\n\n ...requestOptions,\n };\n\n return this.client.request(\n 'GET',\n path + (params.toString() ? `?${params.toString()}` : ''),\n finalRequestOptions\n );\n }\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for usage operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for get\n * \n * @public\n */\nexport type GetResponse = Schemas.Get2UsageTweetsResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Main client for the X API.\n *\n * This module provides the main client class for interacting with the X API.\n */\n\nimport { httpClient } from \"./http-client.js\";\nimport { \n Paginator, \n PostPaginator, \n UserPaginator, \n EventPaginator\n} from \"./paginator.js\";\n\n\n\nimport { ActivityClient } from \"./activity/index.js\";\n\n\n\nimport { NewsClient } from \"./news/index.js\";\n\n\n\nimport { ConnectionsClient } from \"./connections/index.js\";\n\n\n\nimport { AccountActivityClient } from \"./account_activity/index.js\";\n\n\n\nimport { SpacesClient } from \"./spaces/index.js\";\n\n\n\nimport { TrendsClient } from \"./trends/index.js\";\n\n\n\nimport { MediaClient } from \"./media/index.js\";\n\n\n\nimport { DirectMessagesClient } from \"./direct_messages/index.js\";\n\n\n\nimport { PostsClient } from \"./posts/index.js\";\n\n\n\nimport { ListsClient } from \"./lists/index.js\";\n\n\n\nimport { CommunityNotesClient } from \"./community_notes/index.js\";\n\n\n\nimport { GeneralClient } from \"./general/index.js\";\n\n\n\nimport { WebhooksClient } from \"./webhooks/index.js\";\n\n\n\nimport { UsersClient } from \"./users/index.js\";\n\n\n\nimport { CommunitiesClient } from \"./communities/index.js\";\n\n\n\nimport { StreamClient } from \"./stream/client.js\";\n\n\n\nimport { ComplianceClient } from \"./compliance/index.js\";\n\n\n\nimport { UsageClient } from \"./usage/index.js\";\n\n\n\n/**\n * Configuration options for the X API client\n */\nexport interface ClientConfig {\n /** Base URL for API requests */\n baseUrl?: string;\n /** Bearer token for authentication */\n bearerToken?: string;\n /** OAuth2 access token */\n accessToken?: string;\n /** OAuth1 instance for authentication */\n oauth1?: any;\n /** Custom headers to include in requests */\n headers?: Record;\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Whether to automatically retry failed requests */\n retry?: boolean;\n /** Maximum number of retry attempts */\n maxRetries?: number;\n}\n\n/**\n * API Error class for handling X API errors\n */\nexport class ApiError extends Error {\n public readonly status: number;\n public readonly statusText: string;\n public readonly headers: Headers;\n public readonly data?: any;\n\n constructor(message: string, status: number, statusText: string, headers: Headers, data?: any) {\n super(message);\n this.name = 'ApiError';\n this.status = status;\n this.statusText = statusText;\n this.headers = headers;\n this.data = data;\n }\n}\n\n/**\n * Request options for API calls\n */\nexport interface RequestOptions {\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Additional headers */\n headers?: Record;\n /** Request signal for cancellation */\n signal?: AbortSignal;\n /** Request body */\n body?: string;\n /** Return raw HTTP wrapper instead of parsed body */\n raw?: boolean;\n /** Security requirements for the endpoint (from OpenAPI spec) - used for smart auth selection */\n security?: Array>;\n}\n\n/**\n * Response wrapper with metadata\n */\nexport interface ApiResponse {\n /** Response body */\n body: T;\n /** Response headers */\n headers: Headers;\n /** HTTP status code */\n status: number;\n /** HTTP status text */\n statusText: string;\n /** Response URL */\n url: string;\n}\n\n/**\n * Pagination metadata\n */\nexport interface PaginationMeta {\n /** Next page token */\n next_token?: string;\n /** Previous page token */\n previous_token?: string;\n /** Total count */\n total_count?: number;\n /** Result count */\n result_count?: number;\n}\n\n\n/**\n * Main client class for the X API\n * \n * This is the primary entry point for interacting with the X API. It provides\n * access to all API endpoints through specialized client modules and handles\n * authentication, request configuration, and error handling.\n * \n * @example\n * ```typescript\n * import { Client } from 'x-api-sdk';\n * \n * const client = new Client({\n * bearerToken: 'your-bearer-token'\n * });\n * \n * // Get user information\n * const user = await client.users.getUser('783214');\n * \n * // Get followers with pagination\n * const followers = await client.users.getFollowers('783214', {\n * maxResults: 10,\n * userFields: ['id', 'name', 'username']\n * });\n * \n * // Iterate through followers\n * for await (const follower of followers) {\n * console.log(follower.username);\n * }\n * ```\n * \n * @category Client\n */\nexport class Client {\n /** Base URL for API requests */\n readonly baseUrl: string;\n /** Bearer token for authentication */\n readonly bearerToken?: string;\n /** OAuth2 access token */\n readonly accessToken?: string;\n /** OAuth1 instance for authentication */\n readonly oauth1?: any;\n /** Headers for requests */\n readonly headers: Headers;\n /** Request timeout in milliseconds */\n readonly timeout: number;\n /** Whether to automatically retry failed requests */\n readonly retry: boolean;\n /** Maximum number of retry attempts */\n readonly maxRetries: number;\n\n /** HTTP client for making requests */\n readonly httpClient = httpClient;\n\n\n /** activity client */\n readonly activity: ActivityClient;\n\n /** news client */\n readonly news: NewsClient;\n\n /** connections client */\n readonly connections: ConnectionsClient;\n\n /** account activity client */\n readonly accountActivity: AccountActivityClient;\n\n /** spaces client */\n readonly spaces: SpacesClient;\n\n /** trends client */\n readonly trends: TrendsClient;\n\n /** media client */\n readonly media: MediaClient;\n\n /** direct messages client */\n readonly directMessages: DirectMessagesClient;\n\n /** posts client */\n readonly posts: PostsClient;\n\n /** lists client */\n readonly lists: ListsClient;\n\n /** community notes client */\n readonly communityNotes: CommunityNotesClient;\n\n /** general client */\n readonly general: GeneralClient;\n\n /** webhooks client */\n readonly webhooks: WebhooksClient;\n\n /** users client */\n readonly users: UsersClient;\n\n /** communities client */\n readonly communities: CommunitiesClient;\n\n /** stream client */\n readonly stream: StreamClient;\n\n /** compliance client */\n readonly compliance: ComplianceClient;\n\n /** usage client */\n readonly usage: UsageClient;\n\n\n /**\n * Creates a new X API client instance\n * \n * @param config - Configuration options for the client\n * \n * @example\n * ```typescript\n * // Bearer token authentication\n * const client = new Client({\n * bearerToken: 'your-bearer-token'\n * });\n * \n * // OAuth2 authentication\n * const client = new Client({\n * accessToken: 'your-access-token'\n * });\n * \n * // OAuth1 authentication\n * const client = new Client({\n * oauth1: oauth1Instance\n * });\n * ```\n */\n constructor(config: ClientConfig | any) {\n // Handle OAuth1 instance passed directly\n if (config && typeof config === 'object' && config.accessToken && config.accessToken.accessToken && config.accessToken.accessTokenSecret) {\n // This is an OAuth1 instance\n this.oauth1 = config;\n this.baseUrl = \"https://api.x.com\";\n } else {\n // This is a regular config object\n const clientConfig = config as ClientConfig;\n this.baseUrl = clientConfig.baseUrl || \"https://api.x.com\";\n this.bearerToken = clientConfig.bearerToken;\n this.accessToken = clientConfig.accessToken;\n this.oauth1 = clientConfig.oauth1;\n }\n \n this.timeout = (config as ClientConfig).timeout || 30000;\n this.retry = (config as ClientConfig).retry ?? true;\n this.maxRetries = (config as ClientConfig).maxRetries || 3;\n \n // Initialize headers\n const defaultHeaders: Record = {\n 'User-Agent': 'xdk-typescript/0.2.1-beta',\n 'Content-Type': 'application/json',\n 'Accept': 'application/json',\n ...((config as ClientConfig).headers || {}),\n };\n \n this.headers = httpClient.createHeaders(defaultHeaders);\n\n\n this.activity = new ActivityClient(this);\n\n this.news = new NewsClient(this);\n\n this.connections = new ConnectionsClient(this);\n\n this.accountActivity = new AccountActivityClient(this);\n\n this.spaces = new SpacesClient(this);\n\n this.trends = new TrendsClient(this);\n\n this.media = new MediaClient(this);\n\n this.directMessages = new DirectMessagesClient(this);\n\n this.posts = new PostsClient(this);\n\n this.lists = new ListsClient(this);\n\n this.communityNotes = new CommunityNotesClient(this);\n\n this.general = new GeneralClient(this);\n\n this.webhooks = new WebhooksClient(this);\n\n this.users = new UsersClient(this);\n\n this.communities = new CommunitiesClient(this);\n\n this.stream = new StreamClient(this);\n\n this.compliance = new ComplianceClient(this);\n\n this.usage = new UsageClient(this);\n\n }\n\n /**\n * Make an authenticated request to the X API\n * \n * This method handles authentication, request formatting, and error handling\n * for all API requests. It automatically adds the appropriate authentication\n * headers based on the client configuration.\n * \n * @param method - HTTP method (GET, POST, PUT, DELETE, etc.)\n * @param path - API endpoint path (e.g., '/2/users/by/username/username')\n * @param options - Request options including timeout, headers, and body\n * @returns Promise that resolves to the parsed response data\n * \n * @example\n * ```typescript\n * // GET request\n * const user = await client.request('GET', '/2/users/by/username/username', {\n * timeout: 5000\n * });\n * \n * // POST request with body\n * const result = await client.request('POST', '/2/tweets', {\n * body: JSON.stringify({ text: 'Hello World!' })\n * });\n * ```\n * \n * @throws {ApiError} When the API returns an error response\n */\n async request(\n method: string,\n path: string,\n options: RequestOptions = {}\n ): Promise {\n const url = `${this.baseUrl}${path}`;\n const headers = new Headers(this.headers);\n \n // Select the best authentication method based on endpoint requirements\n const selectedAuth = this.selectAuthMethod(method, options.security);\n \n // Add authentication headers based on selected method\n if (selectedAuth === 'bearer_token' && this.bearerToken) {\n headers.set('Authorization', `Bearer ${this.bearerToken}`);\n } else if (selectedAuth === 'oauth2_user_context' && this.accessToken) {\n headers.set('Authorization', `Bearer ${this.accessToken}`);\n } else if (selectedAuth === 'oauth1' && this.oauth1 && this.oauth1.accessToken) {\n // OAuth1 authentication - build proper OAuth1 header\n try {\n const oauthHeader = await this.oauth1.buildRequestHeader(method, url, options.body || '');\n headers.set('Authorization', oauthHeader);\n \n // Keep Content-Type header for JSON requests - X API requires it\n // Only remove Content-Type for form-encoded OAuth1 requests\n // JSON bodies are not included in OAuth1 signature (per OAuth1 spec)\n } catch (error) {\n throw new Error(`Failed to build OAuth1 header: ${error instanceof Error ? error.message : 'Unknown error'}`);\n }\n } else if (!selectedAuth) {\n // No suitable auth method found - validate authentication\n const requiredSchemes = options.security \n ? options.security.flatMap(req => Object.keys(req))\n : [];\n if (requiredSchemes.length > 0) {\n this.validateAuthentication(requiredSchemes, path);\n }\n }\n \n // Add custom headers\n if (options.headers) {\n Object.entries(options.headers).forEach(([key, value]) => {\n headers.set(key, value);\n });\n }\n\n try {\n const response = await this.httpClient.request(url, {\n method,\n headers,\n signal: options.signal,\n body: options.body,\n timeout: options.timeout !== undefined ? options.timeout : this.timeout,\n });\n\n if (!response.ok) {\n let errorData: any;\n try {\n errorData = await response.json();\n } catch {\n errorData = await response.text();\n }\n \n throw new ApiError(\n errorData && errorData.message ? errorData.message : `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n response.headers,\n errorData\n );\n }\n\n // For streaming requests, return the raw Response object\n if (options.raw) {\n return response as any; // Return the actual Response object for streaming\n }\n\n let data: T;\n const contentType = response.headers.get('content-type');\n if (contentType && contentType.includes('application/json')) {\n data = await response.json();\n } else {\n data = await response.text() as T;\n }\n\n // Return parsed body for non-streaming requests\n return data;\n } catch (error) {\n if (error instanceof ApiError) {\n throw error;\n }\n throw new ApiError(\n error instanceof Error ? error.message : 'Request failed',\n 0,\n 'NETWORK_ERROR',\n new Headers(),\n error\n );\n }\n }\n\n /**\n * Check if the OAuth2 token is expired\n */\n isTokenExpired(): boolean {\n // TODO: Implement token expiration check\n return false;\n }\n\n /**\n * Refresh the OAuth2 token\n */\n async refreshToken(): Promise {\n // TODO: Implement token refresh\n }\n\n /**\n * Get the current authentication status\n */\n isAuthenticated(): boolean {\n return !!(this.bearerToken || this.accessToken || (this.oauth1 && this.oauth1.accessToken));\n }\n\n /**\n * Map OpenAPI security scheme names to internal authentication types\n * @param securitySchemeName The security scheme name from OpenAPI\n * @returns Array of internal authentication types\n */\n public mapSecuritySchemeToAuthTypes(securitySchemeName: string): string[] {\n // Mappings for X/Twitter API security schemes\n const schemeMapping: Record = {\n 'BearerToken': ['bearer_token'], // App-only OAuth2.0\n 'OAuth2UserToken': ['oauth2_user_context'], // OAuth2.0 User Context\n 'UserToken': ['oauth1'], // OAuth1.0a User Context\n // Fallback mappings for common variations\n 'OAuth2': ['bearer_token', 'oauth2_user_context'],\n 'OAuth1': ['oauth1'],\n 'Bearer': ['bearer_token'],\n 'OAuth2User': ['oauth2_user_context'],\n 'OAuth1User': ['oauth1'],\n };\n\n return schemeMapping[securitySchemeName] || [securitySchemeName.toLowerCase()];\n }\n\n /**\n * Select the best authentication method based on endpoint requirements and available credentials\n * \n * Priority strategy:\n * 1. If endpoint only accepts one method, use that (if available)\n * 2. If endpoint accepts multiple methods:\n * - For write operations (POST/PUT/DELETE): Prefer OAuth1 > OAuth2 User Token > Bearer Token\n * - For read operations (GET): Prefer Bearer Token > OAuth2 User Token > OAuth1\n * - This allows Bearer Token for read-only operations while using user context for writes\n * \n * @param method HTTP method (GET, POST, etc.)\n * @param securityRequirements Security requirements from OpenAPI spec (array of security requirement objects)\n * @returns Selected auth method: 'bearer_token', 'oauth2_user_context', 'oauth1', or null if none available\n */\n private selectAuthMethod(method: string, securityRequirements?: Array>): 'bearer_token' | 'oauth2_user_context' | 'oauth1' | null {\n // If no security requirements, use default priority\n if (!securityRequirements || securityRequirements.length === 0) {\n if (this.bearerToken) return 'bearer_token';\n if (this.accessToken) return 'oauth2_user_context';\n if (this.oauth1 && this.oauth1.accessToken) return 'oauth1';\n return null;\n }\n\n // Extract all acceptable security schemes from requirements\n // Security requirements are OR'd together (any one can be used)\n const acceptableSchemes = new Set();\n for (const requirement of securityRequirements) {\n for (const schemeName of Object.keys(requirement)) {\n acceptableSchemes.add(schemeName);\n }\n }\n\n // Check what auth methods we have available\n const availableAuth: Record = {\n 'BearerToken': !!this.bearerToken,\n 'OAuth2UserToken': !!this.accessToken,\n 'UserToken': !!(this.oauth1 && this.oauth1.accessToken),\n };\n\n // If only one scheme is acceptable, use it if available\n if (acceptableSchemes.size === 1) {\n const scheme = Array.from(acceptableSchemes)[0];\n if (availableAuth[scheme]) {\n return this.mapSecuritySchemeToAuthTypes(scheme)[0] as 'bearer_token' | 'oauth2_user_context' | 'oauth1';\n }\n return null;\n }\n\n // Multiple schemes acceptable - use priority based on operation type\n const isWriteOperation = ['POST', 'PUT', 'DELETE', 'PATCH'].includes(method.toUpperCase());\n \n // Priority order for write operations: OAuth1 > OAuth2 User Token > Bearer Token\n // (User context is required for most write operations)\n if (isWriteOperation) {\n if (acceptableSchemes.has('UserToken') && availableAuth['UserToken']) {\n return 'oauth1';\n }\n if (acceptableSchemes.has('OAuth2UserToken') && availableAuth['OAuth2UserToken']) {\n return 'oauth2_user_context';\n }\n if (acceptableSchemes.has('BearerToken') && availableAuth['BearerToken']) {\n return 'bearer_token';\n }\n } else {\n // Priority order for read operations: Bearer Token > OAuth2 User Token > OAuth1\n // (Bearer Token is simpler for read-only operations)\n if (acceptableSchemes.has('BearerToken') && availableAuth['BearerToken']) {\n return 'bearer_token';\n }\n if (acceptableSchemes.has('OAuth2UserToken') && availableAuth['OAuth2UserToken']) {\n return 'oauth2_user_context';\n }\n if (acceptableSchemes.has('UserToken') && availableAuth['UserToken']) {\n return 'oauth1';\n }\n }\n\n return null;\n }\n\n /**\n * Validate that the required authentication method is available\n * @param requiredAuthTypes Array of required authentication types (OpenAPI security scheme names)\n * @param operationName Name of the operation for error messages\n */\n public validateAuthentication(requiredAuthTypes: string[], operationName: string): void {\n if (requiredAuthTypes.length === 0) {\n return; // No authentication required\n }\n\n const availableAuthTypes: string[] = [];\n \n if (this.bearerToken) {\n availableAuthTypes.push('bearer_token');\n }\n if (this.accessToken) {\n availableAuthTypes.push('oauth2_user_context');\n }\n if (this.oauth1 && this.oauth1.accessToken) {\n availableAuthTypes.push('oauth1');\n }\n\n // Map OpenAPI security schemes to internal auth types\n const mappedRequiredTypes = requiredAuthTypes.flatMap(scheme => \n this.mapSecuritySchemeToAuthTypes(scheme)\n );\n\n // Check if any of the required auth types are available\n const hasRequiredAuth = mappedRequiredTypes.some(required => \n availableAuthTypes.includes(required)\n );\n\n if (!hasRequiredAuth) {\n const availableStr = availableAuthTypes.length > 0 ? availableAuthTypes.join(', ') : 'none';\n const requiredStr = requiredAuthTypes.join(', ');\n throw new Error(\n `Authentication required for ${operationName}. ` +\n `Required: ${requiredStr}. ` +\n `Available: ${availableStr}. ` +\n `Please configure the appropriate authentication method.`\n );\n }\n }\n\n /**\n * Get available authentication types\n */\n getAvailableAuthTypes(): string[] {\n const authTypes: string[] = [];\n if (this.bearerToken) authTypes.push('bearer_token');\n if (this.accessToken) authTypes.push('oauth2_user_context');\n if (this.oauth1 && this.oauth1.accessToken) authTypes.push('oauth1');\n return authTypes;\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Environment-agnostic cryptographic utilities for the X API SDK.\n * Provides HMAC-SHA1 implementation that works in both Node.js and browser environments.\n */\n\n/**\n * HMAC-SHA1 implementation that works in both Node.js and browser environments\n */\nexport class CryptoUtils {\n /**\n * Generate HMAC-SHA1 signature\n * @param key Signing key\n * @param message Message to sign\n * @returns Base64 encoded signature\n */\n static async hmacSha1(key: string, message: string): Promise {\n // Try to use native Node.js crypto first\n if (\n typeof process !== 'undefined' &&\n process.versions &&\n process.versions.node\n ) {\n try {\n return await this._nodeHmacSha1(key, message);\n } catch (error) {\n // Fall back to Web Crypto API or polyfill\n console.warn('Node.js crypto failed, falling back:', error);\n }\n }\n\n // Try Web Crypto API (modern browsers)\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n try {\n return await this._webCryptoHmacSha1(key, message);\n } catch (error) {\n // Fall back to polyfill\n console.warn('Web Crypto API failed, falling back:', error);\n }\n }\n\n // Fall back to polyfill implementation\n return this._polyfillHmacSha1(key, message);\n }\n\n /**\n * Node.js native HMAC-SHA1 implementation\n */\n private static async _nodeHmacSha1(\n key: string,\n message: string\n ): Promise {\n // Dynamic import for Node.js crypto module (ES module compatible)\n const crypto = await import('crypto');\n const hmac = crypto.createHmac('sha1', key);\n hmac.update(message);\n return hmac.digest('base64');\n }\n\n /**\n * Web Crypto API HMAC-SHA1 implementation\n */\n private static async _webCryptoHmacSha1(\n key: string,\n message: string\n ): Promise {\n // Convert string key to ArrayBuffer\n const keyBuffer = this._stringToArrayBuffer(key);\n const messageBuffer = this._stringToArrayBuffer(message);\n\n // Import the key\n const cryptoKey = await crypto.subtle.importKey(\n 'raw',\n keyBuffer,\n { name: 'HMAC', hash: 'SHA-1' },\n false,\n ['sign']\n );\n\n // Sign the message\n const signature = await crypto.subtle.sign(\n 'HMAC',\n cryptoKey,\n messageBuffer\n );\n\n // Convert to base64\n return this._arrayBufferToBase64(signature);\n }\n\n /**\n * Polyfill HMAC-SHA1 implementation using pure JavaScript\n * This is a fallback that works everywhere but is slower\n */\n private static _polyfillHmacSha1(key: string, message: string): string {\n // For now, throw an error to indicate that proper crypto is needed\n // This will help identify when the fallback is being used\n throw new Error(\n 'HMAC-SHA1 polyfill not implemented. Please ensure Node.js crypto or Web Crypto API is available.'\n );\n\n // In a real implementation, you would use a library like crypto-js:\n // import CryptoJS from 'crypto-js';\n // return CryptoJS.HmacSHA1(message, key).toString(CryptoJS.enc.Base64);\n }\n\n /**\n * Convert string to ArrayBuffer\n */\n private static _stringToArrayBuffer(str: string): ArrayBuffer {\n const buffer = new ArrayBuffer(str.length);\n const view = new Uint8Array(buffer);\n for (let i = 0; i < str.length; i++) {\n view[i] = str.charCodeAt(i);\n }\n return buffer;\n }\n\n /**\n * Convert ArrayBuffer to base64 string\n */\n private static _arrayBufferToBase64(buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return btoa(binary);\n }\n\n /**\n * Generate a random nonce for OAuth\n * @param length Length of the nonce\n * @returns Random nonce string\n */\n static generateNonce(length: number = 32): string {\n if (typeof crypto !== 'undefined' && crypto.getRandomValues) {\n // Use crypto.getRandomValues if available\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join(\n ''\n );\n } else {\n // Fallback to Math.random (less secure but functional)\n let result = '';\n const characters =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n for (let i = 0; i < length; i++) {\n result += characters.charAt(\n Math.floor(Math.random() * characters.length)\n );\n }\n return result;\n }\n }\n\n /**\n * Generate timestamp for OAuth\n * @returns Unix timestamp as string\n */\n static generateTimestamp(): string {\n return Math.floor(Date.now() / 1000).toString();\n }\n\n /**\n * Generate a cryptographically secure random string for PKCE code verifier\n * @param length Length of the code verifier (43-128 characters recommended)\n * @returns Random code verifier string\n */\n static generateCodeVerifier(length: number = 128): string {\n if (typeof crypto !== 'undefined' && crypto.getRandomValues) {\n // Use crypto.getRandomValues if available\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n // Convert to base64url encoding (RFC 7636)\n return this._base64UrlEncode(array);\n } else {\n // Fallback to Math.random (less secure but functional)\n const characters =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';\n let result = '';\n for (let i = 0; i < length; i++) {\n result += characters.charAt(\n Math.floor(Math.random() * characters.length)\n );\n }\n return result;\n }\n }\n\n /**\n * Generate PKCE code challenge from code verifier\n * @param codeVerifier The code verifier string\n * @returns Base64url encoded SHA256 hash of the code verifier\n */\n static async generateCodeChallenge(codeVerifier: string): Promise {\n // Try to use native Node.js crypto first\n if (\n typeof process !== 'undefined' &&\n process.versions &&\n process.versions.node\n ) {\n try {\n return await this._nodeSha256(codeVerifier);\n } catch (error) {\n console.warn('Node.js crypto failed for SHA256, falling back:', error);\n }\n }\n\n // Try Web Crypto API (modern browsers)\n if (typeof crypto !== 'undefined' && crypto.subtle) {\n try {\n return await this._webCryptoSha256(codeVerifier);\n } catch (error) {\n console.warn('Web Crypto API failed for SHA256, falling back:', error);\n }\n }\n\n // Fall back to polyfill implementation\n return this._polyfillSha256(codeVerifier);\n }\n\n /**\n * Node.js native SHA256 implementation for PKCE\n */\n private static async _nodeSha256(message: string): Promise {\n const crypto = await import('crypto');\n const hash = crypto.createHash('sha256');\n hash.update(message);\n const digest = hash.digest();\n return this._base64UrlEncode(digest);\n }\n\n /**\n * Web Crypto API SHA256 implementation for PKCE\n */\n private static async _webCryptoSha256(message: string): Promise {\n const messageBuffer = this._stringToArrayBuffer(message);\n const hashBuffer = await crypto.subtle.digest('SHA-256', messageBuffer);\n return this._base64UrlEncode(hashBuffer);\n }\n\n /**\n * Polyfill SHA256 implementation for PKCE\n * This is a fallback that works everywhere but is slower\n */\n private static _polyfillSha256(message: string): string {\n // For now, throw an error to indicate that proper crypto is needed\n throw new Error(\n 'SHA256 polyfill not implemented. Please ensure Node.js crypto or Web Crypto API is available.'\n );\n\n // In a real implementation, you would use a library like crypto-js:\n // import CryptoJS from 'crypto-js';\n // return CryptoJS.SHA256(message).toString(CryptoJS.enc.Base64url);\n }\n\n /**\n * Convert ArrayBuffer or Uint8Array to base64url encoding (RFC 7636)\n */\n private static _base64UrlEncode(buffer: ArrayBuffer | Uint8Array): string {\n const bytes =\n buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n // Convert to base64url: replace + with -, / with _, and remove padding =\n return btoa(binary)\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '');\n }\n}\n\n/**\n * Convenience function for HMAC-SHA1\n * @param key Signing key\n * @param message Message to sign\n * @returns Promise that resolves to base64 encoded signature\n */\nexport async function hmacSha1(key: string, message: string): Promise {\n return CryptoUtils.hmacSha1(key, message);\n}\n\n/**\n * Convenience function for generating nonce\n * @param length Length of the nonce\n * @returns Random nonce string\n */\nexport function generateNonce(length: number = 32): string {\n return CryptoUtils.generateNonce(length);\n}\n\n/**\n * Convenience function for generating timestamp\n * @returns Unix timestamp as string\n */\nexport function generateTimestamp(): string {\n return CryptoUtils.generateTimestamp();\n}\n\n/**\n * Convenience function for generating PKCE code verifier\n * @param length Length of the code verifier\n * @returns Random code verifier string\n */\nexport function generateCodeVerifier(length: number = 128): string {\n return CryptoUtils.generateCodeVerifier(length);\n}\n\n/**\n * Convenience function for generating PKCE code challenge\n * @param codeVerifier The code verifier string\n * @returns Promise that resolves to base64url encoded SHA256 hash\n */\nexport async function generateCodeChallenge(\n codeVerifier: string\n): Promise {\n return CryptoUtils.generateCodeChallenge(codeVerifier);\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OAuth2 authentication utilities for the X API.\n */\n\nimport { CryptoUtils, generateCodeVerifier, generateCodeChallenge } from './crypto_utils.js';\n\n/**\n * OAuth2 configuration options\n */\nexport interface OAuth2Config {\n /** Client ID */\n clientId: string;\n /** Client secret (optional for public clients) */\n clientSecret?: string;\n /** Redirect URI */\n redirectUri: string;\n /** Scopes to request */\n scope?: string[];\n}\n\n/**\n * OAuth2 token response\n */\nexport interface OAuth2Token {\n /** Access token */\n access_token: string;\n /** Token type */\n token_type: string;\n /** Expiration time in seconds */\n expires_in: number;\n /** Refresh token */\n refresh_token?: string;\n /** Scopes granted */\n scope?: string;\n}\n\n/**\n * OAuth2 authentication handler\n */\nexport class OAuth2 {\n private config: OAuth2Config;\n private token?: OAuth2Token;\n private codeVerifier?: string;\n private codeChallenge?: string;\n\n constructor(config: OAuth2Config) {\n this.config = {\n scope: ['tweet.read', 'users.read'],\n ...config\n };\n }\n\n /**\n * Get the authorization URL\n * @param state Optional state parameter for security\n * @returns Authorization URL\n */\n async getAuthorizationUrl(state?: string): Promise {\n const params = new URLSearchParams({\n response_type: 'code',\n client_id: this.config.clientId,\n redirect_uri: this.config.redirectUri,\n scope: this.config.scope?.join(' ') || '',\n state: state || ''\n });\n\n // PKCE parameters are handled separately - not generated automatically\n\n return `https://x.com/i/oauth2/authorize?${params.toString()}`;\n }\n\n /**\n * Exchange authorization code for tokens\n * @param code Authorization code from callback\n * @param codeVerifier Optional code verifier for PKCE\n * @returns Promise with OAuth2 token\n */\n async exchangeCode(code: string, codeVerifier?: string): Promise {\n const params = new URLSearchParams({\n grant_type: 'authorization_code',\n code,\n redirect_uri: this.config.redirectUri\n });\n\n // Add PKCE code verifier if provided\n if (codeVerifier) {\n params.append('code_verifier', codeVerifier);\n }\n\n // Prepare headers\n const headers: Record = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n };\n\n // Add Basic Auth header if client secret is provided (optional but recommended)\n if (this.config.clientSecret) {\n const credentials = this._base64Encode(`${this.config.clientId}:${this.config.clientSecret}`);\n headers['Authorization'] = `Basic ${credentials}`;\n } else {\n // Only add client_id to body if no client_secret (public client)\n params.append('client_id', this.config.clientId);\n }\n \n const response = await fetch('https://api.x.com/2/oauth2/token', {\n method: 'POST',\n headers,\n body: params.toString()\n });\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => response.text());\n throw new Error(`HTTP error! status: ${response.status}, body: ${JSON.stringify(errorData)}`);\n }\n\n const data = await response.json();\n this.token = {\n access_token: data.access_token,\n token_type: data.token_type,\n expires_in: data.expires_in,\n refresh_token: data.refresh_token,\n scope: data.scope\n };\n\n return this.token;\n }\n\n /**\n * Get the current token\n * @returns Current OAuth2 token if available\n */\n getToken(): OAuth2Token | undefined {\n return this.token;\n }\n\n /**\n * Get the current code verifier (for PKCE)\n * @returns Current code verifier if available\n */\n getCodeVerifier(): string | undefined {\n return this.codeVerifier;\n }\n\n\n /**\n * Manually set PKCE parameters\n * @param codeVerifier The code verifier to use\n * @param codeChallenge Optional code challenge (will be generated if not provided)\n */\n async setPkceParameters(codeVerifier: string, codeChallenge?: string): Promise {\n this.codeVerifier = codeVerifier;\n if (codeChallenge) {\n this.codeChallenge = codeChallenge;\n } else {\n this.codeChallenge = await generateCodeChallenge(codeVerifier);\n }\n }\n\n /**\n * Get the current code challenge (for PKCE)\n * @returns Current code challenge if available\n */\n getCodeChallenge(): string | undefined {\n return this.codeChallenge;\n }\n\n /**\n * Base64 encode a string (with fallback for environments without btoa)\n * @param str String to encode\n * @returns Base64 encoded string\n */\n private _base64Encode(str: string): string {\n if (typeof btoa !== 'undefined') {\n return btoa(str);\n } else if (typeof Buffer !== 'undefined') {\n // Node.js fallback\n return Buffer.from(str, 'utf8').toString('base64');\n } else {\n // Manual base64 encoding fallback\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n let result = '';\n let i = 0;\n while (i < str.length) {\n const a = str.charCodeAt(i++);\n const b = i < str.length ? str.charCodeAt(i++) : 0;\n const c = i < str.length ? str.charCodeAt(i++) : 0;\n const bitmap = (a << 16) | (b << 8) | c;\n result += chars.charAt((bitmap >> 18) & 63);\n result += chars.charAt((bitmap >> 12) & 63);\n result += i - 2 < str.length ? chars.charAt((bitmap >> 6) & 63) : '=';\n result += i - 1 < str.length ? chars.charAt(bitmap & 63) : '=';\n }\n return result;\n }\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OAuth1 authentication utilities for the X API.\n */\n\nimport { CryptoUtils, generateNonce, generateTimestamp } from './crypto_utils.js';\n\n/**\n * OAuth1 configuration options\n */\nexport interface OAuth1Config {\n /** API Key (Consumer Key) */\n apiKey: string;\n /** API Secret (Consumer Secret) */\n apiSecret: string;\n /** Callback URL for OAuth flow */\n callback: string;\n /** Access Token (if already obtained) */\n accessToken?: string;\n /** Access Token Secret (if already obtained) */\n accessTokenSecret?: string;\n}\n\n/**\n * OAuth1 request token response\n */\nexport interface OAuth1RequestToken {\n /** OAuth token */\n oauthToken: string;\n /** OAuth token secret */\n oauthTokenSecret: string;\n}\n\n/**\n * OAuth1 access token response\n */\nexport interface OAuth1AccessToken {\n /** Access token */\n accessToken: string;\n /** Access token secret */\n accessTokenSecret: string;\n}\n\n/**\n * OAuth1 authentication handler\n */\nexport class OAuth1 {\n private config: OAuth1Config;\n public requestToken?: OAuth1RequestToken;\n public accessToken?: OAuth1AccessToken;\n\n constructor(config: OAuth1Config) {\n this.config = config;\n \n // If access token is provided, set it\n if (config.accessToken && config.accessTokenSecret) {\n this.accessToken = {\n accessToken: config.accessToken,\n accessTokenSecret: config.accessTokenSecret\n };\n }\n }\n\n /**\n * Get the authorization URL for OAuth1 flow\n * @param loginWithX Whether to use \"Log in with X\" flow\n * @returns Authorization URL\n */\n getAuthorizationUrl(loginWithX: boolean = false): string {\n if (!this.requestToken) {\n throw new Error('Request token not obtained. Call getRequestToken() first.');\n }\n\n const baseUrl = loginWithX \n ? 'https://x.com/i/oauth/authenticate'\n : 'https://x.com/oauth/authorize';\n\n const params = new URLSearchParams({\n oauth_token: this.requestToken.oauthToken\n });\n\n return `${baseUrl}?${params.toString()}`;\n }\n\n /**\n * Get request token to start OAuth1 flow\n * @returns Promise with request token\n */\n async getRequestToken(): Promise {\n const url = 'https://api.x.com/oauth/request_token';\n \n const params = new URLSearchParams({\n oauth_callback: this.config.callback\n });\n\n const response = await fetch(`${url}?${params.toString()}`, {\n method: 'POST',\n headers: {\n 'Authorization': await this._buildOAuthHeader('POST', url, params.toString())\n }\n });\n\n if (!response.ok) {\n throw new Error(`Failed to get request token: ${response.status} ${response.statusText}`);\n }\n\n const responseText = await response.text();\n const responseParams = new URLSearchParams(responseText);\n \n this.requestToken = {\n oauthToken: responseParams.get('oauth_token')!,\n oauthTokenSecret: responseParams.get('oauth_token_secret')!\n };\n\n return this.requestToken;\n }\n\n /**\n * Exchange verifier for access token\n * @param verifier OAuth verifier from callback or PIN\n * @returns Promise with access token\n */\n async getAccessToken(verifier: string): Promise {\n if (!this.requestToken) {\n throw new Error('Request token not obtained. Call getRequestToken() first.');\n }\n\n const url = 'https://api.x.com/oauth/access_token';\n \n const params = new URLSearchParams({\n oauth_token: this.requestToken.oauthToken,\n oauth_verifier: verifier\n });\n\n const response = await fetch(`${url}?${params.toString()}`, {\n method: 'POST',\n headers: {\n 'Authorization': await this._buildOAuthHeader('POST', url, params.toString())\n }\n });\n\n if (!response.ok) {\n throw new Error(`Failed to get access token: ${response.status} ${response.statusText}`);\n }\n\n const responseText = await response.text();\n const responseParams = new URLSearchParams(responseText);\n \n this.accessToken = {\n accessToken: responseParams.get('oauth_token')!,\n accessTokenSecret: responseParams.get('oauth_token_secret')!\n };\n\n return this.accessToken;\n }\n\n /**\n * Build OAuth1 authorization header\n * @param method HTTP method\n * @param url Request URL\n * @param body Request body\n * @returns Promise that resolves to OAuth1 authorization header string\n */\n private async _buildOAuthHeader(method: string, url: string, body: string): Promise {\n const timestamp = generateTimestamp();\n const nonce = generateNonce();\n \n const oauthParams: Record = {\n oauth_consumer_key: this.config.apiKey,\n oauth_nonce: nonce,\n oauth_signature_method: 'HMAC-SHA1',\n oauth_timestamp: timestamp,\n oauth_version: '1.0'\n };\n\n // Add request token if available\n if (this.requestToken) {\n oauthParams['oauth_token'] = this.requestToken.oauthToken;\n }\n\n // Add access token if available\n if (this.accessToken) {\n oauthParams['oauth_token'] = this.accessToken.accessToken;\n }\n\n // Build signature base string\n const paramString = this._buildParamString(oauthParams, body);\n const signatureBase = `${method.toUpperCase()}&${this._encode(url)}&${this._encode(paramString)}`;\n \n // Generate signature\n const signingKey = `${this._encode(this.config.apiSecret)}&${this._encode(\n this.requestToken?.oauthTokenSecret || this.accessToken?.accessTokenSecret || ''\n )}`;\n \n const signature = await CryptoUtils.hmacSha1(signingKey, signatureBase);\n oauthParams['oauth_signature'] = signature;\n\n // Build authorization header\n const headerParams = Object.entries(oauthParams)\n .map(([key, value]) => `${key}=\"${this._encode(value)}\"`)\n .join(', ');\n\n return `OAuth ${headerParams}`;\n }\n\n /**\n * Build parameter string for OAuth signature\n * @param oauthParams OAuth parameters\n * @param body Request body\n * @returns Parameter string\n */\n private _buildParamString(oauthParams: Record, body: string): string {\n const allParams = { ...oauthParams };\n \n // Parse body parameters if present and it's form-encoded (not JSON)\n // According to OAuth1 spec, JSON bodies should NOT be included in the signature\n if (body) {\n // Check if body is JSON by attempting to parse it\n let isJson = false;\n try {\n JSON.parse(body);\n isJson = true;\n } catch {\n // Not valid JSON, treat as form-encoded\n isJson = false;\n }\n \n if (!isJson) {\n // Only parse form-encoded bodies\n try {\n const bodyParams = new URLSearchParams(body);\n bodyParams.forEach((value, key) => {\n allParams[key] = value;\n });\n } catch (error) {\n // If body parsing fails, ignore it\n console.warn('Failed to parse body parameters:', error);\n }\n }\n // If body is JSON, we don't include it in the signature (per OAuth1 spec)\n }\n\n // Sort parameters alphabetically\n const sortedParams = Object.entries(allParams).sort(([a], [b]) => a.localeCompare(b));\n \n return sortedParams\n .map(([key, value]) => `${this._encode(key)}=${this._encode(value)}`)\n .join('&');\n }\n\n /**\n * URL encode string according to OAuth1 specification\n * @param str String to encode\n * @returns Encoded string\n */\n private _encode(str: string): string {\n return encodeURIComponent(str)\n .replace(/!/g, '%21')\n .replace(/\\*/g, '%2A')\n .replace(/'/g, '%27')\n .replace(/\\(/g, '%28')\n .replace(/\\)/g, '%29')\n .replace(/%7E/g, '~');\n }\n\n /**\n * Convenience method to start the OAuth1 flow\n * @param loginWithX Whether to use \"Log in with X\" flow\n * @returns Promise that resolves to the authorization URL\n */\n async startOAuthFlow(loginWithX: boolean = false): Promise {\n await this.getRequestToken();\n return this.getAuthorizationUrl(loginWithX);\n }\n\n /**\n * Build OAuth1 authorization header for API requests\n * @param method HTTP method\n * @param url Request URL\n * @param body Request body\n * @returns Promise that resolves to OAuth1 authorization header string\n */\n async buildRequestHeader(method: string, url: string, body: string = ''): Promise {\n if (!this.accessToken) {\n throw new Error('Access token not available. Complete OAuth1 flow first.');\n }\n\n // Extract query parameters from URL if present\n let urlWithoutQuery = url;\n let queryParams = '';\n \n try {\n const urlObj = new URL(url);\n if (urlObj.search) {\n queryParams = urlObj.search.substring(1); // Remove the '?' prefix\n urlWithoutQuery = urlObj.origin + urlObj.pathname;\n }\n } catch (error) {\n // If URL parsing fails, use the original URL\n console.warn('Failed to parse URL for OAuth1:', error);\n }\n\n // Combine query parameters with body parameters\n let allParams = '';\n if (queryParams && body) {\n allParams = `${queryParams}&${body}`;\n } else if (queryParams) {\n allParams = queryParams;\n } else if (body) {\n allParams = body;\n }\n\n return this._buildOAuthHeader(method, urlWithoutQuery, allParams);\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * OpenAPI Schema Types\n * Auto-generated from OpenAPI components/schemas\n *\n * @internal\n */\n\n/**\nThe unique identifier of an Activity event.\n *\n * @public\n */\nexport type ActivityEventId = string; /**\nAn activity event or error that can be returned by the x activity streaming API.\n *\n * @public\n */\nexport interface ActivityStreamingResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for ActivityStreamingResponsePayload\n *\n * @public\n */\nexport type ActivityStreamingResponsePayload = any; /**\nAn XActivity subscription.\n *\n * @public\n */\nexport interface ActivitySubscription {\n /** none */ createdAt: string;\n /** none */ eventType: string;\n filter: ActivitySubscriptionFilter;\n subscriptionId: ActivitySubscriptionId;\n /** none */ tag?: string;\n /** none */ updatedAt: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionCreateRequest\n *\n * @public\n */\nexport interface ActivitySubscriptionCreateRequest {\n /** none */ eventType:\n | 'ProfileBioUpdate'\n | 'ProfilePictureUpdate'\n | 'ProfileBannerPictureUpdate'\n | 'ProfileScreennameUpdate'\n | 'ProfileGeoUpdate'\n | 'ProfileUrlUpdate'\n | 'ProfileVerifiedBadgeUpdate'\n | 'TrendsNew';\n filter: ActivitySubscriptionFilter;\n /** none */ tag?: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionCreateResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for ActivitySubscriptionDeleteResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nAn XAA subscription.\n *\n * @public\n */\nexport interface ActivitySubscriptionFilter {\n keyword?: Keyword;\n userId?: UserId;\n} /**\nSchema type for ActivitySubscriptionGetResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionGetResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nThe unique identifier of this subscription.\n *\n * @public\n */\nexport type ActivitySubscriptionId = string; /**\nSchema type for ActivitySubscriptionUpdateRequest\n *\n * @public\n */\nexport interface ActivitySubscriptionUpdateRequest {\n /** none */ tag?: string;\n webhookId?: WebhookConfigId;\n} /**\nSchema type for ActivitySubscriptionUpdateResponse\n *\n * @public\n */\nexport interface ActivitySubscriptionUpdateResponse {\n /** none */ data?: Record;\n}\n/**\nSchema type for AddOrDeleteRulesRequest\n *\n * @public\n */\nexport type AddOrDeleteRulesRequest = any; /**\nA response from modifying user-specified stream filtering rules.\n *\n * @public\n */\nexport interface AddOrDeleteRulesResponse {\n /** All user-specified stream filtering rules that were created. */ data?: Array<\n Rule\n >;\n /** none */ errors?: Array;\n meta: RulesResponseMetadata;\n} /**\nA request to add a user-specified stream filtering rule.\n *\n * @public\n */\nexport interface AddRulesRequest {\n /** none */ add: Array;\n} /**\nThe sum of results returned in this response.\n *\n * @public\n */\nexport type Aggregate = number; /**\nUnique identifier of ai trend.\n *\n * @public\n */\nexport type AiTrendId = string; /**\nSchema type for AllowDownloadStatus\n *\n * @public\n */\nexport interface AllowDownloadStatus {\n /** none */ allowDownload?: boolean;\n} /**\nClient App Rule Counts for all applications in the project\n *\n * @public\n */\nexport type AllProjectClientApps = Array<\n AppRulesCount\n>; /**\nSchema type for AltText\n *\n * @public\n */\nexport interface AltText {\n /** Description of media ( <= 1000 characters ) */ text: string;\n} /**\nSchema type for Analytics\n *\n * @public\n */\nexport interface Analytics {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n}\n/**\nSchema type for AnimatedGif\n *\n * @public\n */\nexport type AnimatedGif = any; /**\nA count of user-provided stream filtering rules at the client application level.\n *\n * @public\n */\nexport interface AppRulesCount {\n clientAppId?: ClientAppId;\n /** Number of rules for client application */ ruleCount?: number;\n} /**\nSchema type for AudiencePolicy\n *\n * @public\n */\nexport interface AudiencePolicy {\n /** none */ creatorSubscriptions?: Array<'Any'>;\n /** none */ xSubscriptions?: Array<'Any'>;\n} /**\nSchema type for BookmarkAddRequest\n *\n * @public\n */\nexport interface BookmarkAddRequest {\n tweetId: TweetId;\n} /**\nThe unique identifier of this Bookmark folder.\n *\n * @public\n */\nexport type BookmarkFolderId = string; /**\nSchema type for BookmarkFolderPostsResponse\n *\n * @public\n */\nexport interface BookmarkFolderPostsResponse {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for BookmarkFoldersResponse\n *\n * @public\n */\nexport interface BookmarkFoldersResponse {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for BookmarkMutationResponse\n *\n * @public\n */\nexport interface BookmarkMutationResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for CashtagEntity\n *\n * @public\n */\nexport type CashtagEntity = any; /**\nRepresent the portion of text recognized as a Cashtag, and its start and end position within the text.\n *\n * @public\n */\nexport interface CashtagFields {\n /** none */ tag: string;\n} /**\nThe ID of the client application\n *\n * @public\n */\nexport type ClientAppId = string; /**\nUsage per client app\n *\n * @public\n */\nexport interface ClientAppUsage {\n /** The unique identifier for this project */ clientAppId?: string;\n /** The usage value */ usage?: Array;\n /** The number of results returned */ usageResultCount?: number;\n}\n/**\nYour client has gone away.\n *\n * @public\n */\nexport type ClientDisconnectedProblem = any;\n/**\nA problem that indicates your client is forbidden from making this request.\n *\n * @public\n */\nexport type ClientForbiddenProblem = any; /**\nA X Community is a curated group of Posts.\n *\n * @public\n */\nexport interface Community {\n /** none */ createdAt?: string;\n id: CommunityId;\n /** The name of this Community. */ name: string;\n} /**\nThe unique identifier of this Community.\n *\n * @public\n */\nexport type CommunityId = string; /**\nSchema type for ComplianceJob\n *\n * @public\n */\nexport interface ComplianceJob {\n createdAt: CreatedAt;\n downloadExpiresAt: DownloadExpiration;\n downloadUrl: DownloadUrl;\n id: JobId;\n name?: ComplianceJobName;\n status: ComplianceJobStatus;\n type: ComplianceJobType;\n uploadExpiresAt: UploadExpiration;\n uploadUrl: UploadUrl;\n} /**\nUser-provided name for a compliance job.\n *\n * @public\n */\nexport type ComplianceJobName = string; /**\nStatus of a compliance job.\n *\n * @public\n */\nexport type ComplianceJobStatus =\n | 'created'\n | 'in_progress'\n | 'failed'\n | 'complete'\n | 'expired'; /**\nType of compliance job to list.\n *\n * @public\n */\nexport type ComplianceJobType = 'tweets' | 'users';\n/**\nYou cannot create a new job if one is already in progress.\n *\n * @public\n */\nexport type ConflictProblem = any;\n/**\nA problem that indicates something is wrong with the connection.\n *\n * @public\n */\nexport type ConnectionExceptionProblem = any; /**\nSchema type for ContentExpiration\n *\n * @public\n */\nexport interface ContentExpiration {\n /** Expiration time for content as a Unix timestamp in seconds */ timestampSec: number;\n} /**\nAnnotation inferred from the Tweet text.\n *\n * @public\n */\nexport interface ContextAnnotation {\n domain: ContextAnnotationDomainFields;\n entity: ContextAnnotationEntityFields;\n} /**\nRepresents the data for the context annotation domain.\n *\n * @public\n */\nexport interface ContextAnnotationDomainFields {\n /** Description of the context annotation domain. */ description?: string;\n /** The unique id for a context annotation domain. */ id: string;\n /** Name of the context annotation domain. */ name?: string;\n} /**\nRepresents the data for the context annotation entity.\n *\n * @public\n */\nexport interface ContextAnnotationEntityFields {\n /** Description of the context annotation entity. */ description?: string;\n /** The unique id for a context annotation entity. */ id: string;\n /** Name of the context annotation entity. */ name?: string;\n} /**\nA two-letter ISO 3166-1 alpha-2 country code.\n *\n * @public\n */\nexport type CountryCode = string; /**\nSchema type for CreateAttachmentsMessageRequest\n *\n * @public\n */\nexport interface CreateAttachmentsMessageRequest {\n attachments: DmAttachments;\n /** Text of the message. */ text?: string;\n} /**\nA request to create a new batch compliance job.\n *\n * @public\n */\nexport interface CreateComplianceJobRequest {\n name?: ComplianceJobName;\n /** If true, this endpoint will return a pre-signed URL with resumable uploads enabled. */ resumable?: boolean;\n /** Type of compliance job to list. */ type: 'tweets' | 'users';\n} /**\nSchema type for CreateComplianceJobResponse\n *\n * @public\n */\nexport interface CreateComplianceJobResponse {\n data?: ComplianceJob;\n /** none */ errors?: Array;\n} /**\nCreation time of the compliance job.\n *\n * @public\n */\nexport type CreatedAt = string; /**\nSchema type for CreateDmConversationRequest\n *\n * @public\n */\nexport interface CreateDmConversationRequest {\n /** The conversation type that is being created. */ conversationType: 'Group';\n message: CreateMessageRequest;\n participantIds: DmParticipants;\n} /**\nSchema type for CreateDmEventResponse\n *\n * @public\n */\nexport interface CreateDmEventResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n}\n/**\nSchema type for CreateMessageRequest\n *\n * @public\n */\nexport type CreateMessageRequest = any; /**\nSchema type for CreateNoteRequest\n *\n * @public\n */\nexport interface CreateNoteRequest {\n info: NoteInfo;\n postId: TweetId;\n /** If true, the note being submitted is only for testing the capability of the bot, and won't be publicly visible. If false, the note being submitted will be a new proposed note on the product. */ testMode: boolean;\n} /**\nSchema type for CreateNoteResponse\n *\n * @public\n */\nexport interface CreateNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for CreateTextMessageRequest\n *\n * @public\n */\nexport interface CreateTextMessageRequest {\n attachments?: DmAttachments;\n /** Text of the message. */ text: string;\n} /**\nSchema type for DeleteDmResponse\n *\n * @public\n */\nexport interface DeleteDmResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for DeleteNoteResponse\n *\n * @public\n */\nexport interface DeleteNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nA response from deleting user-specified stream filtering rules.\n *\n * @public\n */\nexport interface DeleteRulesRequest {\n /** IDs and values of all deleted user-specified stream filtering rules. */ delete: Record<\n string,\n any\n >;\n}\n/**\nA problem that indicates that the resource requested violates the precepts of this API.\n *\n * @public\n */\nexport type DisallowedResourceProblem = any; /**\nRepresent a boundary range (start and end zero-based indices) for the portion of text that is displayed for a post. `start` must be smaller than `end`. The start index is inclusive, the end index is exclusive.\n *\n * @public\n */\nexport type DisplayTextRange = Array<\n number\n>; /**\nAttachments to a DM Event.\n *\n * @public\n */\nexport type DmAttachments = Array<\n DmMediaAttachment\n>; /**\nUnique identifier of a DM conversation. This can either be a numeric string, or a pair of numeric strings separated by a '-' character in the case of one-on-one DM Conversations.\n *\n * @public\n */\nexport type DmConversationId = string; /**\nSchema type for DmEvent\n *\n * @public\n */\nexport interface DmEvent {\n /** Specifies the type of attachments (if any) present in this DM. */ attachments?: Record<\n string,\n any\n >;\n /** none */ cashtags?: Array;\n /** none */ createdAt?: string;\n dmConversationId?: DmConversationId;\n /** none */ eventType: string;\n /** none */ hashtags?: Array;\n id: DmEventId;\n /** none */ mentions?: Array;\n /** A list of participants for a ParticipantsJoin or ParticipantsLeave event_type. */ participantIds?: Array<\n UserId\n >;\n /** A list of Posts this DM refers to. */ referencedTweets?: Array<\n Record\n >;\n senderId?: UserId;\n /** none */ text?: string;\n /** none */ urls?: Array;\n} /**\nUnique identifier of a DM Event.\n *\n * @public\n */\nexport type DmEventId = string; /**\nSchema type for DmMediaAttachment\n *\n * @public\n */\nexport interface DmMediaAttachment {\n mediaId: MediaId;\n} /**\nParticipants for the DM Conversation.\n *\n * @public\n */\nexport type DmParticipants = Array<\n UserId\n>; /**\nSchema type for DomainRestrictions\n *\n * @public\n */\nexport interface DomainRestrictions {\n /** List of whitelisted domains */ whitelist: Array;\n} /**\nExpiration time of the download URL.\n *\n * @public\n */\nexport type DownloadExpiration = string; /**\nURL from which the user will retrieve their compliance results.\n *\n * @public\n */\nexport type DownloadUrl = string;\n/**\nThe rule you have submitted is a duplicate.\n *\n * @public\n */\nexport type DuplicateRuleProblem = any; /**\nThe end time of the bucket.\n *\n * @public\n */\nexport type End = string; /**\nAn Engagement Api Response.\n *\n * @public\n */\nexport interface Engagement {\n /** none */ errors?: Array>;\n /** none */ measurement?: Record;\n} /**\nRepresent a boundary range (start and end index) for a recognized entity (for example a hashtag or a mention). `start` must be smaller than `end`. The start index is inclusive, the end index is exclusive.\n *\n * @public\n */\nexport interface EntityIndicesInclusiveExclusive {\n /** Index (zero-based) at which position this entity ends. The index is exclusive. */ end: number;\n /** Index (zero-based) at which position this entity starts. The index is inclusive. */ start: number;\n} /**\nRepresent a boundary range (start and end index) for a recognized entity (for example a hashtag or a mention). `start` must be smaller than `end`. The start index is inclusive, the end index is inclusive.\n *\n * @public\n */\nexport interface EntityIndicesInclusiveInclusive {\n /** Index (zero-based) at which position this entity ends. The index is inclusive. */ end: number;\n /** Index (zero-based) at which position this entity starts. The index is inclusive. */ start: number;\n} /**\nSchema type for Error\n *\n * @public\n */\nexport interface Error {\n /** none */ code: number;\n /** none */ message: string;\n} /**\nSchema type for EvaluateNoteRequest\n *\n * @public\n */\nexport interface EvaluateNoteRequest {\n /** Text for the community note. */ noteText: string;\n postId: TweetId;\n} /**\nSchema type for EvaluateNoteResponse\n *\n * @public\n */\nexport interface EvaluateNoteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for Expansions\n *\n * @public\n */\nexport interface Expansions {\n /** none */ media?: Array;\n /** none */ places?: Array;\n /** none */ polls?: Array;\n /** none */ topics?: Array;\n /** none */ tweets?: Array;\n /** none */ users?: Array;\n}\n/**\nA problem that indicates that you are not allowed to see a particular field on a Tweet, User, etc.\n *\n * @public\n */\nexport type FieldUnauthorizedProblem = any; /**\nA Tweet or error that can be returned by the streaming Tweet API. The values returned with a successful streamed Tweet includes the user provided rules that the Tweet matched.\n *\n * @public\n */\nexport interface FilteredStreamingTweetResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** The list of rules which matched the Tweet */ matchingRules?: Array<\n Record\n >;\n} /**\nSchema type for FoundMediaOrigin\n *\n * @public\n */\nexport interface FoundMediaOrigin {\n /** Unique Identifier of media within provider ( <= 24 characters )) */ id: string;\n /** The media provider (e.g., 'giphy') that sourced the media ( <= 8 Characters ) */ provider: string;\n} /**\nSchema type for FullTextEntities\n *\n * @public\n */\nexport interface FullTextEntities {\n /** none */ annotations?: Array;\n /** none */ cashtags?: Array;\n /** none */ hashtags?: Array;\n /** none */ mentions?: Array;\n /** none */ urls?: Array;\n}\n/**\nA generic problem with no additional information beyond that provided by the HTTP status code.\n *\n * @public\n */\nexport type GenericProblem = any; /**\nSchema type for Geo\n *\n * @public\n */\nexport interface Geo {\n /** none */ bbox: Array;\n geometry?: Point;\n /** none */ properties: Record;\n /** none */ type: 'Feature';\n}\n/**\nSchema type for GeoRestrictions\n *\n * @public\n */\nexport type GeoRestrictions = any; /**\nSchema type for Get2AiTrendsIdResponse\n *\n * @public\n */\nexport interface Get2AiTrendsIdResponse {\n data?: News;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2CommunitiesIdResponse\n *\n * @public\n */\nexport interface Get2CommunitiesIdResponse {\n data?: Community;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2CommunitiesSearchResponse\n *\n * @public\n */\nexport interface Get2CommunitiesSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ComplianceJobsIdResponse\n *\n * @public\n */\nexport interface Get2ComplianceJobsIdResponse {\n data?: ComplianceJob;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2ComplianceJobsResponse\n *\n * @public\n */\nexport interface Get2ComplianceJobsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmConversationsIdDmEventsResponse\n *\n * @public\n */\nexport interface Get2DmConversationsIdDmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmConversationsWithParticipantIdDmEventsResponse\n *\n * @public\n */\nexport interface Get2DmConversationsWithParticipantIdDmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2DmEventsEventIdResponse\n *\n * @public\n */\nexport interface Get2DmEventsEventIdResponse {\n data?: DmEvent;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2DmEventsResponse\n *\n * @public\n */\nexport interface Get2DmEventsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2FdxAccountsAccountidContactResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidContactResponse {\n data?: PlaidAccountContact;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidPayment-networksResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidPayment_networksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidResponse {\n data?: PlaidAccount;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxAccountsAccountidTransactionsResponse\n *\n * @public\n */\nexport interface Get2FdxAccountsAccountidTransactionsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2FdxCustomersCurrentResponse\n *\n * @public\n */\nexport interface Get2FdxCustomersCurrentResponse {\n data?: PlaidCustomer;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2Insights28hrResponse\n *\n * @public\n */\nexport interface Get2Insights28hrResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2InsightsHistoricalResponse\n *\n * @public\n */\nexport interface Get2InsightsHistoricalResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2LikesFirehoseStreamResponse\n *\n * @public\n */\nexport interface Get2LikesFirehoseStreamResponse {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2LikesSample10StreamResponse\n *\n * @public\n */\nexport interface Get2LikesSample10StreamResponse {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2ListsIdFollowersResponse\n *\n * @public\n */\nexport interface Get2ListsIdFollowersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ListsIdMembersResponse\n *\n * @public\n */\nexport interface Get2ListsIdMembersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2ListsIdResponse\n *\n * @public\n */\nexport interface Get2ListsIdResponse {\n data?: List;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2ListsIdTweetsResponse\n *\n * @public\n */\nexport interface Get2ListsIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2MediaAnalyticsResponse\n *\n * @public\n */\nexport interface Get2MediaAnalyticsResponse {\n data?: MediaAnalytics;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2MediaMediaKeyResponse\n *\n * @public\n */\nexport interface Get2MediaMediaKeyResponse {\n data?: Media;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2MediaResponse\n *\n * @public\n */\nexport interface Get2MediaResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2NewsIdResponse\n *\n * @public\n */\nexport interface Get2NewsIdResponse {\n data?: News;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2NewsSearchResponse\n *\n * @public\n */\nexport interface Get2NewsSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2NotesSearchNotesWrittenResponse\n *\n * @public\n */\nexport interface Get2NotesSearchNotesWrittenResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2NotesSearchPostsEligibleForNotesResponse\n *\n * @public\n */\nexport interface Get2NotesSearchPostsEligibleForNotesResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesByCreatorIdsResponse\n *\n * @public\n */\nexport interface Get2SpacesByCreatorIdsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesIdBuyersResponse\n *\n * @public\n */\nexport interface Get2SpacesIdBuyersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesIdResponse\n *\n * @public\n */\nexport interface Get2SpacesIdResponse {\n data?: Space;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2SpacesIdTweetsResponse\n *\n * @public\n */\nexport interface Get2SpacesIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2SpacesResponse\n *\n * @public\n */\nexport interface Get2SpacesResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2SpacesSearchResponse\n *\n * @public\n */\nexport interface Get2SpacesSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TrendsByWoeidWoeidResponse\n *\n * @public\n */\nexport interface Get2TrendsByWoeidWoeidResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2TweetsAnalyticsResponse\n *\n * @public\n */\nexport interface Get2TweetsAnalyticsResponse {\n data?: Analytics;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2TweetsCountsAllResponse\n *\n * @public\n */\nexport interface Get2TweetsCountsAllResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsCountsRecentResponse\n *\n * @public\n */\nexport interface Get2TweetsCountsRecentResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangEnResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangEnResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangJaResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangJaResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangKoResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangKoResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamLangPtResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamLangPtResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsFirehoseStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsFirehoseStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsIdLikingUsersResponse\n *\n * @public\n */\nexport interface Get2TweetsIdLikingUsersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdQuoteTweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsIdQuoteTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdResponse\n *\n * @public\n */\nexport interface Get2TweetsIdResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsIdRetweetedByResponse\n *\n * @public\n */\nexport interface Get2TweetsIdRetweetedByResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsIdRetweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsIdRetweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsResponse\n *\n * @public\n */\nexport interface Get2TweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSample10StreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSample10StreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSampleStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSampleStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSearchAllResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchAllResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsSearchRecentResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchRecentResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2TweetsSearchStreamResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchStreamResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2TweetsSearchStreamRulesCountsResponse\n *\n * @public\n */\nexport interface Get2TweetsSearchStreamRulesCountsResponse {\n data?: RulesCount;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsageTweetsResponse\n *\n * @public\n */\nexport interface Get2UsageTweetsResponse {\n data?: Usage;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsersByResponse\n *\n * @public\n */\nexport interface Get2UsersByResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersByUsernameUsernameResponse\n *\n * @public\n */\nexport interface Get2UsersByUsernameUsernameResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersIdBlockingResponse\n *\n * @public\n */\nexport interface Get2UsersIdBlockingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdBookmarksResponse\n *\n * @public\n */\nexport interface Get2UsersIdBookmarksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowersResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdFollowingResponse\n *\n * @public\n */\nexport interface Get2UsersIdFollowingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdLikedTweetsResponse\n *\n * @public\n */\nexport interface Get2UsersIdLikedTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdListMembershipsResponse\n *\n * @public\n */\nexport interface Get2UsersIdListMembershipsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdMentionsResponse\n *\n * @public\n */\nexport interface Get2UsersIdMentionsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdMutingResponse\n *\n * @public\n */\nexport interface Get2UsersIdMutingResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdOwnedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdOwnedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdPinnedListsResponse\n *\n * @public\n */\nexport interface Get2UsersIdPinnedListsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdResponse\n *\n * @public\n */\nexport interface Get2UsersIdResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersIdTimelinesReverseChronologicalResponse\n *\n * @public\n */\nexport interface Get2UsersIdTimelinesReverseChronologicalResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersIdTweetsResponse\n *\n * @public\n */\nexport interface Get2UsersIdTweetsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersMeResponse\n *\n * @public\n */\nexport interface Get2UsersMeResponse {\n data?: User;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersPersonalizedTrendsResponse\n *\n * @public\n */\nexport interface Get2UsersPersonalizedTrendsResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n} /**\nSchema type for Get2UsersRepostsOfMeResponse\n *\n * @public\n */\nexport interface Get2UsersRepostsOfMeResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2UsersResponse\n *\n * @public\n */\nexport interface Get2UsersResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for Get2UsersSearchResponse\n *\n * @public\n */\nexport interface Get2UsersSearchResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n includes?: Expansions;\n /** none */ meta?: Record;\n} /**\nSchema type for Get2WebhooksResponse\n *\n * @public\n */\nexport interface Get2WebhooksResponse {\n /** none */ data?: Array;\n /** none */ errors?: Array;\n /** none */ meta?: Record;\n}\n/**\nSchema type for HashtagEntity\n *\n * @public\n */\nexport type HashtagEntity = any; /**\nRepresent the portion of text recognized as a Hashtag, and its start and end position within the text.\n *\n * @public\n */\nexport interface HashtagFields {\n /** The text of the Hashtag. */ tag: string;\n} /**\nHTTP Status Code.\n *\n * @public\n */\nexport type HttpStatusCode = number;\n/**\nA problem that indicates this request is invalid.\n *\n * @public\n */\nexport type InvalidRequestProblem = any;\n/**\nThe rule you have submitted is invalid.\n *\n * @public\n */\nexport type InvalidRuleProblem = any; /**\nCompliance Job ID.\n *\n * @public\n */\nexport type JobId = string; /**\nA keyword to filter on.\n *\n * @public\n */\nexport type Keyword = string; /**\nSchema type for KillAllConnectionsResponse\n *\n * @public\n */\nexport interface KillAllConnectionsResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for LikeComplianceSchema\n *\n * @public\n */\nexport interface LikeComplianceSchema {\n delete: UnlikeComplianceSchema;\n} /**\nThe unique identifier of this Like.\n *\n * @public\n */\nexport type LikeId = string;\n/**\nLikes compliance stream events.\n *\n * @public\n */\nexport type LikesComplianceStreamResponse = any; /**\nA Like event, with the tweet author user and the tweet being liked\n *\n * @public\n */\nexport interface LikeWithTweetAuthor {\n /** Creation time of the Tweet. */ createdAt?: string;\n id?: LikeId;\n likedTweetId?: TweetId;\n /** Timestamp in milliseconds of creation. */ timestampMs?: number;\n tweetAuthorId?: UserId;\n} /**\nA X List is a curated group of accounts.\n *\n * @public\n */\nexport interface List {\n /** none */ createdAt?: string;\n /** none */ description?: string;\n /** none */ followerCount?: number;\n id: ListId;\n /** none */ memberCount?: number;\n /** The name of this List. */ name: string;\n ownerId?: UserId;\n /** none */ private?: boolean;\n} /**\nSchema type for ListAddUserRequest\n *\n * @public\n */\nexport interface ListAddUserRequest {\n userId: UserId;\n} /**\nSchema type for ListCreateRequest\n *\n * @public\n */\nexport interface ListCreateRequest {\n /** none */ description?: string;\n /** none */ name: string;\n /** none */ private?: boolean;\n} /**\nSchema type for ListCreateResponse\n *\n * @public\n */\nexport interface ListCreateResponse {\n /** A X List is a curated group of accounts. */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListDeleteResponse\n *\n * @public\n */\nexport interface ListDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListFollowedRequest\n *\n * @public\n */\nexport interface ListFollowedRequest {\n listId: ListId;\n} /**\nSchema type for ListFollowedResponse\n *\n * @public\n */\nexport interface ListFollowedResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe unique identifier of this List.\n *\n * @public\n */\nexport type ListId = string; /**\nSchema type for ListMutateResponse\n *\n * @public\n */\nexport interface ListMutateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListPinnedRequest\n *\n * @public\n */\nexport interface ListPinnedRequest {\n listId: ListId;\n} /**\nSchema type for ListPinnedResponse\n *\n * @public\n */\nexport interface ListPinnedResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListUnpinResponse\n *\n * @public\n */\nexport interface ListUnpinResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ListUpdateRequest\n *\n * @public\n */\nexport interface ListUpdateRequest {\n /** none */ description?: string;\n /** none */ name?: string;\n /** none */ private?: boolean;\n} /**\nSchema type for ListUpdateResponse\n *\n * @public\n */\nexport interface ListUpdateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for ManagementInfo\n *\n * @public\n */\nexport interface ManagementInfo {\n /** Indicates if the media is managed by Media Studio */ managed: boolean;\n} /**\nSchema type for Media\n *\n * @public\n */\nexport interface Media {\n height?: MediaHeight;\n mediaKey?: MediaKey;\n /** none */ type: string;\n width?: MediaWidth;\n} /**\nSchema type for MediaAnalytics\n *\n * @public\n */\nexport interface MediaAnalytics {\n /** none */ data?: Array>;\n /** none */ errors?: Array;\n} /**\nA string enum value which identifies a media use-case. This identifier is used to enforce use-case specific constraints (e.g. file size, video duration) and enable advanced features.\n *\n * @public\n */\nexport type MediaCategory =\n | 'amplify_video'\n | 'tweet_gif'\n | 'tweet_image'\n | 'tweet_video'\n | 'dm_gif'\n | 'dm_image'\n | 'dm_video'\n | 'subtitles'; /**\nA string enum value which identifies a media use-case. This identifier is used to enforce use-case specific constraints (e.g. file size) and enable advanced features.\n *\n * @public\n */\nexport type MediaCategoryOneShot =\n | 'tweet_image'\n | 'dm_image'\n | 'subtitles'; /**\nThe media category of uploaded media to which subtitles should be added/deleted\n *\n * @public\n */\nexport type MediaCategorySubtitles =\n | 'AmplifyVideo'\n | 'TweetVideo'; /**\nThe height of the media in pixels.\n *\n * @public\n */\nexport type MediaHeight = number; /**\nThe unique identifier of this Media.\n *\n * @public\n */\nexport type MediaId = string; /**\nThe Media Key identifier for this attachment.\n *\n * @public\n */\nexport type MediaKey = string; /**\nSchema type for MediaMetrics\n *\n * @public\n */\nexport interface MediaMetrics {\n /** Tracks the number of clicks on a call-to-action URL */ ctaUrlClicks?: number;\n /** Tracks the number of clicks to watch a video or media content */ ctaWatchClicks?: number;\n /** Tracks the number of times a video or media is played from a user tap */ playFromTap?: number;\n /** Tracks the number of times a video reaches 25% of its duration */ playback25?: number;\n /** Tracks the number of times a video reaches 50% of its duration */ playback50?: number;\n /** Tracks the number of times a video reaches 75% of its duration */ playback75?: number;\n /** Tracks the number of times a video is played to completion */ playbackComplete?: number;\n /** Tracks the number of times a video playback is initiated */ playbackStart?: number;\n /** Tracks the number of times a video is viewed */ videoViews?: number;\n /** Tracks the total time spent watching a video, measured in milliseconds */ watchTimeMs?: number;\n} /**\nThe file to upload.\n *\n * @public\n */\nexport type MediaPayloadBinary = string; /**\nThe file to upload.\n *\n * @public\n */\nexport type MediaPayloadByte = string;\n/**\nSchema type for MediaSegments\n *\n * @public\n */\nexport type MediaSegments = any; /**\nSchema type for MediaTimestampedMetrics\n *\n * @public\n */\nexport interface MediaTimestampedMetrics {\n metrics?: MediaMetrics;\n /** ISO8601 Time */ timestamp?: string;\n}\n/**\nSchema type for MediaUploadAppendRequest\n *\n * @public\n */\nexport type MediaUploadAppendRequest = any; /**\nA response from getting a media upload request status.\n *\n * @public\n */\nexport interface MediaUploadAppendResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for MediaUploadConfigRequest\n *\n * @public\n */\nexport interface MediaUploadConfigRequest {\n /** none */ additionalOwners?: Array;\n mediaCategory?: MediaCategory;\n /** The type of media. */ mediaType?:\n | 'video/mp4'\n | 'video/webm'\n | 'video/mp2t'\n | 'video/quicktime'\n | 'text/srt'\n | 'text/vtt'\n | 'image/jpeg'\n | 'image/gif'\n | 'image/bmp'\n | 'image/png'\n | 'image/webp'\n | 'image/pjpeg'\n | 'image/tiff'\n | 'model/gltf-binary'\n | 'model/vnd.usdz+zip';\n /** Whether this media is shared or not. */ shared?: boolean;\n /** The total size of the media upload in bytes. */ totalBytes?: number;\n} /**\nSchema type for MediaUploadRequestOneShot\n *\n * @public\n */\nexport interface MediaUploadRequestOneShot {\n /** none */ additionalOwners?: Array;\n /** none */ media: any;\n mediaCategory: MediaCategoryOneShot;\n /** The type of image or subtitle. */ mediaType?:\n | 'text/srt'\n | 'text/vtt'\n | 'image/jpeg'\n | 'image/bmp'\n | 'image/png'\n | 'image/webp'\n | 'image/pjpeg'\n | 'image/tiff';\n /** Whether this media is shared or not. */ shared?: boolean;\n} /**\nA response from getting a media upload request status.\n *\n * @public\n */\nexport interface MediaUploadResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe width of the media in pixels.\n *\n * @public\n */\nexport type MediaWidth = number;\n/**\nSchema type for MentionEntity\n *\n * @public\n */\nexport type MentionEntity = any; /**\nRepresent the portion of text recognized as a User mention, and its start and end position within the text.\n *\n * @public\n */\nexport interface MentionFields {\n id?: UserId;\n username: UserName;\n} /**\nSchema type for MetadataCreateRequest\n *\n * @public\n */\nexport interface MetadataCreateRequest {\n id: MediaId;\n /** none */ metadata?: Record;\n} /**\nSchema type for MetadataCreateResponse\n *\n * @public\n */\nexport interface MetadataCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for Metrics\n *\n * @public\n */\nexport interface Metrics {\n /** Tracks number of App Install Attempts */ appInstallAttempts?: number;\n /** Tracks number of App opens */ appOpens?: number;\n /** Tracks number of Detail expands */ detailExpands?: number;\n /** Tracks number of Email Tweet actions */ emailTweet?: number;\n /** Tracks total Engagements */ engagements?: number;\n /** Tracks number of Follows */ follows?: number;\n /** Tracks number of Hashtag clicks */ hashtagClicks?: number;\n /** Tracks number of Impressions */ impressions?: number;\n /** Tracks number of Likes */ likes?: number;\n /** Tracks number of Link clicks */ linkClicks?: number;\n /** Tracks number of Media engagements */ mediaEngagements?: number;\n /** Tracks number of Media views */ mediaViews?: number;\n /** Tracks number of Permalink clicks */ permalinkClicks?: number;\n /** Tracks number of Profile visits */ profileVisits?: number;\n /** Tracks number of Quote Tweets */ quoteTweets?: number;\n /** Tracks number of Replies */ replies?: number;\n /** Tracks number of Retweets */ retweets?: number;\n /** Tracks number of URL clicks */ urlClicks?: number;\n /** Tracks number of User Profile clicks */ userProfileClicks?: number;\n} /**\nCommunity Note misleading tags type.\n *\n * @public\n */\nexport type MisleadingTags =\n | 'disputed_claim_as_fact'\n | 'factual_error'\n | 'manipulated_media'\n | 'misinterpreted_satire'\n | 'missing_important_context'\n | 'other'\n | 'outdated_information'; /**\nSchema type for MuteUserMutationResponse\n *\n * @public\n */\nexport interface MuteUserMutationResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for MuteUserRequest\n *\n * @public\n */\nexport interface MuteUserRequest {\n targetUserId: UserId;\n} /**\nThe newest id in this response.\n *\n * @public\n */\nexport type NewestId = string; /**\nAn AI generated news story.\n *\n * @public\n */\nexport interface News {\n /** The news category. */ category?: string;\n /** none */ clusterPostsResults?: Array>;\n /** none */ contexts?: Record;\n /** none */ disclaimer?: string;\n /** The news hook. */ hook?: string;\n /** none */ keywords?: Array;\n /** none */ lastUpdatedAtMs?: string;\n /** The headline. */ name?: string;\n restId: NewsId;\n /** The news summary. */ summary?: string;\n} /**\nUnique identifier of news story.\n *\n * @public\n */\nexport type NewsId = string; /**\nThe next token.\n *\n * @public\n */\nexport type NextToken = string;\n/**\nA problem that indicates the user's rule set is not compliant.\n *\n * @public\n */\nexport type NonCompliantRulesProblem = any; /**\nA X Community Note is a note on a Post.\n *\n * @public\n */\nexport interface Note {\n id: NoteId;\n info?: NoteInfo;\n postId: TweetId;\n status?: NoteRatingStatus;\n testResult?: NoteTestResult;\n} /**\nCommunity Note classification type.\n *\n * @public\n */\nexport type NoteClassification =\n | 'misinformed_or_potentially_misleading'\n | 'not_misleading'; /**\nThe unique identifier of this Community Note.\n *\n * @public\n */\nexport type NoteId = string; /**\nA X Community Note is a note on a Post.\n *\n * @public\n */\nexport interface NoteInfo {\n classification: NoteClassification;\n /** none */ misleadingTags: Array;\n /** The text summary in the Community Note. */ text: string;\n /** Whether the note provided trustworthy links. */ trustworthySources: boolean;\n} /**\nCommunity Note rating status\n *\n * @public\n */\nexport type NoteRatingStatus =\n | 'currently_rated_helpful'\n | 'currently_rated_not_helpful'\n | 'firm_reject'\n | 'insufficient_consensus'\n | 'minimum_ratings_not_met'\n | 'needs_more_ratings'\n | 'needs_your_help'; /**\nThe evaluation result of a community note.\n *\n * @public\n */\nexport interface NoteTestResult {\n /** Score bucket from the evaluator result. */ evaluatorScoreBucket?: string;\n /** The type of the evaluator. */ evaluatorType?: string;\n} /**\nThe note content of the Tweet.\n *\n * @public\n */\nexport type NoteTweetText = string;\n/**\nA problem that indicates your client application does not have the required OAuth1 permissions for the requested endpoint.\n *\n * @public\n */\nexport type Oauth1PermissionsProblem = any; /**\nThe oldest id in this response.\n *\n * @public\n */\nexport type OldestId = string;\n/**\nYou have been disconnected for operational reasons.\n *\n * @public\n */\nexport type OperationalDisconnectProblem = any; /**\nA base32 pagination token.\n *\n * @public\n */\nexport type PaginationToken32 = string; /**\nA base36 pagination token.\n *\n * @public\n */\nexport type PaginationToken36 = string; /**\nA 'long' pagination token.\n *\n * @public\n */\nexport type PaginationTokenLong = string; /**\nA trend.\n *\n * @public\n */\nexport interface PersonalizedTrend {\n /** Category of this trend. */ category?: string;\n /** Number of posts pertaining to this trend. */ postCount?: number;\n /** Name of the trend. */ trendName?: string;\n /** Time since this is trending. */ trendingSince?: string;\n}\n/**\nSchema type for Photo\n *\n * @public\n */\nexport type Photo = any; /**\nSchema type for Place\n *\n * @public\n */\nexport interface Place {\n /** none */ containedWithin?: Array;\n /** The full name of the county in which this place exists. */ country?: string;\n countryCode?: CountryCode;\n /** The full name of this place. */ fullName: string;\n geo?: Geo;\n id: PlaceId;\n /** The human readable name of this place. */ name?: string;\n placeType?: PlaceType;\n} /**\nThe identifier for this place.\n *\n * @public\n */\nexport type PlaceId = string; /**\nSchema type for PlaceType\n *\n * @public\n */\nexport type PlaceType =\n | 'poi'\n | 'neighborhood'\n | 'city'\n | 'admin'\n | 'country'\n | 'unknown'; /**\nDescriptor for a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccount {\n /** The category of the account (e.g., personal, business). */ accountCategory: string;\n /** The Plaid account ID. */ accountId: string;\n /** The last 2-4 digits of the account number. */ accountNumberDisplay: string;\n /** The type of the account (e.g., checking, savings). */ accountType: string;\n /** The available balance of the account. */ availableBalance?: number;\n currency: PlaidCurrency;\n /** The current balance of the account. */ currentBalance?: number;\n /** The nickname of the account. */ nickname?: string;\n /** The name of the product associated with the account. */ productName: string;\n /** The status of the account. */ status: string;\n} /**\nContact information associated with a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccountContact {\n /** List of addresses associated with the account holder. */ addresses: Array<\n PlaidAddress\n >;\n /** List of email addresses associated with the account holder. */ emails: Array<\n string\n >;\n name: PlaidName;\n /** Relationship of the contact to the account. */ relationship?: string;\n /** List of telephone numbers associated with the account holder. */ telephones: Array<\n PlaidTelephone\n >;\n} /**\nPayment network details associated with the account.\n *\n * @public\n */\nexport interface PlaidAccountPaymentNetwork {\n /** The bank ID associated with the account. */ bankId: string;\n /** The payment network identifier. */ identifier: string;\n /** Indicates if transfers into the account are supported. */ transferIn: boolean;\n /** Indicates if transfers out of the account are supported. */ transferOut: boolean;\n /** The type of payment network (e.g., ACH, SEPA). */ type: string;\n} /**\nDescriptor for a Plaid account.\n *\n * @public\n */\nexport interface PlaidAccountTransaction {\n /** The category of the account (e.g., personal, business). */ accountCategory: string;\n /** The amount transacted. */ amount: number;\n /** Memo for transaction (e.g. CREDIT) */ debitCreditMemo: string;\n /** The transaction description */ description: string;\n /** The timestamp when the transaction was posted. */ postedTimestamp?: string;\n /** The status of the transaction. */ status: string;\n /** The identifier for the transaction. */ transactionId: string;\n /** The timestamp when the transaction occurred. */ transactionTimestamp: string;\n} /**\nAddress information for the account holder.\n *\n * @public\n */\nexport interface PlaidAddress {\n /** The city of the address. */ city: string;\n /** The country of the address (ISO 3166-1 alpha-2 code). */ country: string;\n /** The first line of the address. */ line1: string;\n /** The second line of the address. */ line2?: string;\n /** The postal code of the address. */ postalCode?: string;\n /** The region or state of the address. */ region?: string;\n} /**\nCurrency information.\n *\n * @public\n */\nexport interface PlaidCurrency {\n /** The ISO 4217 currency code. */ currencyCode: string;\n} /**\nA user id for the plaid customer\n *\n * @public\n */\nexport interface PlaidCustomer {\n customerId?: UserId;\n} /**\nName information for the account holder.\n *\n * @public\n */\nexport interface PlaidName {\n /** The first name of the account holder. */ first: string;\n /** The last name of the account holder. */ last: string;\n} /**\nTelephone information for the account holder.\n *\n * @public\n */\nexport interface PlaidTelephone {\n /** The country code for the phone number (e.g., '+1'). */ country: string;\n /** The phone number. */ number: string;\n /** The type of phone number (e.g., 'mobile'). */ type: string;\n} /**\nA [GeoJson Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) geometry object.\n *\n * @public\n */\nexport interface Point {\n coordinates: Position;\n /** none */ type: 'Point';\n} /**\nRepresent a Poll attached to a Tweet.\n *\n * @public\n */\nexport interface Poll {\n /** none */ durationMinutes?: number;\n /** none */ endDatetime?: string;\n id: PollId;\n /** none */ options: Array;\n /** none */ votingStatus?: 'open' | 'closed';\n} /**\nUnique identifier of this poll.\n *\n * @public\n */\nexport type PollId = string; /**\nDescribes a choice in a Poll object.\n *\n * @public\n */\nexport interface PollOption {\n label: PollOptionLabel;\n /** Position of this choice in the poll. */ position: number;\n /** Number of users who voted for this choice. */ votes: number;\n} /**\nThe text of a poll choice.\n *\n * @public\n */\nexport type PollOptionLabel = string; /**\nA [GeoJson Position](https://tools.ietf.org/html/rfc7946#section-3.1.1) in the format `[longitude,latitude]`.\n *\n * @public\n */\nexport type Position = Array<\n number\n>; /**\nSchema type for PreviewImage\n *\n * @public\n */\nexport interface PreviewImage {\n /** none */ mediaKey: Record;\n} /**\nThe previous token.\n *\n * @public\n */\nexport type PreviousToken = string; /**\nAn HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807).\n *\n * @public\n */\nexport interface Problem {\n /** none */ detail?: string;\n /** none */ status?: number;\n /** none */ title: string;\n /** none */ type: string;\n} /**\nSchema type for ProcessingInfo\n *\n * @public\n */\nexport interface ProcessingInfo {\n /** Number of seconds to check again for status */ checkAfterSecs?: number;\n /** Percent of upload progress */ progressPercent?: number;\n /** State of upload */ state?:\n | 'succeeded'\n | 'in_progress'\n | 'pending'\n | 'failed';\n} /**\nSchema type for ProfileUpdateActivityResponsePayload\n *\n * @public\n */\nexport interface ProfileUpdateActivityResponsePayload {\n /** none */ after?: string;\n /** none */ before?: string;\n} /**\nConfirmation that the replay job request was accepted.\n *\n * @public\n */\nexport interface ReplayJobCreateResponse {\n /** The UTC timestamp indicating when the replay job was created. */ createdAt: string;\n /** The unique identifier for the initiated replay job. */ jobId: string;\n} /**\nShows who can reply a Tweet. Fields returned are everyone, mentioned_users, and following.\n *\n * @public\n */\nexport type ReplySettings =\n | 'everyone'\n | 'mentionedUsers'\n | 'following'\n | 'other'; /**\nShows who can reply a Tweet. Fields returned are everyone, mentioned_users, subscribers, verified and following.\n *\n * @public\n */\nexport type ReplySettingsWithVerifiedUsers =\n | 'everyone'\n | 'mentionedUsers'\n | 'following'\n | 'other'\n | 'subscribers'\n | 'verified';\n/**\nA problem that indicates that a given Tweet, User, etc. does not exist.\n *\n * @public\n */\nexport type ResourceNotFoundProblem = any;\n/**\nA problem that indicates you are not allowed to see a particular Tweet, User, etc.\n *\n * @public\n */\nexport type ResourceUnauthorizedProblem = any;\n/**\nA problem that indicates a particular Tweet, User, etc. is not available to you.\n *\n * @public\n */\nexport type ResourceUnavailableProblem = any; /**\nThe number of results returned in this response.\n *\n * @public\n */\nexport type ResultCount = number; /**\nA user-provided stream filtering rule.\n *\n * @public\n */\nexport interface Rule {\n id?: RuleId;\n tag?: RuleTag;\n value: RuleValue;\n} /**\nUnique identifier of this rule.\n *\n * @public\n */\nexport type RuleId = string; /**\nA user-provided stream filtering rule.\n *\n * @public\n */\nexport interface RuleNoId {\n tag?: RuleTag;\n value: RuleValue;\n}\n/**\nYou have exceeded the maximum number of rules.\n *\n * @public\n */\nexport type RulesCapProblem = any; /**\nA count of user-provided stream filtering rules at the application and project levels.\n *\n * @public\n */\nexport interface RulesCount {\n allProjectClientApps?: AllProjectClientApps;\n /** Cap of number of rules allowed per client application */ capPerClientApp?: number;\n /** Cap of number of rules allowed per project */ capPerProject?: number;\n clientAppRulesCount?: AppRulesCount;\n /** Number of rules for project */ projectRulesCount?: number;\n} /**\nSchema type for RulesLookupResponse\n *\n * @public\n */\nexport interface RulesLookupResponse {\n /** none */ data?: Array;\n meta: RulesResponseMetadata;\n}\n/**\nSchema type for RulesRequestSummary\n *\n * @public\n */\nexport type RulesRequestSummary = any; /**\nSchema type for RulesResponseMetadata\n *\n * @public\n */\nexport interface RulesResponseMetadata {\n nextToken?: NextToken;\n /** Number of Rules in result set. */ resultCount?: number;\n /** none */ sent: string;\n summary?: RulesRequestSummary;\n} /**\nA tag meant for the labeling of user provided rules.\n *\n * @public\n */\nexport type RuleTag = string; /**\nThe filterlang value of the rule.\n *\n * @public\n */\nexport type RuleValue = string; /**\nRepresent a Search Count Result.\n *\n * @public\n */\nexport interface SearchCount {\n end: End;\n start: Start;\n tweetCount: TweetCount;\n} /**\nSchema type for SensitiveMediaWarning\n *\n * @public\n */\nexport interface SensitiveMediaWarning {\n /** Indicates if the content contains adult material */ adultContent?: boolean;\n /** Indicates if the content depicts graphic violence */ graphicViolence?: boolean;\n /** Indicates if the content has other sensitive characteristics */ other?: boolean;\n} /**\nSchema type for SharedInfo\n *\n * @public\n */\nexport interface SharedInfo {\n /** Indicates if the media is shared in direct messages */ shared: boolean;\n} /**\nSchema type for Space\n *\n * @public\n */\nexport interface Space {\n /** Creation time of the Space. */ createdAt?: string;\n creatorId?: UserId;\n /** End time of the Space. */ endedAt?: string;\n /** The user ids for the hosts of the Space. */ hostIds?: Array;\n id: SpaceId;\n /** An array of user ids for people who were invited to a Space. */ invitedUserIds?: Array<\n UserId\n >;\n /** Denotes if the Space is a ticketed Space. */ isTicketed?: boolean;\n /** The language of the Space. */ lang?: string;\n /** The number of participants in a Space. */ participantCount?: number;\n /** A date time stamp for when a Space is scheduled to begin. */ scheduledStart?: string;\n /** An array of user ids for people who were speakers in a Space. */ speakerIds?: Array<\n UserId\n >;\n /** When the Space was started as a date string. */ startedAt?: string;\n /** The current state of the Space. */ state: 'live' | 'scheduled' | 'ended';\n /** The number of people who have either purchased a ticket or set a reminder for this Space. */ subscriberCount?: number;\n /** The title of the Space. */ title?: string;\n /** The topics of a Space, as selected by its creator. */ topics?: Array<\n Record\n >;\n /** When the Space was last updated. */ updatedAt?: string;\n} /**\nThe unique identifier of this Space.\n *\n * @public\n */\nexport type SpaceId = string; /**\nThe start time of the bucket.\n *\n * @public\n */\nexport type Start = string; /**\nSchema type for Sticker\n *\n * @public\n */\nexport interface Sticker {\n /** width-to-height ratio of the media */ aspectRatio?: number;\n /** A unique identifier for the group of annotations associated with the media */ groupAnnotationId?: number;\n /** Unique identifier for sticker */ id?: string;\n /** A unique identifier for the sticker set associated with the media */ stickerSetAnnotationId?: number;\n /** Scale or rotate the media on the x-axis */ transformA?: number;\n /** Skew the media on the x-axis */ transformB?: number;\n /** Skew the media on the y-axis */ transformC?: number;\n /** Scale or rotate the media on the y-axis */ transformD?: number;\n /** Scale or rotate the media on the x-axis */ transformTx?: number;\n /** The vertical translation (shift) value for the media */ transformTy?: number;\n} /**\nSchema type for StickerInfo\n *\n * @public\n */\nexport interface StickerInfo {\n /** Stickers list must not be empty and should not exceed 25 */ stickers: Array<\n Sticker\n >;\n} /**\nSchema type for StreamingLikeResponseV2\n *\n * @public\n */\nexport interface StreamingLikeResponseV2 {\n data?: LikeWithTweetAuthor;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for StreamingTweetResponse\n *\n * @public\n */\nexport interface StreamingTweetResponse {\n data?: Tweet;\n /** none */ errors?: Array;\n includes?: Expansions;\n} /**\nSchema type for SubscriptionsCountGetResponse\n *\n * @public\n */\nexport interface SubscriptionsCountGetResponse {\n /** The count of active subscriptions across all webhooks */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsCreateRequest\n *\n * @public\n */\nexport type SubscriptionsCreateRequest = Record<\n string,\n any\n>; /**\nSchema type for SubscriptionsCreateResponse\n *\n * @public\n */\nexport interface SubscriptionsCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsDeleteResponse\n *\n * @public\n */\nexport interface SubscriptionsDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsGetResponse\n *\n * @public\n */\nexport interface SubscriptionsGetResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubscriptionsListGetResponse\n *\n * @public\n */\nexport interface SubscriptionsListGetResponse {\n /** The list of active subscriptions for a specified webhook */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n} /**\nThe language code should be a BCP47 code (e.g. 'EN\", \"SP\")\n *\n * @public\n */\nexport type SubtitleLanguageCode = string; /**\nSchema type for Subtitles\n *\n * @public\n */\nexport interface Subtitles {\n /** Language name in a human readable form */ displayName?: string;\n id?: MediaId;\n languageCode?: SubtitleLanguageCode;\n} /**\nSchema type for SubtitlesCreateRequest\n *\n * @public\n */\nexport interface SubtitlesCreateRequest {\n id?: MediaId;\n mediaCategory?: MediaCategorySubtitles;\n subtitles?: Subtitles;\n} /**\nSchema type for SubtitlesCreateResponse\n *\n * @public\n */\nexport interface SubtitlesCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for SubtitlesDeleteRequest\n *\n * @public\n */\nexport interface SubtitlesDeleteRequest {\n id?: MediaId;\n languageCode?: SubtitleLanguageCode;\n mediaCategory?: MediaCategorySubtitles;\n} /**\nSchema type for SubtitlesDeleteResponse\n *\n * @public\n */\nexport interface SubtitlesDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TimestampedMetrics\n *\n * @public\n */\nexport interface TimestampedMetrics {\n metrics?: Metrics;\n /** ISO8601 Time */ timestamp?: string;\n} /**\nThe topic of a Space, as selected by its creator.\n *\n * @public\n */\nexport interface Topic {\n /** The description of the given topic. */ description?: string;\n id: TopicId;\n /** The name of the given topic. */ name: string;\n} /**\nUnique identifier of this Topic.\n *\n * @public\n */\nexport type TopicId = string; /**\nA trend.\n *\n * @public\n */\nexport interface Trend {\n /** Name of the trend. */ trendName?: string;\n /** Number of Posts in this trend. */ tweetCount?: number;\n} /**\nSchema type for TrendActivityResponsePayload\n *\n * @public\n */\nexport interface TrendActivityResponsePayload {\n /** none */ category?: string;\n /** none */ headline?: string;\n /** none */ hook?: string;\n /** none */ summary?: string;\n} /**\nSchema type for Tweet\n *\n * @public\n */\nexport interface Tweet {\n /** Specifies the type of attachments (if any) present in this Tweet. */ attachments?: Record<\n string,\n any\n >;\n authorId?: UserId;\n communityId?: CommunityId;\n /** none */ contextAnnotations?: Array;\n conversationId?: TweetId;\n /** Creation time of the Tweet. */ createdAt?: string;\n displayTextRange?: DisplayTextRange;\n /** none */ editControls?: Record;\n /** A list of Tweet Ids in this Tweet chain. */ editHistoryTweetIds?: Array<\n TweetId\n >;\n entities?: FullTextEntities;\n /** The location tagged on the Tweet, if the user provided one. */ geo?: Record<\n string,\n any\n >;\n id?: TweetId;\n inReplyToUserId?: UserId;\n /** Language of the Tweet, if detected by X. Returned as a BCP47 language tag. */ lang?: string;\n /** Nonpublic engagement metrics for the Tweet at the time of the request. */ nonPublicMetrics?: Record<\n string,\n any\n >;\n /** The full-content of the Tweet, including text beyond 280 characters. */ noteTweet?: Record<\n string,\n any\n >;\n /** Organic nonpublic engagement metrics for the Tweet at the time of the request. */ organicMetrics?: Record<\n string,\n any\n >;\n /** Indicates if this Tweet contains URLs marked as sensitive, for example content suitable for mature audiences. */ possiblySensitive?: boolean;\n /** Promoted nonpublic engagement metrics for the Tweet at the time of the request. */ promotedMetrics?: Record<\n string,\n any\n >;\n /** Engagement metrics for the Tweet at the time of the request. */ publicMetrics?: Record<\n string,\n any\n >;\n /** A list of Posts this Tweet refers to. For example, if the parent Tweet is a Retweet, a Quoted Tweet or a Reply, it will include the related Tweet referenced to by its parent. */ referencedTweets?: Array<\n Record\n >;\n replySettings?: ReplySettingsWithVerifiedUsers;\n /** The scopes for this tweet */ scopes?: Record;\n /** This is deprecated. */ source?: string;\n /** none */ suggestedSourceLinks?: Array;\n text?: TweetText;\n username?: UserName;\n withheld?: TweetWithheld;\n}\n/**\nTweet compliance data.\n *\n * @public\n */\nexport type TweetComplianceData = any; /**\nSchema type for TweetComplianceSchema\n *\n * @public\n */\nexport interface TweetComplianceSchema {\n /** Event time. */ eventAt: string;\n quoteTweetId?: TweetId;\n /** none */ tweet: Record;\n}\n/**\nTweet compliance stream events.\n *\n * @public\n */\nexport type TweetComplianceStreamResponse = any; /**\nThe count for the bucket.\n *\n * @public\n */\nexport type TweetCount = number; /**\nSchema type for TweetCreateRequest\n *\n * @public\n */\nexport interface TweetCreateRequest {\n /** Card Uri Parameter. This is mutually exclusive from Quote Tweet Id, Poll, Media, and Direct Message Deep Link. */ cardUri?: string;\n communityId?: CommunityId;\n /** Link to take the conversation from the public timeline to a private Direct Message. */ directMessageDeepLink?: string;\n /** Options for editing an existing Post. When provided, this request will edit the specified Post instead of creating a new one. */ editOptions?: Record<\n string,\n any\n >;\n /** Exclusive Tweet for super followers. */ forSuperFollowersOnly?: boolean;\n /** Place ID being attached to the Tweet for geo location. */ geo?: Record<\n string,\n any\n >;\n /** Media information being attached to created Tweet. This is mutually exclusive from Quote Tweet Id, Poll, and Card URI. */ media?: Record<\n string,\n any\n >;\n /** Nullcasted (promoted-only) Posts do not appear in the public timeline and are not served to followers. */ nullcast?: boolean;\n /** Poll options for a Tweet with a poll. This is mutually exclusive from Media, Quote Tweet Id, and Card URI. */ poll?: Record<\n string,\n any\n >;\n quoteTweetId?: TweetId;\n /** Tweet information of the Tweet being replied to. */ reply?: Record<\n string,\n any\n >;\n /** Settings to indicate who can reply to the Tweet. */ replySettings?:\n | 'following'\n | 'mentionedUsers'\n | 'subscribers'\n | 'verified';\n /** Share community post with followers too. */ shareWithFollowers?: boolean;\n text?: TweetText;\n} /**\nSchema type for TweetCreateResponse\n *\n * @public\n */\nexport interface TweetCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TweetDeleteComplianceSchema\n *\n * @public\n */\nexport interface TweetDeleteComplianceSchema {\n delete: TweetComplianceSchema;\n} /**\nSchema type for TweetDeleteResponse\n *\n * @public\n */\nexport interface TweetDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for TweetDropComplianceSchema\n *\n * @public\n */\nexport interface TweetDropComplianceSchema {\n drop: TweetComplianceSchema;\n} /**\nSchema type for TweetEditComplianceObjectSchema\n *\n * @public\n */\nexport interface TweetEditComplianceObjectSchema {\n /** none */ editTweetIds: Array;\n /** Event time. */ eventAt: string;\n initialTweetId: TweetId;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetEditComplianceSchema\n *\n * @public\n */\nexport interface TweetEditComplianceSchema {\n tweetEdit: TweetEditComplianceObjectSchema;\n} /**\nSchema type for TweetHideRequest\n *\n * @public\n */\nexport interface TweetHideRequest {\n /** none */ hidden: boolean;\n} /**\nSchema type for TweetHideResponse\n *\n * @public\n */\nexport interface TweetHideResponse {\n /** none */ data?: Record;\n} /**\nUnique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.\n *\n * @public\n */\nexport type TweetId = string;\n/**\nTweet label data.\n *\n * @public\n */\nexport type TweetLabelData = any;\n/**\nTweet label stream events.\n *\n * @public\n */\nexport type TweetLabelStreamResponse = any; /**\nSchema type for TweetNotice\n *\n * @public\n */\nexport interface TweetNotice {\n /** If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. */ application: string;\n /** Information shown on the Tweet label */ details?: string;\n /** Event time. */ eventAt: string;\n /** The type of label on the Tweet */ eventType: string;\n /** Link to more information about this kind of label */ extendedDetailsUrl?: string;\n /** Title/header of the Tweet label */ labelTitle?: string;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetNoticeSchema\n *\n * @public\n */\nexport interface TweetNoticeSchema {\n publicTweetNotice: TweetNotice;\n} /**\nSchema type for TweetTakedownComplianceSchema\n *\n * @public\n */\nexport interface TweetTakedownComplianceSchema {\n /** Event time. */ eventAt: string;\n quoteTweetId?: TweetId;\n /** none */ tweet: Record;\n /** none */ withheldInCountries: Array;\n} /**\nThe content of the Tweet.\n *\n * @public\n */\nexport type TweetText = string; /**\nSchema type for TweetUndropComplianceSchema\n *\n * @public\n */\nexport interface TweetUndropComplianceSchema {\n undrop: TweetComplianceSchema;\n} /**\nSchema type for TweetUnviewable\n *\n * @public\n */\nexport interface TweetUnviewable {\n /** If the label is being applied or removed. Possible values are ‘apply’ or ‘remove’. */ application: string;\n /** Event time. */ eventAt: string;\n /** none */ tweet: Record;\n} /**\nSchema type for TweetUnviewableSchema\n *\n * @public\n */\nexport interface TweetUnviewableSchema {\n publicTweetUnviewable: TweetUnviewable;\n} /**\nIndicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).\n *\n * @public\n */\nexport interface TweetWithheld {\n /** Indicates if the content is being withheld for on the basis of copyright infringement. */ copyright: boolean;\n /** Provides a list of countries where this content is not available. */ countryCodes: Array<\n CountryCode\n >;\n /** Indicates whether the content being withheld is the `tweet` or a `user`. */ scope?:\n | 'tweet'\n | 'user';\n} /**\nSchema type for TweetWithheldComplianceSchema\n *\n * @public\n */\nexport interface TweetWithheldComplianceSchema {\n withheld: TweetTakedownComplianceSchema;\n} /**\nSchema type for UnlikeComplianceSchema\n *\n * @public\n */\nexport interface UnlikeComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ favorite: Record;\n}\n/**\nA problem that indicates that the authentication used is not supported.\n *\n * @public\n */\nexport type UnsupportedAuthenticationProblem = any; /**\nExpiration time of the upload URL.\n *\n * @public\n */\nexport type UploadExpiration = string; /**\nSchema type for UploadSource\n *\n * @public\n */\nexport interface UploadSource {\n /** Records the source (e.g., app, device) from which the media was uploaded */ uploadSource: string;\n} /**\nURL to which the user will upload their Tweet or user IDs.\n *\n * @public\n */\nexport type UploadUrl = string; /**\nA validly formatted URL.\n *\n * @public\n */\nexport type Url = string;\n/**\nRepresent the portion of text recognized as a URL, and its start and end position within the text.\n *\n * @public\n */\nexport type UrlEntity = any;\n/**\nRepresent the portion of text recognized as a URL, and its start and end position within the text.\n *\n * @public\n */\nexport type UrlEntityDm = any; /**\nRepresent the portion of text recognized as a URL.\n *\n * @public\n */\nexport interface UrlFields {\n /** Description of the URL landing page. */ description?: string;\n /** The URL as displayed in the X client. */ displayUrl?: string;\n expandedUrl?: Url;\n /** none */ images?: Array;\n mediaKey?: MediaKey;\n status?: HttpStatusCode;\n /** Title of the page the URL points to. */ title?: string;\n /** Fully resolved url. */ unwoundUrl?: string;\n url: Url;\n} /**\nRepresent the information for the URL image.\n *\n * @public\n */\nexport interface UrlImage {\n height?: MediaHeight;\n url?: Url;\n width?: MediaWidth;\n} /**\nUsage per client app\n *\n * @public\n */\nexport interface Usage {\n /** Number of days left for the Tweet cap to reset */ capResetDay?: number;\n /** The daily usage breakdown for each Client Application a project */ dailyClientAppUsage?: Array<\n ClientAppUsage\n >;\n /** The daily usage breakdown for a project */ dailyProjectUsage?: Record<\n string,\n any\n >;\n /** Total number of Posts that can be read in this project per month */ projectCap?: number;\n /** The unique identifier for this project */ projectId?: string;\n /** The number of Posts read in this project */ projectUsage?: number;\n}\n/**\nA problem that indicates that a usage cap has been exceeded.\n *\n * @public\n */\nexport type UsageCapExceededProblem = any; /**\nRepresents the data for Usage\n *\n * @public\n */\nexport interface UsageFields {\n /** The time period for the usage */ date?: string;\n /** The usage value */ usage?: number;\n} /**\nThe X User object.\n *\n * @public\n */\nexport interface User {\n /** Metadata about a user's affiliation. */ affiliation?: Record;\n /** Returns detailed information about the relationship between two users. */ connectionStatus?: Array<\n | 'follow_request_received'\n | 'follow_request_sent'\n | 'blocking'\n | 'followed_by'\n | 'following'\n | 'muting'\n >;\n /** Creation time of this User. */ createdAt?: string;\n /** The text of this User's profile description (also known as bio), if the User provided one. */ description?: string;\n /** A list of metadata found in the User's profile description. */ entities?: Record<\n string,\n any\n >;\n id: UserId;\n /** The location specified in the User's profile, if the User provided one. As this is a freeform value, it may not indicate a valid location, but it may be fuzzily evaluated when performing searches with location queries. */ location?: string;\n mostRecentTweetId?: TweetId;\n /** The friendly name of this User, as shown on their profile. */ name: string;\n pinnedTweetId?: TweetId;\n /** The URL to the profile banner for this User. */ profileBannerUrl?: string;\n /** The URL to the profile image for this User. */ profileImageUrl?: string;\n /** Indicates if this User has chosen to protect their Posts (in other words, if this User's Posts are private). */ protected?: boolean;\n /** A list of metrics for this User. */ publicMetrics?: Record;\n /** Indicates if you can send a DM to this User */ receivesYourDm?: boolean;\n /** The X Blue subscription type of the user, eg: Basic, Premium, PremiumPlus or None. */ subscriptionType?:\n | 'Basic'\n | 'Premium'\n | 'PremiumPlus'\n | 'None';\n /** The URL specified in the User's profile. */ url?: string;\n username: UserName;\n /** Indicate if this User is a verified X User. */ verified?: boolean;\n /** The X Blue verified type of the user, eg: blue, government, business or none. */ verifiedType?:\n | 'blue'\n | 'government'\n | 'business'\n | 'none';\n withheld?: UserWithheld;\n}\n/**\nUser compliance data.\n *\n * @public\n */\nexport type UserComplianceData = any; /**\nSchema type for UserComplianceSchema\n *\n * @public\n */\nexport interface UserComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ user: Record;\n}\n/**\nUser compliance stream events.\n *\n * @public\n */\nexport type UserComplianceStreamResponse = any; /**\nSchema type for UserDeleteComplianceSchema\n *\n * @public\n */\nexport interface UserDeleteComplianceSchema {\n userDelete: UserComplianceSchema;\n} /**\nUnique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.\n *\n * @public\n */\nexport type UserId = string; /**\nUnique identifier of this User. The value must be the same as the authenticated user.\n *\n * @public\n */\nexport type UserIdMatchesAuthenticatedUser = string; /**\nThe X handle (screen name) of this user.\n *\n * @public\n */\nexport type UserName = string; /**\nSchema type for UserProfileModificationComplianceSchema\n *\n * @public\n */\nexport interface UserProfileModificationComplianceSchema {\n userProfileModification: UserProfileModificationObjectSchema;\n} /**\nSchema type for UserProfileModificationObjectSchema\n *\n * @public\n */\nexport interface UserProfileModificationObjectSchema {\n /** Event time. */ eventAt: string;\n /** none */ newValue: string;\n /** none */ profileField: string;\n /** none */ user: Record;\n} /**\nSchema type for UserProtectComplianceSchema\n *\n * @public\n */\nexport interface UserProtectComplianceSchema {\n userProtect: UserComplianceSchema;\n} /**\nSchema type for UserScrubGeoObjectSchema\n *\n * @public\n */\nexport interface UserScrubGeoObjectSchema {\n /** Event time. */ eventAt: string;\n upToTweetId: TweetId;\n /** none */ user: Record;\n} /**\nSchema type for UserScrubGeoSchema\n *\n * @public\n */\nexport interface UserScrubGeoSchema {\n scrubGeo: UserScrubGeoObjectSchema;\n} /**\nSchema type for UsersDMBlockCreateResponse\n *\n * @public\n */\nexport interface UsersDMBlockCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersDMUnBlockCreateResponse\n *\n * @public\n */\nexport interface UsersDMUnBlockCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe the search string by which to query for users.\n *\n * @public\n */\nexport type UserSearchQueryVnext = string; /**\nSchema type for UsersFollowingCreateRequest\n *\n * @public\n */\nexport interface UsersFollowingCreateRequest {\n targetUserId: UserId;\n} /**\nSchema type for UsersFollowingCreateResponse\n *\n * @public\n */\nexport interface UsersFollowingCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersFollowingDeleteResponse\n *\n * @public\n */\nexport interface UsersFollowingDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersLikesCreateRequest\n *\n * @public\n */\nexport interface UsersLikesCreateRequest {\n tweetId: TweetId;\n} /**\nSchema type for UsersLikesCreateResponse\n *\n * @public\n */\nexport interface UsersLikesCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersLikesDeleteResponse\n *\n * @public\n */\nexport interface UsersLikesDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersRetweetsCreateRequest\n *\n * @public\n */\nexport interface UsersRetweetsCreateRequest {\n tweetId: TweetId;\n} /**\nSchema type for UsersRetweetsCreateResponse\n *\n * @public\n */\nexport interface UsersRetweetsCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UsersRetweetsDeleteResponse\n *\n * @public\n */\nexport interface UsersRetweetsDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for UserSuspendComplianceSchema\n *\n * @public\n */\nexport interface UserSuspendComplianceSchema {\n userSuspend: UserComplianceSchema;\n} /**\nSchema type for UserTakedownComplianceSchema\n *\n * @public\n */\nexport interface UserTakedownComplianceSchema {\n /** Event time. */ eventAt: string;\n /** none */ user: Record;\n /** none */ withheldInCountries: Array;\n} /**\nSchema type for UserUndeleteComplianceSchema\n *\n * @public\n */\nexport interface UserUndeleteComplianceSchema {\n userUndelete: UserComplianceSchema;\n} /**\nSchema type for UserUnprotectComplianceSchema\n *\n * @public\n */\nexport interface UserUnprotectComplianceSchema {\n userUnprotect: UserComplianceSchema;\n} /**\nSchema type for UserUnsuspendComplianceSchema\n *\n * @public\n */\nexport interface UserUnsuspendComplianceSchema {\n userUnsuspend: UserComplianceSchema;\n} /**\nIndicates withholding details for [withheld content](https://help.twitter.com/en/rules-and-policies/tweet-withheld-by-country).\n *\n * @public\n */\nexport interface UserWithheld {\n /** Provides a list of countries where this content is not available. */ countryCodes: Array<\n CountryCode\n >;\n /** Indicates that the content being withheld is a `user`. */ scope?: 'user';\n} /**\nSchema type for UserWithheldComplianceSchema\n *\n * @public\n */\nexport interface UserWithheldComplianceSchema {\n userWithheld: UserTakedownComplianceSchema;\n} /**\nSchema type for Variant\n *\n * @public\n */\nexport interface Variant {\n /** The bit rate of the media. */ bitRate?: number;\n /** The content type of the media. */ contentType?: string;\n /** The url to the media. */ url?: string;\n} /**\nAn array of all available variants of the media.\n *\n * @public\n */\nexport type Variants = Array;\n/**\nSchema type for Video\n *\n * @public\n */\nexport type Video = any; /**\nA Webhook Configuration\n *\n * @public\n */\nexport interface WebhookConfig {\n /** none */ createdAt: string;\n id: WebhookConfigId;\n /** The callback URL of the webhook. */ url: string;\n /** none */ valid: boolean;\n} /**\nSchema type for WebhookConfigCreateRequest\n *\n * @public\n */\nexport interface WebhookConfigCreateRequest {\n /** none */ url: string;\n} /**\nA Webhook Configuration\n *\n * @public\n */\nexport interface WebhookConfigCreateResponse {\n /** none */ createdAt: string;\n id: WebhookConfigId;\n /** The callback URL of the webhook. */ url: string;\n /** none */ valid: boolean;\n} /**\nSchema type for WebhookConfigDeleteResponse\n *\n * @public\n */\nexport interface WebhookConfigDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nThe unique identifier of this webhook config.\n *\n * @public\n */\nexport type WebhookConfigId = string; /**\nSchema type for WebhookConfigPutResponse\n *\n * @public\n */\nexport interface WebhookConfigPutResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksCreateResponse\n *\n * @public\n */\nexport interface WebhookLinksCreateResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksDeleteResponse\n *\n * @public\n */\nexport interface WebhookLinksDeleteResponse {\n /** none */ data?: Record;\n /** none */ errors?: Array;\n} /**\nSchema type for WebhookLinksGetResponse\n *\n * @public\n */\nexport interface WebhookLinksGetResponse {\n /** The list of active webhook links for a given stream */ data?: Record<\n string,\n any\n >;\n /** none */ errors?: Array;\n}\n","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Models for stream operations\n */\nimport type * as Schemas from '../schemas.js';\n\n\n\n\n\n/**\n * Response for postsSample\n * \n * @public\n */\nexport type PostsSampleResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsFirehosePt\n * \n * @public\n */\nexport type PostsFirehosePtResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsFirehoseJa\n * \n * @public\n */\nexport type PostsFirehoseJaResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for postsSample10\n * \n * @public\n */\nexport type PostsSample10Response = Schemas.Get2TweetsSample10StreamResponse;\n/**\n * Response for postsFirehoseKo\n * \n * @public\n */\nexport type PostsFirehoseKoResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for likesCompliance\n * \n * @public\n */\nexport type LikesComplianceResponse = Schemas.LikesComplianceStreamResponse;\n/**\n * Response for postsCompliance\n * \n * @public\n */\nexport type PostsComplianceResponse = Schemas.TweetComplianceStreamResponse;\n/**\n * Response for getRuleCounts\n * \n * @public\n */\nexport type GetRuleCountsResponse = Schemas.Get2TweetsSearchStreamRulesCountsResponse;\n/**\n * Response for likesFirehose\n * \n * @public\n */\nexport type LikesFirehoseResponse = Schemas.StreamingLikeResponseV2;\n/**\n * Response for postsFirehoseEn\n * \n * @public\n */\nexport type PostsFirehoseEnResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for posts\n * \n * @public\n */\nexport type PostsResponse = Schemas.FilteredStreamingTweetResponse;\n/**\n * Response for usersCompliance\n * \n * @public\n */\nexport type UsersComplianceResponse = Schemas.UserComplianceStreamResponse;\n/**\n * Response for postsFirehose\n * \n * @public\n */\nexport type PostsFirehoseResponse = Schemas.StreamingTweetResponse;\n/**\n * Response for likesSample10\n * \n * @public\n */\nexport type LikesSample10Response = Schemas.StreamingLikeResponseV2;\n/**\n * Response for getRules\n * \n * @public\n */\nexport type GetRulesResponse = Schemas.RulesLookupResponse;\n/**\n * Request for updateRules\n * \n * @public\n */\nexport type UpdateRulesRequest = Schemas.AddOrDeleteRulesRequest;\n/**\n * Response for updateRules\n * \n * @public\n */\nexport type UpdateRulesResponse = Schemas.AddOrDeleteRulesResponse;\n/**\n * Response for labelsCompliance\n * \n * @public\n */\nexport type LabelsComplianceResponse = Schemas.TweetLabelStreamResponse;","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * Pagination utilities for the X API.\n * \n * This module provides comprehensive pagination support for the X API, including\n * automatic iteration, manual page control, and metadata access.\n * \n * @category Pagination\n */\n\n/**\n * Paginated response interface\n * \n * Represents the structure of a paginated API response from the X API.\n * \n * @template T - The type of items in the response\n */\nexport interface PaginatedResponse {\n /** Array of items in the current page */\n data: T[];\n /** Pagination metadata */\n meta?: {\n /** Number of results in the current page */\n result_count?: number;\n /** Token for fetching the next page */\n next_token?: string;\n /** Token for fetching the previous page */\n previous_token?: string;\n };\n /** Additional included objects (users, tweets, etc.) */\n includes?: Record;\n /** Any errors in the response */\n errors?: Array;\n}\n\n\n/**\n * X API paginator with rich functionality\n * \n * This class provides comprehensive pagination support for the X API, including:\n * - Automatic iteration with `for await...of` loops\n * - Manual page control with `fetchNext()` and `fetchPrevious()`\n * - Metadata access for pagination tokens and counts\n * - Error handling and rate limit detection\n * - Support for both forward and backward pagination\n * \n * @template T - The type of items being paginated\n * \n * @example\n * ```typescript\n * // Automatic iteration\n * const followers = await client.users.getFollowers('783214');\n * for await (const follower of followers) {\n * console.log(follower.username);\n * }\n * \n * // Manual control\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext();\n * console.log(followers.items.length); // Number of followers\n * console.log(followers.meta.next_token); // Next page token\n * \n * // Check status\n * if (!followers.done) {\n * await followers.fetchNext();\n * }\n * ```\n * \n * @category Pagination\n */\nexport class Paginator implements AsyncIterable {\n private fetchPage: (token?: string) => Promise>;\n private currentToken?: string;\n private previousToken?: string;\n private hasMore: boolean = true;\n private isDone: boolean = false;\n private allItems: T[] = [];\n private currentMeta?: any;\n private currentIncludes?: Record;\n private currentErrors?: Array;\n private rateLimitHit: boolean = false;\n\n /**\n * Creates a new paginator instance\n * \n * @param fetchPage - Function that fetches a page of data given a pagination token\n */\n constructor(fetchPage: (token?: string) => Promise>) {\n this.fetchPage = fetchPage;\n }\n\n /**\n * Get all fetched items\n */\n get items(): T[] {\n return [...this.allItems];\n }\n\n /**\n * Get current pagination metadata\n */\n get meta(): any {\n return this.currentMeta;\n }\n\n /**\n * Get current includes data\n */\n get includes(): Record | undefined {\n return this.currentIncludes;\n }\n\n /**\n * Get current errors\n */\n get errors(): Array | undefined {\n return this.currentErrors;\n }\n\n /**\n * Check if pagination is done\n */\n get done(): boolean {\n return this.isDone || this.rateLimitHit;\n }\n\n /**\n * Check if rate limit was hit\n */\n get rateLimited(): boolean {\n return this.rateLimitHit;\n }\n\n /**\n * Fetch the next page and add items to current instance\n * \n * This method fetches the next page of data and appends the items to the\n * current paginator instance. It updates the pagination state and metadata.\n * \n * @example\n * ```typescript\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext(); // Fetch first page\n * console.log(followers.items.length); // Number of followers\n * \n * if (!followers.done) {\n * await followers.fetchNext(); // Fetch second page\n * console.log(followers.items.length); // Total followers across pages\n * }\n * ```\n * \n * @throws {Error} When the API request fails\n */\n async fetchNext(): Promise {\n if (this.done) {\n return;\n }\n\n try {\n const response = await this.fetchPage(this.currentToken);\n \n // Update tokens\n this.previousToken = this.currentToken;\n this.currentToken = response.meta?.next_token;\n \n // Update state\n this.hasMore = !!this.currentToken;\n this.isDone = !this.hasMore;\n \n // Add new items to collection\n if (response.data) {\n this.allItems.push(...response.data);\n }\n \n // Update metadata\n this.currentMeta = response.meta;\n this.currentIncludes = response.includes;\n this.currentErrors = response.errors;\n \n } catch (error: any) {\n // Check if it's a rate limit error\n if (error.status === 429 || error.message?.includes('rate limit')) {\n this.rateLimitHit = true;\n }\n throw error;\n }\n }\n\n /**\n * Get next page as a new instance\n * \n * This method creates a new paginator instance that starts from the next page,\n * without affecting the current paginator's state.\n * \n * @example\n * ```typescript\n * const followers = await client.users.getFollowers('783214');\n * await followers.fetchNext(); // Fetch first page\n * \n * if (!followers.done) {\n * const nextPage = await followers.next(); // Get next page as new instance\n * console.log(followers.items.length); // Still first page\n * console.log(nextPage.items.length); // Second page\n * }\n * ```\n * \n * @returns New paginator instance for the next page\n */\n async next(): Promise> {\n if (this.done) {\n return new Paginator(this.fetchPage);\n }\n\n const nextPaginator = new Paginator(this.fetchPage);\n nextPaginator.currentToken = this.currentToken;\n await nextPaginator.fetchNext();\n return nextPaginator;\n }\n\n /**\n * Fetch previous page (if supported)\n */\n async fetchPrevious(): Promise {\n if (!this.previousToken) {\n return;\n }\n\n try {\n const response = await this.fetchPage(this.previousToken);\n \n // Update tokens\n this.currentToken = this.previousToken;\n this.previousToken = response.meta?.previous_token;\n \n // Update state\n this.hasMore = !!this.currentToken;\n this.isDone = !this.hasMore;\n \n // Replace items with previous page items\n this.allItems = response.data || [];\n \n // Update metadata\n this.currentMeta = response.meta;\n this.currentIncludes = response.includes;\n this.currentErrors = response.errors;\n \n } catch (error: any) {\n if (error.status === 429 || error.message?.includes('rate limit')) {\n this.rateLimitHit = true;\n }\n throw error;\n }\n }\n\n /**\n * Get previous page as a new instance\n */\n async previous(): Promise> {\n if (!this.previousToken) {\n return new Paginator(this.fetchPage);\n }\n\n const prevPaginator = new Paginator(this.fetchPage);\n prevPaginator.currentToken = this.previousToken;\n await prevPaginator.fetchNext();\n return prevPaginator;\n }\n\n /**\n * Fetch up to a specified number of additional items\n */\n async fetchLast(count: number): Promise {\n let fetched = 0;\n \n while (!this.done && fetched < count) {\n const beforeCount = this.allItems.length;\n await this.fetchNext();\n const afterCount = this.allItems.length;\n fetched += (afterCount - beforeCount);\n }\n }\n\n /**\n * Reset paginator to initial state\n */\n reset(): void {\n this.currentToken = undefined;\n this.previousToken = undefined;\n this.hasMore = true;\n this.isDone = false;\n this.allItems = [];\n this.currentMeta = undefined;\n this.currentIncludes = undefined;\n this.currentErrors = undefined;\n this.rateLimitHit = false;\n }\n\n /**\n * Iterator for all fetched items\n */\n *[Symbol.iterator](): Iterator {\n for (const item of this.allItems) {\n yield item;\n }\n }\n\n /**\n * Async iterator that fetches pages automatically\n */\n async *[Symbol.asyncIterator](): AsyncIterator {\n let lastYieldedIndex = 0;\n \n // First, yield all currently fetched items\n for (let i = lastYieldedIndex; i < this.allItems.length; i++) {\n yield this.allItems[i];\n }\n lastYieldedIndex = this.allItems.length;\n\n // Then continue fetching and yielding new items\n while (!this.done) {\n await this.fetchNext();\n \n // Yield only new items since last iteration\n for (let i = lastYieldedIndex; i < this.allItems.length; i++) {\n yield this.allItems[i];\n }\n lastYieldedIndex = this.allItems.length;\n }\n }\n}\n\n/**\n * Specialized paginators for different data types\n */\n\n/**\n * Paginator for posts\n */\nexport class PostPaginator extends Paginator {\n get posts(): any[] {\n return this.items;\n }\n}\n\n/**\n * Paginator for users\n */\nexport class UserPaginator extends Paginator {\n get users(): any[] {\n return this.items;\n }\n}\n\n\n\n/**\n * Paginator for events (like DM events)\n */\nexport class EventPaginator extends Paginator {\n get events(): any[] {\n return this.items;\n }\n} ","// AUTO-GENERATED FILE - DO NOT EDIT\n// This file was automatically generated by the XDK build tool.\n// Any manual changes will be overwritten on the next generation.\n/**\n * X API SDK\n *\n * A modern TypeScript/JavaScript SDK for interacting with the X API.\n * Built with full TypeScript support, React hooks, and Next.js integration.\n */\n\n// Automatic polyfill setup for Node.js environments\nif (typeof process !== 'undefined' && process.versions && process.versions.node) {\n // Node.js environment - set up polyfills if needed\n if (typeof globalThis.fetch === 'undefined' || typeof globalThis.Headers === 'undefined') {\n try {\n // Try to use native Node.js fetch (Node 18+)\n if (typeof globalThis.fetch === 'function' && typeof globalThis.Headers === 'function') {\n // Native APIs are available, no polyfills needed\n } else {\n // Need to set up polyfills for older Node.js versions\n const nodeFetch = require('node-fetch');\n const { Headers: NodeHeaders } = nodeFetch;\n \n if (typeof globalThis.fetch === 'undefined') {\n (globalThis as any).fetch = nodeFetch.default || nodeFetch;\n }\n if (typeof globalThis.Headers === 'undefined') {\n (globalThis as any).Headers = NodeHeaders;\n }\n }\n } catch (error) {\n // If node-fetch is not available, provide a helpful error\n console.warn(\n 'X API SDK: node-fetch not found. For Node.js environments, please install node-fetch:\\n' +\n 'npm install node-fetch\\n' +\n 'Or upgrade to Node.js 18+ for native fetch support.'\n );\n }\n }\n}\n\n// Main client\nexport { Client } from './client.js';\nexport type { ClientConfig } from './client.js';\n\n// Error handling\nexport { ApiError } from './client.js';\nexport type { RequestOptions, ApiResponse, PaginationMeta } from './client.js';\n\n// HTTP client\nexport { httpClient, HttpClient } from './http-client.js';\nexport type { RequestOptions as HttpClientRequestOptions, HttpResponse } from './http-client.js';\n\n// Authentication\nexport { OAuth2 } from './oauth2_auth.js';\nexport type { OAuth2Config, OAuth2Token } from './oauth2_auth.js';\nexport { OAuth1 } from './oauth1_auth.js';\nexport type { OAuth1Config, OAuth1RequestToken, OAuth1AccessToken } from './oauth1_auth.js';\n\n// Crypto utilities\nexport { CryptoUtils, hmacSha1, generateNonce, generateTimestamp, generateCodeVerifier, generateCodeChallenge } from './crypto_utils.js';\n\n// Streaming\nexport type { StreamListener, TweetStreamListener } from './stream_listener.js';\n\n// Schema types (export all OpenAPI schema types)\nexport * as Schemas from './schemas.js';\n\n// Client modules (export client classes and types)\n\nexport { ActivityClient } from './activity/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Activity from './activity/models.js';\n\nexport { NewsClient } from './news/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as News from './news/models.js';\n\nexport { ConnectionsClient } from './connections/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Connections from './connections/models.js';\n\nexport { AccountActivityClient } from './account_activity/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as AccountActivity from './account_activity/models.js';\n\nexport { SpacesClient } from './spaces/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Spaces from './spaces/models.js';\n\nexport { TrendsClient } from './trends/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Trends from './trends/models.js';\n\nexport { MediaClient } from './media/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Media from './media/models.js';\n\nexport { DirectMessagesClient } from './direct_messages/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as DirectMessages from './direct_messages/models.js';\n\nexport { PostsClient } from './posts/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Posts from './posts/models.js';\n\nexport { ListsClient } from './lists/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Lists from './lists/models.js';\n\nexport { CommunityNotesClient } from './community_notes/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as CommunityNotes from './community_notes/models.js';\n\nexport { GeneralClient } from './general/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as General from './general/models.js';\n\nexport { WebhooksClient } from './webhooks/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Webhooks from './webhooks/models.js';\n\nexport { UsersClient } from './users/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Users from './users/models.js';\n\nexport { CommunitiesClient } from './communities/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Communities from './communities/models.js';\n\nexport { StreamClient } from './stream/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Stream from './stream/models.js';\n\nexport { ComplianceClient } from './compliance/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Compliance from './compliance/models.js';\n\nexport { UsageClient } from './usage/client.js';\n// Export all types (Request, Response, Options) from this module as a namespace\nexport * as Usage from './usage/models.js';\n\n\n// Utilities\nexport * from './paginator.js'; "]} \ No newline at end of file diff --git a/xdk/typescript/package.json b/xdk/typescript/package.json index 50070490..f3f9ce34 100644 --- a/xdk/typescript/package.json +++ b/xdk/typescript/package.json @@ -102,10 +102,10 @@ "test:coverage": "jest --coverage", "docs": "typedoc", "docs:build": "typedoc && echo \"Documentation generated in docs/\"", - "docs:build-simple": "node generate-docs-simple.js", + "docs:build-simple": "node scripts/generate-docs-simple.js", "docs:serve": "npx http-server docs -p 8080 -o", - "docs:watch": "node watch-docs.js", - "docs:mintlify": "node process-for-mintlify.js" + "docs:watch": "node scripts/watch-docs.js", + "docs:mintlify": "node scripts/process-for-mintlify.js" }, "prettier": { "semi": true, diff --git a/xdk/typescript/scripts/generate-docs-simple.js b/xdk/typescript/scripts/generate-docs-simple.js new file mode 100644 index 00000000..9448feb3 --- /dev/null +++ b/xdk/typescript/scripts/generate-docs-simple.js @@ -0,0 +1,64 @@ +// AUTO-GENERATED FILE - DO NOT EDIT +// This file was automatically generated by the XDK build tool. +// Any manual changes will be overwritten on the next generation. +import { execSync } from 'child_process'; +import fs from 'fs'; +import path from 'path'; + +console.log('🚀 Generating X API SDK Documentation...'); + +// Create a temporary tsconfig that excludes problematic files +const tsconfig = { + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "allowJs": true, + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "outDir": "./dist", + "rootDir": "./src" + }, + "include": [ + "src/client.ts", + "src/paginator.ts", + "src/index.ts", + "src/http-client.ts" + ], + "exclude": [ + "**/stream_client.ts", + "**/event_driven_stream.ts", + "**/stream_listener.ts", + "**/oauth1_auth.ts", + "**/oauth2_auth.ts", + "**/crypto_utils.ts", + "**/models.ts" + ] +}; + +// Write temporary tsconfig +fs.writeFileSync('tsconfig.docs.json', JSON.stringify(tsconfig, null, 2)); + +try { + // Generate documentation using the temporary tsconfig + execSync('npx typedoc --tsconfig tsconfig.docs.json --out docs --name "X API SDK v0.2.1-beta" --readme README.md --theme default --includeVersion true --excludePrivate true --excludeProtected true --excludeExternals true --excludeInternal true --searchInComments true --cleanOutputDir true', { stdio: 'inherit' }); + + console.log('✅ Documentation generated successfully in docs/'); + + // Clean up temporary file + fs.unlinkSync('tsconfig.docs.json'); + +} catch (error) { + console.error('❌ Documentation generation failed:', error.message); + + // Clean up temporary file + if (fs.existsSync('tsconfig.docs.json')) { + fs.unlinkSync('tsconfig.docs.json'); + } + + process.exit(1); +} diff --git a/xdk/typescript/scripts/generate-docs.js b/xdk/typescript/scripts/generate-docs.js index 7a7d7323..d7adf841 100644 --- a/xdk/typescript/scripts/generate-docs.js +++ b/xdk/typescript/scripts/generate-docs.js @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE - DO NOT EDIT // This file was automatically generated by the XDK build tool. // Any manual changes will be overwritten on the next generation. -#!/usr/bin/env node - /** * Documentation generation script for X API SDK * diff --git a/xdk/typescript/scripts/process-for-mintlify.js b/xdk/typescript/scripts/process-for-mintlify.js new file mode 100644 index 00000000..38221c29 --- /dev/null +++ b/xdk/typescript/scripts/process-for-mintlify.js @@ -0,0 +1,1243 @@ +// AUTO-GENERATED FILE - DO NOT EDIT +// This file was automatically generated by the XDK build tool. +// Any manual changes will be overwritten on the next generation. +import { execSync } from 'child_process'; +import fs from 'fs'; +import path from 'path'; + +console.log('🚀 Processing X API SDK Documentation for Mintlify...'); + +// Mintlify configuration +const MINTLIFY_CONFIG = { + outputDir: 'mintlify-docs', + baseUrl: 'https://docs.x.com', + title: 'X API SDK v0.2.1-beta', + description: 'TypeScript SDK for the X API with comprehensive pagination, authentication, and streaming support.', + version: '0.2.1-beta', + githubUrl: 'https://github.com/xdevplatform/xsdk', + logo: { + light: '/logo-light.svg', + dark: '/logo-dark.svg' + } +}; + +// (Removed legacy category mappings and method groups) + +// Helper function to generate Mintlify frontmatter +function generateFrontmatter(title, sidebarTitle = null) { + // Clean up titles by removing generic type parameters for better readability + const cleanTitle = (str) => { + if (typeof str !== 'string') return str; + return str + .replace(/<.*?>/g, '') // Remove all generic type parameters + .replace(/Interface:\s+/, '') // Remove "Interface:" prefix + .replace(/Class:\s+/, '') // Remove "Class:" prefix + .replace(/\\/g, '') // Remove any backslashes + .replace(/\s+/g, ' ') // Normalize whitespace + .trim(); + }; + + const frontmatter = { + title: cleanTitle(title) + }; + + if (sidebarTitle) { + frontmatter.sidebarTitle = cleanTitle(sidebarTitle); + } + + // Use simple quoted strings for clean frontmatter + return `--- +title: "${cleanTitle(title)}" +${sidebarTitle ? `sidebarTitle: "${cleanTitle(sidebarTitle)}"` : ''} +--- + +`; +} + +// Helper function to clean and format markdown content +function processMarkdownContent(content, title, currentFilePath, knownTargets) { + // Remove TypeDoc-specific elements that don't work well in Mintlify + content = content + // Remove TypeDoc navigation elements + .replace(/\[\[include:.*?\]\]/g, '') + .replace(/\[\[include-start:.*?\]\]/g, '') + .replace(/\[\[include-end:.*?\]\]/g, '') + + // Fix code block formatting + .replace(/```typescript\n/g, '```typescript\n') + .replace(/```javascript\n/g, '```javascript\n') + + // Remove TypeDoc breadcrumbs (README/Exports) + .replace(/^\[[^\]]+\]\([^\)]+\)\s*\/\s*\[Exports\]\([^\)]+\)\s*\/.*\n?/m, '') + // Remove modules breadcrumb variant: [..](..)/ Exports + .replace(/^\[[^\]]+\]\([^\)]+\)\s*\/\s*Exports\s*\n?/m, '') + // Fix internal links → absolute Mintlify paths, preserve TypeDoc subdirs + // Examples: + // [Client](classes/Client.md) → /xdks/typescript/reference/classes/Client + // [deleteSubscription](AccountActivityClient.md#deletesubscription) → /xdks/typescript/reference/AccountActivityClient#deletesubscription + .replace(/\[([^\]]+)\]\(([^)#]+?)(?:\.(?:md|mdx))?(#[^)]+)?\)/g, (match, text, rawLinkPath, hash) => { + // Skip absolute URLs (http, https, mailto, tel) + if (/^(?:https?:|mailto:|tel:)/i.test(rawLinkPath)) { + return match; + } + const anchor = hash || ''; + const linkPath = rawLinkPath.replace(/\.(?:md|mdx)$/i, ''); + const currentDir = currentFilePath ? currentFilePath.substring(0, currentFilePath.lastIndexOf('/')) : ''; + // Normalize relative paths + const joined = path.posix.normalize(path.posix.join(currentDir || '', linkPath)); + let targetPath = joined.replace(/^\.\/?/, '').replace(/^docs\//, ''); + // If no directory segment and a known target exists for this base name, use it + if (!targetPath.includes('/') && knownTargets && knownTargets.has(targetPath)) { + targetPath = `${knownTargets.get(targetPath)}/${targetPath}`; + } + return `[${text}](/xdks/typescript/reference/${targetPath}${anchor})`; + }) + + // Fix method signatures + .replace(/### (.*?)\(/g, '### `$1`(') + + // Add proper spacing + .replace(/\n\n\n+/g, '\n\n') + + // Fix parameter formatting + .replace(/\*\*@param\s+(\w+)\s+(.*?)\*\*/g, '**@param** `$1` - $2') + // Replace package placeholder with real npm package + .replace(/@your-org\/x-api-sdk/g, '@xdevplatform/xdk') + .replace(/from\s+['"]x-api-sdk['"]/g, "from '@xdevplatform/xdk'") + .replace(/\*\*@returns\s+(.*?)\*\*/g, '**@returns** $1') + .replace(/\*\*@throws\s+(.*?)\*\*/g, '**@throws** $1'); + + // Remove the first H1 header to avoid duplicate titles (frontmatter title will be used) + content = content.replace(/^\s*#\s+[^\n]+\n+/, ''); + + // Escape generic type angle brackets like PaginatedResponse to avoid MDX JSX parsing + content = content.replace(/\b([A-Z][A-Za-z0-9_]*)<([^>\n]+)>/g, (m, name, inner) => { + const escapedInner = inner.replace(//g, '>'); + return `${name}<${escapedInner}>`; + }); + + // Remove explicit Table of contents blocks; Mintlify renders a sidebar TOC automatically + content = content.replace(/(^##\s+Table of contents\n[\s\S]*?)(?=^##\s+|^#\s+|\Z)/gmi, ''); + + // Convert Properties sections to Mintlify components (ResponseField/ParamField/Expandable) + // Check if this is an interface or class file + const isInterfaceOrClass = currentFilePath && ( + currentFilePath.includes('interfaces/') || + currentFilePath.includes('classes/') + ); + + if (isInterfaceOrClass && content.includes('## Properties')) { + const useParamField = /Options\b/i.test(currentFilePath); + const fieldTag = useParamField ? 'ParamField' : 'ResponseField'; + + // Helper to escape type strings for HTML attributes + const escapeType = (type) => String(type) + .replace(/\"/g, '"') + .replace(/"/g, '"') + .replace(//g, '>') + .replace(/\{/g, '{') + .replace(/\}/g, '}'); + + // Helper to parse inline object type (e.g., "{ name?: string; age: number }") + const parseInlineObject = (objStr) => { + // Remove outer braces and array brackets + let cleaned = objStr.trim().replace(/^\{/, '').replace(/\}\s*\[\]?\s*$/, '').trim(); + if (!cleaned) return []; + + const props = []; + // Split by semicolons, but be careful with nested objects + let depth = 0; + let current = ''; + const parts = []; + + for (let i = 0; i < cleaned.length; i++) { + const char = cleaned[i]; + if (char === '{') depth++; + else if (char === '}') depth--; + else if (char === ';' && depth === 0) { + parts.push(current.trim()); + current = ''; + continue; + } + current += char; + } + if (current.trim()) parts.push(current.trim()); + + for (const part of parts) { + // Match: name?: type or name: type + const match = part.match(/^\s*([^:?]+?)\??\s*:\s*(.+?)\s*$/); + if (match) { + const propName = match[1].trim(); + let propType = match[2].trim(); + const isOptional = part.includes('?') && !propType.includes('?'); + + // Clean up type (remove extra braces if present) + propType = propType.replace(/^\{/, '').replace(/\}$/, ''); + + props.push({ + name: propName, + type: propType, + optional: isOptional + }); + } + } + return props; + }; + + // Convert markdown table to Expandable with child fields + const tableToExpandable = (tableLines, tagName) => { + const children = []; + for (const line of tableLines) { + const trimmed = line.trim(); + // Skip header/separator rows + if (/^\|\s*:?-{2,}\s*\|/.test(trimmed) || /^\|\s*Name\s*\|\s*Type\s*\|\s*$/i.test(trimmed)) continue; + const m = trimmed.match(/^\|\s*`?([^`|]+?)`?\s*\|\s*(.+?)\s*\|$/); + if (!m) continue; + const fname = m[1].trim().replace(/\?$/, ''); + let ftype = m[2].trim(); + const isOptional = m[1].includes('?'); + + // Remove ALL backticks and backslashes from type for parsing + // Backticks might be around the whole type or around individual parts + ftype = ftype.replace(/`/g, '').replace(/\\/g, ''); + + // Check if type is Object[] with inline definition + if (/^\{[\s\S]*\}\s*\[\]\s*$/.test(ftype)) { + const objProps = parseInlineObject(ftype); + if (objProps.length > 0) { + const nested = objProps.map(p => { + const req = p.optional ? '' : ' required'; + const cleanPType = p.type.replace(/\}\s*\[\]\s*$/, '').trim(); + return `<${tagName} name="${p.name}" type="${escapeType(cleanPType)}"${req}>\n`; + }).join('\n\n'); + children.push(`<${tagName} name="${fname}" type="Object[]"${isOptional ? '' : ' required'}>\n\n${nested}\n\n`); + } else { + children.push(`<${tagName} name="${fname}" type="Object[]"${isOptional ? '' : ' required'}>\n`); + } + } else if (/^\{[\s\S]*\}$/.test(ftype)) { + // Nested object + const objProps = parseInlineObject(ftype); + if (objProps.length > 0) { + const nested = objProps.map(p => { + const req = p.optional ? '' : ' required'; + return `<${tagName} name="${p.name}" type="${escapeType(p.type.trim())}"${req}>\n`; + }).join('\n\n'); + children.push(`<${tagName} name="${fname}" type="Object"${isOptional ? '' : ' required'}>\n\n${nested}\n\n`); + } else { + children.push(`<${tagName} name="${fname}" type="Object"${isOptional ? '' : ' required'}>\n`); + } + } else { + // Simple type + const cleanType = ftype; + children.push(`<${tagName} name="${fname}" type="${escapeType(cleanType)}"${isOptional ? '' : ' required'}>\n`); + } + } + return children; + }; + + // Convert each property section + // Find Properties section - match from ## Properties to end of content or next ## section + const propsIndex = content.indexOf('## Properties'); + if (propsIndex !== -1) { + // Find where Properties section ends (next ## or end of content) + const afterProps = content.substring(propsIndex + '## Properties'.length); + const nextSection = afterProps.match(/^\s*\n+(.*?)(?=^##\s+|$)/s); + if (!nextSection) return content; + + const propsSection = nextSection[1]; + const convertedProps = []; + + // Match each property using regex - be more flexible with matching + // Split by ### headers first to ensure we get complete property blocks + const propBlocks = propsSection.split(/(?=^###\s+)/m).filter(b => b.trim().startsWith('###')); + + for (const propBlock of propBlocks) { + const nameMatch = propBlock.match(/^###\s+([^\n]+)\n+/); + if (!nameMatch) continue; + + const propName = nameMatch[1].trim(); + const propBody = propBlock.substring(nameMatch[0].length); + + // Check if optional + const isOptional = /•\s*`?Optional`?/.test(propBody); + + // Extract type first (before description extraction) + // Match: • Optional **name**: `type` or • **name**: type (with or without backticks) + // Handle cases like: `Object`, `\{ ... \}[]`, or inline types without backticks + const typePattern = /:\s*(?:`([^`]+)`|([^\n]+?))(?:\s*\n|$)/; + const typeMatch = propBody.match(typePattern); + let typeStr = 'any'; + + if (typeMatch) { + // Prefer backtick-wrapped type, otherwise use unwrapped + typeStr = (typeMatch[1] || typeMatch[2] || '').trim(); + } + + // Clean up type string - remove backslashes, backticks, and extract from markdown links + // Handle markdown link format: [`Type`](link) -> just use "Type" + typeStr = typeStr.replace(/\[`([^`]+)`\]\([^\)]+\)/g, '$1'); + typeStr = typeStr.replace(/`/g, '').replace(/\\/g, ''); + + // Extract description (text after type line, before "Type declaration" or "Defined in") + // First, find where the type line ends + const typeLineEnd = propBody.indexOf('\n', propBody.indexOf(':')); + const afterTypeLine = typeLineEnd !== -1 ? propBody.substring(typeLineEnd + 1) : propBody; + + // Then extract just the description part (before Type declaration or Defined in) + const descMatch = afterTypeLine.match(/^([\s\S]*?)(?:\n####\s+Type declaration|\n####\s+Defined in|\n___|\n###|$)/); + let description = descMatch ? descMatch[1].trim() : ''; + + // Remove any leftover type line fragments + description = description + .replace(/^•\s*`?Optional`?\s*\*\*[^*]+\*\*:\s*`?[^`\n]+`?\s*\n*/, '') + .replace(/^•\s*\*\*[^*]+\*\*:\s*`?[^`\n]+`?\s*\n*/, '') + .replace(/^•\s*`?Optional`?\s*$/, '') + .trim(); + + // Check if there's a Type declaration table + const typeDeclMatch = propBody.match(/####\s+Type declaration\s*\n+([\s\S]*?)(?=\n####\s+Defined in|\n___|\n###|$)/); + + if (typeDeclMatch) { + // Has table - convert to Expandable + const tableText = typeDeclMatch[1]; + const tableLines = tableText.split('\n').filter(l => l.trim().startsWith('|')); + const children = tableToExpandable(tableLines, fieldTag); + + if (children.length > 0) { + const finalType = typeStr === 'Object' || typeStr.includes('Object') ? 'Object' : typeStr; + const requiredAttr = isOptional ? '' : ' required'; + const expandableContent = children.join('\n\n'); + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="${escapeType(finalType)}"${requiredAttr}>\n${descPart}\n${expandableContent}\n\n`); + } else { + const requiredAttr = isOptional ? '' : ' required'; + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="${escapeType(typeStr)}"${requiredAttr}>\n${descPart}`); + } + } else if (/^\{[\s\S]*\}\s*\[\]\s*$/.test(typeStr.replace(/`/g, ''))) { + // Object[] with inline definition - remove backticks and backslashes + const cleanTypeStr = typeStr.replace(/`/g, '').replace(/\\/g, ''); + const objProps = parseInlineObject(cleanTypeStr); + + // Clean description - remove any type definition remnants + description = description.replace(/\{[\s\S]*\}\s*\[\]\s*$/, '').trim(); + + if (objProps.length > 0) { + const nested = objProps.map(p => { + const req = p.optional ? '' : ' required'; + const cleanPType = p.type.replace(/\}\s*\[\]\s*$/, '').trim(); + return `<${fieldTag} name="${p.name}" type="${escapeType(cleanPType)}"${req}>\n`; + }).join('\n\n'); + const requiredAttr = isOptional ? '' : ' required'; + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="Object[]"${requiredAttr}>\n${descPart}\n${nested}\n\n`); + } else { + const requiredAttr = isOptional ? '' : ' required'; + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="Object[]"${requiredAttr}>\n${descPart}`); + } + } else { + // Simple type or reference type + const cleanType = typeStr.replace(/^`|`$/g, '').replace(/\\/g, ''); + const requiredAttr = isOptional ? '' : ' required'; + const descPart = description ? `${description}\n\n` : ''; + convertedProps.push(`<${fieldTag} name="${propName}" type="${escapeType(cleanType)}"${requiredAttr}>\n${descPart}`); + } + } + + if (convertedProps.length > 0) { + // Replace the Properties section with converted content + const convertedContent = convertedProps.join('\n\n'); + const beforeProps = content.substring(0, propsIndex); + const afterPropsStart = propsIndex + '## Properties'.length + nextSection[0].length; + const rest = content.substring(afterPropsStart); + content = beforeProps + '## Properties\n\n' + convertedContent + '\n' + rest; + } + } + + // Clean up "Defined in" sections and separators + content = content + .replace(/^####\s+Defined in[\s\S]*?(?=^###\s+|^##\s+|$)/gm, '') + .replace(/^___\s*$/gm, ''); + + // Escape '<' inside component blocks to avoid MDX JSX parse issues in text like '<=' + // But preserve JSX tags like , , etc. + content = content + .replace(/()([\s\S]*?)(<\/ResponseField>)/g, (m, open, inner, close) => { + // Escape '<' only when it's NOT part of a JSX tag (like or ) + // Pattern: < followed by either a letter (JSX tag start) or /letter (JSX closing tag) + // Escape everything else like '<=' or '< number' + const escaped = inner.replace(/<(?![A-Za-z/])/g, '<'); + return open + escaped + close; + }) + .replace(/()([\s\S]*?)(<\/ParamField>)/g, (m, open, inner, close) => { + const escaped = inner.replace(/<(?![A-Za-z/])/g, '<'); + return open + escaped + close; + }); + } + + return content; +} + +// Helper function to determine category from file path +function getCategoryFromPath(filePath) { + if (filePath.includes('classes/Client')) return 'Getting Started'; + if (filePath.includes('classes/Paginator')) return 'Core Features'; + if (filePath.includes('stream_client')) return 'Core Features'; + if (filePath.includes('interfaces/')) return 'API Reference'; + + return 'API Reference'; +} + +// Main processing function +async function processDocs() { + try { + // First, try to generate the documentation, but skip if it fails (e.g., Node version mismatch) + console.log('📚 Generating documentation...'); + try { + execSync('npm run docs:build', { stdio: 'inherit' }); + } catch (error) { + console.log('⚠️ TypeDoc generation failed (likely Node version issue), using existing docs if available...'); + if (!fs.existsSync('docs') || fs.readdirSync('docs').length === 0) { + throw new Error('No documentation found and TypeDoc generation failed. Please upgrade Node.js to 16+ or generate docs manually.'); + } + console.log('✅ Using existing documentation files'); + } + + // Create output directory + const outputDir = MINTLIFY_CONFIG.outputDir; + if (fs.existsSync(outputDir)) { + fs.rmSync(outputDir, { recursive: true }); + } + fs.mkdirSync(outputDir, { recursive: true }); + + // Create subdirectories with xdks/typescript prefix + fs.mkdirSync(path.join(outputDir, 'xdks', 'typescript', 'reference'), { recursive: true }); + + console.log('📝 Processing markdown files...'); + + // Process all markdown files + const docsDir = 'docs'; + + // Recursive function to get all files (for Node.js < 18) + function getAllFiles(dir, fileList = []) { + const files = fs.readdirSync(dir); + files.forEach(file => { + const filePath = path.join(dir, file); + if (fs.statSync(filePath).isDirectory()) { + getAllFiles(filePath, fileList); + } else if (file.endsWith('.md')) { + // Store relative path from docsDir + fileList.push(path.relative(docsDir, filePath)); + } + }); + return fileList; + } + + const files = getAllFiles(docsDir); + + // Build map of known targets: baseName -> subdirectory (classes/interfaces/modules/enums) + const knownTargets = new Map(); + for (const f of files) { + if (typeof f === 'string' && f.endsWith('.md')) { + const base = path.basename(f, '.md'); + const dir = path.dirname(f).replace(/^\.$/, ''); + if (!knownTargets.has(base) && dir && dir !== 'docs') { + knownTargets.set(base, dir); + } + } + } + + const processedFiles = []; + const navigation = { + 'Getting Started': [], + 'Core Features': [], + 'API Reference': [], + 'Authentication': [], + 'Utilities': [] + }; + + for (const file of files) { + if (file.endsWith('.md') && file !== 'README.md') { + const filePath = path.join(docsDir, file); + const content = fs.readFileSync(filePath, 'utf8'); + + // Extract title from content or filename + let title = path.basename(file, '.md'); + const titleMatch = content.match(/^#\s+(.+)$/m); + if (titleMatch) { + title = titleMatch[1]; + } + + // Clean up title (keep original class/interface names without inserting spaces) + title = title + .replace(/^Class\s+/, '') + .replace(/^Interface\s+/, '') + .replace(/^Type\s+/, '') + .trim(); + + const category = getCategoryFromPath(file); + const processedContent = processMarkdownContent(content, title, file, knownTargets); + + // Generate frontmatter with sidebarTitle + const frontmatter = generateFrontmatter(title, title); + const finalContent = frontmatter + processedContent; + + // Determine output path with xdks/typescript prefix, preserving TypeDoc subdirectories + const baseName = path.basename(file, '.md'); + const subDir = path.dirname(file); // e.g., classes, interfaces, enums + const targetDir = path.join(outputDir, 'xdks', 'typescript', 'reference', subDir); + fs.mkdirSync(targetDir, { recursive: true }); + const outputPath = path.join(targetDir, `${baseName}.mdx`); + + // Write processed file + fs.writeFileSync(outputPath, finalContent); + processedFiles.push({ + title, + category, + path: outputPath, + originalPath: file + }); + + // Add to navigation with xdks/typescript prefix (preserve subdirectory) + if (navigation[category]) { + const relativeRefPath = path.join(subDir, baseName).replace(/\\/g, '/'); + navigation[category].push({ + title, + url: `xdks/typescript/reference/${relativeRefPath}` + }); + } + } + } + + // Create high-level documentation pages + console.log('📄 Creating high-level documentation pages...'); + + // Overview page + const overviewContent = `--- +title: "TypeScript XDK" +sidebarTitle: "Overview" +--- + +A comprehensive TypeScript SDK for the X API (formerly Twitter API) with advanced features including smart pagination, multiple authentication methods, real-time streaming, and full type safety. + +## Key Features + +- **🔐 Authentication**: User Context (OAuth1.0a, OAuth2.0), and App-Only (Bearer token) authentication +- **🔄 Pagination**: Automatic pagination with async iteration support +- **📡 Streaming**: Event-driven streaming with automatic reconnection +- **📚 Type Safety**: Complete TypeScript definitions for all endpoints and parameters +- **🎯 Full X API Support**: Users, Posts, Lists, Bookmarks, Communities, and more + +## Quick Start + + + +\`\`\`typescript quickstart.ts theme={null} +import { + Client, + type ClientConfig, + type Users +} from '@xdevplatform/xdk'; + +const config: ClientConfig = { bearerToken: 'your-bearer-token' }; + +const client: Client = new Client(config); + +async function main(): Promise { + const userResponse: Users.GetByUsernameResponse = await client.users.getByUsername('XDevelopers'); + const username: string = userResponse.data?.username!; + console.log(username); +} + +main(); +\`\`\` + +\`\`\`javascript quickstart.js theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: 'your-bearer-token' }); + +const userResponse = await client.users.getByUsername('XDevelopers'); +const username = userResponse.data.username; +console.log(username); +\`\`\` + + + +## What's Next? + +- [Installation Guide](/xdks/typescript/install) - Set up the SDK in your project +- [Authentication](/xdks/typescript/authentication) - Learn about different auth methods +- [Pagination](/xdks/typescript/pagination) - Learn about data pagination +- [Streaming](/xdks/typescript/streaming) - Learn about real-time data streaming +- [API Reference](/xdks/typescript/reference/Client) - Read the complete API documentation +`; + + fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'overview.mdx'), overviewContent); + + // Install page + const installContent = `--- +title: "Installation" +sidebarTitle: "Installation" +--- + +Get started with the TypeScript SDK for X API in your project. + +## Install + + + +\`\`\`bash npm theme={null} +npm install @xdevplatform/xdk +\`\`\` + +\`\`\`bash yarn theme={null} +yarn add @xdevplatform/xdk +\`\`\` + +\`\`\`bash pnpm theme={null} +pnpm add @xdevplatform/xdk +\`\`\` + + + +## TypeScript Support + +The SDK is written in TypeScript and includes full type definitions. No additional type packages are required. + +## Requirements + +- Node.js 16+ +- TypeScript 4.5+ (if using TypeScript) + +## Next Steps + +- [Authentication](/xdks/typescript/authentication) - Set up authentication +- [Quick Start](/xdks/typescript/overview) - Your first API call +`; + + fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'install.mdx'), installContent); + + // Authentication page + const authContent = `--- +title: "Authentication" +sidebarTitle: "Authentication" +--- + +The TypeScript SDK supports multiple authentication methods for different use cases. + +## Bearer Token (App-Only Auth) + +For read-only operations and public data access: + + + +\`\`\`typescript quickstart.ts theme={null} +import { + Client, + type ClientConfig, + type Users +} from '@xdevplatform/xdk'; + +const config: ClientConfig = { bearerToken: 'your-bearer-token' }; + +const client: Client = new Client(config); + +async function main(): Promise { + const userResponse: Users.GetByUsernameResponse = await client.users.getByUsername('XDevelopers'); + const username: string = userResponse.data?.username!; + console.log(username); +} + +main(); +\`\`\` + +\`\`\`javascript quickstart.js theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: 'your-bearer-token' }); + +const userResponse = await client.users.getByUsername('XDevelopers'); +const username = userResponse.data.username; +console.log(username); +\`\`\` + + + +## OAuth 1.0a (User Context) + +For legacy applications or specific use cases: + + + +\`\`\`typescript oauth1.ts theme={null} +import { + Client, + OAuth1, + type OAuth1Config, + type ClientConfig, + type Users +} from '@xdevplatform/xdk'; + +const oauth1Config: OAuth1Config = { + apiKey: 'your-api-key', + apiSecret: 'your-api-secret', + accessToken: 'user-access-token', + accessTokenSecret: 'user-access-token-secret' +}; + +const oauth1: OAuth1 = new OAuth1(oauth1Config); + +const config: ClientConfig = { + oauth1: oauth1, +}; + +const client: Client = new Client(config); + +async function main(): Promise { + const response: Users.GetMeResponse = await client.users.getMe(); + + const me = response.data; + console.log(me); +} + +main(); + +\`\`\` + +\`\`\`javascript oauth1.js theme={null} +import { + Client, + type ClientConfig, + type Users +} from '@xdevplatform/xdk'; + +const config: ClientConfig = { bearerToken: 'your-bearer-token' }; + +const client: Client = new Client(config); + +async function main(): Promise { + const userResponse: Users.GetByUsernameResponse = await client.users.getByUsername('XDevelopers'); + const username: string = userResponse.data?.username!; + console.log(username); +} + +main(); + +\`\`\` + + + +## OAuth 2.0 (User Context) + +For user-specific operations: + + + +\`\`\`typescript oauth2.ts theme={null} +import { + Client, + OAuth2, + generateCodeVerifier, + generateCodeChallenge, + type OAuth2Config, + type ClientConfig, + type OAuth2Token +} from '@xdevplatform/xdk'; + +(async (): Promise => { + const oauth2Config: OAuth2Config = { + clientId: 'your-client-id', + clientSecret: 'your-client-secret', + redirectUri: 'https://example.com', + scope: ['tweet.read', 'users.read', 'offline.access'], + }; + + const oauth2: OAuth2 = new OAuth2(oauth2Config); + + const state: string = 'example-state'; + const codeVerifier: string = generateCodeVerifier(); + const codeChallenge: string = await generateCodeChallenge(codeVerifier); + + oauth2.setPkceParameters(codeVerifier, codeChallenge); + + const authUrl: string = await oauth2.getAuthorizationUrl(state); + + const tokens: OAuth2Token = await oauth2.exchangeCode(authCode, codeVerifier); + + const config: ClientConfig = { + accessToken: tokens.access_token, + }; + + const client: Client = new Client(config); +}); + +\`\`\` + +\`\`\`javascript oauth2.js theme={null} +import { Client, OAuth2, generateCodeVerifier, generateCodeChallenge } from '@xdevplatform/xdk'; + +(async () => { + const oauth2 = new OAuth2({ + clientId: 'your-client-id', + clientSecret: 'your-client-secret', + redirectUri: 'https://example.com', + scope: ['tweet.read', 'users.read', 'offline.access'], + }); + + const state = 'example-state'; + const codeVerifier = generateCodeVerifier(); + const codeChallenge = await generateCodeChallenge(codeVerifier); + oauth2.setPkceParameters(codeVerifier, codeChallenge); + const authUrl = await oauth2.getAuthorizationUrl(state); + + const tokens = await oauth2.exchangeCode(authCode, codeVerifier); + + const client = new Client({ accessToken: tokens.access_token }); + + const response = await client.users.getMe(); + const me = response.data; + console.log(me); +}); +\`\`\` + + + +## Environment Variables + +Store sensitive credentials in environment variables: + +\`\`\`bash +# .env +X_API_BEARER_TOKEN=your-bearer-token +X_API_CLIENT_ID=your-client-id +X_API_CLIENT_SECRET=your-client-secret +\`\`\` + + + +\`\`\`typescript env.ts theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: process.env.X_API_BEARER_TOKEN }); +\`\`\` + +\`\`\`javascript env.js theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: process.env.X_API_BEARER_TOKEN }); +\`\`\` + + +`; + + fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'authentication.mdx'), authContent); + + // Pagination page + const paginationContent = `--- +title: "Pagination" +sidebarTitle: "Pagination" +--- + +The SDK provides generic paginator utilities you can use with any endpoint that returns paginated responses. Methods return plain responses; you wrap them with a paginator. + +### Basic Pagination + + + +\`\`\`typescript quick-start.ts theme={null} +import { Client, UserPaginator, PaginatedResponse, Schemas } from '@xdevplatform/xdk'; + +const client: Client = new Client({ bearerToken: 'your-bearer-token' }); + +// Wrap any list endpoint with proper typing +const followers: UserPaginator = new UserPaginator( + async (token?: string): Promise> => { + const res = await client.users.getFollowers('', { + maxResults: 100, + paginationToken: token, + userFields: ['id','name','username'], + }); + return { + data: res.data ?? [], + meta: res.meta, + includes: res.includes, + errors: res.errors + }; + } +); +\`\`\` + +\`\`\`javascript quick-start.js theme={null} +import { Client } from '@xdevplatform/xdk'; +import { UserPaginator } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: 'your-bearer-token' }); + +const followers = new UserPaginator(async (token) => { + const res = await client.users.getFollowers('', { + maxResults: 100, + paginationToken: token, + userFields: ['id','name','username'], + }); + return { data: res.data ?? [], meta: res.meta, includes: res.includes, errors: res.errors }; +}); +\`\`\` + + + +### Manual paging + + + +\`\`\`typescript manual.ts theme={null} +import { UserPaginator, Schemas } from '@xdevplatform/xdk'; + +await followers.fetchNext(); // first page +while (!followers.done) { + await followers.fetchNext(); // subsequent pages +} + +const userCount: number = followers.users.length; // all fetched users +const firstUser: Schemas.User | undefined = followers.users[0]; +const nextToken: string | undefined = followers.meta?.next_token; +\`\`\` + +\`\`\`javascript manual.js theme={null} +await followers.fetchNext(); +while (!followers.done) await followers.fetchNext(); +console.log(followers.items.length); +\`\`\` + + + +### Async iteration + + + +\`\`\`typescript async.ts theme={null} +import { Schemas } from '@xdevplatform/xdk'; + +for await (const user of followers) { + const typedUser: Schemas.User = user; + console.log(typedUser.username); // fully typed access +} +\`\`\` + +\`\`\`javascript async.js theme={null} +for await (const user of followers) { + console.log(user.username); +} +\`\`\` + + + +### Next page as a new instance + + + +\`\`\`typescript next.ts theme={null} +import { UserPaginator } from '@xdevplatform/xdk'; + +await followers.fetchNext(); +if (!followers.done) { + const page2: UserPaginator = await followers.next(); // independent paginator starting at next page + await page2.fetchNext(); + console.log(page2.users.length); // items from second page +} +\`\`\` + +\`\`\`javascript next.js theme={null} +await followers.fetchNext(); +if (!followers.done) { + const page2 = await followers.next(); + await page2.fetchNext(); +} +\`\`\` + + + +### Error handling and rate limits + + + +\`\`\`typescript errors.ts theme={null} +import { UserPaginator, Schemas } from '@xdevplatform/xdk'; + +try { + for await (const item of followers) { + const user: Schemas.User = item; + // process user... + } +} catch (err: unknown) { + if (followers.rateLimited) { + console.error('Rate limited, backoff required'); + // backoff / retry later + } else { + console.error('Pagination error:', err); + throw err; + } +} +\`\`\` + +\`\`\`javascript errors.js theme={null} +try { + for await (const item of followers) { + // ... + } +} catch (err) { + if (followers.rateLimited) { + // backoff / retry later + } else { + throw err; + } +} +\`\`\` + + +`; +fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'pagination.mdx'), paginationContent); + +// Streaming page +const streamingContent = `--- +title: "Streaming" +sidebarTitle: "Streaming" +--- + +The TypeScript SDK provides real-time streaming capabilities for live data feeds. + +## Basic Streaming + +Connect to real-time sampled posts: + + + +\`\`\`typescript stream.ts theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client: Client = new Client({ bearerToken: 'your-bearer-token' }); + +// 1% sampled public posts +const stream = await client.stream.postsSample({ + tweetFields: ['id','text','created_at'], + expansions: ['author_id'], + userFields: ['id','username','name'] +}); + +// Listen to events +stream.on('data', (event) => { + // event is the parsed JSON line (data/includes/matching_rules) + console.log('New data:', event); +}); + +stream.on('error', (e) => console.error('Stream error:', e)); +stream.on('close', () => console.log('Stream closed')); +\`\`\` + +\`\`\`javascript stream.js theme={null} +import { Client } from '@xdevplatform/xdk'; + +const client = new Client({ bearerToken: 'your-bearer-token' }); +const stream = await client.stream.postsSample({ tweetfields: ['id','text'] }); + +stream.on('data', (event) => { + console.log('New data:', event); +}); +stream.on('error', (e) => console.error('Stream error:', e)); +stream.on('close', () => console.log('Stream closed')); +\`\`\` + + + +## Async Iteration + +Consume the stream with async iteration: + + + +\`\`\`typescript async.ts theme={null} +const stream = await client.stream.postsSample(); +for await (const event of stream) { + // Each event is a parsed JSON line (data/includes/matching_rules) + console.log(event); +} +\`\`\` + +\`\`\`javascript async.js theme={null} +const stream = await client.stream.postsSample(); +for await (const event of stream) { + console.log(event); +} +\`\`\` + + + +## Stream Management + +Control lifecycle from the event-driven stream: + +\`\`\`typescript +// Close the stream +stream.close(); + +// Auto-reconnect (if enabled by your wrapper) +// The default EventDrivenStream exposes basic reconnect hooks +\`\`\` + +## Error Handling + +Handle streaming errors and reconnections: + +\`\`\`typescript +stream.on('error', (event) => { + const err = event.error || event; + console.error('Stream error:', err); +}); + +stream.on('keepAlive', () => { + // heartbeat event +}); +\`\`\` +`; +fs.writeFileSync(path.join(outputDir, 'xdks', 'typescript', 'streaming.mdx'), streamingContent); + + // Create navigation structure for integration into existing Mintlify site + console.log('⚙️ Creating navigation structure...'); + + // Build API Reference groups from the generated files on disk + const refRoot = path.join(outputDir, 'xdks', 'typescript', 'reference'); + const classesDir = path.join(refRoot, 'classes'); + const interfacesDir = path.join(refRoot, 'interfaces'); + + const listFilesNoExt = (dir) => { + try { + return fs.readdirSync(dir) + .filter(f => f.endsWith('.mdx')) + .map(f => `xdks/typescript/reference/${path.basename(dir)}/${path.basename(f, '.mdx')}`); + } catch (_) { + return []; + } + }; + + const classesPages = listFilesNoExt(classesDir); + const interfacesPages = listFilesNoExt(interfacesDir); + + // Build sub-groups for Classes and Interfaces + const MODULE_PREFIXES = [ + 'AccountActivity','Activity','Communities','CommunityNotes','Compliance','Connections', + 'DirectMessages','General','Lists','Media','Posts','Spaces','Stream','Trends','Usage', + 'Users','Webhooks','Http','OAuth','Client','Paginator','EventDrivenStream','StreamClient' + ]; + + function groupPages(pages, kind) { + const buckets = new Map(); + for (const p of pages) { + const name = p.split('/').pop(); + let group = null; + for (const pref of MODULE_PREFIXES) { + if (name.startsWith(pref)) { group = pref; break; } + } + if (!group) { + if (kind === 'classes') { + if (/Client$/.test(name)) group = 'Clients'; + else if (/Stream/i.test(name)) group = 'Streaming'; + else if (/Paginator$/.test(name)) group = 'Pagination'; + else group = 'Core'; + } else { + // interfaces + group = 'Misc'; + } + } + if (!buckets.has(group)) buckets.set(group, []); + buckets.get(group).push(p); + } + // Sort pages within groups alphabetically + for (const [k, arr] of buckets) arr.sort(); + // Convert to [{group, pages}] + return Array.from(buckets.entries()).sort((a,b)=>a[0].localeCompare(b[0])).map(([group, pages]) => ({ group, pages })); + } + + const classGroups = groupPages(classesPages, 'classes'); + const interfaceGroups = groupPages(interfacesPages, 'interfaces'); + + // Overwrite modules.mdx with an organized, expandable structure + const modulesOut = path.join(refRoot, 'modules.mdx'); + // Derive original TypeDoc modules title from docs/modules.md + let typedocModulesTitle = 'Modules'; + try { + const rawModules = fs.readFileSync(path.join('docs', 'modules.md'), 'utf8'); + const m = rawModules.match(/^#\s+(.+)$/m); + if (m) typedocModulesTitle = m[1].trim(); + } catch (_) {} + const renderGroupList = (groups) => groups.map(g => ( + ` \n` + + g.pages.map(p => ` - [${p.split('/').pop()}](/${p})`).join('\n') + + `\n ` + )).join('\n\n'); + + const modulesContent = `---\n`+ +`title: "${typedocModulesTitle}"\n`+ +`sidebarTitle: "${typedocModulesTitle}"\n`+ +`---\n\n`+ +`\n\n`+ +`\n\n`+ +renderGroupList(interfaceGroups)+`\n\n`+ +`\n\n`+ +`\n\n`+ +renderGroupList(classGroups)+`\n\n`+ +`\n\n`+ +`\n`; + + fs.writeFileSync(modulesOut, modulesContent); + + // Generate the TypeScript SDK navigation tab with requested structure + const typescriptSdkNavigation = { + tab: 'TypeScript SDK', + hidden: true, + pages: [ + 'xdks/typescript/overview', + 'xdks/typescript/install', + 'xdks/typescript/authentication', + 'xdks/typescript/pagination', + 'xdks/typescript/streaming', + { + group: 'API Reference', + pages: [ + 'xdks/typescript/reference/modules', + { + group: 'Interfaces', + pages: interfaceGroups + }, + { + group: 'Classes', + pages: classGroups + } + ] + } + ] + }; + + // Also create a JSON file for easy copy-paste + fs.writeFileSync( + path.join(outputDir, 'typescript-sdk-navigation.json'), + JSON.stringify(typescriptSdkNavigation, null, 2) + ); + + console.log('✅ TypeScript SDK documentation processed successfully!'); + console.log(`📁 Output directory: ${outputDir}/`); + console.log(`📊 Processed ${processedFiles.length} files`); + console.log('\n🚀 Integration steps:'); + console.log('1. Copy the \'xdk/\' folder to your existing Mintlify site'); + console.log('2. Add the navigation structure from \'typescript-sdk-navigation.json\' to your mintlify.json'); + console.log('3. Push to your main branch to deploy'); + + } catch (error) { + console.error('❌ Error processing documentation:', error.message); + process.exit(1); + } +} + +// Run the processing +processDocs(); \ No newline at end of file diff --git a/xdk/typescript/scripts/watch-docs.js b/xdk/typescript/scripts/watch-docs.js new file mode 100644 index 00000000..aaddc410 --- /dev/null +++ b/xdk/typescript/scripts/watch-docs.js @@ -0,0 +1,70 @@ +// AUTO-GENERATED FILE - DO NOT EDIT +// This file was automatically generated by the XDK build tool. +// Any manual changes will be overwritten on the next generation. +import { execSync } from 'child_process'; +import { watch } from 'chokidar'; +import { spawn } from 'child_process'; + +console.log('🚀 Starting X API SDK Documentation Watch Server...'); + +let serverProcess = null; + +function startServer() { + if (serverProcess) { + serverProcess.kill(); + } + + console.log('📚 Starting documentation server on http://localhost:8080'); + serverProcess = spawn('npx', ['http-server', 'docs', '-p', '8080', '-o'], { + stdio: 'inherit' + }); +} + +function regenerateDocs() { + console.log('🔄 Regenerating documentation...'); + try { + execSync('node scripts/generate-docs-simple.js', { stdio: 'inherit' }); + console.log('✅ Documentation regenerated successfully'); + } catch (error) { + console.error('❌ Failed to regenerate documentation:', error.message); + } +} + +// Initial documentation generation +regenerateDocs(); +startServer(); + +// Watch for changes in source files +const watcher = watch([ + 'src/**/*.ts', + '!src/**/stream_client.ts', + '!src/**/event_driven_stream.ts', + '!src/**/stream_listener.ts', + '!src/**/oauth1_auth.ts', + '!src/**/oauth2_auth.ts', + '!src/**/crypto_utils.ts' +], { + ignored: /(^|[\/\\])\../, // ignore dotfiles + persistent: true +}); + +watcher.on('change', (path) => { + console.log(`📝 File changed: ${path}`); + regenerateDocs(); +}); + +watcher.on('error', (error) => { + console.error('❌ Watcher error:', error); +}); + +// Graceful shutdown +process.on('SIGINT', () => { + console.log('\n🛑 Shutting down documentation server...'); + if (serverProcess) { + serverProcess.kill(); + } + watcher.close(); + process.exit(0); +}); + +console.log('👀 Watching for changes... Press Ctrl+C to stop'); diff --git a/xdk/typescript/src/account_activity/client.ts b/xdk/typescript/src/account_activity/client.ts index b72dbd67..9b253098 100644 --- a/xdk/typescript/src/account_activity/client.ts +++ b/xdk/typescript/src/account_activity/client.ts @@ -16,13 +16,13 @@ import { EventPaginator, } from '../paginator.js'; import { + GetSubscriptionsResponse, ValidateSubscriptionResponse, CreateSubscriptionRequest, CreateSubscriptionResponse, GetSubscriptionCountResponse, - GetSubscriptionsResponse, - CreateReplayJobResponse, DeleteSubscriptionResponse, + CreateReplayJobResponse, } from './models.js'; /** @@ -90,6 +90,52 @@ export class AccountActivityClient { return normalized as T; } + /** + * Get subscriptions + * Retrieves a list of all active subscriptions for a given webhook. + + + * @param webhookId The webhook ID to pull subscriptions for. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getSubscriptions(webhookId: string): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const requestOptions = {}; + + // Build the path with path parameters + let path = + '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list'; + + path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [], + }, + ], + + // No optional parameters, using empty request options + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + /** * Validate subscription * Checks a user’s Account Activity subscription for a given webhook. @@ -242,29 +288,38 @@ export class AccountActivityClient { } /** - * Get subscriptions - * Retrieves a list of all active subscriptions for a given webhook. + * Delete subscription + * Deletes an Account Activity subscription for the given webhook and user ID. - * @param webhookId The webhook ID to pull subscriptions for. + * @param webhookId The webhook ID to check subscription against. + + * @param userId User ID to unsubscribe from. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getSubscriptions(webhookId: string): Promise { + async deleteSubscription( + webhookId: string, + userId: string + ): Promise { // Normalize options to handle both camelCase and original API parameter names const requestOptions = {}; // Build the path with path parameters let path = - '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list'; + '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all'; path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); + path = path.replace('{user_id}', encodeURIComponent(String(userId))); + // Build query parameters const params = new URLSearchParams(); @@ -280,8 +335,8 @@ export class AccountActivityClient { // No optional parameters, using empty request options }; - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); @@ -352,59 +407,4 @@ export class AccountActivityClient { finalRequestOptions ); } - - /** - * Delete subscription - * Deletes an Account Activity subscription for the given webhook and user ID. - - - * @param webhookId The webhook ID to check subscription against. - - - - * @param userId User ID to unsubscribe from. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async deleteSubscription( - webhookId: string, - userId: string - ): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const requestOptions = {}; - - // Build the path with path parameters - let path = - '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all'; - - path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); - - path = path.replace('{user_id}', encodeURIComponent(String(userId))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [], - }, - ], - - // No optional parameters, using empty request options - }; - - return this.client.request( - 'DELETE', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } } diff --git a/xdk/typescript/src/account_activity/models.ts b/xdk/typescript/src/account_activity/models.ts index 46c19a44..d942de00 100644 --- a/xdk/typescript/src/account_activity/models.ts +++ b/xdk/typescript/src/account_activity/models.ts @@ -10,6 +10,12 @@ import type * as Schemas from '../schemas.js'; +/** + * Response for getSubscriptions + * + * @public + */ +export type GetSubscriptionsResponse = Schemas.SubscriptionsListGetResponse; /** * Response for validateSubscription * @@ -35,20 +41,14 @@ export type CreateSubscriptionResponse = Schemas.SubscriptionsCreateResponse; */ export type GetSubscriptionCountResponse = Schemas.SubscriptionsCountGetResponse; /** - * Response for getSubscriptions + * Response for deleteSubscription * * @public */ -export type GetSubscriptionsResponse = Schemas.SubscriptionsListGetResponse; +export type DeleteSubscriptionResponse = Schemas.SubscriptionsDeleteResponse; /** * Response for createReplayJob * * @public */ -export type CreateReplayJobResponse = Schemas.ReplayJobCreateResponse; -/** - * Response for deleteSubscription - * - * @public - */ -export type DeleteSubscriptionResponse = Schemas.SubscriptionsDeleteResponse; \ No newline at end of file +export type CreateReplayJobResponse = Schemas.ReplayJobCreateResponse; \ No newline at end of file diff --git a/xdk/typescript/src/account_activity/stream_client.ts b/xdk/typescript/src/account_activity/stream_client.ts index b624fa91..4fa33447 100644 --- a/xdk/typescript/src/account_activity/stream_client.ts +++ b/xdk/typescript/src/account_activity/stream_client.ts @@ -10,20 +10,20 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { + GetSubscriptionsResponse, ValidateSubscriptionResponse, CreateSubscriptionResponse, GetSubscriptionCountResponse, - GetSubscriptionsResponse, - CreateReplayJobResponse, DeleteSubscriptionResponse, + CreateReplayJobResponse, } from './models.js'; /** - * Options for validateSubscription method + * Options for getSubscriptions method * * @public */ -export interface ValidateSubscriptionStreamingOptions { +export interface GetSubscriptionsStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -34,14 +34,11 @@ export interface ValidateSubscriptionStreamingOptions { [key: string]: any; } /** - * Options for createSubscription method + * Options for validateSubscription method * * @public */ -export interface CreateSubscriptionStreamingOptions { - /** Request body */ - body?: any; - +export interface ValidateSubscriptionStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -52,11 +49,14 @@ export interface CreateSubscriptionStreamingOptions { [key: string]: any; } /** - * Options for getSubscriptionCount method + * Options for createSubscription method * * @public */ -export interface GetSubscriptionCountStreamingOptions { +export interface CreateSubscriptionStreamingOptions { + /** Request body */ + body?: any; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -67,11 +67,11 @@ export interface GetSubscriptionCountStreamingOptions { [key: string]: any; } /** - * Options for getSubscriptions method + * Options for getSubscriptionCount method * * @public */ -export interface GetSubscriptionsStreamingOptions { +export interface GetSubscriptionCountStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -82,11 +82,11 @@ export interface GetSubscriptionsStreamingOptions { [key: string]: any; } /** - * Options for createReplayJob method + * Options for deleteSubscription method * * @public */ -export interface CreateReplayJobStreamingOptions { +export interface DeleteSubscriptionStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -97,11 +97,11 @@ export interface CreateReplayJobStreamingOptions { [key: string]: any; } /** - * Options for deleteSubscription method + * Options for createReplayJob method * * @public */ -export interface DeleteSubscriptionStreamingOptions { +export interface CreateReplayJobStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -148,6 +148,60 @@ export class AccountActivityClient { return normalized as T; } + /** + * Get subscriptions + * Retrieves a list of all active subscriptions for a given webhook. + * + * @returns Promise with the API response + */ + async getSubscriptions( + webhookId: string, + options: GetSubscriptionsStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('BearerToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'getSubscriptions'); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + + // Build the path with path parameters + let path = + '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list'; + + path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + /** * Validate subscription * Checks a user’s Account Activity subscription for a given webhook. @@ -323,22 +377,23 @@ export class AccountActivityClient { } /** - * Get subscriptions - * Retrieves a list of all active subscriptions for a given webhook. + * Delete subscription + * Deletes an Account Activity subscription for the given webhook and user ID. * * @returns Promise with the API response */ - async getSubscriptions( + async deleteSubscription( webhookId: string, - options: GetSubscriptionsStreamingOptions = {} - ): Promise { + userId: string, + options: DeleteSubscriptionStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getSubscriptions'); + this.client.validateAuthentication(requiredAuthTypes, 'deleteSubscription'); // Normalize options to handle both camelCase and original API parameter names @@ -350,10 +405,12 @@ export class AccountActivityClient { // Build the path with path parameters let path = - '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list'; + '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all'; path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); + path = path.replace('{user_id}', encodeURIComponent(String(userId))); + // Build query parameters const params = new URLSearchParams(); @@ -369,8 +426,8 @@ export class AccountActivityClient { }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); @@ -439,61 +496,4 @@ export class AccountActivityClient { finalRequestOptions ); } - - /** - * Delete subscription - * Deletes an Account Activity subscription for the given webhook and user ID. - * - * @returns Promise with the API response - */ - async deleteSubscription( - webhookId: string, - userId: string, - options: DeleteSubscriptionStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('BearerToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'deleteSubscription'); - - // Normalize options to handle both camelCase and original API parameter names - - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) - - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; - - // Build the path with path parameters - let path = - '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all'; - - path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); - - path = path.replace('{user_id}', encodeURIComponent(String(userId))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'DELETE', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } } diff --git a/xdk/typescript/src/activity/client.ts b/xdk/typescript/src/activity/client.ts index b7ec9043..f5995469 100644 --- a/xdk/typescript/src/activity/client.ts +++ b/xdk/typescript/src/activity/client.ts @@ -19,10 +19,10 @@ import { GetSubscriptionsResponse, CreateSubscriptionRequest, CreateSubscriptionResponse, + StreamResponse, UpdateSubscriptionRequest, UpdateSubscriptionResponse, DeleteSubscriptionResponse, - StreamResponse, } from './models.js'; /** @@ -40,21 +40,6 @@ export interface CreateSubscriptionOptions { [key: string]: any; } -/** - * Options for updateSubscription method - * - * @public - */ -export interface UpdateSubscriptionOptions { - /** Request body */ - body?: UpdateSubscriptionRequest; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - /** * Options for stream method * @@ -79,6 +64,21 @@ export interface StreamOptions { [key: string]: any; } +/** + * Options for updateSubscription method + * + * @public + */ +export interface UpdateSubscriptionOptions { + /** Request body */ + body?: UpdateSubscriptionRequest; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + /** * Client for activity operations * @@ -218,6 +218,78 @@ export class ActivityClient { ); } + /** + * Activity Stream + * Stream of X Activities + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async stream(options: StreamOptions = {}): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + backfill_minutes: 'backfillMinutes', + + start_time: 'startTime', + + end_time: 'endTime', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + const { + backfillMinutes = undefined, + + startTime = undefined, + + endTime = undefined, + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/activity/stream'; + + // Build query parameters + const params = new URLSearchParams(); + + if (backfillMinutes !== undefined) { + params.append('backfill_minutes', String(backfillMinutes)); + } + + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + /** * Update X activity subscription * Updates a subscription for an X activity event @@ -327,76 +399,4 @@ export class ActivityClient { finalRequestOptions ); } - - /** - * Activity Stream - * Stream of X Activities - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async stream(options: StreamOptions = {}): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - backfill_minutes: 'backfillMinutes', - - start_time: 'startTime', - - end_time: 'endTime', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - const { - backfillMinutes = undefined, - - startTime = undefined, - - endTime = undefined, - - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/activity/stream'; - - // Build query parameters - const params = new URLSearchParams(); - - if (backfillMinutes !== undefined) { - params.append('backfill_minutes', String(backfillMinutes)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [], - }, - ], - - ...requestOptions, - }; - - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } } diff --git a/xdk/typescript/src/activity/models.ts b/xdk/typescript/src/activity/models.ts index 93361e80..01e89083 100644 --- a/xdk/typescript/src/activity/models.ts +++ b/xdk/typescript/src/activity/models.ts @@ -28,6 +28,12 @@ export type CreateSubscriptionRequest = Schemas.ActivitySubscriptionCreateReques * @public */ export type CreateSubscriptionResponse = Schemas.ActivitySubscriptionCreateResponse; +/** + * Response for stream + * + * @public + */ +export type StreamResponse = Schemas.ActivityStreamingResponse; /** * Request for updateSubscription * @@ -45,10 +51,4 @@ export type UpdateSubscriptionResponse = Schemas.ActivitySubscriptionUpdateRespo * * @public */ -export type DeleteSubscriptionResponse = Schemas.ActivitySubscriptionDeleteResponse; -/** - * Response for stream - * - * @public - */ -export type StreamResponse = Schemas.ActivityStreamingResponse; \ No newline at end of file +export type DeleteSubscriptionResponse = Schemas.ActivitySubscriptionDeleteResponse; \ No newline at end of file diff --git a/xdk/typescript/src/activity/stream_client.ts b/xdk/typescript/src/activity/stream_client.ts index efe01265..2394a79b 100644 --- a/xdk/typescript/src/activity/stream_client.ts +++ b/xdk/typescript/src/activity/stream_client.ts @@ -12,9 +12,9 @@ import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { GetSubscriptionsResponse, CreateSubscriptionResponse, + StreamResponse, UpdateSubscriptionResponse, DeleteSubscriptionResponse, - StreamResponse, } from './models.js'; /** @@ -51,13 +51,22 @@ export interface CreateSubscriptionStreamingOptions { [key: string]: any; } /** - * Options for updateSubscription method + * Options for stream method * * @public */ -export interface UpdateSubscriptionStreamingOptions { - /** Request body */ - body?: any; +export interface StreamStreamingOptions { + /** The number of minutes of backfill requested. + * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ + backfillMinutes?: number; + + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; /** Additional request options */ requestOptions?: RequestOptions; @@ -69,11 +78,14 @@ export interface UpdateSubscriptionStreamingOptions { [key: string]: any; } /** - * Options for deleteSubscription method + * Options for updateSubscription method * * @public */ -export interface DeleteSubscriptionStreamingOptions { +export interface UpdateSubscriptionStreamingOptions { + /** Request body */ + body?: any; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -84,23 +96,11 @@ export interface DeleteSubscriptionStreamingOptions { [key: string]: any; } /** - * Options for stream method + * Options for deleteSubscription method * * @public */ -export interface StreamStreamingOptions { - /** The number of minutes of backfill requested. - * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ - backfillMinutes?: number; - - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - +export interface DeleteSubscriptionStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ diff --git a/xdk/typescript/src/client.ts b/xdk/typescript/src/client.ts index 2add3fba..ba931433 100644 --- a/xdk/typescript/src/client.ts +++ b/xdk/typescript/src/client.ts @@ -17,23 +17,23 @@ import { -import { NewsClient } from "./news/index.js"; +import { ActivityClient } from "./activity/index.js"; -import { UsersClient } from "./users/index.js"; +import { NewsClient } from "./news/index.js"; -import { DirectMessagesClient } from "./direct_messages/index.js"; +import { ConnectionsClient } from "./connections/index.js"; -import { CommunityNotesClient } from "./community_notes/index.js"; +import { AccountActivityClient } from "./account_activity/index.js"; -import { PostsClient } from "./posts/index.js"; +import { SpacesClient } from "./spaces/index.js"; @@ -41,51 +41,51 @@ import { TrendsClient } from "./trends/index.js"; -import { ActivityClient } from "./activity/index.js"; +import { MediaClient } from "./media/index.js"; -import { UsageClient } from "./usage/index.js"; +import { DirectMessagesClient } from "./direct_messages/index.js"; -import { SpacesClient } from "./spaces/index.js"; +import { PostsClient } from "./posts/index.js"; -import { CommunitiesClient } from "./communities/index.js"; +import { ListsClient } from "./lists/index.js"; -import { ConnectionsClient } from "./connections/index.js"; +import { CommunityNotesClient } from "./community_notes/index.js"; -import { MediaClient } from "./media/index.js"; +import { GeneralClient } from "./general/index.js"; -import { ListsClient } from "./lists/index.js"; +import { WebhooksClient } from "./webhooks/index.js"; -import { ComplianceClient } from "./compliance/index.js"; +import { UsersClient } from "./users/index.js"; -import { GeneralClient } from "./general/index.js"; +import { CommunitiesClient } from "./communities/index.js"; -import { AccountActivityClient } from "./account_activity/index.js"; +import { StreamClient } from "./stream/client.js"; -import { StreamClient } from "./stream/client.js"; +import { ComplianceClient } from "./compliance/index.js"; -import { WebhooksClient } from "./webhooks/index.js"; +import { UsageClient } from "./usage/index.js"; @@ -233,59 +233,59 @@ export class Client { readonly httpClient = httpClient; + /** activity client */ + readonly activity: ActivityClient; + /** news client */ readonly news: NewsClient; - /** users client */ - readonly users: UsersClient; - - /** direct messages client */ - readonly directMessages: DirectMessagesClient; - - /** community notes client */ - readonly communityNotes: CommunityNotesClient; - - /** posts client */ - readonly posts: PostsClient; - - /** trends client */ - readonly trends: TrendsClient; - - /** activity client */ - readonly activity: ActivityClient; + /** connections client */ + readonly connections: ConnectionsClient; - /** usage client */ - readonly usage: UsageClient; + /** account activity client */ + readonly accountActivity: AccountActivityClient; /** spaces client */ readonly spaces: SpacesClient; - /** communities client */ - readonly communities: CommunitiesClient; - - /** connections client */ - readonly connections: ConnectionsClient; + /** trends client */ + readonly trends: TrendsClient; /** media client */ readonly media: MediaClient; + /** direct messages client */ + readonly directMessages: DirectMessagesClient; + + /** posts client */ + readonly posts: PostsClient; + /** lists client */ readonly lists: ListsClient; - /** compliance client */ - readonly compliance: ComplianceClient; + /** community notes client */ + readonly communityNotes: CommunityNotesClient; /** general client */ readonly general: GeneralClient; - /** account activity client */ - readonly accountActivity: AccountActivityClient; + /** webhooks client */ + readonly webhooks: WebhooksClient; + + /** users client */ + readonly users: UsersClient; + + /** communities client */ + readonly communities: CommunitiesClient; /** stream client */ readonly stream: StreamClient; - /** webhooks client */ - readonly webhooks: WebhooksClient; + /** compliance client */ + readonly compliance: ComplianceClient; + + /** usage client */ + readonly usage: UsageClient; /** @@ -341,41 +341,41 @@ export class Client { this.headers = httpClient.createHeaders(defaultHeaders); - this.news = new NewsClient(this); + this.activity = new ActivityClient(this); - this.users = new UsersClient(this); + this.news = new NewsClient(this); - this.directMessages = new DirectMessagesClient(this); + this.connections = new ConnectionsClient(this); - this.communityNotes = new CommunityNotesClient(this); + this.accountActivity = new AccountActivityClient(this); - this.posts = new PostsClient(this); + this.spaces = new SpacesClient(this); this.trends = new TrendsClient(this); - this.activity = new ActivityClient(this); - - this.usage = new UsageClient(this); - - this.spaces = new SpacesClient(this); - - this.communities = new CommunitiesClient(this); + this.media = new MediaClient(this); - this.connections = new ConnectionsClient(this); + this.directMessages = new DirectMessagesClient(this); - this.media = new MediaClient(this); + this.posts = new PostsClient(this); this.lists = new ListsClient(this); - this.compliance = new ComplianceClient(this); + this.communityNotes = new CommunityNotesClient(this); this.general = new GeneralClient(this); - this.accountActivity = new AccountActivityClient(this); + this.webhooks = new WebhooksClient(this); + + this.users = new UsersClient(this); + + this.communities = new CommunitiesClient(this); this.stream = new StreamClient(this); - this.webhooks = new WebhooksClient(this); + this.compliance = new ComplianceClient(this); + + this.usage = new UsageClient(this); } diff --git a/xdk/typescript/src/community_notes/client.ts b/xdk/typescript/src/community_notes/client.ts index 55e87c49..eb1f14cd 100644 --- a/xdk/typescript/src/community_notes/client.ts +++ b/xdk/typescript/src/community_notes/client.ts @@ -17,62 +17,14 @@ import { } from '../paginator.js'; import { DeleteResponse, - SearchEligiblePostsResponse, EvaluateRequest, EvaluateResponse, SearchWrittenResponse, CreateRequest, CreateResponse, + SearchEligiblePostsResponse, } from './models.js'; -/** - * Options for searchEligiblePosts method - * - * @public - */ -export interface SearchEligiblePostsOptions { - /** Pagination token to get next set of posts eligible for notes. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: string; - - /** Max results to return. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. - * Also accepts: post_selection or proper camelCase (e.g., postSelection) */ - postSelection?: string; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - /** * Options for evaluate method * @@ -127,6 +79,54 @@ export interface CreateOptions { [key: string]: any; } +/** + * Options for searchEligiblePosts method + * + * @public + */ +export interface SearchEligiblePostsOptions { + /** Pagination token to get next set of posts eligible for notes. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: string; + + /** Max results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. + * Also accepts: post_selection or proper camelCase (e.g., postSelection) */ + postSelection?: string; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + /** * Client for community notes operations * @@ -227,22 +227,74 @@ export class CommunityNotesClient { } /** - * Search for Posts Eligible for Community Notes - * Returns all the posts that are eligible for community notes. + * Evaluate a Community Note + * Endpoint to evaluate a community note. - * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async evaluate(options: EvaluateOptions = {}): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + // Destructure options (exclude path parameters, they're already function params) + const { + body, + requestOptions: requestOptions = {}, + } = normalizedOptions; - * @returns {Promise} Promise resolving to the API response + // Build the path with path parameters + let path = '/2/evaluate_note'; + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ['tweet.write'], + }, + + { + UserToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Search for Community Notes Written + * Returns all the community notes written by the user. + + + + * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchEligiblePosts( + async searchWritten( testMode: boolean, - options: SearchEligiblePostsOptions = {} - ): Promise { + options: SearchWrittenOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -250,17 +302,7 @@ export class CommunityNotesClient { max_results: 'maxResults', - post_selection: 'postSelection', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - - 'user.fields': 'userFields', - - 'place.fields': 'placeFields', + 'note.fields': 'noteFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -273,25 +315,13 @@ export class CommunityNotesClient { maxResults = undefined, - postSelection = undefined, - - tweetFields = [], - - expansions = [], - - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + noteFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/notes/search/posts_eligible_for_notes'; + let path = '/2/notes/search/notes_written'; // Build query parameters const params = new URLSearchParams(); @@ -308,32 +338,8 @@ export class CommunityNotesClient { params.append('max_results', String(maxResults)); } - if (postSelection !== undefined) { - params.append('post_selection', String(postSelection)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (noteFields !== undefined && noteFields.length > 0) { + params.append('note.fields', noteFields.join(',')); } // Prepare request options @@ -352,7 +358,7 @@ export class CommunityNotesClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -360,15 +366,15 @@ export class CommunityNotesClient { } /** - * Evaluate a Community Note - * Endpoint to evaluate a community note. + * Create a Community Note + * Creates a community note endpoint for LLM use case. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async evaluate(options: EvaluateOptions = {}): Promise { + async create(options: CreateOptions = {}): Promise { // Normalize options to handle both camelCase and original API parameter names const normalizedOptions = options || {}; @@ -381,7 +387,7 @@ export class CommunityNotesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/evaluate_note'; + let path = '/2/notes'; // Build query parameters const params = new URLSearchParams(); @@ -404,7 +410,7 @@ export class CommunityNotesClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -412,22 +418,22 @@ export class CommunityNotesClient { } /** - * Search for Community Notes Written - * Returns all the community notes written by the user. + * Search for Posts Eligible for Community Notes + * Returns all the posts that are eligible for community notes. - * @param testMode If true, return the notes the caller wrote for the test. If false, return the notes the caller wrote on the product. + * @param testMode If true, return a list of posts that are for the test. If false, return a list of posts that the bots can write proposed notes on the product. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchWritten( + async searchEligiblePosts( testMode: boolean, - options: SearchWrittenOptions = {} - ): Promise { + options: SearchEligiblePostsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -435,7 +441,17 @@ export class CommunityNotesClient { max_results: 'maxResults', - 'note.fields': 'noteFields', + post_selection: 'postSelection', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -448,13 +464,25 @@ export class CommunityNotesClient { maxResults = undefined, - noteFields = [], + postSelection = undefined, + + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/notes/search/notes_written'; + let path = '/2/notes/search/posts_eligible_for_notes'; // Build query parameters const params = new URLSearchParams(); @@ -471,68 +499,40 @@ export class CommunityNotesClient { params.append('max_results', String(maxResults)); } - if (noteFields !== undefined && noteFields.length > 0) { - params.append('note.fields', noteFields.join(',')); + if (postSelection !== undefined) { + params.append('post_selection', String(postSelection)); } - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['tweet.read'], - }, - - { - UserToken: [], - }, - ], - - ...requestOptions, - }; - - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Create a Community Note - * Creates a community note endpoint for LLM use case. - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async create(options: CreateOptions = {}): Promise { - // Normalize options to handle both camelCase and original API parameter names + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } - const normalizedOptions = options || {}; + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } - // Destructure options (exclude path parameters, they're already function params) - const { - body, + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } - requestOptions: requestOptions = {}, - } = normalizedOptions; + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } - // Build the path with path parameters - let path = '/2/notes'; + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } - // Build query parameters - const params = new URLSearchParams(); + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['tweet.write'], + OAuth2UserToken: ['tweet.read'], }, { @@ -543,8 +543,8 @@ export class CommunityNotesClient { ...requestOptions, }; - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/community_notes/models.ts b/xdk/typescript/src/community_notes/models.ts index d1b0cc47..d95223b2 100644 --- a/xdk/typescript/src/community_notes/models.ts +++ b/xdk/typescript/src/community_notes/models.ts @@ -16,12 +16,6 @@ import type * as Schemas from '../schemas.js'; * @public */ export type DeleteResponse = Schemas.DeleteNoteResponse; -/** - * Response for searchEligiblePosts - * - * @public - */ -export type SearchEligiblePostsResponse = Schemas.Get2NotesSearchPostsEligibleForNotesResponse; /** * Request for evaluate * @@ -51,4 +45,10 @@ export type CreateRequest = Schemas.CreateNoteRequest; * * @public */ -export type CreateResponse = Schemas.CreateNoteResponse; \ No newline at end of file +export type CreateResponse = Schemas.CreateNoteResponse; +/** + * Response for searchEligiblePosts + * + * @public + */ +export type SearchEligiblePostsResponse = Schemas.Get2NotesSearchPostsEligibleForNotesResponse; \ No newline at end of file diff --git a/xdk/typescript/src/community_notes/stream_client.ts b/xdk/typescript/src/community_notes/stream_client.ts index cc37572a..43c9ece1 100644 --- a/xdk/typescript/src/community_notes/stream_client.ts +++ b/xdk/typescript/src/community_notes/stream_client.ts @@ -11,10 +11,10 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { DeleteResponse, - SearchEligiblePostsResponse, EvaluateResponse, SearchWrittenResponse, CreateResponse, + SearchEligiblePostsResponse, } from './models.js'; /** @@ -32,57 +32,6 @@ export interface DeleteStreamingOptions { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } -/** - * Options for searchEligiblePosts method - * - * @public - */ -export interface SearchEligiblePostsStreamingOptions { - /** Pagination token to get next set of posts eligible for notes. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: string; - - /** Max results to return. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. - * Also accepts: post_selection or proper camelCase (e.g., postSelection) */ - postSelection?: string; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} /** * Options for evaluate method * @@ -146,6 +95,57 @@ export interface CreateStreamingOptions { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for searchEligiblePosts method + * + * @public + */ +export interface SearchEligiblePostsStreamingOptions { + /** Pagination token to get next set of posts eligible for notes. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: string; + + /** Max results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** The selection of posts to return. Valid values are 'feed_size: small' and 'feed_size: large'. Default is 'feed_size: small', only top AI writers have access to large size feed. + * Also accepts: post_selection or proper camelCase (e.g., postSelection) */ + postSelection?: string; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} export class CommunityNotesClient { private client: Client; @@ -239,15 +239,14 @@ export class CommunityNotesClient { } /** - * Search for Posts Eligible for Community Notes - * Returns all the posts that are eligible for community notes. + * Evaluate a Community Note + * Endpoint to evaluate a community note. * * @returns Promise with the API response */ - async searchEligiblePosts( - testMode: boolean, - options: SearchEligiblePostsStreamingOptions = {} - ): Promise { + async evaluate( + options: EvaluateStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -256,29 +255,77 @@ export class CommunityNotesClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication( - requiredAuthTypes, - 'searchEligiblePosts' - ); + this.client.validateAuthentication(requiredAuthTypes, 'evaluate'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - pagination_token: 'paginationToken', + const normalizedOptions = options || {}; - max_results: 'maxResults', + // Destructure options (exclude path parameters, they're already function params) - post_selection: 'postSelection', + const { + body, - 'tweet.fields': 'tweetFields', + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; - 'media.fields': 'mediaFields', + // Build the path with path parameters + let path = '/2/evaluate_note'; - 'poll.fields': 'pollFields', + // Build query parameters + const params = new URLSearchParams(); - 'user.fields': 'userFields', + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, - 'place.fields': 'placeFields', + body: JSON.stringify(body), + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Search for Community Notes Written + * Returns all the community notes written by the user. + * + * @returns Promise with the API response + */ + async searchWritten( + testMode: boolean, + options: SearchWrittenStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('OAuth2UserToken'); + + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'searchWritten'); + + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + pagination_token: 'paginationToken', + + max_results: 'maxResults', + + 'note.fields': 'noteFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -292,19 +339,7 @@ export class CommunityNotesClient { maxResults = undefined, - postSelection = undefined, - - tweetFields = [], - - expansions = [], - - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + noteFields = [], headers = {}, signal, @@ -312,7 +347,7 @@ export class CommunityNotesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/notes/search/posts_eligible_for_notes'; + let path = '/2/notes/search/notes_written'; // Build query parameters const params = new URLSearchParams(); @@ -329,32 +364,8 @@ export class CommunityNotesClient { params.append('max_results', String(maxResults)); } - if (postSelection !== undefined) { - params.append('post_selection', String(postSelection)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (noteFields !== undefined && noteFields.length > 0) { + params.append('note.fields', noteFields.join(',')); } // Prepare request options @@ -369,7 +380,7 @@ export class CommunityNotesClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -377,14 +388,12 @@ export class CommunityNotesClient { } /** - * Evaluate a Community Note - * Endpoint to evaluate a community note. + * Create a Community Note + * Creates a community note endpoint for LLM use case. * * @returns Promise with the API response */ - async evaluate( - options: EvaluateStreamingOptions = {} - ): Promise { + async create(options: CreateStreamingOptions = {}): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -393,7 +402,7 @@ export class CommunityNotesClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'evaluate'); + this.client.validateAuthentication(requiredAuthTypes, 'create'); // Normalize options to handle both camelCase and original API parameter names @@ -410,7 +419,7 @@ export class CommunityNotesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/evaluate_note'; + let path = '/2/notes'; // Build query parameters const params = new URLSearchParams(); @@ -429,7 +438,7 @@ export class CommunityNotesClient { }; // Make the request - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -437,15 +446,15 @@ export class CommunityNotesClient { } /** - * Search for Community Notes Written - * Returns all the community notes written by the user. + * Search for Posts Eligible for Community Notes + * Returns all the posts that are eligible for community notes. * * @returns Promise with the API response */ - async searchWritten( + async searchEligiblePosts( testMode: boolean, - options: SearchWrittenStreamingOptions = {} - ): Promise { + options: SearchEligiblePostsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -454,7 +463,10 @@ export class CommunityNotesClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'searchWritten'); + this.client.validateAuthentication( + requiredAuthTypes, + 'searchEligiblePosts' + ); // Normalize options to handle both camelCase and original API parameter names @@ -463,7 +475,17 @@ export class CommunityNotesClient { max_results: 'maxResults', - 'note.fields': 'noteFields', + post_selection: 'postSelection', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -477,7 +499,19 @@ export class CommunityNotesClient { maxResults = undefined, - noteFields = [], + postSelection = undefined, + + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], headers = {}, signal, @@ -485,7 +519,7 @@ export class CommunityNotesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/notes/search/notes_written'; + let path = '/2/notes/search/posts_eligible_for_notes'; // Build query parameters const params = new URLSearchParams(); @@ -502,65 +536,33 @@ export class CommunityNotesClient { params.append('max_results', String(maxResults)); } - if (noteFields !== undefined && noteFields.length > 0) { - params.append('note.fields', noteFields.join(',')); + if (postSelection !== undefined) { + params.append('post_selection', String(postSelection)); } - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Create a Community Note - * Creates a community note endpoint for LLM use case. - * - * @returns Promise with the API response - */ - async create(options: CreateStreamingOptions = {}): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('OAuth2UserToken'); - - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'create'); - - // Normalize options to handle both camelCase and original API parameter names - - const normalizedOptions = options || {}; + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } - // Destructure options (exclude path parameters, they're already function params) + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } - const { - body, + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } - // Build the path with path parameters - let path = '/2/notes'; + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } - // Build query parameters - const params = new URLSearchParams(); + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } // Prepare request options const finalRequestOptions: RequestOptions = { @@ -570,14 +572,12 @@ export class CommunityNotesClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/compliance/client.ts b/xdk/typescript/src/compliance/client.ts index 4c94f94f..917c3d42 100644 --- a/xdk/typescript/src/compliance/client.ts +++ b/xdk/typescript/src/compliance/client.ts @@ -16,18 +16,22 @@ import { EventPaginator, } from '../paginator.js'; import { - GetJobsByIdResponse, GetJobsResponse, CreateJobsRequest, CreateJobsResponse, + GetJobsByIdResponse, } from './models.js'; /** - * Options for getJobsById method + * Options for getJobs method * * @public */ -export interface GetJobsByIdOptions { +export interface GetJobsOptions { + /** Status of Compliance Job to list. + * Also accepts: status or proper camelCase (e.g., status) */ + status?: string; + /** A comma separated list of ComplianceJob fields to display. * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ complianceJobFields?: Array; @@ -39,15 +43,11 @@ export interface GetJobsByIdOptions { } /** - * Options for getJobs method + * Options for getJobsById method * * @public */ -export interface GetJobsOptions { - /** Status of Compliance Job to list. - * Also accepts: status or proper camelCase (e.g., status) */ - status?: string; - +export interface GetJobsByIdOptions { /** A comma separated list of ComplianceJob fields to display. * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ complianceJobFields?: Array; @@ -108,71 +108,6 @@ export class ComplianceClient { return normalized as T; } - /** - * Get Compliance Job by ID - * Retrieves details of a specific Compliance Job by its ID. - - - * @param id The ID of the Compliance Job to retrieve. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getJobsById( - id: string, - options: GetJobsByIdOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - 'compliance_job.fields': 'complianceJobFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - const { - complianceJobFields = [], - - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/compliance/jobs/{id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - if (complianceJobFields !== undefined && complianceJobFields.length > 0) { - params.append('compliance_job.fields', complianceJobFields.join(',')); - } - - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [], - }, - ], - - ...requestOptions, - }; - - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - /** * Get Compliance Jobs * Retrieves a list of Compliance Jobs filtered by job type and optional status. @@ -288,4 +223,69 @@ export class ComplianceClient { finalRequestOptions ); } + + /** + * Get Compliance Job by ID + * Retrieves details of a specific Compliance Job by its ID. + + + * @param id The ID of the Compliance Job to retrieve. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getJobsById( + id: string, + options: GetJobsByIdOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + 'compliance_job.fields': 'complianceJobFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + const { + complianceJobFields = [], + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/compliance/jobs/{id}'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + // Build query parameters + const params = new URLSearchParams(); + + if (complianceJobFields !== undefined && complianceJobFields.length > 0) { + params.append('compliance_job.fields', complianceJobFields.join(',')); + } + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } } diff --git a/xdk/typescript/src/compliance/models.ts b/xdk/typescript/src/compliance/models.ts index eee59331..251d4813 100644 --- a/xdk/typescript/src/compliance/models.ts +++ b/xdk/typescript/src/compliance/models.ts @@ -10,12 +10,6 @@ import type * as Schemas from '../schemas.js'; -/** - * Response for getJobsById - * - * @public - */ -export type GetJobsByIdResponse = Schemas.Get2ComplianceJobsIdResponse; /** * Response for getJobs * @@ -33,4 +27,10 @@ export type CreateJobsRequest = Schemas.CreateComplianceJobRequest; * * @public */ -export type CreateJobsResponse = Schemas.CreateComplianceJobResponse; \ No newline at end of file +export type CreateJobsResponse = Schemas.CreateComplianceJobResponse; +/** + * Response for getJobsById + * + * @public + */ +export type GetJobsByIdResponse = Schemas.Get2ComplianceJobsIdResponse; \ No newline at end of file diff --git a/xdk/typescript/src/compliance/stream_client.ts b/xdk/typescript/src/compliance/stream_client.ts index 72094125..38cd6962 100644 --- a/xdk/typescript/src/compliance/stream_client.ts +++ b/xdk/typescript/src/compliance/stream_client.ts @@ -10,17 +10,21 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { - GetJobsByIdResponse, GetJobsResponse, CreateJobsResponse, + GetJobsByIdResponse, } from './models.js'; /** - * Options for getJobsById method + * Options for getJobs method * * @public */ -export interface GetJobsByIdStreamingOptions { +export interface GetJobsStreamingOptions { + /** Status of Compliance Job to list. + * Also accepts: status or proper camelCase (e.g., status) */ + status?: string; + /** A comma separated list of ComplianceJob fields to display. * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ complianceJobFields?: Array; @@ -35,19 +39,11 @@ export interface GetJobsByIdStreamingOptions { [key: string]: any; } /** - * Options for getJobs method + * Options for createJobs method * * @public */ -export interface GetJobsStreamingOptions { - /** Status of Compliance Job to list. - * Also accepts: status or proper camelCase (e.g., status) */ - status?: string; - - /** A comma separated list of ComplianceJob fields to display. - * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ - complianceJobFields?: Array; - +export interface CreateJobsStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -58,11 +54,15 @@ export interface GetJobsStreamingOptions { [key: string]: any; } /** - * Options for createJobs method + * Options for getJobsById method * * @public */ -export interface CreateJobsStreamingOptions { +export interface GetJobsByIdStreamingOptions { + /** A comma separated list of ComplianceJob fields to display. + * Also accepts: compliance_job.fields or proper camelCase (e.g., complianceJobFields) */ + complianceJobFields?: Array; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -110,22 +110,22 @@ export class ComplianceClient { } /** - * Get Compliance Job by ID - * Retrieves details of a specific Compliance Job by its ID. + * Get Compliance Jobs + * Retrieves a list of Compliance Jobs filtered by job type and optional status. * * @returns Promise with the API response */ - async getJobsById( - id: string, - options: GetJobsByIdStreamingOptions = {} - ): Promise { + async getJobs( + type: string, + options: GetJobsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getJobsById'); + this.client.validateAuthentication(requiredAuthTypes, 'getJobs'); // Normalize options to handle both camelCase and original API parameter names @@ -140,6 +140,8 @@ export class ComplianceClient { // Destructure options (exclude path parameters, they're already function params) const { + status = undefined, + complianceJobFields = [], headers = {}, @@ -148,13 +150,19 @@ export class ComplianceClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/compliance/jobs/{id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/compliance/jobs'; // Build query parameters const params = new URLSearchParams(); + if (type !== undefined) { + params.append('type', String(type)); + } + + if (status !== undefined) { + params.append('status', String(status)); + } + if (complianceJobFields !== undefined && complianceJobFields.length > 0) { params.append('compliance_job.fields', complianceJobFields.join(',')); } @@ -171,7 +179,7 @@ export class ComplianceClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -179,44 +187,30 @@ export class ComplianceClient { } /** - * Get Compliance Jobs - * Retrieves a list of Compliance Jobs filtered by job type and optional status. + * Create Compliance Job + * Creates a new Compliance Job for the specified job type. * * @returns Promise with the API response */ - async getJobs( - type: string, - options: GetJobsStreamingOptions = {} - ): Promise { + async createJobs( + body: any, + options: CreateJobsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getJobs'); + this.client.validateAuthentication(requiredAuthTypes, 'createJobs'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - 'compliance_job.fields': 'complianceJobFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) - const { - status = undefined, - - complianceJobFields = [], - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters let path = '/2/compliance/jobs'; @@ -224,18 +218,6 @@ export class ComplianceClient { // Build query parameters const params = new URLSearchParams(); - if (type !== undefined) { - params.append('type', String(type)); - } - - if (status !== undefined) { - params.append('status', String(status)); - } - - if (complianceJobFields !== undefined && complianceJobFields.length > 0) { - params.append('compliance_job.fields', complianceJobFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -244,49 +226,69 @@ export class ComplianceClient { }, signal: signal, + body: JSON.stringify(body), + ...requestOptions, }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Create Compliance Job - * Creates a new Compliance Job for the specified job type. + * Get Compliance Job by ID + * Retrieves details of a specific Compliance Job by its ID. * * @returns Promise with the API response */ - async createJobs( - body: any, - options: CreateJobsStreamingOptions = {} - ): Promise { + async getJobsById( + id: string, + options: GetJobsByIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'createJobs'); + this.client.validateAuthentication(requiredAuthTypes, 'getJobsById'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + 'compliance_job.fields': 'complianceJobFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + complianceJobFields = [], + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/compliance/jobs'; + let path = '/2/compliance/jobs/{id}'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (complianceJobFields !== undefined && complianceJobFields.length > 0) { + params.append('compliance_job.fields', complianceJobFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -295,14 +297,12 @@ export class ComplianceClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/direct_messages/client.ts b/xdk/typescript/src/direct_messages/client.ts index 79481c63..5f118bc1 100644 --- a/xdk/typescript/src/direct_messages/client.ts +++ b/xdk/typescript/src/direct_messages/client.ts @@ -16,25 +16,40 @@ import { EventPaginator, } from '../paginator.js'; import { + CreateByParticipantIdRequest, + CreateByParticipantIdResponse, + GetEventsResponse, GetEventsByParticipantIdResponse, + GetEventsByConversationIdResponse, + GetEventsByIdResponse, + DeleteEventsResponse, CreateByConversationIdRequest, CreateByConversationIdResponse, - CreateByParticipantIdRequest, - CreateByParticipantIdResponse, CreateConversationRequest, CreateConversationResponse, - GetEventsByIdResponse, - DeleteEventsResponse, - GetEventsResponse, - GetEventsByConversationIdResponse, } from './models.js'; /** - * Options for getEventsByParticipantId method + * Options for createByParticipantId method * * @public */ -export interface GetEventsByParticipantIdOptions { +export interface CreateByParticipantIdOptions { + /** Request body */ + body?: CreateByParticipantIdRequest; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for getEvents method + * + * @public + */ +export interface GetEventsOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -74,56 +89,23 @@ export interface GetEventsByParticipantIdOptions { } /** - * Options for createByConversationId method - * - * @public - */ -export interface CreateByConversationIdOptions { - /** Request body */ - body?: CreateByConversationIdRequest; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for createByParticipantId method + * Options for getEventsByParticipantId method * * @public */ -export interface CreateByParticipantIdOptions { - /** Request body */ - body?: CreateByParticipantIdRequest; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} +export interface GetEventsByParticipantIdOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; -/** - * Options for createConversation method - * - * @public - */ -export interface CreateConversationOptions { - /** Request body */ - body?: CreateConversationRequest; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} + /** The set of event_types to include in the results. + * Also accepts: event_types or proper camelCase (e.g., eventTypes) */ + eventTypes?: Array; -/** - * Options for getEventsById method - * - * @public - */ -export interface GetEventsByIdOptions { /** A comma separated list of DmEvent fields to display. * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */ dmEventFields?: Array; @@ -151,11 +133,11 @@ export interface GetEventsByIdOptions { } /** - * Options for getEvents method + * Options for getEventsByConversationId method * * @public */ -export interface GetEventsOptions { +export interface GetEventsByConversationIdOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -195,23 +177,11 @@ export interface GetEventsOptions { } /** - * Options for getEventsByConversationId method + * Options for getEventsById method * * @public */ -export interface GetEventsByConversationIdOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - - /** The set of event_types to include in the results. - * Also accepts: event_types or proper camelCase (e.g., eventTypes) */ - eventTypes?: Array; - +export interface GetEventsByIdOptions { /** A comma separated list of DmEvent fields to display. * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */ dmEventFields?: Array; @@ -238,6 +208,36 @@ export interface GetEventsByConversationIdOptions { [key: string]: any; } +/** + * Options for createByConversationId method + * + * @public + */ +export interface CreateByConversationIdOptions { + /** Request body */ + body?: CreateByConversationIdRequest; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for createConversation method + * + * @public + */ +export interface CreateConversationOptions { + /** Request body */ + body?: CreateConversationRequest; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + /** * Client for direct messages operations * @@ -289,22 +289,79 @@ export class DirectMessagesClient { } /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. + * Create DM message by participant ID + * Sends a new direct message to a specific participant by their ID. - * @param participantId The ID of the participant user for the One to One DM conversation. + * @param participantId The ID of the recipient user that will receive the DM. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getEventsByParticipantId( + async createByParticipantId( participantId: string, - options: GetEventsByParticipantIdOptions = {} - ): Promise { + options: CreateByParticipantIdOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + const { + body, + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/dm_conversations/with/{participant_id}/messages'; + + path = path.replace( + '{participant_id}', + encodeURIComponent(String(participantId)) + ); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], + }, + + { + UserToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Get DM events + * Retrieves a list of recent direct message events across all conversations. + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getEvents(options: GetEventsOptions = {}): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -349,12 +406,7 @@ export class DirectMessagesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_conversations/with/{participant_id}/dm_events'; - - path = path.replace( - '{participant_id}', - encodeURIComponent(String(participantId)) - ); + let path = '/2/dm_events'; // Build query parameters const params = new URLSearchParams(); @@ -407,7 +459,7 @@ export class DirectMessagesClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -415,99 +467,67 @@ export class DirectMessagesClient { } /** - * Create DM message by conversation ID - * Sends a new direct message to a specific conversation by its ID. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. - * @param dmConversationId The DM Conversation ID. + * @param participantId The ID of the participant user for the One to One DM conversation. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createByConversationId( - dmConversationId: string, - options: CreateByConversationIdOptions = {} - ): Promise { + async getEventsByParticipantId( + participantId: string, + options: GetEventsByParticipantIdOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + max_results: 'maxResults', - // Destructure options (exclude path parameters, they're already function params) - const { - body, + pagination_token: 'paginationToken', - requestOptions: requestOptions = {}, - } = normalizedOptions; + event_types: 'eventTypes', - // Build the path with path parameters - let path = '/2/dm_conversations/{dm_conversation_id}/messages'; + 'dm_event.fields': 'dmEventFields', - path = path.replace( - '{dm_conversation_id}', - encodeURIComponent(String(dmConversationId)) - ); + 'media.fields': 'mediaFields', - // Build query parameters - const params = new URLSearchParams(); + 'user.fields': 'userFields', - // Prepare request options - const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - ...requestOptions, + 'tweet.fields': 'tweetFields', }; - - return this.client.request( - 'POST', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings ); - } - - /** - * Create DM message by participant ID - * Sends a new direct message to a specific participant by their ID. + // Destructure options (exclude path parameters, they're already function params) + const { + maxResults = undefined, - * @param participantId The ID of the recipient user that will receive the DM. + paginationToken = undefined, + eventTypes = [], + dmEventFields = [], + expansions = [], - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async createByParticipantId( - participantId: string, - options: CreateByParticipantIdOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names + mediaFields = [], - const normalizedOptions = options || {}; + userFields = [], - // Destructure options (exclude path parameters, they're already function params) - const { - body, + tweetFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_conversations/with/{participant_id}/messages'; + let path = '/2/dm_conversations/with/{participant_id}/dm_events'; path = path.replace( '{participant_id}', @@ -517,14 +537,44 @@ export class DirectMessagesClient { // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (eventTypes !== undefined && eventTypes.length > 0) { + params.append('event_types', eventTypes.join(',')); + } + + if (dmEventFields !== undefined && dmEventFields.length > 0) { + params.append('dm_event.fields', dmEventFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'], }, { @@ -535,50 +585,119 @@ export class DirectMessagesClient { ...requestOptions, }; - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Create DM conversation - * Initiates a new direct message conversation with specified participants. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. + * @param id The DM conversation ID. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createConversation( - options: CreateConversationOptions = {} - ): Promise { + async getEventsByConversationId( + id: string, + options: GetEventsByConversationIdOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + + event_types: 'eventTypes', + + 'dm_event.fields': 'dmEventFields', + + 'media.fields': 'mediaFields', + + 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - body, + maxResults = undefined, + + paginationToken = undefined, + + eventTypes = [], + + dmEventFields = [], + + expansions = [], + + mediaFields = [], + + userFields = [], + + tweetFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_conversations'; + let path = '/2/dm_conversations/{id}/dm_events'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (eventTypes !== undefined && eventTypes.length > 0) { + params.append('event_types', eventTypes.join(',')); + } + + if (dmEventFields !== undefined && dmEventFields.length > 0) { + params.append('dm_event.fields', dmEventFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'], }, { @@ -589,8 +708,8 @@ export class DirectMessagesClient { ...requestOptions, }; - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); @@ -745,102 +864,52 @@ export class DirectMessagesClient { } /** - * Get DM events - * Retrieves a list of recent direct message events across all conversations. - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getEvents(options: GetEventsOptions = {}): Promise { - // Normalize options to handle both camelCase and original API parameter names + * Create DM message by conversation ID + * Sends a new direct message to a specific conversation by its ID. - const paramMappings: Record = { - max_results: 'maxResults', - pagination_token: 'paginationToken', + * @param dmConversationId The DM Conversation ID. - event_types: 'eventTypes', - 'dm_event.fields': 'dmEventFields', - 'media.fields': 'mediaFields', - 'user.fields': 'userFields', + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async createByConversationId( + dmConversationId: string, + options: CreateByConversationIdOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - eventTypes = [], - - dmEventFields = [], - - expansions = [], - - mediaFields = [], - - userFields = [], - - tweetFields = [], + body, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_events'; + let path = '/2/dm_conversations/{dm_conversation_id}/messages'; + + path = path.replace( + '{dm_conversation_id}', + encodeURIComponent(String(dmConversationId)) + ); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (eventTypes !== undefined && eventTypes.length > 0) { - params.append('event_types', eventTypes.join(',')); - } - - if (dmEventFields !== undefined && dmEventFields.length > 0) { - params.append('dm_event.fields', dmEventFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'], + OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], }, { @@ -851,119 +920,50 @@ export class DirectMessagesClient { ...requestOptions, }; - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. - - - * @param id The DM conversation ID. - + * Create DM conversation + * Initiates a new direct message conversation with specified participants. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getEventsByConversationId( - id: string, - options: GetEventsByConversationIdOptions = {} - ): Promise { + async createConversation( + options: CreateConversationOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - event_types: 'eventTypes', - - 'dm_event.fields': 'dmEventFields', - - 'media.fields': 'mediaFields', - - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - eventTypes = [], - - dmEventFields = [], - - expansions = [], - - mediaFields = [], - - userFields = [], - - tweetFields = [], + body, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_conversations/{id}/dm_events'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/dm_conversations'; // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (eventTypes !== undefined && eventTypes.length > 0) { - params.append('event_types', eventTypes.join(',')); - } - - if (dmEventFields !== undefined && dmEventFields.length > 0) { - params.append('dm_event.fields', dmEventFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['dm.read', 'tweet.read', 'users.read'], + OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], }, { @@ -974,8 +974,8 @@ export class DirectMessagesClient { ...requestOptions, }; - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/direct_messages/models.ts b/xdk/typescript/src/direct_messages/models.ts index 1c340d61..9116d13f 100644 --- a/xdk/typescript/src/direct_messages/models.ts +++ b/xdk/typescript/src/direct_messages/models.ts @@ -11,68 +11,68 @@ import type * as Schemas from '../schemas.js'; /** - * Response for getEventsByParticipantId + * Request for createByParticipantId * * @public */ -export type GetEventsByParticipantIdResponse = Schemas.Get2DmConversationsWithParticipantIdDmEventsResponse; +export type CreateByParticipantIdRequest = Schemas.CreateMessageRequest; /** - * Request for createByConversationId + * Response for createByParticipantId * * @public */ -export type CreateByConversationIdRequest = Schemas.CreateMessageRequest; +export type CreateByParticipantIdResponse = Schemas.CreateDmEventResponse; /** - * Response for createByConversationId + * Response for getEvents * * @public */ -export type CreateByConversationIdResponse = Schemas.CreateDmEventResponse; +export type GetEventsResponse = Schemas.Get2DmEventsResponse; /** - * Request for createByParticipantId + * Response for getEventsByParticipantId * * @public */ -export type CreateByParticipantIdRequest = Schemas.CreateMessageRequest; +export type GetEventsByParticipantIdResponse = Schemas.Get2DmConversationsWithParticipantIdDmEventsResponse; /** - * Response for createByParticipantId + * Response for getEventsByConversationId * * @public */ -export type CreateByParticipantIdResponse = Schemas.CreateDmEventResponse; +export type GetEventsByConversationIdResponse = Schemas.Get2DmConversationsIdDmEventsResponse; /** - * Request for createConversation + * Response for getEventsById * * @public */ -export type CreateConversationRequest = Schemas.CreateDmConversationRequest; +export type GetEventsByIdResponse = Schemas.Get2DmEventsEventIdResponse; /** - * Response for createConversation + * Response for deleteEvents * * @public */ -export type CreateConversationResponse = Schemas.CreateDmEventResponse; +export type DeleteEventsResponse = Schemas.DeleteDmResponse; /** - * Response for getEventsById + * Request for createByConversationId * * @public */ -export type GetEventsByIdResponse = Schemas.Get2DmEventsEventIdResponse; +export type CreateByConversationIdRequest = Schemas.CreateMessageRequest; /** - * Response for deleteEvents + * Response for createByConversationId * * @public */ -export type DeleteEventsResponse = Schemas.DeleteDmResponse; +export type CreateByConversationIdResponse = Schemas.CreateDmEventResponse; /** - * Response for getEvents + * Request for createConversation * * @public */ -export type GetEventsResponse = Schemas.Get2DmEventsResponse; +export type CreateConversationRequest = Schemas.CreateDmConversationRequest; /** - * Response for getEventsByConversationId + * Response for createConversation * * @public */ -export type GetEventsByConversationIdResponse = Schemas.Get2DmConversationsIdDmEventsResponse; \ No newline at end of file +export type CreateConversationResponse = Schemas.CreateDmEventResponse; \ No newline at end of file diff --git a/xdk/typescript/src/direct_messages/stream_client.ts b/xdk/typescript/src/direct_messages/stream_client.ts index 43b41e1d..8fc187ac 100644 --- a/xdk/typescript/src/direct_messages/stream_client.ts +++ b/xdk/typescript/src/direct_messages/stream_client.ts @@ -10,22 +10,40 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { - GetEventsByParticipantIdResponse, - CreateByConversationIdResponse, CreateByParticipantIdResponse, - CreateConversationResponse, - GetEventsByIdResponse, - DeleteEventsResponse, GetEventsResponse, + GetEventsByParticipantIdResponse, GetEventsByConversationIdResponse, + GetEventsByIdResponse, + DeleteEventsResponse, + CreateByConversationIdResponse, + CreateConversationResponse, } from './models.js'; /** - * Options for getEventsByParticipantId method + * Options for createByParticipantId method * * @public */ -export interface GetEventsByParticipantIdStreamingOptions { +export interface CreateByParticipantIdStreamingOptions { + /** Request body */ + body?: any; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getEvents method + * + * @public + */ +export interface GetEventsStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -68,65 +86,23 @@ export interface GetEventsByParticipantIdStreamingOptions { [key: string]: any; } /** - * Options for createByConversationId method + * Options for getEventsByParticipantId method * * @public */ -export interface CreateByConversationIdStreamingOptions { - /** Request body */ - body?: any; +export interface GetEventsByParticipantIdStreamingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for createByParticipantId method - * - * @public - */ -export interface CreateByParticipantIdStreamingOptions { - /** Request body */ - body?: any; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for createConversation method - * - * @public - */ -export interface CreateConversationStreamingOptions { - /** Request body */ - body?: any; + /** The set of event_types to include in the results. + * Also accepts: event_types or proper camelCase (e.g., eventTypes) */ + eventTypes?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getEventsById method - * - * @public - */ -export interface GetEventsByIdStreamingOptions { /** A comma separated list of DmEvent fields to display. * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */ dmEventFields?: Array; @@ -157,26 +133,11 @@ export interface GetEventsByIdStreamingOptions { [key: string]: any; } /** - * Options for deleteEvents method - * - * @public - */ -export interface DeleteEventsStreamingOptions { - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getEvents method + * Options for getEventsByConversationId method * * @public */ -export interface GetEventsStreamingOptions { +export interface GetEventsByConversationIdStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -219,23 +180,11 @@ export interface GetEventsStreamingOptions { [key: string]: any; } /** - * Options for getEventsByConversationId method + * Options for getEventsById method * * @public */ -export interface GetEventsByConversationIdStreamingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - - /** The set of event_types to include in the results. - * Also accepts: event_types or proper camelCase (e.g., eventTypes) */ - eventTypes?: Array; - +export interface GetEventsByIdStreamingOptions { /** A comma separated list of DmEvent fields to display. * Also accepts: dm_event.fields or proper camelCase (e.g., dmEventFields) */ dmEventFields?: Array; @@ -265,6 +214,57 @@ export interface GetEventsByConversationIdStreamingOptions { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for deleteEvents method + * + * @public + */ +export interface DeleteEventsStreamingOptions { + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for createByConversationId method + * + * @public + */ +export interface CreateByConversationIdStreamingOptions { + /** Request body */ + body?: any; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for createConversation method + * + * @public + */ +export interface CreateConversationStreamingOptions { + /** Request body */ + body?: any; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} export class DirectMessagesClient { private client: Client; @@ -303,15 +303,15 @@ export class DirectMessagesClient { } /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. + * Create DM message by participant ID + * Sends a new direct message to a specific participant by their ID. * * @returns Promise with the API response */ - async getEventsByParticipantId( + async createByParticipantId( participantId: string, - options: GetEventsByParticipantIdStreamingOptions = {} - ): Promise { + options: CreateByParticipantIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -322,9 +322,74 @@ export class DirectMessagesClient { this.client.validateAuthentication( requiredAuthTypes, - 'getEventsByParticipantId' + 'createByParticipantId' + ); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { + body, + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/dm_conversations/with/{participant_id}/messages'; + + path = path.replace( + '{participant_id}', + encodeURIComponent(String(participantId)) ); + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, + + body: JSON.stringify(body), + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Get DM events + * Retrieves a list of recent direct message events across all conversations. + * + * @returns Promise with the API response + */ + async getEvents( + options: GetEventsStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('OAuth2UserToken'); + + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'getEvents'); + // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -372,12 +437,7 @@ export class DirectMessagesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_conversations/with/{participant_id}/dm_events'; - - path = path.replace( - '{participant_id}', - encodeURIComponent(String(participantId)) - ); + let path = '/2/dm_events'; // Build query parameters const params = new URLSearchParams(); @@ -426,7 +486,7 @@ export class DirectMessagesClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -434,15 +494,15 @@ export class DirectMessagesClient { } /** - * Create DM message by conversation ID - * Sends a new direct message to a specific conversation by its ID. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. * * @returns Promise with the API response */ - async createByConversationId( - dmConversationId: string, - options: CreateByConversationIdStreamingOptions = {} - ): Promise { + async getEventsByParticipantId( + participantId: string, + options: GetEventsByParticipantIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -453,17 +513,49 @@ export class DirectMessagesClient { this.client.validateAuthentication( requiredAuthTypes, - 'createByConversationId' + 'getEventsByParticipantId' ); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + + event_types: 'eventTypes', + + 'dm_event.fields': 'dmEventFields', + + 'media.fields': 'mediaFields', + + 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - body, + maxResults = undefined, + + paginationToken = undefined, + + eventTypes = [], + + dmEventFields = [], + + expansions = [], + + mediaFields = [], + + userFields = [], + + tweetFields = [], headers = {}, signal, @@ -471,16 +563,48 @@ export class DirectMessagesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_conversations/{dm_conversation_id}/messages'; + let path = '/2/dm_conversations/with/{participant_id}/dm_events'; path = path.replace( - '{dm_conversation_id}', - encodeURIComponent(String(dmConversationId)) + '{participant_id}', + encodeURIComponent(String(participantId)) ); // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (eventTypes !== undefined && eventTypes.length > 0) { + params.append('event_types', eventTypes.join(',')); + } + + if (dmEventFields !== undefined && dmEventFields.length > 0) { + params.append('dm_event.fields', dmEventFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -489,29 +613,27 @@ export class DirectMessagesClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Create DM message by participant ID - * Sends a new direct message to a specific participant by their ID. + * Get DM events for a DM conversation + * Retrieves direct message events for a specific conversation. * * @returns Promise with the API response */ - async createByParticipantId( - participantId: string, - options: CreateByParticipantIdStreamingOptions = {} - ): Promise { + async getEventsByConversationId( + id: string, + options: GetEventsByConversationIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -522,82 +644,49 @@ export class DirectMessagesClient { this.client.validateAuthentication( requiredAuthTypes, - 'createByParticipantId' + 'getEventsByConversationId' ); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) - - const { - body, - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + const paramMappings: Record = { + max_results: 'maxResults', - // Build the path with path parameters - let path = '/2/dm_conversations/with/{participant_id}/messages'; + pagination_token: 'paginationToken', - path = path.replace( - '{participant_id}', - encodeURIComponent(String(participantId)) - ); + event_types: 'eventTypes', - // Build query parameters - const params = new URLSearchParams(); + 'dm_event.fields': 'dmEventFields', - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, + 'media.fields': 'mediaFields', - body: JSON.stringify(body), + 'user.fields': 'userFields', - ...requestOptions, + 'tweet.fields': 'tweetFields', }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); - // Make the request - return this.client.request( - 'POST', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Create DM conversation - * Initiates a new direct message conversation with specified participants. - * - * @returns Promise with the API response - */ - async createConversation( - options: CreateConversationStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; + // Destructure options (exclude path parameters, they're already function params) - requiredAuthTypes.push('OAuth2UserToken'); + const { + maxResults = undefined, - requiredAuthTypes.push('UserToken'); + paginationToken = undefined, - this.client.validateAuthentication(requiredAuthTypes, 'createConversation'); + eventTypes = [], - // Normalize options to handle both camelCase and original API parameter names + dmEventFields = [], - const normalizedOptions = options || {}; + expansions = [], - // Destructure options (exclude path parameters, they're already function params) + mediaFields = [], - const { - body, + userFields = [], + + tweetFields = [], headers = {}, signal, @@ -605,11 +694,45 @@ export class DirectMessagesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_conversations'; + let path = '/2/dm_conversations/{id}/dm_events'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (eventTypes !== undefined && eventTypes.length > 0) { + params.append('event_types', eventTypes.join(',')); + } + + if (dmEventFields !== undefined && dmEventFields.length > 0) { + params.append('dm_event.fields', dmEventFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -618,14 +741,12 @@ export class DirectMessagesClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); @@ -788,14 +909,15 @@ export class DirectMessagesClient { } /** - * Get DM events - * Retrieves a list of recent direct message events across all conversations. + * Create DM message by conversation ID + * Sends a new direct message to a specific conversation by its ID. * * @returns Promise with the API response */ - async getEvents( - options: GetEventsStreamingOptions = {} - ): Promise { + async createByConversationId( + dmConversationId: string, + options: CreateByConversationIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -804,48 +926,19 @@ export class DirectMessagesClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getEvents'); + this.client.validateAuthentication( + requiredAuthTypes, + 'createByConversationId' + ); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - event_types: 'eventTypes', - - 'dm_event.fields': 'dmEventFields', - - 'media.fields': 'mediaFields', - - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - eventTypes = [], - - dmEventFields = [], - - expansions = [], - - mediaFields = [], - - userFields = [], - - tweetFields = [], + body, headers = {}, signal, @@ -853,43 +946,16 @@ export class DirectMessagesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_events'; + let path = '/2/dm_conversations/{dm_conversation_id}/messages'; + + path = path.replace( + '{dm_conversation_id}', + encodeURIComponent(String(dmConversationId)) + ); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (eventTypes !== undefined && eventTypes.length > 0) { - params.append('event_types', eventTypes.join(',')); - } - - if (dmEventFields !== undefined && dmEventFields.length > 0) { - params.append('dm_event.fields', dmEventFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -898,27 +964,28 @@ export class DirectMessagesClient { }, signal: signal, + body: JSON.stringify(body), + ...requestOptions, }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get DM events for a DM conversation - * Retrieves direct message events for a specific conversation. + * Create DM conversation + * Initiates a new direct message conversation with specified participants. * * @returns Promise with the API response */ - async getEventsByConversationId( - id: string, - options: GetEventsByConversationIdStreamingOptions = {} - ): Promise { + async createConversation( + options: CreateConversationStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -927,51 +994,16 @@ export class DirectMessagesClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication( - requiredAuthTypes, - 'getEventsByConversationId' - ); + this.client.validateAuthentication(requiredAuthTypes, 'createConversation'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - event_types: 'eventTypes', - - 'dm_event.fields': 'dmEventFields', - - 'media.fields': 'mediaFields', - - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - eventTypes = [], - - dmEventFields = [], - - expansions = [], - - mediaFields = [], - - userFields = [], - - tweetFields = [], + body, headers = {}, signal, @@ -979,45 +1011,11 @@ export class DirectMessagesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/dm_conversations/{id}/dm_events'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/dm_conversations'; // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (eventTypes !== undefined && eventTypes.length > 0) { - params.append('event_types', eventTypes.join(',')); - } - - if (dmEventFields !== undefined && dmEventFields.length > 0) { - params.append('dm_event.fields', dmEventFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -1026,12 +1024,14 @@ export class DirectMessagesClient { }, signal: signal, + body: JSON.stringify(body), + ...requestOptions, }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/index.ts b/xdk/typescript/src/index.ts index dadf1ae4..1da3c157 100644 --- a/xdk/typescript/src/index.ts +++ b/xdk/typescript/src/index.ts @@ -68,77 +68,77 @@ export * as Schemas from './schemas.js'; // Client modules (export client classes and types) -export { NewsClient } from './news/client.js'; +export { ActivityClient } from './activity/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as News from './news/models.js'; +export * as Activity from './activity/models.js'; -export { UsersClient } from './users/client.js'; +export { NewsClient } from './news/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as Users from './users/models.js'; +export * as News from './news/models.js'; -export { DirectMessagesClient } from './direct_messages/client.js'; +export { ConnectionsClient } from './connections/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as DirectMessages from './direct_messages/models.js'; +export * as Connections from './connections/models.js'; -export { CommunityNotesClient } from './community_notes/client.js'; +export { AccountActivityClient } from './account_activity/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as CommunityNotes from './community_notes/models.js'; +export * as AccountActivity from './account_activity/models.js'; -export { PostsClient } from './posts/client.js'; +export { SpacesClient } from './spaces/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as Posts from './posts/models.js'; +export * as Spaces from './spaces/models.js'; export { TrendsClient } from './trends/client.js'; // Export all types (Request, Response, Options) from this module as a namespace export * as Trends from './trends/models.js'; -export { ActivityClient } from './activity/client.js'; -// Export all types (Request, Response, Options) from this module as a namespace -export * as Activity from './activity/models.js'; - -export { UsageClient } from './usage/client.js'; -// Export all types (Request, Response, Options) from this module as a namespace -export * as Usage from './usage/models.js'; - -export { SpacesClient } from './spaces/client.js'; -// Export all types (Request, Response, Options) from this module as a namespace -export * as Spaces from './spaces/models.js'; - -export { CommunitiesClient } from './communities/client.js'; +export { MediaClient } from './media/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as Communities from './communities/models.js'; +export * as Media from './media/models.js'; -export { ConnectionsClient } from './connections/client.js'; +export { DirectMessagesClient } from './direct_messages/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as Connections from './connections/models.js'; +export * as DirectMessages from './direct_messages/models.js'; -export { MediaClient } from './media/client.js'; +export { PostsClient } from './posts/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as Media from './media/models.js'; +export * as Posts from './posts/models.js'; export { ListsClient } from './lists/client.js'; // Export all types (Request, Response, Options) from this module as a namespace export * as Lists from './lists/models.js'; -export { ComplianceClient } from './compliance/client.js'; +export { CommunityNotesClient } from './community_notes/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as Compliance from './compliance/models.js'; +export * as CommunityNotes from './community_notes/models.js'; export { GeneralClient } from './general/client.js'; // Export all types (Request, Response, Options) from this module as a namespace export * as General from './general/models.js'; -export { AccountActivityClient } from './account_activity/client.js'; +export { WebhooksClient } from './webhooks/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as AccountActivity from './account_activity/models.js'; +export * as Webhooks from './webhooks/models.js'; + +export { UsersClient } from './users/client.js'; +// Export all types (Request, Response, Options) from this module as a namespace +export * as Users from './users/models.js'; + +export { CommunitiesClient } from './communities/client.js'; +// Export all types (Request, Response, Options) from this module as a namespace +export * as Communities from './communities/models.js'; export { StreamClient } from './stream/client.js'; // Export all types (Request, Response, Options) from this module as a namespace export * as Stream from './stream/models.js'; -export { WebhooksClient } from './webhooks/client.js'; +export { ComplianceClient } from './compliance/client.js'; // Export all types (Request, Response, Options) from this module as a namespace -export * as Webhooks from './webhooks/models.js'; +export * as Compliance from './compliance/models.js'; + +export { UsageClient } from './usage/client.js'; +// Export all types (Request, Response, Options) from this module as a namespace +export * as Usage from './usage/models.js'; // Utilities diff --git a/xdk/typescript/src/lists/client.ts b/xdk/typescript/src/lists/client.ts index c1bf27a5..0e0f4730 100644 --- a/xdk/typescript/src/lists/client.ts +++ b/xdk/typescript/src/lists/client.ts @@ -16,59 +16,20 @@ import { EventPaginator, } from '../paginator.js'; import { - RemoveMemberByUserIdResponse, - GetByIdResponse, - UpdateRequest, - UpdateResponse, - DeleteResponse, GetMembersResponse, AddMemberRequest, AddMemberResponse, GetFollowersResponse, GetPostsResponse, + RemoveMemberByUserIdResponse, + GetByIdResponse, + UpdateRequest, + UpdateResponse, + DeleteResponse, CreateRequest, CreateResponse, } from './models.js'; -/** - * Options for getById method - * - * @public - */ -export interface GetByIdOptions { - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for update method - * - * @public - */ -export interface UpdateOptions { - /** Request body */ - body?: UpdateRequest; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - /** * Options for getMembers method * @@ -192,6 +153,45 @@ export interface GetPostsOptions { [key: string]: any; } +/** + * Options for getById method + * + * @public + */ +export interface GetByIdOptions { + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for update method + * + * @public + */ +export interface UpdateOptions { + /** Request body */ + body?: UpdateRequest; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + /** * Options for create method * @@ -254,262 +254,7 @@ export class ListsClient { // The camelName is already the proper camelCase format } - return normalized as T; - } - - /** - * Remove List member - * Removes a User from a specific List by its ID and the User’s ID. - - - * @param id The ID of the List to remove a member. - - - - * @param userId The ID of User that will be removed from the List. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async removeMemberByUserId( - id: string, - userId: string - ): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const requestOptions = {}; - - // Build the path with path parameters - let path = '/2/lists/{id}/members/{user_id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - path = path.replace('{user_id}', encodeURIComponent(String(userId))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - // No optional parameters, using empty request options - }; - - return this.client.request( - 'DELETE', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get List by ID - * Retrieves details of a specific List by its ID. - - - * @param id The ID of the List. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getById( - id: string, - options: GetByIdOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - 'list.fields': 'listFields', - - 'user.fields': 'userFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - const { - listFields = [], - - expansions = [], - - userFields = [], - - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/lists/{id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - if (listFields !== undefined && listFields.length > 0) { - params.append('list.fields', listFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [], - }, - - { - OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - ...requestOptions, - }; - - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Update List - * Updates the details of a specific List owned by the authenticated user by its ID. - - - * @param id The ID of the List to modify. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async update( - id: string, - options: UpdateOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) - const { - body, - - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/lists/{id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - ...requestOptions, - }; - - return this.client.request( - 'PUT', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Delete List - * Deletes a specific List owned by the authenticated user by its ID. - - - * @param id The ID of the List to delete. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async delete(id: string): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const requestOptions = {}; - - // Build the path with path parameters - let path = '/2/lists/{id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - // No optional parameters, using empty request options - }; - - return this.client.request( - 'DELETE', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); + return normalized as T; } /** @@ -906,6 +651,261 @@ export class ListsClient { ); } + /** + * Remove List member + * Removes a User from a specific List by its ID and the User’s ID. + + + * @param id The ID of the List to remove a member. + + + + * @param userId The ID of User that will be removed from the List. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async removeMemberByUserId( + id: string, + userId: string + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const requestOptions = {}; + + // Build the path with path parameters + let path = '/2/lists/{id}/members/{user_id}'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + path = path.replace('{user_id}', encodeURIComponent(String(userId))); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], + }, + + { + UserToken: [], + }, + ], + + // No optional parameters, using empty request options + }; + + return this.client.request( + 'DELETE', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Get List by ID + * Retrieves details of a specific List by its ID. + + + * @param id The ID of the List. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getById( + id: string, + options: GetByIdOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + 'list.fields': 'listFields', + + 'user.fields': 'userFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + const { + listFields = [], + + expansions = [], + + userFields = [], + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/lists/{id}'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + // Build query parameters + const params = new URLSearchParams(); + + if (listFields !== undefined && listFields.length > 0) { + params.append('list.fields', listFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [], + }, + + { + OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'], + }, + + { + UserToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Update List + * Updates the details of a specific List owned by the authenticated user by its ID. + + + * @param id The ID of the List to modify. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async update( + id: string, + options: UpdateOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + const { + body, + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/lists/{id}'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], + }, + + { + UserToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'PUT', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Delete List + * Deletes a specific List owned by the authenticated user by its ID. + + + * @param id The ID of the List to delete. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async delete(id: string): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const requestOptions = {}; + + // Build the path with path parameters + let path = '/2/lists/{id}'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], + }, + + { + UserToken: [], + }, + ], + + // No optional parameters, using empty request options + }; + + return this.client.request( + 'DELETE', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + /** * Create List * Creates a new List for the authenticated user. diff --git a/xdk/typescript/src/lists/models.ts b/xdk/typescript/src/lists/models.ts index 70b367b6..024e6a07 100644 --- a/xdk/typescript/src/lists/models.ts +++ b/xdk/typescript/src/lists/models.ts @@ -11,65 +11,65 @@ import type * as Schemas from '../schemas.js'; /** - * Response for removeMemberByUserId + * Response for getMembers * * @public */ -export type RemoveMemberByUserIdResponse = Schemas.ListMutateResponse; +export type GetMembersResponse = Schemas.Get2ListsIdMembersResponse; /** - * Response for getById + * Request for addMember * * @public */ -export type GetByIdResponse = Schemas.Get2ListsIdResponse; +export type AddMemberRequest = Schemas.ListAddUserRequest; /** - * Request for update + * Response for addMember * * @public */ -export type UpdateRequest = Schemas.ListUpdateRequest; +export type AddMemberResponse = Schemas.ListMutateResponse; /** - * Response for update + * Response for getFollowers * * @public */ -export type UpdateResponse = Schemas.ListUpdateResponse; +export type GetFollowersResponse = Schemas.Get2ListsIdFollowersResponse; /** - * Response for delete + * Response for getPosts * * @public */ -export type DeleteResponse = Schemas.ListDeleteResponse; +export type GetPostsResponse = Schemas.Get2ListsIdTweetsResponse; /** - * Response for getMembers + * Response for removeMemberByUserId * * @public */ -export type GetMembersResponse = Schemas.Get2ListsIdMembersResponse; +export type RemoveMemberByUserIdResponse = Schemas.ListMutateResponse; /** - * Request for addMember + * Response for getById * * @public */ -export type AddMemberRequest = Schemas.ListAddUserRequest; +export type GetByIdResponse = Schemas.Get2ListsIdResponse; /** - * Response for addMember + * Request for update * * @public */ -export type AddMemberResponse = Schemas.ListMutateResponse; +export type UpdateRequest = Schemas.ListUpdateRequest; /** - * Response for getFollowers + * Response for update * * @public */ -export type GetFollowersResponse = Schemas.Get2ListsIdFollowersResponse; +export type UpdateResponse = Schemas.ListUpdateResponse; /** - * Response for getPosts + * Response for delete * * @public */ -export type GetPostsResponse = Schemas.Get2ListsIdTweetsResponse; +export type DeleteResponse = Schemas.ListDeleteResponse; /** * Request for create * diff --git a/xdk/typescript/src/lists/stream_client.ts b/xdk/typescript/src/lists/stream_client.ts index c6dba71e..2176aaab 100644 --- a/xdk/typescript/src/lists/stream_client.ts +++ b/xdk/typescript/src/lists/stream_client.ts @@ -10,92 +10,17 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { - RemoveMemberByUserIdResponse, - GetByIdResponse, - UpdateResponse, - DeleteResponse, GetMembersResponse, AddMemberResponse, GetFollowersResponse, GetPostsResponse, + RemoveMemberByUserIdResponse, + GetByIdResponse, + UpdateResponse, + DeleteResponse, CreateResponse, } from './models.js'; -/** - * Options for removeMemberByUserId method - * - * @public - */ -export interface RemoveMemberByUserIdStreamingOptions { - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getById method - * - * @public - */ -export interface GetByIdStreamingOptions { - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for update method - * - * @public - */ -export interface UpdateStreamingOptions { - /** Request body */ - body?: any; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for delete method - * - * @public - */ -export interface DeleteStreamingOptions { - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} /** * Options for getMembers method * @@ -231,6 +156,81 @@ export interface GetPostsStreamingOptions { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for removeMemberByUserId method + * + * @public + */ +export interface RemoveMemberByUserIdStreamingOptions { + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getById method + * + * @public + */ +export interface GetByIdStreamingOptions { + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for update method + * + * @public + */ +export interface UpdateStreamingOptions { + /** Request body */ + body?: any; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for delete method + * + * @public + */ +export interface DeleteStreamingOptions { + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** * Options for create method * @@ -287,47 +287,89 @@ export class ListsClient { } /** - * Remove List member - * Removes a User from a specific List by its ID and the User’s ID. + * Get List members + * Retrieves a list of Users who are members of a specific List by its ID. * * @returns Promise with the API response */ - async removeMemberByUserId( + async getMembers( id: string, - userId: string, - options: RemoveMemberByUserIdStreamingOptions = {} - ): Promise { + options: GetMembersStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication( - requiredAuthTypes, - 'removeMemberByUserId' - ); + this.client.validateAuthentication(requiredAuthTypes, 'getMembers'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + + 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + maxResults = undefined, + + paginationToken = undefined, + + userFields = [], + + expansions = [], + + tweetFields = [], + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/lists/{id}/members/{user_id}'; + let path = '/2/lists/{id}/members'; path = path.replace('{id}', encodeURIComponent(String(id))); - path = path.replace('{user_id}', encodeURIComponent(String(userId))); - // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -340,55 +382,41 @@ export class ListsClient { }; // Make the request - return this.client.request( - 'DELETE', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get List by ID - * Retrieves details of a specific List by its ID. + * Add List member + * Adds a User to a specific List by its ID. * * @returns Promise with the API response */ - async getById( + async addMember( id: string, - options: GetByIdStreamingOptions = {} - ): Promise { + options: AddMemberStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getById'); + this.client.validateAuthentication(requiredAuthTypes, 'addMember'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - 'list.fields': 'listFields', - - 'user.fields': 'userFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) const { - listFields = [], - - expansions = [], - - userFields = [], + body, headers = {}, signal, @@ -396,25 +424,13 @@ export class ListsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/lists/{id}'; + let path = '/2/lists/{id}/members'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (listFields !== undefined && listFields.length > 0) { - params.append('list.fields', listFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -423,45 +439,69 @@ export class ListsClient { }, signal: signal, + body: JSON.stringify(body), + ...requestOptions, }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Update List - * Updates the details of a specific List owned by the authenticated user by its ID. + * Get List followers + * Retrieves a list of Users who follow a specific List by its ID. * * @returns Promise with the API response */ - async update( + async getFollowers( id: string, - options: UpdateStreamingOptions = {} - ): Promise { + options: GetFollowersStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'update'); + this.client.validateAuthentication(requiredAuthTypes, 'getFollowers'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + + 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - body, + maxResults = undefined, + + paginationToken = undefined, + + userFields = [], + + expansions = [], + + tweetFields = [], headers = {}, signal, @@ -469,69 +509,32 @@ export class ListsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/lists/{id}'; + let path = '/2/lists/{id}/followers'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - body: JSON.stringify(body), - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'PUT', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Delete List - * Deletes a specific List owned by the authenticated user by its ID. - * - * @returns Promise with the API response - */ - async delete( - id: string, - options: DeleteStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('OAuth2UserToken'); - - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'delete'); - - // Normalize options to handle both camelCase and original API parameter names - - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } - // Build the path with path parameters - let path = '/2/lists/{id}'; + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } - path = path.replace('{id}', encodeURIComponent(String(id))); + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } - // Build query parameters - const params = new URLSearchParams(); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } // Prepare request options const finalRequestOptions: RequestOptions = { @@ -545,23 +548,23 @@ export class ListsClient { }; // Make the request - return this.client.request( - 'DELETE', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get List members - * Retrieves a list of Users who are members of a specific List by its ID. + * Get List Posts + * Retrieves a list of Posts associated with a specific List by its ID. * * @returns Promise with the API response */ - async getMembers( + async getPosts( id: string, - options: GetMembersStreamingOptions = {} - ): Promise { + options: GetPostsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -572,7 +575,7 @@ export class ListsClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getMembers'); + this.client.validateAuthentication(requiredAuthTypes, 'getPosts'); // Normalize options to handle both camelCase and original API parameter names @@ -581,9 +584,15 @@ export class ListsClient { pagination_token: 'paginationToken', + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + 'user.fields': 'userFields', - 'tweet.fields': 'tweetFields', + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -597,11 +606,17 @@ export class ListsClient { paginationToken = undefined, - userFields = [], + tweetFields = [], expansions = [], - tweetFields = [], + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], headers = {}, signal, @@ -609,7 +624,7 @@ export class ListsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/lists/{id}/members'; + let path = '/2/lists/{id}/tweets'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -624,16 +639,28 @@ export class ListsClient { params.append('pagination_token', String(paginationToken)); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Prepare request options @@ -648,7 +675,7 @@ export class ListsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -656,15 +683,16 @@ export class ListsClient { } /** - * Add List member - * Adds a User to a specific List by its ID. + * Remove List member + * Removes a User from a specific List by its ID and the User’s ID. * * @returns Promise with the API response */ - async addMember( + async removeMemberByUserId( id: string, - options: AddMemberStreamingOptions = {} - ): Promise { + userId: string, + options: RemoveMemberByUserIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -673,7 +701,10 @@ export class ListsClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'addMember'); + this.client.validateAuthentication( + requiredAuthTypes, + 'removeMemberByUserId' + ); // Normalize options to handle both camelCase and original API parameter names @@ -681,19 +712,15 @@ export class ListsClient { // Destructure options (exclude path parameters, they're already function params) - const { - body, - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/lists/{id}/members'; + let path = '/2/lists/{id}/members/{user_id}'; path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace('{user_id}', encodeURIComponent(String(userId))); + // Build query parameters const params = new URLSearchParams(); @@ -705,29 +732,27 @@ export class ListsClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get List followers - * Retrieves a list of Users who follow a specific List by its ID. + * Get List by ID + * Retrieves details of a specific List by its ID. * * @returns Promise with the API response */ - async getFollowers( + async getById( id: string, - options: GetFollowersStreamingOptions = {} - ): Promise { + options: GetByIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -738,18 +763,14 @@ export class ListsClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getFollowers'); + this.client.validateAuthentication(requiredAuthTypes, 'getById'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', + 'list.fields': 'listFields', 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -759,15 +780,11 @@ export class ListsClient { // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - userFields = [], + listFields = [], expansions = [], - tweetFields = [], + userFields = [], headers = {}, signal, @@ -775,31 +792,23 @@ export class ListsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/lists/{id}/followers'; + let path = '/2/lists/{id}'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (listFields !== undefined && listFields.length > 0) { + params.append('list.fields', listFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } // Prepare request options @@ -814,7 +823,7 @@ export class ListsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -822,67 +831,33 @@ export class ListsClient { } /** - * Get List Posts - * Retrieves a list of Posts associated with a specific List by its ID. + * Update List + * Updates the details of a specific List owned by the authenticated user by its ID. * * @returns Promise with the API response */ - async getPosts( + async update( id: string, - options: GetPostsStreamingOptions = {} - ): Promise { + options: UpdateStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getPosts'); + this.client.validateAuthentication(requiredAuthTypes, 'update'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - - 'user.fields': 'userFields', - - 'place.fields': 'placeFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - tweetFields = [], - - expansions = [], - - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + body, headers = {}, signal, @@ -890,44 +865,69 @@ export class ListsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/lists/{id}/tweets'; + let path = '/2/lists/{id}'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } + body: JSON.stringify(body), - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } + ...requestOptions, + }; - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } + // Make the request + return this.client.request( + 'PUT', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } + /** + * Delete List + * Deletes a specific List owned by the authenticated user by its ID. + * + * @returns Promise with the API response + */ + async delete( + id: string, + options: DeleteStreamingOptions = {} + ): Promise { + // Validate authentication requirements - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } + const requiredAuthTypes = []; - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } + requiredAuthTypes.push('OAuth2UserToken'); - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); - } + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'delete'); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/lists/{id}'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + // Build query parameters + const params = new URLSearchParams(); // Prepare request options const finalRequestOptions: RequestOptions = { @@ -941,8 +941,8 @@ export class ListsClient { }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/media/client.ts b/xdk/typescript/src/media/client.ts index 0b4f8207..d5972215 100644 --- a/xdk/typescript/src/media/client.ts +++ b/xdk/typescript/src/media/client.ts @@ -16,34 +16,34 @@ import { EventPaginator, } from '../paginator.js'; import { - GetAnalyticsResponse, - CreateSubtitlesRequest, - CreateSubtitlesResponse, - DeleteSubtitlesRequest, - DeleteSubtitlesResponse, + GetByKeyResponse, + CreateMetadataRequest, + CreateMetadataResponse, + FinalizeUploadResponse, + AppendUploadRequest, + AppendUploadResponse, InitializeUploadRequest, InitializeUploadResponse, + GetByKeysResponse, GetUploadStatusResponse, UploadRequest, UploadResponse, - GetByKeyResponse, - AppendUploadRequest, - AppendUploadResponse, - GetByKeysResponse, - FinalizeUploadResponse, - CreateMetadataRequest, - CreateMetadataResponse, + GetAnalyticsResponse, + CreateSubtitlesRequest, + CreateSubtitlesResponse, + DeleteSubtitlesRequest, + DeleteSubtitlesResponse, } from './models.js'; /** - * Options for getAnalytics method + * Options for getByKey method * * @public */ -export interface GetAnalyticsOptions { - /** A comma separated list of MediaAnalytics fields to display. - * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */ - mediaAnalyticsFields?: Array; +export interface GetByKeyOptions { + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -52,13 +52,13 @@ export interface GetAnalyticsOptions { } /** - * Options for createSubtitles method + * Options for createMetadata method * * @public */ -export interface CreateSubtitlesOptions { +export interface CreateMetadataOptions { /** Request body */ - body?: CreateSubtitlesRequest; + body?: CreateMetadataRequest; /** Additional request options */ requestOptions?: RequestOptions; @@ -67,13 +67,13 @@ export interface CreateSubtitlesOptions { } /** - * Options for deleteSubtitles method + * Options for appendUpload method * * @public */ -export interface DeleteSubtitlesOptions { +export interface AppendUploadOptions { /** Request body */ - body?: DeleteSubtitlesRequest; + body?: AppendUploadRequest; /** Additional request options */ requestOptions?: RequestOptions; @@ -97,14 +97,14 @@ export interface InitializeUploadOptions { } /** - * Options for getUploadStatus method + * Options for getByKeys method * * @public */ -export interface GetUploadStatusOptions { - /** The command for the media upload request. - * Also accepts: command or proper camelCase (e.g., command) */ - command?: string; +export interface GetByKeysOptions { + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -113,13 +113,14 @@ export interface GetUploadStatusOptions { } /** - * Options for upload method + * Options for getUploadStatus method * * @public */ -export interface UploadOptions { - /** Request body */ - body?: UploadRequest; +export interface GetUploadStatusOptions { + /** The command for the media upload request. + * Also accepts: command or proper camelCase (e.g., command) */ + command?: string; /** Additional request options */ requestOptions?: RequestOptions; @@ -128,14 +129,13 @@ export interface UploadOptions { } /** - * Options for getByKey method + * Options for upload method * * @public */ -export interface GetByKeyOptions { - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; +export interface UploadOptions { + /** Request body */ + body?: UploadRequest; /** Additional request options */ requestOptions?: RequestOptions; @@ -144,13 +144,14 @@ export interface GetByKeyOptions { } /** - * Options for appendUpload method + * Options for getAnalytics method * * @public */ -export interface AppendUploadOptions { - /** Request body */ - body?: AppendUploadRequest; +export interface GetAnalyticsOptions { + /** A comma separated list of MediaAnalytics fields to display. + * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */ + mediaAnalyticsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -159,14 +160,13 @@ export interface AppendUploadOptions { } /** - * Options for getByKeys method + * Options for createSubtitles method * * @public */ -export interface GetByKeysOptions { - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; +export interface CreateSubtitlesOptions { + /** Request body */ + body?: CreateSubtitlesRequest; /** Additional request options */ requestOptions?: RequestOptions; @@ -175,13 +175,13 @@ export interface GetByKeysOptions { } /** - * Options for createMetadata method + * Options for deleteSubtitles method * * @public */ -export interface CreateMetadataOptions { +export interface DeleteSubtitlesOptions { /** Request body */ - body?: CreateMetadataRequest; + body?: DeleteSubtitlesRequest; /** Additional request options */ requestOptions?: RequestOptions; @@ -240,41 +240,26 @@ export class MediaClient { } /** - * Get Media analytics - * Retrieves analytics data for media. - - - - * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. - - - - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - - - - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + * Get Media by media key + * Retrieves details of a specific Media file by its media key. + * @param mediaKey A single Media Key. - * @param granularity The granularity for the search counts results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getAnalytics( - mediaKeys: Array, - endTime: string, - startTime: string, - granularity: string, - options: GetAnalyticsOptions = {} - ): Promise { + async getByKey( + mediaKey: string, + options: GetByKeyOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'media_analytics.fields': 'mediaAnalyticsFields', + 'media.fields': 'mediaFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -283,41 +268,31 @@ export class MediaClient { // Destructure options (exclude path parameters, they're already function params) const { - mediaAnalyticsFields = [], + mediaFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/analytics'; + let path = '/2/media/{media_key}'; + + path = path.replace('{media_key}', encodeURIComponent(String(mediaKey))); // Build query parameters const params = new URLSearchParams(); - if (mediaKeys !== undefined && mediaKeys.length > 0) { - params.append('media_keys', mediaKeys.join(',')); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (granularity !== undefined) { - params.append('granularity', String(granularity)); - } - - if (mediaAnalyticsFields !== undefined && mediaAnalyticsFields.length > 0) { - params.append('media_analytics.fields', mediaAnalyticsFields.join(',')); + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); } // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ + { + BearerToken: [], + }, + { OAuth2UserToken: ['tweet.read'], }, @@ -330,7 +305,7 @@ export class MediaClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -338,17 +313,17 @@ export class MediaClient { } /** - * Create Media subtitles - * Creates subtitles for a specific Media file. + * Create Media metadata + * Creates metadata for a Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createSubtitles( - options: CreateSubtitlesOptions = {} - ): Promise { + async createMetadata( + options: CreateMetadataOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const normalizedOptions = options || {}; @@ -361,7 +336,7 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/subtitles'; + let path = '/2/media/metadata'; // Build query parameters const params = new URLSearchParams(); @@ -384,7 +359,7 @@ export class MediaClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -392,38 +367,33 @@ export class MediaClient { } /** - * Delete Media subtitles - * Deletes subtitles for a specific Media file. + * Finalize Media upload + * Finalizes a Media upload request. + * @param id The media id of the targeted media to finalize. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteSubtitles( - options: DeleteSubtitlesOptions = {} - ): Promise { + async finalizeUpload(id: string): Promise { // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) - const { - body, - - requestOptions: requestOptions = {}, - } = normalizedOptions; + const requestOptions = {}; // Build the path with path parameters - let path = '/2/media/subtitles'; + let path = '/2/media/upload/{id}/finalize'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - // Pass security requirements for smart auth selection security: [ { @@ -435,28 +405,33 @@ export class MediaClient { }, ], - ...requestOptions, + // No optional parameters, using empty request options }; - return this.client.request( - 'DELETE', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Initialize media upload - * Initializes a media upload. + * Append Media upload + * Appends data to a Media upload request. + + * @param id The media identifier for the media to perform the append operation. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async initializeUpload( - options: InitializeUploadOptions = {} - ): Promise { + async appendUpload( + id: string, + options: AppendUploadOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const normalizedOptions = options || {}; @@ -469,7 +444,9 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/upload/initialize'; + let path = '/2/media/upload/{id}/append'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); @@ -492,7 +469,7 @@ export class MediaClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -500,53 +477,38 @@ export class MediaClient { } /** - * Get Media upload status - * Retrieves the status of a Media upload by its ID. - - - - * @param mediaId Media id for the requested media upload status. + * Initialize media upload + * Initializes a media upload. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getUploadStatus( - mediaId: any, - options: GetUploadStatusOptions = {} - ): Promise { + async initializeUpload( + options: InitializeUploadOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = {}; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) const { - command = undefined, + body, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/upload'; + let path = '/2/media/upload/initialize'; // Build query parameters const params = new URLSearchParams(); - if (mediaId !== undefined) { - params.append('media_id', String(mediaId)); - } - - if (command !== undefined) { - params.append('command', String(command)); - } - // Prepare request options const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + // Pass security requirements for smart auth selection security: [ { @@ -561,48 +523,71 @@ export class MediaClient { ...requestOptions, }; - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Upload media - * Uploads a media file for use in posts or other content. + * Get Media by media keys + * Retrieves details of Media files by their media keys. - * @returns {Promise} Promise resolving to the API response + * @param mediaKeys A comma separated list of Media Keys. Up to 100 are allowed in a single request. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async upload(options: UploadOptions = {}): Promise { + async getByKeys( + mediaKeys: Array, + options: GetByKeysOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + 'media.fields': 'mediaFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - body, + mediaFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/upload'; + let path = '/2/media'; // Build query parameters const params = new URLSearchParams(); + if (mediaKeys !== undefined && mediaKeys.length > 0) { + params.append('media_keys', mediaKeys.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['media.write'], + BearerToken: [], + }, + + { + OAuth2UserToken: ['tweet.read'], }, { @@ -613,35 +598,33 @@ export class MediaClient { ...requestOptions, }; - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get Media by media key - * Retrieves details of a specific Media file by its media key. + * Get Media upload status + * Retrieves the status of a Media upload by its ID. - * @param mediaKey A single Media Key. + * @param mediaId Media id for the requested media upload status. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByKey( - mediaKey: string, - options: GetByKeyOptions = {} - ): Promise { + async getUploadStatus( + mediaId: any, + options: GetUploadStatusOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - 'media.fields': 'mediaFields', - }; + const paramMappings: Record = {}; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings @@ -649,21 +632,23 @@ export class MediaClient { // Destructure options (exclude path parameters, they're already function params) const { - mediaFields = [], + command = undefined, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/{media_key}'; - - path = path.replace('{media_key}', encodeURIComponent(String(mediaKey))); + let path = '/2/media/upload'; // Build query parameters const params = new URLSearchParams(); - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); + if (mediaId !== undefined) { + params.append('media_id', String(mediaId)); + } + + if (command !== undefined) { + params.append('command', String(command)); } // Prepare request options @@ -671,11 +656,7 @@ export class MediaClient { // Pass security requirements for smart auth selection security: [ { - BearerToken: [], - }, - - { - OAuth2UserToken: ['tweet.read'], + OAuth2UserToken: ['media.write'], }, { @@ -686,7 +667,7 @@ export class MediaClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -694,22 +675,15 @@ export class MediaClient { } /** - * Append Media upload - * Appends data to a Media upload request. - - - * @param id The media identifier for the media to perform the append operation. - + * Upload media + * Uploads a media file for use in posts or other content. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async appendUpload( - id: string, - options: AppendUploadOptions = {} - ): Promise { + async upload(options: UploadOptions = {}): Promise { // Normalize options to handle both camelCase and original API parameter names const normalizedOptions = options || {}; @@ -722,9 +696,7 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/upload/{id}/append'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/media/upload'; // Build query parameters const params = new URLSearchParams(); @@ -747,7 +719,7 @@ export class MediaClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -755,8 +727,8 @@ export class MediaClient { } /** - * Get Media by media keys - * Retrieves details of Media files by their media keys. + * Get Media analytics + * Retrieves analytics data for media. @@ -764,17 +736,32 @@ export class MediaClient { - * @returns {Promise} Promise resolving to the API response + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. + + + + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + + + + * @param granularity The granularity for the search counts results. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByKeys( + async getAnalytics( mediaKeys: Array, - options: GetByKeysOptions = {} - ): Promise { + endTime: string, + startTime: string, + granularity: string, + options: GetAnalyticsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'media.fields': 'mediaFields', + 'media_analytics.fields': 'mediaAnalyticsFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -783,13 +770,13 @@ export class MediaClient { // Destructure options (exclude path parameters, they're already function params) const { - mediaFields = [], + mediaAnalyticsFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/media'; + let path = '/2/media/analytics'; // Build query parameters const params = new URLSearchParams(); @@ -798,18 +785,26 @@ export class MediaClient { params.append('media_keys', mediaKeys.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (granularity !== undefined) { + params.append('granularity', String(granularity)); + } + + if (mediaAnalyticsFields !== undefined && mediaAnalyticsFields.length > 0) { + params.append('media_analytics.fields', mediaAnalyticsFields.join(',')); } // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ - { - BearerToken: [], - }, - { OAuth2UserToken: ['tweet.read'], }, @@ -822,7 +817,7 @@ export class MediaClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -830,33 +825,38 @@ export class MediaClient { } /** - * Finalize Media upload - * Finalizes a Media upload request. - - - * @param id The media id of the targeted media to finalize. - + * Create Media subtitles + * Creates subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async finalizeUpload(id: string): Promise { + async createSubtitles( + options: CreateSubtitlesOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const requestOptions = {}; + const normalizedOptions = options || {}; - // Build the path with path parameters - let path = '/2/media/upload/{id}/finalize'; + // Destructure options (exclude path parameters, they're already function params) + const { + body, - path = path.replace('{id}', encodeURIComponent(String(id))); + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/media/subtitles'; // Build query parameters const params = new URLSearchParams(); // Prepare request options const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + // Pass security requirements for smart auth selection security: [ { @@ -868,10 +868,10 @@ export class MediaClient { }, ], - // No optional parameters, using empty request options + ...requestOptions, }; - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -879,17 +879,17 @@ export class MediaClient { } /** - * Create Media metadata - * Creates metadata for a Media file. + * Delete Media subtitles + * Deletes subtitles for a specific Media file. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createMetadata( - options: CreateMetadataOptions = {} - ): Promise { + async deleteSubtitles( + options: DeleteSubtitlesOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const normalizedOptions = options || {}; @@ -902,7 +902,7 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/metadata'; + let path = '/2/media/subtitles'; // Build query parameters const params = new URLSearchParams(); @@ -925,8 +925,8 @@ export class MediaClient { ...requestOptions, }; - return this.client.request( - 'POST', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/media/models.ts b/xdk/typescript/src/media/models.ts index a3694682..a6cdfad7 100644 --- a/xdk/typescript/src/media/models.ts +++ b/xdk/typescript/src/media/models.ts @@ -11,35 +11,41 @@ import type * as Schemas from '../schemas.js'; /** - * Response for getAnalytics + * Response for getByKey * * @public */ -export type GetAnalyticsResponse = Schemas.MediaAnalytics; +export type GetByKeyResponse = Schemas.Get2MediaMediaKeyResponse; /** - * Request for createSubtitles + * Request for createMetadata * * @public */ -export type CreateSubtitlesRequest = Schemas.SubtitlesCreateRequest; +export type CreateMetadataRequest = Schemas.MetadataCreateRequest; /** - * Response for createSubtitles + * Response for createMetadata * * @public */ -export type CreateSubtitlesResponse = Schemas.SubtitlesCreateResponse; +export type CreateMetadataResponse = Schemas.MetadataCreateResponse; /** - * Request for deleteSubtitles + * Response for finalizeUpload * * @public */ -export type DeleteSubtitlesRequest = Schemas.SubtitlesDeleteRequest; +export type FinalizeUploadResponse = Schemas.MediaUploadResponse; /** - * Response for deleteSubtitles + * Request for appendUpload * * @public */ -export type DeleteSubtitlesResponse = Schemas.SubtitlesDeleteResponse; +export type AppendUploadRequest = Schemas.MediaUploadAppendRequest; +/** + * Response for appendUpload + * + * @public + */ +export type AppendUploadResponse = Schemas.MediaUploadAppendResponse; /** * Request for initializeUpload * @@ -52,6 +58,12 @@ export type InitializeUploadRequest = Schemas.MediaUploadConfigRequest; * @public */ export type InitializeUploadResponse = Schemas.MediaUploadResponse; +/** + * Response for getByKeys + * + * @public + */ +export type GetByKeysResponse = Schemas.Get2MediaResponse; /** * Response for getUploadStatus * @@ -71,44 +83,32 @@ export type UploadRequest = Schemas.MediaUploadRequestOneShot; */ export type UploadResponse = Schemas.MediaUploadResponse; /** - * Response for getByKey - * - * @public - */ -export type GetByKeyResponse = Schemas.Get2MediaMediaKeyResponse; -/** - * Request for appendUpload - * - * @public - */ -export type AppendUploadRequest = Schemas.MediaUploadAppendRequest; -/** - * Response for appendUpload + * Response for getAnalytics * * @public */ -export type AppendUploadResponse = Schemas.MediaUploadAppendResponse; +export type GetAnalyticsResponse = Schemas.MediaAnalytics; /** - * Response for getByKeys + * Request for createSubtitles * * @public */ -export type GetByKeysResponse = Schemas.Get2MediaResponse; +export type CreateSubtitlesRequest = Schemas.SubtitlesCreateRequest; /** - * Response for finalizeUpload + * Response for createSubtitles * * @public */ -export type FinalizeUploadResponse = Schemas.MediaUploadResponse; +export type CreateSubtitlesResponse = Schemas.SubtitlesCreateResponse; /** - * Request for createMetadata + * Request for deleteSubtitles * * @public */ -export type CreateMetadataRequest = Schemas.MetadataCreateRequest; +export type DeleteSubtitlesRequest = Schemas.SubtitlesDeleteRequest; /** - * Response for createMetadata + * Response for deleteSubtitles * * @public */ -export type CreateMetadataResponse = Schemas.MetadataCreateResponse; \ No newline at end of file +export type DeleteSubtitlesResponse = Schemas.SubtitlesDeleteResponse; \ No newline at end of file diff --git a/xdk/typescript/src/media/stream_client.ts b/xdk/typescript/src/media/stream_client.ts index 10ff3fb9..f99d1336 100644 --- a/xdk/typescript/src/media/stream_client.ts +++ b/xdk/typescript/src/media/stream_client.ts @@ -10,28 +10,28 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { - GetAnalyticsResponse, - CreateSubtitlesResponse, - DeleteSubtitlesResponse, - InitializeUploadResponse, - GetUploadStatusResponse, - UploadResponse, GetByKeyResponse, + CreateMetadataResponse, + FinalizeUploadResponse, AppendUploadResponse, + InitializeUploadResponse, GetByKeysResponse, - FinalizeUploadResponse, - CreateMetadataResponse, + GetUploadStatusResponse, + UploadResponse, + GetAnalyticsResponse, + CreateSubtitlesResponse, + DeleteSubtitlesResponse, } from './models.js'; /** - * Options for getAnalytics method + * Options for getByKey method * * @public */ -export interface GetAnalyticsStreamingOptions { - /** A comma separated list of MediaAnalytics fields to display. - * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */ - mediaAnalyticsFields?: Array; +export interface GetByKeyStreamingOptions { + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -43,11 +43,11 @@ export interface GetAnalyticsStreamingOptions { [key: string]: any; } /** - * Options for createSubtitles method + * Options for createMetadata method * * @public */ -export interface CreateSubtitlesStreamingOptions { +export interface CreateMetadataStreamingOptions { /** Request body */ body?: any; @@ -61,14 +61,11 @@ export interface CreateSubtitlesStreamingOptions { [key: string]: any; } /** - * Options for deleteSubtitles method + * Options for finalizeUpload method * * @public */ -export interface DeleteSubtitlesStreamingOptions { - /** Request body */ - body?: any; - +export interface FinalizeUploadStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -79,11 +76,11 @@ export interface DeleteSubtitlesStreamingOptions { [key: string]: any; } /** - * Options for initializeUpload method + * Options for appendUpload method * * @public */ -export interface InitializeUploadStreamingOptions { +export interface AppendUploadStreamingOptions { /** Request body */ body?: any; @@ -97,14 +94,13 @@ export interface InitializeUploadStreamingOptions { [key: string]: any; } /** - * Options for getUploadStatus method + * Options for initializeUpload method * * @public */ -export interface GetUploadStatusStreamingOptions { - /** The command for the media upload request. - * Also accepts: command or proper camelCase (e.g., command) */ - command?: string; +export interface InitializeUploadStreamingOptions { + /** Request body */ + body?: any; /** Additional request options */ requestOptions?: RequestOptions; @@ -116,13 +112,14 @@ export interface GetUploadStatusStreamingOptions { [key: string]: any; } /** - * Options for upload method + * Options for getByKeys method * * @public */ -export interface UploadStreamingOptions { - /** Request body */ - body?: any; +export interface GetByKeysStreamingOptions { + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -134,14 +131,14 @@ export interface UploadStreamingOptions { [key: string]: any; } /** - * Options for getByKey method + * Options for getUploadStatus method * * @public */ -export interface GetByKeyStreamingOptions { - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; +export interface GetUploadStatusStreamingOptions { + /** The command for the media upload request. + * Also accepts: command or proper camelCase (e.g., command) */ + command?: string; /** Additional request options */ requestOptions?: RequestOptions; @@ -153,11 +150,11 @@ export interface GetByKeyStreamingOptions { [key: string]: any; } /** - * Options for appendUpload method + * Options for upload method * * @public */ -export interface AppendUploadStreamingOptions { +export interface UploadStreamingOptions { /** Request body */ body?: any; @@ -171,14 +168,14 @@ export interface AppendUploadStreamingOptions { [key: string]: any; } /** - * Options for getByKeys method + * Options for getAnalytics method * * @public */ -export interface GetByKeysStreamingOptions { - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; +export interface GetAnalyticsStreamingOptions { + /** A comma separated list of MediaAnalytics fields to display. + * Also accepts: media_analytics.fields or proper camelCase (e.g., mediaAnalyticsFields) */ + mediaAnalyticsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -190,11 +187,14 @@ export interface GetByKeysStreamingOptions { [key: string]: any; } /** - * Options for finalizeUpload method + * Options for createSubtitles method * * @public */ -export interface FinalizeUploadStreamingOptions { +export interface CreateSubtitlesStreamingOptions { + /** Request body */ + body?: any; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -205,11 +205,11 @@ export interface FinalizeUploadStreamingOptions { [key: string]: any; } /** - * Options for createMetadata method + * Options for deleteSubtitles method * * @public */ -export interface CreateMetadataStreamingOptions { +export interface DeleteSubtitlesStreamingOptions { /** Request body */ body?: any; @@ -260,32 +260,31 @@ export class MediaClient { } /** - * Get Media analytics - * Retrieves analytics data for media. + * Get Media by media key + * Retrieves details of a specific Media file by its media key. * * @returns Promise with the API response */ - async getAnalytics( - mediaKeys: Array, - endTime: string, - startTime: string, - granularity: string, - options: GetAnalyticsStreamingOptions = {} - ): Promise { + async getByKey( + mediaKey: string, + options: GetByKeyStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getAnalytics'); + this.client.validateAuthentication(requiredAuthTypes, 'getByKey'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'media_analytics.fields': 'mediaAnalyticsFields', + 'media.fields': 'mediaFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -295,7 +294,7 @@ export class MediaClient { // Destructure options (exclude path parameters, they're already function params) const { - mediaAnalyticsFields = [], + mediaFields = [], headers = {}, signal, @@ -303,29 +302,15 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/analytics'; + let path = '/2/media/{media_key}'; + + path = path.replace('{media_key}', encodeURIComponent(String(mediaKey))); // Build query parameters const params = new URLSearchParams(); - if (mediaKeys !== undefined && mediaKeys.length > 0) { - params.append('media_keys', mediaKeys.join(',')); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (granularity !== undefined) { - params.append('granularity', String(granularity)); - } - - if (mediaAnalyticsFields !== undefined && mediaAnalyticsFields.length > 0) { - params.append('media_analytics.fields', mediaAnalyticsFields.join(',')); + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); } // Prepare request options @@ -340,7 +325,7 @@ export class MediaClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -348,14 +333,14 @@ export class MediaClient { } /** - * Create Media subtitles - * Creates subtitles for a specific Media file. + * Create Media metadata + * Creates metadata for a Media file. * * @returns Promise with the API response */ - async createSubtitles( - options: CreateSubtitlesStreamingOptions = {} - ): Promise { + async createMetadata( + options: CreateMetadataStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -364,7 +349,7 @@ export class MediaClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'createSubtitles'); + this.client.validateAuthentication(requiredAuthTypes, 'createMetadata'); // Normalize options to handle both camelCase and original API parameter names @@ -381,7 +366,7 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/subtitles'; + let path = '/2/media/metadata'; // Build query parameters const params = new URLSearchParams(); @@ -400,7 +385,7 @@ export class MediaClient { }; // Make the request - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -408,14 +393,15 @@ export class MediaClient { } /** - * Delete Media subtitles - * Deletes subtitles for a specific Media file. + * Finalize Media upload + * Finalizes a Media upload request. * * @returns Promise with the API response */ - async deleteSubtitles( - options: DeleteSubtitlesStreamingOptions = {} - ): Promise { + async finalizeUpload( + id: string, + options: FinalizeUploadStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -424,7 +410,7 @@ export class MediaClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'deleteSubtitles'); + this.client.validateAuthentication(requiredAuthTypes, 'finalizeUpload'); // Normalize options to handle both camelCase and original API parameter names @@ -432,16 +418,12 @@ export class MediaClient { // Destructure options (exclude path parameters, they're already function params) - const { - body, - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/subtitles'; + let path = '/2/media/upload/{id}/finalize'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); @@ -454,28 +436,27 @@ export class MediaClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'DELETE', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Initialize media upload - * Initializes a media upload. + * Append Media upload + * Appends data to a Media upload request. * * @returns Promise with the API response */ - async initializeUpload( - options: InitializeUploadStreamingOptions = {} - ): Promise { + async appendUpload( + id: string, + options: AppendUploadStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -484,7 +465,7 @@ export class MediaClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'initializeUpload'); + this.client.validateAuthentication(requiredAuthTypes, 'appendUpload'); // Normalize options to handle both camelCase and original API parameter names @@ -501,7 +482,9 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/upload/initialize'; + let path = '/2/media/upload/{id}/append'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); @@ -520,7 +503,7 @@ export class MediaClient { }; // Make the request - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -528,15 +511,14 @@ export class MediaClient { } /** - * Get Media upload status - * Retrieves the status of a Media upload by its ID. + * Initialize media upload + * Initializes a media upload. * * @returns Promise with the API response */ - async getUploadStatus( - mediaId: any, - options: GetUploadStatusStreamingOptions = {} - ): Promise { + async initializeUpload( + options: InitializeUploadStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -545,20 +527,16 @@ export class MediaClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getUploadStatus'); + this.client.validateAuthentication(requiredAuthTypes, 'initializeUpload'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = {}; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) const { - command = undefined, + body, headers = {}, signal, @@ -566,19 +544,11 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/upload'; + let path = '/2/media/upload/initialize'; // Build query parameters const params = new URLSearchParams(); - if (mediaId !== undefined) { - params.append('media_id', String(mediaId)); - } - - if (command !== undefined) { - params.append('command', String(command)); - } - // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -587,42 +557,55 @@ export class MediaClient { }, signal: signal, + body: JSON.stringify(body), + ...requestOptions, }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Upload media - * Uploads a media file for use in posts or other content. + * Get Media by media keys + * Retrieves details of Media files by their media keys. * * @returns Promise with the API response */ - async upload(options: UploadStreamingOptions = {}): Promise { + async getByKeys( + mediaKeys: Array, + options: GetByKeysStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'upload'); + this.client.validateAuthentication(requiredAuthTypes, 'getByKeys'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + 'media.fields': 'mediaFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - body, + mediaFields = [], headers = {}, signal, @@ -630,11 +613,19 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/upload'; + let path = '/2/media'; // Build query parameters const params = new URLSearchParams(); + if (mediaKeys !== undefined && mediaKeys.length > 0) { + params.append('media_keys', mediaKeys.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -643,46 +634,40 @@ export class MediaClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get Media by media key - * Retrieves details of a specific Media file by its media key. + * Get Media upload status + * Retrieves the status of a Media upload by its ID. * * @returns Promise with the API response */ - async getByKey( - mediaKey: string, - options: GetByKeyStreamingOptions = {} - ): Promise { + async getUploadStatus( + mediaId: any, + options: GetUploadStatusStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getByKey'); + this.client.validateAuthentication(requiredAuthTypes, 'getUploadStatus'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - 'media.fields': 'mediaFields', - }; + const paramMappings: Record = {}; const normalizedOptions = this._normalizeOptions( options || {}, paramMappings @@ -691,7 +676,7 @@ export class MediaClient { // Destructure options (exclude path parameters, they're already function params) const { - mediaFields = [], + command = undefined, headers = {}, signal, @@ -699,15 +684,17 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/{media_key}'; - - path = path.replace('{media_key}', encodeURIComponent(String(mediaKey))); + let path = '/2/media/upload'; // Build query parameters const params = new URLSearchParams(); - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); + if (mediaId !== undefined) { + params.append('media_id', String(mediaId)); + } + + if (command !== undefined) { + params.append('command', String(command)); } // Prepare request options @@ -722,7 +709,7 @@ export class MediaClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -730,15 +717,12 @@ export class MediaClient { } /** - * Append Media upload - * Appends data to a Media upload request. + * Upload media + * Uploads a media file for use in posts or other content. * * @returns Promise with the API response */ - async appendUpload( - id: string, - options: AppendUploadStreamingOptions = {} - ): Promise { + async upload(options: UploadStreamingOptions = {}): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -747,7 +731,7 @@ export class MediaClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'appendUpload'); + this.client.validateAuthentication(requiredAuthTypes, 'upload'); // Normalize options to handle both camelCase and original API parameter names @@ -764,9 +748,7 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/upload/{id}/append'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/media/upload'; // Build query parameters const params = new URLSearchParams(); @@ -785,7 +767,7 @@ export class MediaClient { }; // Make the request - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -793,31 +775,32 @@ export class MediaClient { } /** - * Get Media by media keys - * Retrieves details of Media files by their media keys. + * Get Media analytics + * Retrieves analytics data for media. * * @returns Promise with the API response */ - async getByKeys( + async getAnalytics( mediaKeys: Array, - options: GetByKeysStreamingOptions = {} - ): Promise { + endTime: string, + startTime: string, + granularity: string, + options: GetAnalyticsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getByKeys'); + this.client.validateAuthentication(requiredAuthTypes, 'getAnalytics'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'media.fields': 'mediaFields', + 'media_analytics.fields': 'mediaAnalyticsFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -827,7 +810,7 @@ export class MediaClient { // Destructure options (exclude path parameters, they're already function params) const { - mediaFields = [], + mediaAnalyticsFields = [], headers = {}, signal, @@ -835,7 +818,7 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media'; + let path = '/2/media/analytics'; // Build query parameters const params = new URLSearchParams(); @@ -844,8 +827,20 @@ export class MediaClient { params.append('media_keys', mediaKeys.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (granularity !== undefined) { + params.append('granularity', String(granularity)); + } + + if (mediaAnalyticsFields !== undefined && mediaAnalyticsFields.length > 0) { + params.append('media_analytics.fields', mediaAnalyticsFields.join(',')); } // Prepare request options @@ -860,7 +855,7 @@ export class MediaClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -868,15 +863,14 @@ export class MediaClient { } /** - * Finalize Media upload - * Finalizes a Media upload request. + * Create Media subtitles + * Creates subtitles for a specific Media file. * * @returns Promise with the API response */ - async finalizeUpload( - id: string, - options: FinalizeUploadStreamingOptions = {} - ): Promise { + async createSubtitles( + options: CreateSubtitlesStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -885,7 +879,7 @@ export class MediaClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'finalizeUpload'); + this.client.validateAuthentication(requiredAuthTypes, 'createSubtitles'); // Normalize options to handle both camelCase and original API parameter names @@ -893,12 +887,16 @@ export class MediaClient { // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + body, - // Build the path with path parameters - let path = '/2/media/upload/{id}/finalize'; + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; - path = path.replace('{id}', encodeURIComponent(String(id))); + // Build the path with path parameters + let path = '/2/media/subtitles'; // Build query parameters const params = new URLSearchParams(); @@ -911,11 +909,13 @@ export class MediaClient { }, signal: signal, + body: JSON.stringify(body), + ...requestOptions, }; // Make the request - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -923,14 +923,14 @@ export class MediaClient { } /** - * Create Media metadata - * Creates metadata for a Media file. + * Delete Media subtitles + * Deletes subtitles for a specific Media file. * * @returns Promise with the API response */ - async createMetadata( - options: CreateMetadataStreamingOptions = {} - ): Promise { + async deleteSubtitles( + options: DeleteSubtitlesStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -939,7 +939,7 @@ export class MediaClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'createMetadata'); + this.client.validateAuthentication(requiredAuthTypes, 'deleteSubtitles'); // Normalize options to handle both camelCase and original API parameter names @@ -956,7 +956,7 @@ export class MediaClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/media/metadata'; + let path = '/2/media/subtitles'; // Build query parameters const params = new URLSearchParams(); @@ -975,8 +975,8 @@ export class MediaClient { }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/news/client.ts b/xdk/typescript/src/news/client.ts index a376911d..a47094aa 100644 --- a/xdk/typescript/src/news/client.ts +++ b/xdk/typescript/src/news/client.ts @@ -15,7 +15,7 @@ import { UserPaginator, EventPaginator, } from '../paginator.js'; -import { GetResponse } from './models.js'; +import { GetResponse, SearchResponse } from './models.js'; /** * Options for get method @@ -33,6 +33,30 @@ export interface GetOptions { [key: string]: any; } +/** + * Options for search method + * + * @public + */ +export interface SearchOptions { + /** The number of results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** The maximum age of the News story to search for. + * Also accepts: max_age_hours or proper camelCase (e.g., maxAgeHours) */ + maxAgeHours?: number; + + /** A comma separated list of News fields to display. + * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ + newsFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + /** * Client for news operations * @@ -152,4 +176,91 @@ export class NewsClient { finalRequestOptions ); } + + /** + * Search News + * Retrieves a list of News stories matching the specified search query. + + + + * @param query The search query. + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async search( + query: string, + options: SearchOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + max_results: 'maxResults', + + max_age_hours: 'maxAgeHours', + + 'news.fields': 'newsFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + const { + maxResults = undefined, + + maxAgeHours = undefined, + + newsFields = [], + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/news/search'; + + // Build query parameters + const params = new URLSearchParams(); + + if (query !== undefined) { + params.append('query', String(query)); + } + + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (maxAgeHours !== undefined) { + params.append('max_age_hours', String(maxAgeHours)); + } + + if (newsFields !== undefined && newsFields.length > 0) { + params.append('news.fields', newsFields.join(',')); + } + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [], + }, + + { + OAuth2UserToken: ['tweet.read', 'users.read'], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } } diff --git a/xdk/typescript/src/news/models.ts b/xdk/typescript/src/news/models.ts index 06f22d07..757d37f5 100644 --- a/xdk/typescript/src/news/models.ts +++ b/xdk/typescript/src/news/models.ts @@ -15,4 +15,10 @@ import type * as Schemas from '../schemas.js'; * * @public */ -export type GetResponse = Schemas.Get2NewsIdResponse; \ No newline at end of file +export type GetResponse = Schemas.Get2NewsIdResponse; +/** + * Response for search + * + * @public + */ +export type SearchResponse = Schemas.Get2NewsSearchResponse; \ No newline at end of file diff --git a/xdk/typescript/src/news/stream_client.ts b/xdk/typescript/src/news/stream_client.ts index 9375bd88..6799c1fb 100644 --- a/xdk/typescript/src/news/stream_client.ts +++ b/xdk/typescript/src/news/stream_client.ts @@ -9,7 +9,7 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; -import { GetResponse } from './models.js'; +import { GetResponse, SearchResponse } from './models.js'; /** * Options for get method @@ -30,6 +30,33 @@ export interface GetStreamingOptions { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for search method + * + * @public + */ +export interface SearchStreamingOptions { + /** The number of results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** The maximum age of the News story to search for. + * Also accepts: max_age_hours or proper camelCase (e.g., maxAgeHours) */ + maxAgeHours?: number; + + /** A comma separated list of News fields to display. + * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ + newsFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} export class NewsClient { private client: Client; @@ -139,4 +166,93 @@ export class NewsClient { finalRequestOptions ); } + + /** + * Search News + * Retrieves a list of News stories matching the specified search query. + * + * @returns Promise with the API response + */ + async search( + query: string, + options: SearchStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('BearerToken'); + + requiredAuthTypes.push('OAuth2UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'search'); + + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + max_results: 'maxResults', + + max_age_hours: 'maxAgeHours', + + 'news.fields': 'newsFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + + const { + maxResults = undefined, + + maxAgeHours = undefined, + + newsFields = [], + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/news/search'; + + // Build query parameters + const params = new URLSearchParams(); + + if (query !== undefined) { + params.append('query', String(query)); + } + + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (maxAgeHours !== undefined) { + params.append('max_age_hours', String(maxAgeHours)); + } + + if (newsFields !== undefined && newsFields.length > 0) { + params.append('news.fields', newsFields.join(',')); + } + + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } } diff --git a/xdk/typescript/src/posts/client.ts b/xdk/typescript/src/posts/client.ts index 5c9123e9..8fd4d8d0 100644 --- a/xdk/typescript/src/posts/client.ts +++ b/xdk/typescript/src/posts/client.ts @@ -16,63 +16,32 @@ import { EventPaginator, } from '../paginator.js'; import { - HideReplyRequest, - HideReplyResponse, - GetAnalyticsResponse, - GetInsightsHistoricalResponse, - GetCountsRecentResponse, - GetCountsAllResponse, + GetInsights28hrResponse, GetRepostsResponse, + SearchAllResponse, + GetInsightsHistoricalResponse, GetByIdResponse, DeleteResponse, - GetRepostedByResponse, - GetInsights28hrResponse, + GetAnalyticsResponse, GetByIdsResponse, CreateRequest, CreateResponse, - GetLikingUsersResponse, - SearchAllResponse, - GetQuotedResponse, + GetCountsRecentResponse, + GetCountsAllResponse, SearchRecentResponse, + HideReplyRequest, + HideReplyResponse, + GetRepostedByResponse, + GetQuotedResponse, + GetLikingUsersResponse, } from './models.js'; /** - * Options for hideReply method - * - * @public - */ -export interface HideReplyOptions { - /** Request body */ - body?: HideReplyRequest; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for getAnalytics method - * - * @public - */ -export interface GetAnalyticsOptions { - /** A comma separated list of Analytics fields to display. - * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */ - analyticsFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for getInsightsHistorical method + * Options for getInsights28hr method * * @public */ -export interface GetInsightsHistoricalOptions { +export interface GetInsights28hrOptions { /** A comma separated list of Engagement fields to display. * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ engagementFields?: Array; @@ -84,42 +53,42 @@ export interface GetInsightsHistoricalOptions { } /** - * Options for getCountsRecent method + * Options for getReposts method * * @public */ -export interface GetCountsRecentOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; +export interface GetRepostsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; - /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; - /** Returns results with a Post ID less than (that is, older than) the specified ID. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; - /** The granularity for the search counts results. - * Also accepts: granularity or proper camelCase (e.g., granularity) */ - granularity?: string; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; - /** A comma separated list of SearchCount fields to display. - * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */ - searchCountFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -128,12 +97,12 @@ export interface GetCountsRecentOptions { } /** - * Options for getCountsAll method + * Options for searchAll method * * @public */ -export interface GetCountsAllOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). +export interface SearchAllOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; @@ -149,6 +118,10 @@ export interface GetCountsAllOptions { * Also accepts: until_id or proper camelCase (e.g., untilId) */ untilId?: any; + /** The maximum number of search results to be returned by a request. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. * Also accepts: next_token or proper camelCase (e.g., nextToken) */ nextToken?: any; @@ -157,33 +130,9 @@ export interface GetCountsAllOptions { * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** The granularity for the search counts results. - * Also accepts: granularity or proper camelCase (e.g., granularity) */ - granularity?: string; - - /** A comma separated list of SearchCount fields to display. - * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */ - searchCountFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for getReposts method - * - * @public - */ -export interface GetRepostsOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; + /** This order in which to return results. + * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ + sortOrder?: string; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ @@ -215,6 +164,22 @@ export interface GetRepostsOptions { [key: string]: any; } +/** + * Options for getInsightsHistorical method + * + * @public + */ +export interface GetInsightsHistoricalOptions { + /** A comma separated list of Engagement fields to display. + * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ + engagementFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + /** * Options for getById method * @@ -252,46 +217,14 @@ export interface GetByIdOptions { } /** - * Options for getRepostedBy method - * - * @public - */ -export interface GetRepostedByOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for getInsights28hr method + * Options for getAnalytics method * * @public */ -export interface GetInsights28hrOptions { - /** A comma separated list of Engagement fields to display. - * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ - engagementFields?: Array; +export interface GetAnalyticsOptions { + /** A comma separated list of Analytics fields to display. + * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */ + analyticsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -336,44 +269,12 @@ export interface GetByIdsOptions { } /** - * Options for getLikingUsers method - * - * @public - */ -export interface GetLikingUsersOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for searchAll method + * Options for getCountsRecent method * * @public */ -export interface SearchAllOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). +export interface GetCountsRecentOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; @@ -389,10 +290,6 @@ export interface SearchAllOptions { * Also accepts: until_id or proper camelCase (e.g., untilId) */ untilId?: any; - /** The maximum number of search results to be returned by a request. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. * Also accepts: next_token or proper camelCase (e.g., nextToken) */ nextToken?: any; @@ -401,11 +298,103 @@ export interface SearchAllOptions { * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** This order in which to return results. - * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ - sortOrder?: string; + /** The granularity for the search counts results. + * Also accepts: granularity or proper camelCase (e.g., granularity) */ + granularity?: string; - /** A comma separated list of Tweet fields to display. + /** A comma separated list of SearchCount fields to display. + * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */ + searchCountFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for getCountsAll method + * + * @public + */ +export interface GetCountsAllOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + + /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + + /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + + /** Returns results with a Post ID less than (that is, older than) the specified ID. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + + /** The granularity for the search counts results. + * Also accepts: granularity or proper camelCase (e.g., granularity) */ + granularity?: string; + + /** A comma separated list of SearchCount fields to display. + * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */ + searchCountFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for searchRecent method + * + * @public + */ +export interface SearchRecentOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + + /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + + /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + + /** Returns results with a Post ID less than (that is, older than) the specified ID. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + + /** The maximum number of search results to be returned by a request. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + + /** This order in which to return results. + * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ + sortOrder?: string; + + /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -435,6 +424,53 @@ export interface SearchAllOptions { [key: string]: any; } +/** + * Options for hideReply method + * + * @public + */ +export interface HideReplyOptions { + /** Request body */ + body?: HideReplyRequest; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for getRepostedBy method + * + * @public + */ +export interface GetRepostedByOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + /** * Options for getQuoted method * @@ -484,66 +520,30 @@ export interface GetQuotedOptions { } /** - * Options for searchRecent method + * Options for getLikingUsers method * * @public */ -export interface SearchRecentOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - - /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - - /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - - /** Returns results with a Post ID less than (that is, older than) the specified ID. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - - /** The maximum number of search results to be returned by a request. +export interface GetLikingUsersOptions { + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + /** This parameter is used to get the next 'page' of results. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** This order in which to return results. - * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ - sortOrder?: string; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -602,49 +602,77 @@ export class PostsClient { } /** - * Hide reply - * Hides or unhides a reply to a conversation owned by the authenticated user. + * Get 28-hour Post insights + * Retrieves engagement metrics for specified Posts over the last 28 hours. - * @param tweetId The ID of the reply that you want to hide or unhide. + * @param tweetIds List of PostIds for 28hr metrics. - * @returns {Promise} Promise resolving to the API response + * @param granularity granularity of metrics response. + + + + * @param requestedMetrics request metrics for historical request. + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async hideReply( - tweetId: string, - options: HideReplyOptions = {} - ): Promise { + async getInsights28hr( + tweetIds: Array, + granularity: string, + requestedMetrics: Array, + options: GetInsights28hrOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + 'engagement.fields': 'engagementFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - body, + engagementFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/{tweet_id}/hidden'; - - path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); + let path = '/2/insights/28hr'; // Build query parameters const params = new URLSearchParams(); + if (tweetIds !== undefined && tweetIds.length > 0) { + params.append('tweet_ids', tweetIds.join(',')); + } + + if (granularity !== undefined) { + params.append('granularity', String(granularity)); + } + + if (requestedMetrics !== undefined && requestedMetrics.length > 0) { + params.append('requested_metrics', requestedMetrics.join(',')); + } + + if (engagementFields !== undefined && engagementFields.length > 0) { + params.append('engagement.fields', engagementFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['tweet.moderate.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['tweet.read'], }, { @@ -655,49 +683,46 @@ export class PostsClient { ...requestOptions, }; - return this.client.request( - 'PUT', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get Post analytics - * Retrieves analytics data for specified Posts within a defined time range. - - - - * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. + * Get Reposts + * Retrieves a list of Posts that repost a specific Post by its ID. + * @param id A single Post ID. - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getReposts( + id: string, + options: GetRepostsOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + const paramMappings: Record = { + max_results: 'maxResults', + pagination_token: 'paginationToken', - * @param granularity The granularity for the search counts results. + 'tweet.fields': 'tweetFields', + 'media.fields': 'mediaFields', + 'poll.fields': 'pollFields', - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getAnalytics( - ids: Array, - endTime: string, - startTime: string, - granularity: string, - options: GetAnalyticsOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names + 'user.fields': 'userFields', - const paramMappings: Record = { - 'analytics.fields': 'analyticsFields', + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -706,142 +731,63 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - analyticsFields = [], - - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/tweets/analytics'; - - // Build query parameters - const params = new URLSearchParams(); - - if (ids !== undefined && ids.length > 0) { - params.append('ids', ids.join(',')); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (granularity !== undefined) { - params.append('granularity', String(granularity)); - } - - if (analyticsFields !== undefined && analyticsFields.length > 0) { - params.append('analytics.fields', analyticsFields.join(',')); - } - - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - ...requestOptions, - }; - - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get historical Post insights - * Retrieves historical engagement metrics for specified Posts within a defined time range. - - - - * @param tweetIds List of PostIds for historical metrics. - - - - * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - - - - * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - - - - * @param granularity granularity of metrics response. - + maxResults = undefined, + paginationToken = undefined, - * @param requestedMetrics request metrics for historical request. + tweetFields = [], + expansions = [], + mediaFields = [], - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getInsightsHistorical( - tweetIds: Array, - endTime: string, - startTime: string, - granularity: string, - requestedMetrics: Array, - options: GetInsightsHistoricalOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names + pollFields = [], - const paramMappings: Record = { - 'engagement.fields': 'engagementFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + userFields = [], - // Destructure options (exclude path parameters, they're already function params) - const { - engagementFields = [], + placeFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/insights/historical'; + let path = '/2/tweets/{id}/retweets'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (tweetIds !== undefined && tweetIds.length > 0) { - params.append('tweet_ids', tweetIds.join(',')); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); } - if (endTime !== undefined) { - params.append('end_time', String(endTime)); + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } - if (startTime !== undefined) { - params.append('start_time', String(startTime)); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } - if (granularity !== undefined) { - params.append('granularity', String(granularity)); + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); } - if (requestedMetrics !== undefined && requestedMetrics.length > 0) { - params.append('requested_metrics', requestedMetrics.join(',')); + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); } - if (engagementFields !== undefined && engagementFields.length > 0) { - params.append('engagement.fields', engagementFields.join(',')); + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Prepare request options @@ -849,7 +795,11 @@ export class PostsClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['tweet.read'], + BearerToken: [], + }, + + { + OAuth2UserToken: ['tweet.read', 'users.read'], }, { @@ -860,7 +810,7 @@ export class PostsClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -868,8 +818,8 @@ export class PostsClient { } /** - * Get count of recent Posts - * Retrieves the count of Posts from the last 7 days matching a search query. + * Search all Posts + * Retrieves Posts from the full archive matching a search query. @@ -877,13 +827,13 @@ export class PostsClient { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getCountsRecent( + async searchAll( query: string, - options: GetCountsRecentOptions = {} - ): Promise { + options: SearchAllOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -895,11 +845,23 @@ export class PostsClient { until_id: 'untilId', + max_results: 'maxResults', + next_token: 'nextToken', pagination_token: 'paginationToken', - 'search_count.fields': 'searchCountFields', + sort_order: 'sortOrder', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -916,19 +878,31 @@ export class PostsClient { untilId = undefined, + maxResults = undefined, + nextToken = undefined, paginationToken = undefined, - granularity = undefined, + sortOrder = undefined, - searchCountFields = [], + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/counts/recent'; + let path = '/2/tweets/search/all'; // Build query parameters const params = new URLSearchParams(); @@ -953,6 +927,10 @@ export class PostsClient { params.append('until_id', String(untilId)); } + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + if (nextToken !== undefined) { params.append('next_token', String(nextToken)); } @@ -961,133 +939,32 @@ export class PostsClient { params.append('pagination_token', String(paginationToken)); } - if (granularity !== undefined) { - params.append('granularity', String(granularity)); + if (sortOrder !== undefined) { + params.append('sort_order', String(sortOrder)); } - if (searchCountFields !== undefined && searchCountFields.length > 0) { - params.append('search_count.fields', searchCountFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [], - }, - ], - - ...requestOptions, - }; - - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get count of all Posts - * Retrieves the count of Posts matching a search query from the full archive. - - - - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getCountsAll( - query: string, - options: GetCountsAllOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - start_time: 'startTime', - - end_time: 'endTime', - - since_id: 'sinceId', - - until_id: 'untilId', - - next_token: 'nextToken', - - pagination_token: 'paginationToken', - - 'search_count.fields': 'searchCountFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - const { - startTime = undefined, - - endTime = undefined, - - sinceId = undefined, - - untilId = undefined, - - nextToken = undefined, - - paginationToken = undefined, - - granularity = undefined, - - searchCountFields = [], - - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/tweets/counts/all'; - - // Build query parameters - const params = new URLSearchParams(); - - if (query !== undefined) { - params.append('query', String(query)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); } - if (nextToken !== undefined) { - params.append('next_token', String(nextToken)); + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); } - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); } - if (granularity !== undefined) { - params.append('granularity', String(granularity)); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } - if (searchCountFields !== undefined && searchCountFields.length > 0) { - params.append('search_count.fields', searchCountFields.join(',')); + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Prepare request options @@ -1102,7 +979,7 @@ export class PostsClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1110,38 +987,46 @@ export class PostsClient { } /** - * Get Reposts - * Retrieves a list of Posts that repost a specific Post by its ID. + * Get historical Post insights + * Retrieves historical engagement metrics for specified Posts within a defined time range. - * @param id A single Post ID. + * @param tweetIds List of PostIds for historical metrics. - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getReposts( - id: string, - options: GetRepostsOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - const paramMappings: Record = { - max_results: 'maxResults', - pagination_token: 'paginationToken', - 'tweet.fields': 'tweetFields', + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - 'media.fields': 'mediaFields', - 'poll.fields': 'pollFields', - 'user.fields': 'userFields', + * @param granularity granularity of metrics response. - 'place.fields': 'placeFields', + + + * @param requestedMetrics request metrics for historical request. + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getInsightsHistorical( + tweetIds: Array, + endTime: string, + startTime: string, + granularity: string, + requestedMetrics: Array, + options: GetInsightsHistoricalOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + 'engagement.fields': 'engagementFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1150,63 +1035,39 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - tweetFields = [], - - expansions = [], - - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + engagementFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/{id}/retweets'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/insights/historical'; // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (tweetIds !== undefined && tweetIds.length > 0) { + params.append('tweet_ids', tweetIds.join(',')); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); + if (endTime !== undefined) { + params.append('end_time', String(endTime)); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); + if (startTime !== undefined) { + params.append('start_time', String(startTime)); } - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); + if (granularity !== undefined) { + params.append('granularity', String(granularity)); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (requestedMetrics !== undefined && requestedMetrics.length > 0) { + params.append('requested_metrics', requestedMetrics.join(',')); } - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (engagementFields !== undefined && engagementFields.length > 0) { + params.append('engagement.fields', engagementFields.join(',')); } // Prepare request options @@ -1214,11 +1075,7 @@ export class PostsClient { // Pass security requirements for smart auth selection security: [ { - BearerToken: [], - }, - - { - OAuth2UserToken: ['tweet.read', 'users.read'], + OAuth2UserToken: ['tweet.read'], }, { @@ -1229,7 +1086,7 @@ export class PostsClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1397,139 +1254,41 @@ export class PostsClient { } /** - * Get Reposted by - * Retrieves a list of Users who reposted a specific Post by its ID. + * Get Post analytics + * Retrieves analytics data for specified Posts within a defined time range. - * @param id A single Post ID. + * @param ids A comma separated list of Post IDs. Up to 100 are allowed in a single request. - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getRepostedBy( - id: string, - options: GetRepostedByOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names + * @param endTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the end of the time range. - const paramMappings: Record = { - max_results: 'maxResults', - pagination_token: 'paginationToken', - 'user.fields': 'userFields', + * @param startTime YYYY-MM-DDTHH:mm:ssZ. The UTC timestamp representing the start of the time range. - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - // Destructure options (exclude path parameters, they're already function params) - const { - maxResults = undefined, - paginationToken = undefined, + * @param granularity The granularity for the search counts results. - userFields = [], - expansions = [], - tweetFields = [], - - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/tweets/{id}/retweeted_by'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [], - }, - - { - OAuth2UserToken: ['tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - ...requestOptions, - }; - - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get 28-hour Post insights - * Retrieves engagement metrics for specified Posts over the last 28 hours. - - - - * @param tweetIds List of PostIds for 28hr metrics. - - - - * @param granularity granularity of metrics response. - - - - * @param requestedMetrics request metrics for historical request. - - - - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getInsights28hr( - tweetIds: Array, + async getAnalytics( + ids: Array, + endTime: string, + startTime: string, granularity: string, - requestedMetrics: Array, - options: GetInsights28hrOptions = {} - ): Promise { + options: GetAnalyticsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'engagement.fields': 'engagementFields', + 'analytics.fields': 'analyticsFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1538,31 +1297,35 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - engagementFields = [], + analyticsFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/insights/28hr'; + let path = '/2/tweets/analytics'; // Build query parameters const params = new URLSearchParams(); - if (tweetIds !== undefined && tweetIds.length > 0) { - params.append('tweet_ids', tweetIds.join(',')); + if (ids !== undefined && ids.length > 0) { + params.append('ids', ids.join(',')); } - if (granularity !== undefined) { - params.append('granularity', String(granularity)); + if (endTime !== undefined) { + params.append('end_time', String(endTime)); } - if (requestedMetrics !== undefined && requestedMetrics.length > 0) { - params.append('requested_metrics', requestedMetrics.join(',')); + if (startTime !== undefined) { + params.append('start_time', String(startTime)); } - if (engagementFields !== undefined && engagementFields.length > 0) { - params.append('engagement.fields', engagementFields.join(',')); + if (granularity !== undefined) { + params.append('granularity', String(granularity)); + } + + if (analyticsFields !== undefined && analyticsFields.length > 0) { + params.append('analytics.fields', analyticsFields.join(',')); } // Prepare request options @@ -1570,7 +1333,7 @@ export class PostsClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['tweet.read'], + OAuth2UserToken: ['tweet.read', 'users.read'], }, { @@ -1581,7 +1344,7 @@ export class PostsClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1749,32 +1512,38 @@ export class PostsClient { } /** - * Get Liking Users - * Retrieves a list of Users who liked a specific Post by its ID. + * Get count of recent Posts + * Retrieves the count of Posts from the last 7 days matching a search query. - * @param id A single Post ID. + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getLikingUsers( - id: string, - options: GetLikingUsersOptions = {} - ): Promise { + async getCountsRecent( + query: string, + options: GetCountsRecentOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', + start_time: 'startTime', - pagination_token: 'paginationToken', + end_time: 'endTime', - 'user.fields': 'userFields', + since_id: 'sinceId', - 'tweet.fields': 'tweetFields', + until_id: 'untilId', + + next_token: 'nextToken', + + pagination_token: 'paginationToken', + + 'search_count.fields': 'searchCountFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1783,53 +1552,428 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, + startTime = undefined, - paginationToken = undefined, + endTime = undefined, - userFields = [], + sinceId = undefined, - expansions = [], + untilId = undefined, - tweetFields = [], + nextToken = undefined, + + paginationToken = undefined, + + granularity = undefined, + + searchCountFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/{id}/liking_users'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/tweets/counts/recent'; // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); + if (query !== undefined) { + params.append('query', String(query)); + } + + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); + } + + if (untilId !== undefined) { + params.append('until_id', String(untilId)); + } + + if (nextToken !== undefined) { + params.append('next_token', String(nextToken)); } if (paginationToken !== undefined) { params.append('pagination_token', String(paginationToken)); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (granularity !== undefined) { + params.append('granularity', String(granularity)); + } + + if (searchCountFields !== undefined && searchCountFields.length > 0) { + params.append('search_count.fields', searchCountFields.join(',')); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Get count of all Posts + * Retrieves the count of Posts matching a search query from the full archive. + + + + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getCountsAll( + query: string, + options: GetCountsAllOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + start_time: 'startTime', + + end_time: 'endTime', + + since_id: 'sinceId', + + until_id: 'untilId', + + next_token: 'nextToken', + + pagination_token: 'paginationToken', + + 'search_count.fields': 'searchCountFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + const { + startTime = undefined, + + endTime = undefined, + + sinceId = undefined, + + untilId = undefined, + + nextToken = undefined, + + paginationToken = undefined, + + granularity = undefined, + + searchCountFields = [], + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/tweets/counts/all'; + + // Build query parameters + const params = new URLSearchParams(); + + if (query !== undefined) { + params.append('query', String(query)); + } + + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); + } + + if (untilId !== undefined) { + params.append('until_id', String(untilId)); + } + + if (nextToken !== undefined) { + params.append('next_token', String(nextToken)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (granularity !== undefined) { + params.append('granularity', String(granularity)); + } + + if (searchCountFields !== undefined && searchCountFields.length > 0) { + params.append('search_count.fields', searchCountFields.join(',')); + } + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Search recent Posts + * Retrieves Posts from the last 7 days matching a search query. + + + + * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async searchRecent( + query: string, + options: SearchRecentOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + start_time: 'startTime', + + end_time: 'endTime', + + since_id: 'sinceId', + + until_id: 'untilId', + + max_results: 'maxResults', + + next_token: 'nextToken', + + pagination_token: 'paginationToken', + + sort_order: 'sortOrder', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + const { + startTime = undefined, + + endTime = undefined, + + sinceId = undefined, + + untilId = undefined, + + maxResults = undefined, + + nextToken = undefined, + + paginationToken = undefined, + + sortOrder = undefined, + + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/tweets/search/recent'; + + // Build query parameters + const params = new URLSearchParams(); + + if (query !== undefined) { + params.append('query', String(query)); + } + + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); + } + + if (untilId !== undefined) { + params.append('until_id', String(untilId)); + } + + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (nextToken !== undefined) { + params.append('next_token', String(nextToken)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (sortOrder !== undefined) { + params.append('sort_order', String(sortOrder)); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + BearerToken: [], + }, + + { + OAuth2UserToken: ['tweet.read', 'users.read'], + }, + + { + UserToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Hide reply + * Hides or unhides a reply to a conversation owned by the authenticated user. + + + * @param tweetId The ID of the reply that you want to hide or unhide. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async hideReply( + tweetId: string, + options: HideReplyOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + const { + body, + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/tweets/{tweet_id}/hidden'; + + path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } + // Build query parameters + const params = new URLSearchParams(); // Prepare request options const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'], + OAuth2UserToken: ['tweet.moderate.write', 'tweet.read', 'users.read'], }, { @@ -1840,58 +1984,40 @@ export class PostsClient { ...requestOptions, }; - return this.client.request( - 'GET', + return this.client.request( + 'PUT', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Search all Posts - * Retrieves Posts from the full archive matching a search query. + * Get Reposted by + * Retrieves a list of Users who reposted a specific Post by its ID. + * @param id A single Post ID. - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchAll( - query: string, - options: SearchAllOptions = {} - ): Promise { + async getRepostedBy( + id: string, + options: GetRepostedByOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - start_time: 'startTime', - - end_time: 'endTime', - - since_id: 'sinceId', - - until_id: 'untilId', - max_results: 'maxResults', - next_token: 'nextToken', - pagination_token: 'paginationToken', - sort_order: 'sortOrder', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1900,101 +2026,45 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - startTime = undefined, - - endTime = undefined, - - sinceId = undefined, - - untilId = undefined, - maxResults = undefined, - nextToken = undefined, - paginationToken = undefined, - sortOrder = undefined, - - tweetFields = [], + userFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + tweetFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/all'; + let path = '/2/tweets/{id}/retweeted_by'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (query !== undefined) { - params.append('query', String(query)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); - } - if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (nextToken !== undefined) { - params.append('next_token', String(nextToken)); - } - if (paginationToken !== undefined) { params.append('pagination_token', String(paginationToken)); } - if (sortOrder !== undefined) { - params.append('sort_order', String(sortOrder)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -2004,12 +2074,20 @@ export class PostsClient { { BearerToken: [], }, + + { + OAuth2UserToken: ['tweet.read', 'users.read'], + }, + + { + UserToken: [], + }, ], ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2150,50 +2228,32 @@ export class PostsClient { } /** - * Search recent Posts - * Retrieves Posts from the last 7 days matching a search query. + * Get Liking Users + * Retrieves a list of Users who liked a specific Post by its ID. + * @param id A single Post ID. - * @param query One query/rule/filter for matching Posts. Refer to https://t.co/rulelength to identify the max query length. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async searchRecent( - query: string, - options: SearchRecentOptions = {} - ): Promise { + async getLikingUsers( + id: string, + options: GetLikingUsersOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - start_time: 'startTime', - - end_time: 'endTime', - - since_id: 'sinceId', - - until_id: 'untilId', - max_results: 'maxResults', - next_token: 'nextToken', - pagination_token: 'paginationToken', - sort_order: 'sortOrder', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2202,101 +2262,45 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - startTime = undefined, - - endTime = undefined, - - sinceId = undefined, - - untilId = undefined, - maxResults = undefined, - nextToken = undefined, - paginationToken = undefined, - sortOrder = undefined, - - tweetFields = [], + userFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + tweetFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/recent'; + let path = '/2/tweets/{id}/liking_users'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (query !== undefined) { - params.append('query', String(query)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); - } - if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (nextToken !== undefined) { - params.append('next_token', String(nextToken)); - } - if (paginationToken !== undefined) { params.append('pagination_token', String(paginationToken)); } - if (sortOrder !== undefined) { - params.append('sort_order', String(sortOrder)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -2304,11 +2308,7 @@ export class PostsClient { // Pass security requirements for smart auth selection security: [ { - BearerToken: [], - }, - - { - OAuth2UserToken: ['tweet.read', 'users.read'], + OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'], }, { @@ -2319,7 +2319,7 @@ export class PostsClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions diff --git a/xdk/typescript/src/posts/models.ts b/xdk/typescript/src/posts/models.ts index 784cc911..54f96753 100644 --- a/xdk/typescript/src/posts/models.ts +++ b/xdk/typescript/src/posts/models.ts @@ -11,23 +11,23 @@ import type * as Schemas from '../schemas.js'; /** - * Request for hideReply + * Response for getInsights28hr * * @public */ -export type HideReplyRequest = Schemas.TweetHideRequest; +export type GetInsights28hrResponse = Schemas.Get2Insights28hrResponse; /** - * Response for hideReply + * Response for getReposts * * @public */ -export type HideReplyResponse = Schemas.TweetHideResponse; +export type GetRepostsResponse = Schemas.Get2TweetsIdRetweetsResponse; /** - * Response for getAnalytics + * Response for searchAll * * @public */ -export type GetAnalyticsResponse = Schemas.Analytics; +export type SearchAllResponse = Schemas.Get2TweetsSearchAllResponse; /** * Response for getInsightsHistorical * @@ -35,77 +35,77 @@ export type GetAnalyticsResponse = Schemas.Analytics; */ export type GetInsightsHistoricalResponse = Schemas.Get2InsightsHistoricalResponse; /** - * Response for getCountsRecent + * Response for getById * * @public */ -export type GetCountsRecentResponse = Schemas.Get2TweetsCountsRecentResponse; +export type GetByIdResponse = Schemas.Get2TweetsIdResponse; /** - * Response for getCountsAll + * Response for delete * * @public */ -export type GetCountsAllResponse = Schemas.Get2TweetsCountsAllResponse; +export type DeleteResponse = Schemas.TweetDeleteResponse; /** - * Response for getReposts + * Response for getAnalytics * * @public */ -export type GetRepostsResponse = Schemas.Get2TweetsIdRetweetsResponse; +export type GetAnalyticsResponse = Schemas.Analytics; /** - * Response for getById + * Response for getByIds * * @public */ -export type GetByIdResponse = Schemas.Get2TweetsIdResponse; +export type GetByIdsResponse = Schemas.Get2TweetsResponse; /** - * Response for delete + * Request for create * * @public */ -export type DeleteResponse = Schemas.TweetDeleteResponse; +export type CreateRequest = Schemas.TweetCreateRequest; /** - * Response for getRepostedBy + * Response for create * * @public */ -export type GetRepostedByResponse = Schemas.Get2TweetsIdRetweetedByResponse; +export type CreateResponse = Schemas.TweetCreateResponse; /** - * Response for getInsights28hr + * Response for getCountsRecent * * @public */ -export type GetInsights28hrResponse = Schemas.Get2Insights28hrResponse; +export type GetCountsRecentResponse = Schemas.Get2TweetsCountsRecentResponse; /** - * Response for getByIds + * Response for getCountsAll * * @public */ -export type GetByIdsResponse = Schemas.Get2TweetsResponse; +export type GetCountsAllResponse = Schemas.Get2TweetsCountsAllResponse; /** - * Request for create + * Response for searchRecent * * @public */ -export type CreateRequest = Schemas.TweetCreateRequest; +export type SearchRecentResponse = Schemas.Get2TweetsSearchRecentResponse; /** - * Response for create + * Request for hideReply * * @public */ -export type CreateResponse = Schemas.TweetCreateResponse; +export type HideReplyRequest = Schemas.TweetHideRequest; /** - * Response for getLikingUsers + * Response for hideReply * * @public */ -export type GetLikingUsersResponse = Schemas.Get2TweetsIdLikingUsersResponse; +export type HideReplyResponse = Schemas.TweetHideResponse; /** - * Response for searchAll + * Response for getRepostedBy * * @public */ -export type SearchAllResponse = Schemas.Get2TweetsSearchAllResponse; +export type GetRepostedByResponse = Schemas.Get2TweetsIdRetweetedByResponse; /** * Response for getQuoted * @@ -113,8 +113,8 @@ export type SearchAllResponse = Schemas.Get2TweetsSearchAllResponse; */ export type GetQuotedResponse = Schemas.Get2TweetsIdQuoteTweetsResponse; /** - * Response for searchRecent + * Response for getLikingUsers * * @public */ -export type SearchRecentResponse = Schemas.Get2TweetsSearchRecentResponse; \ No newline at end of file +export type GetLikingUsersResponse = Schemas.Get2TweetsIdLikingUsersResponse; \ No newline at end of file diff --git a/xdk/typescript/src/posts/stream_client.ts b/xdk/typescript/src/posts/stream_client.ts index 900e981f..94ecf752 100644 --- a/xdk/typescript/src/posts/stream_client.ts +++ b/xdk/typescript/src/posts/stream_client.ts @@ -10,67 +10,30 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { - HideReplyResponse, - GetAnalyticsResponse, - GetInsightsHistoricalResponse, - GetCountsRecentResponse, - GetCountsAllResponse, + GetInsights28hrResponse, GetRepostsResponse, + SearchAllResponse, + GetInsightsHistoricalResponse, GetByIdResponse, DeleteResponse, - GetRepostedByResponse, - GetInsights28hrResponse, + GetAnalyticsResponse, GetByIdsResponse, CreateResponse, - GetLikingUsersResponse, - SearchAllResponse, - GetQuotedResponse, + GetCountsRecentResponse, + GetCountsAllResponse, SearchRecentResponse, + HideReplyResponse, + GetRepostedByResponse, + GetQuotedResponse, + GetLikingUsersResponse, } from './models.js'; /** - * Options for hideReply method - * - * @public - */ -export interface HideReplyStreamingOptions { - /** Request body */ - body?: any; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getAnalytics method - * - * @public - */ -export interface GetAnalyticsStreamingOptions { - /** A comma separated list of Analytics fields to display. - * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */ - analyticsFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getInsightsHistorical method + * Options for getInsights28hr method * * @public */ -export interface GetInsightsHistoricalStreamingOptions { +export interface GetInsights28hrStreamingOptions { /** A comma separated list of Engagement fields to display. * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ engagementFields?: Array; @@ -85,42 +48,42 @@ export interface GetInsightsHistoricalStreamingOptions { [key: string]: any; } /** - * Options for getCountsRecent method + * Options for getReposts method * * @public */ -export interface GetCountsRecentStreamingOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; +export interface GetRepostsStreamingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; - /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; - /** Returns results with a Post ID less than (that is, older than) the specified ID. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; - /** The granularity for the search counts results. - * Also accepts: granularity or proper camelCase (e.g., granularity) */ - granularity?: string; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; - /** A comma separated list of SearchCount fields to display. - * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */ - searchCountFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -132,12 +95,12 @@ export interface GetCountsRecentStreamingOptions { [key: string]: any; } /** - * Options for getCountsAll method + * Options for searchAll method * * @public */ -export interface GetCountsAllStreamingOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). +export interface SearchAllStreamingOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; @@ -153,6 +116,10 @@ export interface GetCountsAllStreamingOptions { * Also accepts: until_id or proper camelCase (e.g., untilId) */ untilId?: any; + /** The maximum number of search results to be returned by a request. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. * Also accepts: next_token or proper camelCase (e.g., nextToken) */ nextToken?: any; @@ -161,36 +128,9 @@ export interface GetCountsAllStreamingOptions { * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** The granularity for the search counts results. - * Also accepts: granularity or proper camelCase (e.g., granularity) */ - granularity?: string; - - /** A comma separated list of SearchCount fields to display. - * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */ - searchCountFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getReposts method - * - * @public - */ -export interface GetRepostsStreamingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; + /** This order in which to return results. + * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ + sortOrder?: string; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ @@ -225,6 +165,25 @@ export interface GetRepostsStreamingOptions { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for getInsightsHistorical method + * + * @public + */ +export interface GetInsightsHistoricalStreamingOptions { + /** A comma separated list of Engagement fields to display. + * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ + engagementFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** * Options for getById method * @@ -280,49 +239,14 @@ export interface DeleteStreamingOptions { [key: string]: any; } /** - * Options for getRepostedBy method - * - * @public - */ -export interface GetRepostedByStreamingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getInsights28hr method + * Options for getAnalytics method * * @public */ -export interface GetInsights28hrStreamingOptions { - /** A comma separated list of Engagement fields to display. - * Also accepts: engagement.fields or proper camelCase (e.g., engagementFields) */ - engagementFields?: Array; +export interface GetAnalyticsStreamingOptions { + /** A comma separated list of Analytics fields to display. + * Also accepts: analytics.fields or proper camelCase (e.g., analyticsFields) */ + analyticsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -388,33 +312,45 @@ export interface CreateStreamingOptions { [key: string]: any; } /** - * Options for getLikingUsers method + * Options for getCountsRecent method * * @public */ -export interface GetLikingUsersStreamingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; +export interface GetCountsRecentStreamingOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; + /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; + /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; + /** Returns results with a Post ID less than (that is, older than) the specified ID. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; - /** Additional request options */ - requestOptions?: RequestOptions; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + + /** The granularity for the search counts results. + * Also accepts: granularity or proper camelCase (e.g., granularity) */ + granularity?: string; + + /** A comma separated list of SearchCount fields to display. + * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */ + searchCountFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; /** Additional headers */ headers?: Record; /** AbortSignal for cancelling the request */ @@ -423,11 +359,58 @@ export interface GetLikingUsersStreamingOptions { [key: string]: any; } /** - * Options for searchAll method + * Options for getCountsAll method * * @public */ -export interface SearchAllStreamingOptions { +export interface GetCountsAllStreamingOptions { + /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp (from most recent 7 days) from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + + /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + + /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + + /** Returns results with a Post ID less than (that is, older than) the specified ID. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; + + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + + /** The granularity for the search counts results. + * Also accepts: granularity or proper camelCase (e.g., granularity) */ + granularity?: string; + + /** A comma separated list of SearchCount fields to display. + * Also accepts: search_count.fields or proper camelCase (e.g., searchCountFields) */ + searchCountFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for searchRecent method + * + * @public + */ +export interface SearchRecentStreamingOptions { /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; @@ -493,6 +476,59 @@ export interface SearchAllStreamingOptions { /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ [key: string]: any; } +/** + * Options for hideReply method + * + * @public + */ +export interface HideReplyStreamingOptions { + /** Request body */ + body?: any; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getRepostedBy method + * + * @public + */ +export interface GetRepostedByStreamingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} /** * Options for getQuoted method * @@ -545,66 +581,30 @@ export interface GetQuotedStreamingOptions { [key: string]: any; } /** - * Options for searchRecent method + * Options for getLikingUsers method * * @public */ -export interface SearchRecentStreamingOptions { - /** YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Posts will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute). - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - - /** YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Posts will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute). - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - - /** Returns results with a Post ID greater than (that is, more recent than) the specified ID. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - - /** Returns results with a Post ID less than (that is, older than) the specified ID. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - - /** The maximum number of search results to be returned by a request. +export interface GetLikingUsersStreamingOptions { + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + /** This parameter is used to get the next 'page' of results. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** This order in which to return results. - * Also accepts: sort_order or proper camelCase (e.g., sortOrder) */ - sortOrder?: string; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -653,15 +653,17 @@ export class PostsClient { } /** - * Hide reply - * Hides or unhides a reply to a conversation owned by the authenticated user. + * Get 28-hour Post insights + * Retrieves engagement metrics for specified Posts over the last 28 hours. * * @returns Promise with the API response */ - async hideReply( - tweetId: string, - options: HideReplyStreamingOptions = {} - ): Promise { + async getInsights28hr( + tweetIds: Array, + granularity: string, + requestedMetrics: Array, + options: GetInsights28hrStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -670,16 +672,22 @@ export class PostsClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'hideReply'); + this.client.validateAuthentication(requiredAuthTypes, 'getInsights28hr'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + 'engagement.fields': 'engagementFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - body, + engagementFields = [], headers = {}, signal, @@ -687,13 +695,27 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/{tweet_id}/hidden'; - - path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); + let path = '/2/insights/28hr'; // Build query parameters const params = new URLSearchParams(); + if (tweetIds !== undefined && tweetIds.length > 0) { + params.append('tweet_ids', tweetIds.join(',')); + } + + if (granularity !== undefined) { + params.append('granularity', String(granularity)); + } + + if (requestedMetrics !== undefined && requestedMetrics.length > 0) { + params.append('requested_metrics', requestedMetrics.join(',')); + } + + if (engagementFields !== undefined && engagementFields.length > 0) { + params.append('engagement.fields', engagementFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -702,148 +724,79 @@ export class PostsClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'PUT', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get Post analytics - * Retrieves analytics data for specified Posts within a defined time range. + * Get Reposts + * Retrieves a list of Posts that repost a specific Post by its ID. * * @returns Promise with the API response */ - async getAnalytics( - ids: Array, - endTime: string, - startTime: string, - granularity: string, - options: GetAnalyticsStreamingOptions = {} - ): Promise { + async getReposts( + id: string, + options: GetRepostsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getAnalytics'); + this.client.validateAuthentication(requiredAuthTypes, 'getReposts'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'analytics.fields': 'analyticsFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + max_results: 'maxResults', - // Destructure options (exclude path parameters, they're already function params) + pagination_token: 'paginationToken', - const { - analyticsFields = [], - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/tweets/analytics'; - - // Build query parameters - const params = new URLSearchParams(); - - if (ids !== undefined && ids.length > 0) { - params.append('ids', ids.join(',')); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } + 'tweet.fields': 'tweetFields', - if (granularity !== undefined) { - params.append('granularity', String(granularity)); - } + 'media.fields': 'mediaFields', - if (analyticsFields !== undefined && analyticsFields.length > 0) { - params.append('analytics.fields', analyticsFields.join(',')); - } + 'poll.fields': 'pollFields', - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, + 'user.fields': 'userFields', - ...requestOptions, + 'place.fields': 'placeFields', }; - - // Make the request - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings ); - } - /** - * Get historical Post insights - * Retrieves historical engagement metrics for specified Posts within a defined time range. - * - * @returns Promise with the API response - */ - async getInsightsHistorical( - tweetIds: Array, - endTime: string, - startTime: string, - granularity: string, - requestedMetrics: Array, - options: GetInsightsHistoricalStreamingOptions = {} - ): Promise { - // Validate authentication requirements + // Destructure options (exclude path parameters, they're already function params) - const requiredAuthTypes = []; + const { + maxResults = undefined, - requiredAuthTypes.push('OAuth2UserToken'); + paginationToken = undefined, - requiredAuthTypes.push('UserToken'); + tweetFields = [], - this.client.validateAuthentication( - requiredAuthTypes, - 'getInsightsHistorical' - ); + expansions = [], - // Normalize options to handle both camelCase and original API parameter names + mediaFields = [], - const paramMappings: Record = { - 'engagement.fields': 'engagementFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + pollFields = [], - // Destructure options (exclude path parameters, they're already function params) + userFields = [], - const { - engagementFields = [], + placeFields = [], headers = {}, signal, @@ -851,33 +804,43 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/insights/historical'; + let path = '/2/tweets/{id}/retweets'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (tweetIds !== undefined && tweetIds.length > 0) { - params.append('tweet_ids', tweetIds.join(',')); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); } - if (endTime !== undefined) { - params.append('end_time', String(endTime)); + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } - if (startTime !== undefined) { - params.append('start_time', String(startTime)); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } - if (granularity !== undefined) { - params.append('granularity', String(granularity)); + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); } - if (requestedMetrics !== undefined && requestedMetrics.length > 0) { - params.append('requested_metrics', requestedMetrics.join(',')); + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); } - if (engagementFields !== undefined && engagementFields.length > 0) { - params.append('engagement.fields', engagementFields.join(',')); + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Prepare request options @@ -892,7 +855,7 @@ export class PostsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -900,22 +863,22 @@ export class PostsClient { } /** - * Get count of recent Posts - * Retrieves the count of Posts from the last 7 days matching a search query. + * Search all Posts + * Retrieves Posts from the full archive matching a search query. * * @returns Promise with the API response */ - async getCountsRecent( + async searchAll( query: string, - options: GetCountsRecentStreamingOptions = {} - ): Promise { + options: SearchAllStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getCountsRecent'); + this.client.validateAuthentication(requiredAuthTypes, 'searchAll'); // Normalize options to handle both camelCase and original API parameter names @@ -928,11 +891,23 @@ export class PostsClient { until_id: 'untilId', + max_results: 'maxResults', + next_token: 'nextToken', pagination_token: 'paginationToken', - 'search_count.fields': 'searchCountFields', + sort_order: 'sortOrder', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -950,13 +925,25 @@ export class PostsClient { untilId = undefined, + maxResults = undefined, + nextToken = undefined, paginationToken = undefined, - granularity = undefined, + sortOrder = undefined, - searchCountFields = [], + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], headers = {}, signal, @@ -964,7 +951,7 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/counts/recent'; + let path = '/2/tweets/search/all'; // Build query parameters const params = new URLSearchParams(); @@ -989,6 +976,10 @@ export class PostsClient { params.append('until_id', String(untilId)); } + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + if (nextToken !== undefined) { params.append('next_token', String(nextToken)); } @@ -997,12 +988,32 @@ export class PostsClient { params.append('pagination_token', String(paginationToken)); } - if (granularity !== undefined) { - params.append('granularity', String(granularity)); + if (sortOrder !== undefined) { + params.append('sort_order', String(sortOrder)); } - if (searchCountFields !== undefined && searchCountFields.length > 0) { - params.append('search_count.fields', searchCountFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Prepare request options @@ -1017,7 +1028,7 @@ export class PostsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1025,39 +1036,36 @@ export class PostsClient { } /** - * Get count of all Posts - * Retrieves the count of Posts matching a search query from the full archive. + * Get historical Post insights + * Retrieves historical engagement metrics for specified Posts within a defined time range. * * @returns Promise with the API response */ - async getCountsAll( - query: string, - options: GetCountsAllStreamingOptions = {} - ): Promise { + async getInsightsHistorical( + tweetIds: Array, + endTime: string, + startTime: string, + granularity: string, + requestedMetrics: Array, + options: GetInsightsHistoricalStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getCountsAll'); + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication( + requiredAuthTypes, + 'getInsightsHistorical' + ); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - start_time: 'startTime', - - end_time: 'endTime', - - since_id: 'sinceId', - - until_id: 'untilId', - - next_token: 'nextToken', - - pagination_token: 'paginationToken', - - 'search_count.fields': 'searchCountFields', + 'engagement.fields': 'engagementFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1067,21 +1075,7 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - startTime = undefined, - - endTime = undefined, - - sinceId = undefined, - - untilId = undefined, - - nextToken = undefined, - - paginationToken = undefined, - - granularity = undefined, - - searchCountFields = [], + engagementFields = [], headers = {}, signal, @@ -1089,172 +1083,33 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/counts/all'; + let path = '/2/insights/historical'; // Build query parameters const params = new URLSearchParams(); - if (query !== undefined) { - params.append('query', String(query)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); + if (tweetIds !== undefined && tweetIds.length > 0) { + params.append('tweet_ids', tweetIds.join(',')); } if (endTime !== undefined) { params.append('end_time', String(endTime)); } - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); - } - - if (nextToken !== undefined) { - params.append('next_token', String(nextToken)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); + if (startTime !== undefined) { + params.append('start_time', String(startTime)); } if (granularity !== undefined) { params.append('granularity', String(granularity)); } - if (searchCountFields !== undefined && searchCountFields.length > 0) { - params.append('search_count.fields', searchCountFields.join(',')); - } - - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get Reposts - * Retrieves a list of Posts that repost a specific Post by its ID. - * - * @returns Promise with the API response - */ - async getReposts( - id: string, - options: GetRepostsStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('BearerToken'); - - requiredAuthTypes.push('OAuth2UserToken'); - - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'getReposts'); - - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - - 'user.fields': 'userFields', - - 'place.fields': 'placeFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - - const { - maxResults = undefined, - - paginationToken = undefined, - - tweetFields = [], - - expansions = [], - - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/tweets/{id}/retweets'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (requestedMetrics !== undefined && requestedMetrics.length > 0) { + params.append('requested_metrics', requestedMetrics.join(',')); } - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (engagementFields !== undefined && engagementFields.length > 0) { + params.append('engagement.fields', engagementFields.join(',')); } // Prepare request options @@ -1269,7 +1124,7 @@ export class PostsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1443,37 +1298,32 @@ export class PostsClient { } /** - * Get Reposted by - * Retrieves a list of Users who reposted a specific Post by its ID. + * Get Post analytics + * Retrieves analytics data for specified Posts within a defined time range. * * @returns Promise with the API response */ - async getRepostedBy( - id: string, - options: GetRepostedByStreamingOptions = {} - ): Promise { + async getAnalytics( + ids: Array, + endTime: string, + startTime: string, + granularity: string, + options: GetAnalyticsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getRepostedBy'); + this.client.validateAuthentication(requiredAuthTypes, 'getAnalytics'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', + 'analytics.fields': 'analyticsFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1483,15 +1333,7 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - userFields = [], - - expansions = [], - - tweetFields = [], + analyticsFields = [], headers = {}, signal, @@ -1499,31 +1341,29 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/{id}/retweeted_by'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/tweets/analytics'; // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); + if (ids !== undefined && ids.length > 0) { + params.append('ids', ids.join(',')); } - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); + if (endTime !== undefined) { + params.append('end_time', String(endTime)); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (startTime !== undefined) { + params.append('start_time', String(startTime)); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); + if (granularity !== undefined) { + params.append('granularity', String(granularity)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (analyticsFields !== undefined && analyticsFields.length > 0) { + params.append('analytics.fields', analyticsFields.join(',')); } // Prepare request options @@ -1538,7 +1378,7 @@ export class PostsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1546,41 +1386,59 @@ export class PostsClient { } /** - * Get 28-hour Post insights - * Retrieves engagement metrics for specified Posts over the last 28 hours. + * Get Posts by IDs + * Retrieves details of multiple Posts by their IDs. * * @returns Promise with the API response */ - async getInsights28hr( - tweetIds: Array, - granularity: string, - requestedMetrics: Array, - options: GetInsights28hrStreamingOptions = {} - ): Promise { + async getByIds( + ids: Array, + options: GetByIdsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getInsights28hr'); + this.client.validateAuthentication(requiredAuthTypes, 'getByIds'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'engagement.fields': 'engagementFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - engagementFields = [], + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], headers = {}, signal, @@ -1588,25 +1446,37 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/insights/28hr'; + let path = '/2/tweets'; // Build query parameters const params = new URLSearchParams(); - if (tweetIds !== undefined && tweetIds.length > 0) { - params.append('tweet_ids', tweetIds.join(',')); + if (ids !== undefined && ids.length > 0) { + params.append('ids', ids.join(',')); } - if (granularity !== undefined) { - params.append('granularity', String(granularity)); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } - if (requestedMetrics !== undefined && requestedMetrics.length > 0) { - params.append('requested_metrics', requestedMetrics.join(',')); + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); } - if (engagementFields !== undefined && engagementFields.length > 0) { - params.append('engagement.fields', engagementFields.join(',')); + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Prepare request options @@ -1621,7 +1491,7 @@ export class PostsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1629,39 +1499,94 @@ export class PostsClient { } /** - * Get Posts by IDs - * Retrieves details of multiple Posts by their IDs. + * Create or Edit Post + * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided. * * @returns Promise with the API response */ - async getByIds( - ids: Array, - options: GetByIdsStreamingOptions = {} - ): Promise { + async create( + body: any, + options: CreateStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getByIds'); + this.client.validateAuthentication(requiredAuthTypes, 'create'); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/tweets'; + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, + + body: JSON.stringify(body), + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Get count of recent Posts + * Retrieves the count of Posts from the last 7 days matching a search query. + * + * @returns Promise with the API response + */ + async getCountsRecent( + query: string, + options: GetCountsRecentStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('BearerToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'getCountsRecent'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'tweet.fields': 'tweetFields', + start_time: 'startTime', - 'media.fields': 'mediaFields', + end_time: 'endTime', - 'poll.fields': 'pollFields', + since_id: 'sinceId', - 'user.fields': 'userFields', + until_id: 'untilId', - 'place.fields': 'placeFields', + next_token: 'nextToken', + + pagination_token: 'paginationToken', + + 'search_count.fields': 'searchCountFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1671,17 +1596,21 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - tweetFields = [], + startTime = undefined, - expansions = [], + endTime = undefined, - mediaFields = [], + sinceId = undefined, - pollFields = [], + untilId = undefined, - userFields = [], + nextToken = undefined, - placeFields = [], + paginationToken = undefined, + + granularity = undefined, + + searchCountFields = [], headers = {}, signal, @@ -1689,37 +1618,45 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets'; + let path = '/2/tweets/counts/recent'; // Build query parameters const params = new URLSearchParams(); - if (ids !== undefined && ids.length > 0) { - params.append('ids', ids.join(',')); + if (query !== undefined) { + params.append('query', String(query)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (startTime !== undefined) { + params.append('start_time', String(startTime)); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); + if (endTime !== undefined) { + params.append('end_time', String(endTime)); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); } - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); + if (untilId !== undefined) { + params.append('until_id', String(untilId)); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (nextToken !== undefined) { + params.append('next_token', String(nextToken)); } - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (granularity !== undefined) { + params.append('granularity', String(granularity)); + } + + if (searchCountFields !== undefined && searchCountFields.length > 0) { + params.append('search_count.fields', searchCountFields.join(',')); } // Prepare request options @@ -1734,7 +1671,7 @@ export class PostsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1742,39 +1679,111 @@ export class PostsClient { } /** - * Create or Edit Post - * Creates a new Post for the authenticated user, or edits an existing Post when edit_options are provided. + * Get count of all Posts + * Retrieves the count of Posts matching a search query from the full archive. * * @returns Promise with the API response */ - async create( - body: any, - options: CreateStreamingOptions = {} - ): Promise { + async getCountsAll( + query: string, + options: GetCountsAllStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('OAuth2UserToken'); - - requiredAuthTypes.push('UserToken'); + requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'create'); + this.client.validateAuthentication(requiredAuthTypes, 'getCountsAll'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + start_time: 'startTime', + + end_time: 'endTime', + + since_id: 'sinceId', + + until_id: 'untilId', + + next_token: 'nextToken', + + pagination_token: 'paginationToken', + + 'search_count.fields': 'searchCountFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + startTime = undefined, + + endTime = undefined, + + sinceId = undefined, + + untilId = undefined, + + nextToken = undefined, + + paginationToken = undefined, + + granularity = undefined, + + searchCountFields = [], + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets'; + let path = '/2/tweets/counts/all'; // Build query parameters const params = new URLSearchParams(); + if (query !== undefined) { + params.append('query', String(query)); + } + + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); + } + + if (untilId !== undefined) { + params.append('until_id', String(untilId)); + } + + if (nextToken !== undefined) { + params.append('next_token', String(nextToken)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (granularity !== undefined) { + params.append('granularity', String(granularity)); + } + + if (searchCountFields !== undefined && searchCountFields.length > 0) { + params.append('search_count.fields', searchCountFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -1783,49 +1792,67 @@ export class PostsClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get Liking Users - * Retrieves a list of Users who liked a specific Post by its ID. + * Search recent Posts + * Retrieves Posts from the last 7 days matching a search query. * * @returns Promise with the API response */ - async getLikingUsers( - id: string, - options: GetLikingUsersStreamingOptions = {} - ): Promise { + async searchRecent( + query: string, + options: SearchRecentStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getLikingUsers'); + this.client.validateAuthentication(requiredAuthTypes, 'searchRecent'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { + start_time: 'startTime', + + end_time: 'endTime', + + since_id: 'sinceId', + + until_id: 'untilId', + max_results: 'maxResults', + next_token: 'nextToken', + pagination_token: 'paginationToken', - 'user.fields': 'userFields', + sort_order: 'sortOrder', 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1835,15 +1862,152 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { + startTime = undefined, + + endTime = undefined, + + sinceId = undefined, + + untilId = undefined, + maxResults = undefined, + nextToken = undefined, + paginationToken = undefined, - userFields = [], + sortOrder = undefined, + + tweetFields = [], expansions = [], - tweetFields = [], + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/tweets/search/recent'; + + // Build query parameters + const params = new URLSearchParams(); + + if (query !== undefined) { + params.append('query', String(query)); + } + + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); + } + + if (untilId !== undefined) { + params.append('until_id', String(untilId)); + } + + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (nextToken !== undefined) { + params.append('next_token', String(nextToken)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (sortOrder !== undefined) { + params.append('sort_order', String(sortOrder)); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Hide reply + * Hides or unhides a reply to a conversation owned by the authenticated user. + * + * @returns Promise with the API response + */ + async hideReply( + tweetId: string, + options: HideReplyStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('OAuth2UserToken'); + + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'hideReply'); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { + body, headers = {}, signal, @@ -1851,33 +2015,13 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/{id}/liking_users'; + let path = '/2/tweets/{tweet_id}/hidden'; - path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -1886,63 +2030,51 @@ export class PostsClient { }, signal: signal, + body: JSON.stringify(body), + ...requestOptions, }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'PUT', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Search all Posts - * Retrieves Posts from the full archive matching a search query. + * Get Reposted by + * Retrieves a list of Users who reposted a specific Post by its ID. * * @returns Promise with the API response */ - async searchAll( - query: string, - options: SearchAllStreamingOptions = {} - ): Promise { + async getRepostedBy( + id: string, + options: GetRepostedByStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'searchAll'); - - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - start_time: 'startTime', + requiredAuthTypes.push('OAuth2UserToken'); - end_time: 'endTime', + requiredAuthTypes.push('UserToken'); - since_id: 'sinceId', + this.client.validateAuthentication(requiredAuthTypes, 'getRepostedBy'); - until_id: 'untilId', + // Normalize options to handle both camelCase and original API parameter names + const paramMappings: Record = { max_results: 'maxResults', - next_token: 'nextToken', - pagination_token: 'paginationToken', - sort_order: 'sortOrder', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1952,33 +2084,15 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - startTime = undefined, - - endTime = undefined, - - sinceId = undefined, - - untilId = undefined, - maxResults = undefined, - nextToken = undefined, - paginationToken = undefined, - sortOrder = undefined, - - tweetFields = [], + userFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + tweetFields = [], headers = {}, signal, @@ -1986,69 +2100,31 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/all'; + let path = '/2/tweets/{id}/retweeted_by'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (query !== undefined) { - params.append('query', String(query)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); - } - if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (nextToken !== undefined) { - params.append('next_token', String(nextToken)); - } - if (paginationToken !== undefined) { params.append('pagination_token', String(paginationToken)); } - if (sortOrder !== undefined) { - params.append('sort_order', String(sortOrder)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -2063,7 +2139,7 @@ export class PostsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2204,55 +2280,35 @@ export class PostsClient { } /** - * Search recent Posts - * Retrieves Posts from the last 7 days matching a search query. + * Get Liking Users + * Retrieves a list of Users who liked a specific Post by its ID. * * @returns Promise with the API response */ - async searchRecent( - query: string, - options: SearchRecentStreamingOptions = {} - ): Promise { + async getLikingUsers( + id: string, + options: GetLikingUsersStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'searchRecent'); + this.client.validateAuthentication(requiredAuthTypes, 'getLikingUsers'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - start_time: 'startTime', - - end_time: 'endTime', - - since_id: 'sinceId', - - until_id: 'untilId', - max_results: 'maxResults', - next_token: 'nextToken', - pagination_token: 'paginationToken', - sort_order: 'sortOrder', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2262,33 +2318,15 @@ export class PostsClient { // Destructure options (exclude path parameters, they're already function params) const { - startTime = undefined, - - endTime = undefined, - - sinceId = undefined, - - untilId = undefined, - maxResults = undefined, - nextToken = undefined, - paginationToken = undefined, - sortOrder = undefined, - - tweetFields = [], + userFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + tweetFields = [], headers = {}, signal, @@ -2296,69 +2334,31 @@ export class PostsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/recent'; + let path = '/2/tweets/{id}/liking_users'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (query !== undefined) { - params.append('query', String(query)); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); - } - if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (nextToken !== undefined) { - params.append('next_token', String(nextToken)); - } - if (paginationToken !== undefined) { params.append('pagination_token', String(paginationToken)); } - if (sortOrder !== undefined) { - params.append('sort_order', String(sortOrder)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -2373,7 +2373,7 @@ export class PostsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions diff --git a/xdk/typescript/src/schemas.ts b/xdk/typescript/src/schemas.ts index c1b7418c..b020b4b9 100644 --- a/xdk/typescript/src/schemas.ts +++ b/xdk/typescript/src/schemas.ts @@ -922,6 +922,15 @@ export interface Get2NewsIdResponse { data?: News; /** none */ errors?: Array; } /** +Schema type for Get2NewsSearchResponse + * + * @public + */ +export interface Get2NewsSearchResponse { + /** none */ data?: Array; + /** none */ errors?: Array; + /** none */ meta?: Record; +} /** Schema type for Get2NotesSearchNotesWrittenResponse * * @public diff --git a/xdk/typescript/src/spaces/client.ts b/xdk/typescript/src/spaces/client.ts index 8ebe0e45..4e51c023 100644 --- a/xdk/typescript/src/spaces/client.ts +++ b/xdk/typescript/src/spaces/client.ts @@ -16,47 +16,35 @@ import { EventPaginator, } from '../paginator.js'; import { - GetPostsResponse, - SearchResponse, GetByIdResponse, - GetByCreatorIdsResponse, GetBuyersResponse, + GetPostsResponse, + GetByCreatorIdsResponse, GetByIdsResponse, + SearchResponse, } from './models.js'; /** - * Options for getPosts method + * Options for getById method * * @public */ -export interface GetPostsOptions { - /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +export interface GetByIdOptions { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -65,34 +53,30 @@ export interface GetPostsOptions { } /** - * Options for search method + * Options for getBuyers method * * @public */ -export interface SearchOptions { - /** The state of Spaces to search for. - * Also accepts: state or proper camelCase (e.g., state) */ - state?: string; +export interface GetBuyersOptions { + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; - /** The number of results to return. + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -101,26 +85,38 @@ export interface SearchOptions { } /** - * Options for getById method + * Options for getPosts method * * @public */ -export interface GetByIdOptions { - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; +export interface GetPostsOptions { + /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -157,30 +153,26 @@ export interface GetByCreatorIdsOptions { } /** - * Options for getBuyers method + * Options for getByIds method * * @public */ -export interface GetBuyersOptions { - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; +export interface GetByIdsOptions { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -189,11 +181,19 @@ export interface GetBuyersOptions { } /** - * Options for getByIds method + * Options for search method * * @public */ -export interface GetByIdsOptions { +export interface SearchOptions { + /** The state of Spaces to search for. + * Also accepts: state or proper camelCase (e.g., state) */ + state?: string; + + /** The number of results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** A comma separated list of Space fields to display. * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ spaceFields?: Array; @@ -267,8 +267,8 @@ export class SpacesClient { } /** - * Get Space Posts - * Retrieves a list of Posts shared in a specific Space by its ID. + * Get space by ID + * Retrieves details of a specific space by its ID. * @param id The ID of the Space to be retrieved. @@ -276,27 +276,21 @@ export class SpacesClient { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPosts( + async getById( id: string, - options: GetPostsOptions = {} - ): Promise { + options: GetByIdOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', + 'space.fields': 'spaceFields', 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'topic.fields': 'topicFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -305,57 +299,39 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - tweetFields = [], + spaceFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - userFields = [], - placeFields = [], + topicFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces/{id}/tweets'; + let path = '/2/spaces/{id}'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (spaceFields !== undefined && spaceFields.length > 0) { + params.append('space.fields', spaceFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (topicFields !== undefined && topicFields.length > 0) { + params.append('topic.fields', topicFields.join(',')); } // Prepare request options @@ -374,7 +350,7 @@ export class SpacesClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -382,32 +358,32 @@ export class SpacesClient { } /** - * Search Spaces - * Retrieves a list of Spaces matching the specified search query. + * Get Space ticket buyers + * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + * @param id The ID of the Space to be retrieved. - * @param query The search query. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async search( - query: string, - options: SearchOptions = {} - ): Promise { + async getBuyers( + id: string, + options: GetBuyersOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', + pagination_token: 'paginationToken', - 'space.fields': 'spaceFields', + max_results: 'maxResults', 'user.fields': 'userFields', - 'topic.fields': 'topicFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -416,63 +392,51 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { - state = undefined, + paginationToken = undefined, maxResults = undefined, - spaceFields = [], + userFields = [], expansions = [], - userFields = [], - - topicFields = [], + tweetFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces/search'; + let path = '/2/spaces/{id}/buyers'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (query !== undefined) { - params.append('query', String(query)); - } - - if (state !== undefined) { - params.append('state', String(state)); + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (spaceFields !== undefined && spaceFields.length > 0) { - params.append('space.fields', spaceFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (topicFields !== undefined && topicFields.length > 0) { - params.append('topic.fields', topicFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ - { - BearerToken: [], - }, - { OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'], }, @@ -481,7 +445,7 @@ export class SpacesClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -489,8 +453,8 @@ export class SpacesClient { } /** - * Get space by ID - * Retrieves details of a specific space by its ID. + * Get Space Posts + * Retrieves a list of Posts shared in a specific Space by its ID. * @param id The ID of the Space to be retrieved. @@ -498,21 +462,27 @@ export class SpacesClient { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById( + async getPosts( id: string, - options: GetByIdOptions = {} - ): Promise { + options: GetPostsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'space.fields': 'spaceFields', + max_results: 'maxResults', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', 'user.fields': 'userFields', - 'topic.fields': 'topicFields', + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -521,39 +491,57 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { - spaceFields = [], + maxResults = undefined, + + tweetFields = [], expansions = [], + mediaFields = [], + + pollFields = [], + userFields = [], - topicFields = [], + placeFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces/{id}'; + let path = '/2/spaces/{id}/tweets'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (spaceFields !== undefined && spaceFields.length > 0) { - params.append('space.fields', spaceFields.join(',')); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } - if (topicFields !== undefined && topicFields.length > 0) { - params.append('topic.fields', topicFields.join(',')); + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Prepare request options @@ -572,7 +560,7 @@ export class SpacesClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -673,32 +661,30 @@ export class SpacesClient { } /** - * Get Space ticket buyers - * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + * Get Spaces by IDs + * Retrieves details of multiple Spaces by their IDs. - * @param id The ID of the Space to be retrieved. + * @param ids The list of Space IDs to return. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBuyers( - id: string, - options: GetBuyersOptions = {} - ): Promise { + async getByIds( + ids: Array, + options: GetByIdsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - pagination_token: 'paginationToken', - - max_results: 'maxResults', + 'space.fields': 'spaceFields', 'user.fields': 'userFields', - 'tweet.fields': 'tweetFields', + 'topic.fields': 'topicFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -707,51 +693,51 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { - paginationToken = undefined, + spaceFields = [], - maxResults = undefined, + expansions = [], userFields = [], - expansions = [], - - tweetFields = [], + topicFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces/{id}/buyers'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/spaces'; // Build query parameters const params = new URLSearchParams(); - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); + if (ids !== undefined && ids.length > 0) { + params.append('ids', ids.join(',')); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (spaceFields !== undefined && spaceFields.length > 0) { + params.append('space.fields', spaceFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (topicFields !== undefined && topicFields.length > 0) { + params.append('topic.fields', topicFields.join(',')); } // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ + { + BearerToken: [], + }, + { OAuth2UserToken: ['space.read', 'tweet.read', 'users.read'], }, @@ -760,7 +746,7 @@ export class SpacesClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -768,25 +754,27 @@ export class SpacesClient { } /** - * Get Spaces by IDs - * Retrieves details of multiple Spaces by their IDs. + * Search Spaces + * Retrieves a list of Spaces matching the specified search query. - * @param ids The list of Space IDs to return. + * @param query The search query. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByIds( - ids: Array, - options: GetByIdsOptions = {} - ): Promise { + async search( + query: string, + options: SearchOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { + max_results: 'maxResults', + 'space.fields': 'spaceFields', 'user.fields': 'userFields', @@ -800,6 +788,10 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { + state = undefined, + + maxResults = undefined, + spaceFields = [], expansions = [], @@ -812,13 +804,21 @@ export class SpacesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces'; + let path = '/2/spaces/search'; // Build query parameters const params = new URLSearchParams(); - if (ids !== undefined && ids.length > 0) { - params.append('ids', ids.join(',')); + if (query !== undefined) { + params.append('query', String(query)); + } + + if (state !== undefined) { + params.append('state', String(state)); + } + + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); } if (spaceFields !== undefined && spaceFields.length > 0) { @@ -853,7 +853,7 @@ export class SpacesClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions diff --git a/xdk/typescript/src/spaces/models.ts b/xdk/typescript/src/spaces/models.ts index 09c85778..b1bfd31e 100644 --- a/xdk/typescript/src/spaces/models.ts +++ b/xdk/typescript/src/spaces/models.ts @@ -11,23 +11,23 @@ import type * as Schemas from '../schemas.js'; /** - * Response for getPosts + * Response for getById * * @public */ -export type GetPostsResponse = Schemas.Get2SpacesIdTweetsResponse; +export type GetByIdResponse = Schemas.Get2SpacesIdResponse; /** - * Response for search + * Response for getBuyers * * @public */ -export type SearchResponse = Schemas.Get2SpacesSearchResponse; +export type GetBuyersResponse = Schemas.Get2SpacesIdBuyersResponse; /** - * Response for getById + * Response for getPosts * * @public */ -export type GetByIdResponse = Schemas.Get2SpacesIdResponse; +export type GetPostsResponse = Schemas.Get2SpacesIdTweetsResponse; /** * Response for getByCreatorIds * @@ -35,14 +35,14 @@ export type GetByIdResponse = Schemas.Get2SpacesIdResponse; */ export type GetByCreatorIdsResponse = Schemas.Get2SpacesByCreatorIdsResponse; /** - * Response for getBuyers + * Response for getByIds * * @public */ -export type GetBuyersResponse = Schemas.Get2SpacesIdBuyersResponse; +export type GetByIdsResponse = Schemas.Get2SpacesResponse; /** - * Response for getByIds + * Response for search * * @public */ -export type GetByIdsResponse = Schemas.Get2SpacesResponse; \ No newline at end of file +export type SearchResponse = Schemas.Get2SpacesSearchResponse; \ No newline at end of file diff --git a/xdk/typescript/src/spaces/stream_client.ts b/xdk/typescript/src/spaces/stream_client.ts index 5924b836..447a0608 100644 --- a/xdk/typescript/src/spaces/stream_client.ts +++ b/xdk/typescript/src/spaces/stream_client.ts @@ -10,47 +10,35 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { - GetPostsResponse, - SearchResponse, GetByIdResponse, - GetByCreatorIdsResponse, GetBuyersResponse, + GetPostsResponse, + GetByCreatorIdsResponse, GetByIdsResponse, + SearchResponse, } from './models.js'; /** - * Options for getPosts method + * Options for getById method * * @public */ -export interface GetPostsStreamingOptions { - /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +export interface GetByIdStreamingOptions { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -62,34 +50,30 @@ export interface GetPostsStreamingOptions { [key: string]: any; } /** - * Options for search method + * Options for getBuyers method * * @public */ -export interface SearchStreamingOptions { - /** The state of Spaces to search for. - * Also accepts: state or proper camelCase (e.g., state) */ - state?: string; +export interface GetBuyersStreamingOptions { + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; - /** The number of results to return. + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -101,26 +85,38 @@ export interface SearchStreamingOptions { [key: string]: any; } /** - * Options for getById method + * Options for getPosts method * * @public */ -export interface GetByIdStreamingOptions { - /** A comma separated list of Space fields to display. - * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ - spaceFields?: Array; +export interface GetPostsStreamingOptions { + /** The number of Posts to fetch from the provided space. If not provided, the value will default to the maximum of 100. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Topic fields to display. - * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ - topicFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -163,30 +159,26 @@ export interface GetByCreatorIdsStreamingOptions { [key: string]: any; } /** - * Options for getBuyers method + * Options for getByIds method * * @public */ -export interface GetBuyersStreamingOptions { - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; +export interface GetByIdsStreamingOptions { + /** A comma separated list of Space fields to display. + * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ + spaceFields?: Array; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of Topic fields to display. + * Also accepts: topic.fields or proper camelCase (e.g., topicFields) */ + topicFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -198,11 +190,19 @@ export interface GetBuyersStreamingOptions { [key: string]: any; } /** - * Options for getByIds method + * Options for search method * * @public */ -export interface GetByIdsStreamingOptions { +export interface SearchStreamingOptions { + /** The state of Spaces to search for. + * Also accepts: state or proper camelCase (e.g., state) */ + state?: string; + + /** The number of results to return. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + /** A comma separated list of Space fields to display. * Also accepts: space.fields or proper camelCase (e.g., spaceFields) */ spaceFields?: Array; @@ -266,15 +266,15 @@ export class SpacesClient { } /** - * Get Space Posts - * Retrieves a list of Posts shared in a specific Space by its ID. + * Get space by ID + * Retrieves details of a specific space by its ID. * * @returns Promise with the API response */ - async getPosts( + async getById( id: string, - options: GetPostsStreamingOptions = {} - ): Promise { + options: GetByIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -283,22 +283,16 @@ export class SpacesClient { requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getPosts'); + this.client.validateAuthentication(requiredAuthTypes, 'getById'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', + 'space.fields': 'spaceFields', 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'topic.fields': 'topicFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -308,19 +302,13 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - tweetFields = [], + spaceFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - userFields = [], - placeFields = [], + topicFields = [], headers = {}, signal, @@ -328,39 +316,27 @@ export class SpacesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces/{id}/tweets'; + let path = '/2/spaces/{id}'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (spaceFields !== undefined && spaceFields.length > 0) { + params.append('space.fields', spaceFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (topicFields !== undefined && topicFields.length > 0) { + params.append('topic.fields', topicFields.join(',')); } // Prepare request options @@ -375,7 +351,7 @@ export class SpacesClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -383,35 +359,33 @@ export class SpacesClient { } /** - * Search Spaces - * Retrieves a list of Spaces matching the specified search query. + * Get Space ticket buyers + * Retrieves a list of Users who purchased tickets to a specific Space by its ID. * * @returns Promise with the API response */ - async search( - query: string, - options: SearchStreamingOptions = {} - ): Promise { + async getBuyers( + id: string, + options: GetBuyersStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'search'); + this.client.validateAuthentication(requiredAuthTypes, 'getBuyers'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', + pagination_token: 'paginationToken', - 'space.fields': 'spaceFields', + max_results: 'maxResults', 'user.fields': 'userFields', - 'topic.fields': 'topicFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -421,17 +395,15 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { - state = undefined, + paginationToken = undefined, maxResults = undefined, - spaceFields = [], + userFields = [], expansions = [], - userFields = [], - - topicFields = [], + tweetFields = [], headers = {}, signal, @@ -439,37 +411,31 @@ export class SpacesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces/search'; + let path = '/2/spaces/{id}/buyers'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (query !== undefined) { - params.append('query', String(query)); - } - - if (state !== undefined) { - params.append('state', String(state)); + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (spaceFields !== undefined && spaceFields.length > 0) { - params.append('space.fields', spaceFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (topicFields !== undefined && topicFields.length > 0) { - params.append('topic.fields', topicFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -484,7 +450,7 @@ export class SpacesClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -492,15 +458,15 @@ export class SpacesClient { } /** - * Get space by ID - * Retrieves details of a specific space by its ID. + * Get Space Posts + * Retrieves a list of Posts shared in a specific Space by its ID. * * @returns Promise with the API response */ - async getById( + async getPosts( id: string, - options: GetByIdStreamingOptions = {} - ): Promise { + options: GetPostsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -509,16 +475,22 @@ export class SpacesClient { requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getById'); + this.client.validateAuthentication(requiredAuthTypes, 'getPosts'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'space.fields': 'spaceFields', + max_results: 'maxResults', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', 'user.fields': 'userFields', - 'topic.fields': 'topicFields', + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -528,13 +500,19 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { - spaceFields = [], + maxResults = undefined, + + tweetFields = [], expansions = [], + mediaFields = [], + + pollFields = [], + userFields = [], - topicFields = [], + placeFields = [], headers = {}, signal, @@ -542,27 +520,39 @@ export class SpacesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces/{id}'; + let path = '/2/spaces/{id}/tweets'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (spaceFields !== undefined && spaceFields.length > 0) { - params.append('space.fields', spaceFields.join(',')); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } - if (topicFields !== undefined && topicFields.length > 0) { - params.append('topic.fields', topicFields.join(',')); + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Prepare request options @@ -577,7 +567,7 @@ export class SpacesClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -680,33 +670,33 @@ export class SpacesClient { } /** - * Get Space ticket buyers - * Retrieves a list of Users who purchased tickets to a specific Space by its ID. + * Get Spaces by IDs + * Retrieves details of multiple Spaces by their IDs. * * @returns Promise with the API response */ - async getBuyers( - id: string, - options: GetBuyersStreamingOptions = {} - ): Promise { + async getByIds( + ids: Array, + options: GetByIdsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getBuyers'); + this.client.validateAuthentication(requiredAuthTypes, 'getByIds'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - pagination_token: 'paginationToken', - - max_results: 'maxResults', + 'space.fields': 'spaceFields', 'user.fields': 'userFields', - 'tweet.fields': 'tweetFields', + 'topic.fields': 'topicFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -716,15 +706,13 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { - paginationToken = undefined, + spaceFields = [], - maxResults = undefined, + expansions = [], userFields = [], - expansions = [], - - tweetFields = [], + topicFields = [], headers = {}, signal, @@ -732,31 +720,29 @@ export class SpacesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces/{id}/buyers'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/spaces'; // Build query parameters const params = new URLSearchParams(); - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); + if (ids !== undefined && ids.length > 0) { + params.append('ids', ids.join(',')); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (spaceFields !== undefined && spaceFields.length > 0) { + params.append('space.fields', spaceFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (topicFields !== undefined && topicFields.length > 0) { + params.append('topic.fields', topicFields.join(',')); } // Prepare request options @@ -771,7 +757,7 @@ export class SpacesClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -779,15 +765,15 @@ export class SpacesClient { } /** - * Get Spaces by IDs - * Retrieves details of multiple Spaces by their IDs. + * Search Spaces + * Retrieves a list of Spaces matching the specified search query. * * @returns Promise with the API response */ - async getByIds( - ids: Array, - options: GetByIdsStreamingOptions = {} - ): Promise { + async search( + query: string, + options: SearchStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -796,11 +782,13 @@ export class SpacesClient { requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getByIds'); + this.client.validateAuthentication(requiredAuthTypes, 'search'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { + max_results: 'maxResults', + 'space.fields': 'spaceFields', 'user.fields': 'userFields', @@ -815,6 +803,10 @@ export class SpacesClient { // Destructure options (exclude path parameters, they're already function params) const { + state = undefined, + + maxResults = undefined, + spaceFields = [], expansions = [], @@ -829,13 +821,21 @@ export class SpacesClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/spaces'; + let path = '/2/spaces/search'; // Build query parameters const params = new URLSearchParams(); - if (ids !== undefined && ids.length > 0) { - params.append('ids', ids.join(',')); + if (query !== undefined) { + params.append('query', String(query)); + } + + if (state !== undefined) { + params.append('state', String(state)); + } + + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); } if (spaceFields !== undefined && spaceFields.length > 0) { @@ -866,7 +866,7 @@ export class SpacesClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions diff --git a/xdk/typescript/src/stream/models.ts b/xdk/typescript/src/stream/models.ts index 19d3d4d7..8d068484 100644 --- a/xdk/typescript/src/stream/models.ts +++ b/xdk/typescript/src/stream/models.ts @@ -17,104 +17,104 @@ import type * as Schemas from '../schemas.js'; */ export type PostsSampleResponse = Schemas.StreamingTweetResponse; /** - * Response for postsFirehose + * Response for postsFirehosePt * * @public */ -export type PostsFirehoseResponse = Schemas.StreamingTweetResponse; +export type PostsFirehosePtResponse = Schemas.StreamingTweetResponse; /** - * Response for labelsCompliance + * Response for postsFirehoseJa * * @public */ -export type LabelsComplianceResponse = Schemas.TweetLabelStreamResponse; +export type PostsFirehoseJaResponse = Schemas.StreamingTweetResponse; /** - * Response for likesCompliance + * Response for postsSample10 * * @public */ -export type LikesComplianceResponse = Schemas.LikesComplianceStreamResponse; +export type PostsSample10Response = Schemas.Get2TweetsSample10StreamResponse; /** - * Response for likesSample10 + * Response for postsFirehoseKo * * @public */ -export type LikesSample10Response = Schemas.StreamingLikeResponseV2; +export type PostsFirehoseKoResponse = Schemas.StreamingTweetResponse; /** - * Response for postsFirehosePt + * Response for likesCompliance * * @public */ -export type PostsFirehosePtResponse = Schemas.StreamingTweetResponse; +export type LikesComplianceResponse = Schemas.LikesComplianceStreamResponse; /** - * Response for postsFirehoseEn + * Response for postsCompliance * * @public */ -export type PostsFirehoseEnResponse = Schemas.StreamingTweetResponse; +export type PostsComplianceResponse = Schemas.TweetComplianceStreamResponse; /** - * Response for posts + * Response for getRuleCounts * * @public */ -export type PostsResponse = Schemas.FilteredStreamingTweetResponse; +export type GetRuleCountsResponse = Schemas.Get2TweetsSearchStreamRulesCountsResponse; /** - * Response for getRules + * Response for likesFirehose * * @public */ -export type GetRulesResponse = Schemas.RulesLookupResponse; +export type LikesFirehoseResponse = Schemas.StreamingLikeResponseV2; /** - * Request for updateRules + * Response for postsFirehoseEn * * @public */ -export type UpdateRulesRequest = Schemas.AddOrDeleteRulesRequest; +export type PostsFirehoseEnResponse = Schemas.StreamingTweetResponse; /** - * Response for updateRules + * Response for posts * * @public */ -export type UpdateRulesResponse = Schemas.AddOrDeleteRulesResponse; +export type PostsResponse = Schemas.FilteredStreamingTweetResponse; /** - * Response for postsCompliance + * Response for usersCompliance * * @public */ -export type PostsComplianceResponse = Schemas.TweetComplianceStreamResponse; +export type UsersComplianceResponse = Schemas.UserComplianceStreamResponse; /** - * Response for postsFirehoseKo + * Response for postsFirehose * * @public */ -export type PostsFirehoseKoResponse = Schemas.StreamingTweetResponse; +export type PostsFirehoseResponse = Schemas.StreamingTweetResponse; /** - * Response for likesFirehose + * Response for likesSample10 * * @public */ -export type LikesFirehoseResponse = Schemas.StreamingLikeResponseV2; +export type LikesSample10Response = Schemas.StreamingLikeResponseV2; /** - * Response for postsSample10 + * Response for getRules * * @public */ -export type PostsSample10Response = Schemas.Get2TweetsSample10StreamResponse; +export type GetRulesResponse = Schemas.RulesLookupResponse; /** - * Response for postsFirehoseJa + * Request for updateRules * * @public */ -export type PostsFirehoseJaResponse = Schemas.StreamingTweetResponse; +export type UpdateRulesRequest = Schemas.AddOrDeleteRulesRequest; /** - * Response for getRuleCounts + * Response for updateRules * * @public */ -export type GetRuleCountsResponse = Schemas.Get2TweetsSearchStreamRulesCountsResponse; +export type UpdateRulesResponse = Schemas.AddOrDeleteRulesResponse; /** - * Response for usersCompliance + * Response for labelsCompliance * * @public */ -export type UsersComplianceResponse = Schemas.UserComplianceStreamResponse; \ No newline at end of file +export type LabelsComplianceResponse = Schemas.TweetLabelStreamResponse; \ No newline at end of file diff --git a/xdk/typescript/src/stream/stream_client.ts b/xdk/typescript/src/stream/stream_client.ts index 6fc1c137..0ddfc8af 100644 --- a/xdk/typescript/src/stream/stream_client.ts +++ b/xdk/typescript/src/stream/stream_client.ts @@ -11,22 +11,22 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { PostsSampleResponse, - PostsFirehoseResponse, - LabelsComplianceResponse, - LikesComplianceResponse, - LikesSample10Response, PostsFirehosePtResponse, + PostsFirehoseJaResponse, + PostsSample10Response, + PostsFirehoseKoResponse, + LikesComplianceResponse, + PostsComplianceResponse, + GetRuleCountsResponse, + LikesFirehoseResponse, PostsFirehoseEnResponse, PostsResponse, + UsersComplianceResponse, + PostsFirehoseResponse, + LikesSample10Response, GetRulesResponse, UpdateRulesResponse, - PostsComplianceResponse, - PostsFirehoseKoResponse, - LikesFirehoseResponse, - PostsSample10Response, - PostsFirehoseJaResponse, - GetRuleCountsResponse, - UsersComplianceResponse, + LabelsComplianceResponse, } from './models.js'; /** @@ -73,11 +73,11 @@ export interface PostsSampleStreamingOptions { [key: string]: any; } /** - * Options for postsFirehose method + * Options for postsFirehosePt method * * @public */ -export interface PostsFirehoseStreamingOptions { +export interface PostsFirehosePtStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -124,70 +124,16 @@ export interface PostsFirehoseStreamingOptions { [key: string]: any; } /** - * Options for labelsCompliance method - * - * @public - */ -export interface LabelsComplianceStreamingOptions { - /** The number of minutes of backfill requested. - * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ - backfillMinutes?: number; - - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for likesCompliance method - * - * @public - */ -export interface LikesComplianceStreamingOptions { - /** The number of minutes of backfill requested. - * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ - backfillMinutes?: number; - - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for likesSample10 method + * Options for postsFirehoseJa method * * @public */ -export interface LikesSample10StreamingOptions { +export interface PostsFirehoseJaStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; @@ -195,21 +141,29 @@ export interface LikesSample10StreamingOptions { * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of LikeWithTweetAuthor fields to display. - * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ - likeWithTweetAuthorFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -221,11 +175,11 @@ export interface LikesSample10StreamingOptions { [key: string]: any; } /** - * Options for postsFirehosePt method + * Options for postsSample10 method * * @public */ -export interface PostsFirehosePtStreamingOptions { +export interface PostsSample10StreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -272,11 +226,11 @@ export interface PostsFirehosePtStreamingOptions { [key: string]: any; } /** - * Options for postsFirehoseEn method + * Options for postsFirehoseKo method * * @public */ -export interface PostsFirehoseEnStreamingOptions { +export interface PostsFirehoseKoStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -323,47 +277,23 @@ export interface PostsFirehoseEnStreamingOptions { [key: string]: any; } /** - * Options for posts method + * Options for likesCompliance method * * @public */ -export interface PostsStreamingOptions { +export interface LikesComplianceStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Likes Compliance events will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Likes Compliance events will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -374,22 +304,22 @@ export interface PostsStreamingOptions { [key: string]: any; } /** - * Options for getRules method + * Options for postsCompliance method * * @public */ -export interface GetRulesStreamingOptions { - /** A comma-separated list of Rule IDs. - * Also accepts: ids or proper camelCase (e.g., ids) */ - ids?: Array; +export interface PostsComplianceStreamingOptions { + /** The number of minutes of backfill requested. + * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ + backfillMinutes?: number; - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; - /** This value is populated by passing the 'next_token' returned in a request to paginate through results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: string; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; /** Additional request options */ requestOptions?: RequestOptions; @@ -401,18 +331,14 @@ export interface GetRulesStreamingOptions { [key: string]: any; } /** - * Options for updateRules method + * Options for getRuleCounts method * * @public */ -export interface UpdateRulesStreamingOptions { - /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. - * Also accepts: dry_run or proper camelCase (e.g., dryRun) */ - dryRun?: boolean; - - /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. - * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */ - deleteAll?: boolean; +export interface GetRuleCountsStreamingOptions { + /** A comma separated list of RulesCount fields to display. + * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */ + rulesCountFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -424,23 +350,39 @@ export interface UpdateRulesStreamingOptions { [key: string]: any; } /** - * Options for postsCompliance method + * Options for likesFirehose method * * @public */ -export interface PostsComplianceStreamingOptions { +export interface LikesFirehoseStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Post Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; + /** A comma separated list of LikeWithTweetAuthor fields to display. + * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ + likeWithTweetAuthorFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -451,11 +393,11 @@ export interface PostsComplianceStreamingOptions { [key: string]: any; } /** - * Options for postsFirehoseKo method + * Options for postsFirehoseEn method * * @public */ -export interface PostsFirehoseKoStreamingOptions { +export interface PostsFirehoseEnStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -502,16 +444,16 @@ export interface PostsFirehoseKoStreamingOptions { [key: string]: any; } /** - * Options for likesFirehose method + * Options for posts method * * @public */ -export interface LikesFirehoseStreamingOptions { +export interface PostsStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; @@ -519,21 +461,29 @@ export interface LikesFirehoseStreamingOptions { * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of LikeWithTweetAuthor fields to display. - * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ - likeWithTweetAuthorFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -545,11 +495,38 @@ export interface LikesFirehoseStreamingOptions { [key: string]: any; } /** - * Options for postsSample10 method + * Options for usersCompliance method * * @public */ -export interface PostsSample10StreamingOptions { +export interface UsersComplianceStreamingOptions { + /** The number of minutes of backfill requested. + * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ + backfillMinutes?: number; + + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for postsFirehose method + * + * @public + */ +export interface PostsFirehoseStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; @@ -596,16 +573,16 @@ export interface PostsSample10StreamingOptions { [key: string]: any; } /** - * Options for postsFirehoseJa method + * Options for likesSample10 method * * @public */ -export interface PostsFirehoseJaStreamingOptions { +export interface LikesSample10StreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Posts will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp to which the Likes will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; @@ -613,29 +590,21 @@ export interface PostsFirehoseJaStreamingOptions { * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; + /** A comma separated list of LikeWithTweetAuthor fields to display. + * Also accepts: like_with_tweet_author.fields or proper camelCase (e.g., likeWithTweetAuthorFields) */ + likeWithTweetAuthorFields?: Array; - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -647,14 +616,22 @@ export interface PostsFirehoseJaStreamingOptions { [key: string]: any; } /** - * Options for getRuleCounts method + * Options for getRules method * * @public */ -export interface GetRuleCountsStreamingOptions { - /** A comma separated list of RulesCount fields to display. - * Also accepts: rules_count.fields or proper camelCase (e.g., rulesCountFields) */ - rulesCountFields?: Array; +export interface GetRulesStreamingOptions { + /** A comma-separated list of Rule IDs. + * Also accepts: ids or proper camelCase (e.g., ids) */ + ids?: Array; + + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** This value is populated by passing the 'next_token' returned in a request to paginate through results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: string; /** Additional request options */ requestOptions?: RequestOptions; @@ -666,20 +643,43 @@ export interface GetRuleCountsStreamingOptions { [key: string]: any; } /** - * Options for usersCompliance method + * Options for updateRules method * * @public */ -export interface UsersComplianceStreamingOptions { +export interface UpdateRulesStreamingOptions { + /** Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. + * Also accepts: dry_run or proper camelCase (e.g., dryRun) */ + dryRun?: boolean; + + /** Delete All can be used to delete all of the rules associated this client app, it should be specified with no other parameters. Once deleted, rules cannot be recovered. + * Also accepts: delete_all or proper camelCase (e.g., deleteAll) */ + deleteAll?: boolean; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for labelsCompliance method + * + * @public + */ +export interface LabelsComplianceStreamingOptions { /** The number of minutes of backfill requested. * Also accepts: backfill_minutes or proper camelCase (e.g., backfillMinutes) */ backfillMinutes?: number; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the User Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Post labels will be provided. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the User Compliance events will be provided. + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Post labels will be provided. * Also accepts: end_time or proper camelCase (e.g., endTime) */ endTime?: string; @@ -871,8 +871,8 @@ export class StreamClient { } /** - * Stream all Posts - * Streams all public Posts in real-time. + * Stream Portuguese Posts + * Streams all public Portuguese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -886,9 +886,9 @@ export class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehose( + async postsFirehosePt( partition: number, - options: PostsFirehoseStreamingOptions = {} + options: PostsFirehosePtStreamingOptions = {} ): Promise { // Validate authentication requirements @@ -896,7 +896,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'postsFirehose'); + this.client.validateAuthentication(requiredAuthTypes, 'postsFirehosePt'); // Normalize options to handle both camelCase and original API parameter names @@ -949,7 +949,7 @@ export class StreamClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/firehose/stream'; + let path = '/2/tweets/firehose/stream/lang/pt'; // Build query parameters const params = new URLSearchParams(); @@ -1037,8 +1037,8 @@ export class StreamClient { } /** - * Stream Post labels - * Streams all labeling events applied to Posts. + * Stream Japanese Posts + * Streams all public Japanese-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -1046,10 +1046,15 @@ export class StreamClient { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - async labelsCompliance( - options: LabelsComplianceStreamingOptions = {} + async postsFirehoseJa( + partition: number, + options: PostsFirehoseJaStreamingOptions = {} ): Promise { // Validate authentication requirements @@ -1057,7 +1062,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'labelsCompliance'); + this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseJa'); // Normalize options to handle both camelCase and original API parameter names @@ -1067,6 +1072,16 @@ export class StreamClient { start_time: 'startTime', end_time: 'endTime', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1082,13 +1097,25 @@ export class StreamClient { endTime = undefined, + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], + headers = {}, signal, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/label/stream'; + let path = '/2/tweets/firehose/stream/lang/ja'; // Build query parameters const params = new URLSearchParams(); @@ -1097,6 +1124,10 @@ export class StreamClient { params.append('backfill_minutes', String(backfillMinutes)); } + if (partition !== undefined) { + params.append('partition', String(partition)); + } + if (startTime !== undefined) { params.append('start_time', String(startTime)); } @@ -1105,6 +1136,30 @@ export class StreamClient { params.append('end_time', String(endTime)); } + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + // Make the authenticated request using the main client's request method // We need raw: true to get the raw Response object for streaming const url = path + (params.toString() ? `?${params.toString()}` : ''); @@ -1148,8 +1203,8 @@ export class StreamClient { } /** - * Stream Likes compliance data - * Streams all compliance data related to Likes for Users. + * Stream 10% sampled Posts + * Streams a 10% sample of public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -1157,10 +1212,15 @@ export class StreamClient { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - async likesCompliance( - options: LikesComplianceStreamingOptions = {} + async postsSample10( + partition: number, + options: PostsSample10StreamingOptions = {} ): Promise { // Validate authentication requirements @@ -1168,7 +1228,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'likesCompliance'); + this.client.validateAuthentication(requiredAuthTypes, 'postsSample10'); // Normalize options to handle both camelCase and original API parameter names @@ -1178,6 +1238,16 @@ export class StreamClient { start_time: 'startTime', end_time: 'endTime', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1193,13 +1263,25 @@ export class StreamClient { endTime = undefined, + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], + headers = {}, signal, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/likes/compliance/stream'; + let path = '/2/tweets/sample10/stream'; // Build query parameters const params = new URLSearchParams(); @@ -1208,6 +1290,10 @@ export class StreamClient { params.append('backfill_minutes', String(backfillMinutes)); } + if (partition !== undefined) { + params.append('partition', String(partition)); + } + if (startTime !== undefined) { params.append('start_time', String(startTime)); } @@ -1216,6 +1302,30 @@ export class StreamClient { params.append('end_time', String(endTime)); } + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + // Make the authenticated request using the main client's request method // We need raw: true to get the raw Response object for streaming const url = path + (params.toString() ? `?${params.toString()}` : ''); @@ -1259,8 +1369,8 @@ export class StreamClient { } /** - * Stream sampled Likes - * Streams a 10% sample of public Likes in real-time. + * Stream Korean Posts + * Streams all public Korean-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -1274,9 +1384,9 @@ export class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - async likesSample10( + async postsFirehoseKo( partition: number, - options: LikesSample10StreamingOptions = {} + options: PostsFirehoseKoStreamingOptions = {} ): Promise { // Validate authentication requirements @@ -1284,7 +1394,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'likesSample10'); + this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseKo'); // Normalize options to handle both camelCase and original API parameter names @@ -1295,11 +1405,15 @@ export class StreamClient { end_time: 'endTime', - 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields', + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', 'user.fields': 'userFields', - 'tweet.fields': 'tweetFields', + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1315,13 +1429,17 @@ export class StreamClient { endTime = undefined, - likeWithTweetAuthorFields = [], + tweetFields = [], expansions = [], + mediaFields = [], + + pollFields = [], + userFields = [], - tweetFields = [], + placeFields = [], headers = {}, signal, @@ -1329,7 +1447,7 @@ export class StreamClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/likes/sample10/stream'; + let path = '/2/tweets/firehose/stream/lang/ko'; // Build query parameters const params = new URLSearchParams(); @@ -1350,26 +1468,28 @@ export class StreamClient { params.append('end_time', String(endTime)); } - if ( - likeWithTweetAuthorFields !== undefined && - likeWithTweetAuthorFields.length > 0 - ) { - params.append( - 'like_with_tweet_author.fields', - likeWithTweetAuthorFields.join(',') - ); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Make the authenticated request using the main client's request method @@ -1415,8 +1535,8 @@ export class StreamClient { } /** - * Stream Portuguese Posts - * Streams all public Portuguese-language Posts in real-time. + * Stream Likes compliance data + * Streams all compliance data related to Likes for Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -1424,15 +1544,10 @@ export class StreamClient { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehosePt( - partition: number, - options: PostsFirehosePtStreamingOptions = {} + async likesCompliance( + options: LikesComplianceStreamingOptions = {} ): Promise { // Validate authentication requirements @@ -1440,7 +1555,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'postsFirehosePt'); + this.client.validateAuthentication(requiredAuthTypes, 'likesCompliance'); // Normalize options to handle both camelCase and original API parameter names @@ -1450,16 +1565,6 @@ export class StreamClient { start_time: 'startTime', end_time: 'endTime', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - - 'user.fields': 'userFields', - - 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1475,25 +1580,13 @@ export class StreamClient { endTime = undefined, - tweetFields = [], - - expansions = [], - - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], - headers = {}, signal, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/firehose/stream/lang/pt'; + let path = '/2/likes/compliance/stream'; // Build query parameters const params = new URLSearchParams(); @@ -1502,10 +1595,6 @@ export class StreamClient { params.append('backfill_minutes', String(backfillMinutes)); } - if (partition !== undefined) { - params.append('partition', String(partition)); - } - if (startTime !== undefined) { params.append('start_time', String(startTime)); } @@ -1514,30 +1603,6 @@ export class StreamClient { params.append('end_time', String(endTime)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); - } - // Make the authenticated request using the main client's request method // We need raw: true to get the raw Response object for streaming const url = path + (params.toString() ? `?${params.toString()}` : ''); @@ -1581,8 +1646,8 @@ export class StreamClient { } /** - * Stream English Posts - * Streams all public English-language Posts in real-time. + * Stream Posts compliance data + * Streams all compliance data related to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -1596,9 +1661,9 @@ export class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehoseEn( + async postsCompliance( partition: number, - options: PostsFirehoseEnStreamingOptions = {} + options: PostsComplianceStreamingOptions = {} ): Promise { // Validate authentication requirements @@ -1606,7 +1671,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseEn'); + this.client.validateAuthentication(requiredAuthTypes, 'postsCompliance'); // Normalize options to handle both camelCase and original API parameter names @@ -1616,16 +1681,6 @@ export class StreamClient { start_time: 'startTime', end_time: 'endTime', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - - 'user.fields': 'userFields', - - 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1641,25 +1696,13 @@ export class StreamClient { endTime = undefined, - tweetFields = [], - - expansions = [], - - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], - headers = {}, signal, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/firehose/stream/lang/en'; + let path = '/2/tweets/compliance/stream'; // Build query parameters const params = new URLSearchParams(); @@ -1680,30 +1723,6 @@ export class StreamClient { params.append('end_time', String(endTime)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); - } - // Make the authenticated request using the main client's request method // We need raw: true to get the raw Response object for streaming const url = path + (params.toString() ? `?${params.toString()}` : ''); @@ -1747,8 +1766,8 @@ export class StreamClient { } /** - * Stream filtered Posts - * Streams Posts in real-time matching the active rule set. + * Stream all Likes + * Streams all public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -1756,16 +1775,23 @@ export class StreamClient { + * @param partition The partition number. + + + * @returns {Promise} Event-driven stream for handling streaming data */ - async posts(options: PostsStreamingOptions = {}): Promise { + async likesFirehose( + partition: number, + options: LikesFirehoseStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'posts'); + this.client.validateAuthentication(requiredAuthTypes, 'likesFirehose'); // Normalize options to handle both camelCase and original API parameter names @@ -1776,15 +1802,11 @@ export class StreamClient { end_time: 'endTime', - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', + 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields', 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1800,17 +1822,13 @@ export class StreamClient { endTime = undefined, - tweetFields = [], + likeWithTweetAuthorFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - userFields = [], - placeFields = [], + tweetFields = [], headers = {}, signal, @@ -1818,7 +1836,7 @@ export class StreamClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/stream'; + let path = '/2/likes/firehose/stream'; // Build query parameters const params = new URLSearchParams(); @@ -1827,6 +1845,10 @@ export class StreamClient { params.append('backfill_minutes', String(backfillMinutes)); } + if (partition !== undefined) { + params.append('partition', String(partition)); + } + if (startTime !== undefined) { params.append('start_time', String(startTime)); } @@ -1835,28 +1857,26 @@ export class StreamClient { params.append('end_time', String(endTime)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if ( + likeWithTweetAuthorFields !== undefined && + likeWithTweetAuthorFields.length > 0 + ) { + params.append( + 'like_with_tweet_author.fields', + likeWithTweetAuthorFields.join(',') + ); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Make the authenticated request using the main client's request method @@ -1902,8 +1922,8 @@ export class StreamClient { } /** - * Stream Posts compliance data - * Streams all compliance data related to Posts. + * Stream English Posts + * Streams all public English-language Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -1917,9 +1937,9 @@ export class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsCompliance( + async postsFirehoseEn( partition: number, - options: PostsComplianceStreamingOptions = {} + options: PostsFirehoseEnStreamingOptions = {} ): Promise { // Validate authentication requirements @@ -1927,7 +1947,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'postsCompliance'); + this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseEn'); // Normalize options to handle both camelCase and original API parameter names @@ -1937,6 +1957,16 @@ export class StreamClient { start_time: 'startTime', end_time: 'endTime', + + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1952,13 +1982,25 @@ export class StreamClient { endTime = undefined, + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], + headers = {}, signal, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/compliance/stream'; + let path = '/2/tweets/firehose/stream/lang/en'; // Build query parameters const params = new URLSearchParams(); @@ -1979,6 +2021,30 @@ export class StreamClient { params.append('end_time', String(endTime)); } + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + // Make the authenticated request using the main client's request method // We need raw: true to get the raw Response object for streaming const url = path + (params.toString() ? `?${params.toString()}` : ''); @@ -2022,8 +2088,8 @@ export class StreamClient { } /** - * Stream Korean Posts - * Streams all public Korean-language Posts in real-time. + * Stream filtered Posts + * Streams Posts in real-time matching the active rule set. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -2031,23 +2097,16 @@ export class StreamClient { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehoseKo( - partition: number, - options: PostsFirehoseKoStreamingOptions = {} - ): Promise { + async posts(options: PostsStreamingOptions = {}): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseKo'); + this.client.validateAuthentication(requiredAuthTypes, 'posts'); // Normalize options to handle both camelCase and original API parameter names @@ -2100,7 +2159,7 @@ export class StreamClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/firehose/stream/lang/ko'; + let path = '/2/tweets/search/stream'; // Build query parameters const params = new URLSearchParams(); @@ -2109,10 +2168,6 @@ export class StreamClient { params.append('backfill_minutes', String(backfillMinutes)); } - if (partition !== undefined) { - params.append('partition', String(partition)); - } - if (startTime !== undefined) { params.append('start_time', String(startTime)); } @@ -2188,8 +2243,8 @@ export class StreamClient { } /** - * Stream all Likes - * Streams all public Likes in real-time. + * Stream Users compliance data + * Streams all compliance data related to Users. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -2203,9 +2258,9 @@ export class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - async likesFirehose( + async usersCompliance( partition: number, - options: LikesFirehoseStreamingOptions = {} + options: UsersComplianceStreamingOptions = {} ): Promise { // Validate authentication requirements @@ -2213,7 +2268,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'likesFirehose'); + this.client.validateAuthentication(requiredAuthTypes, 'usersCompliance'); // Normalize options to handle both camelCase and original API parameter names @@ -2223,12 +2278,6 @@ export class StreamClient { start_time: 'startTime', end_time: 'endTime', - - 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields', - - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2244,21 +2293,13 @@ export class StreamClient { endTime = undefined, - likeWithTweetAuthorFields = [], - - expansions = [], - - userFields = [], - - tweetFields = [], - headers = {}, signal, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/likes/firehose/stream'; + let path = '/2/users/compliance/stream'; // Build query parameters const params = new URLSearchParams(); @@ -2279,28 +2320,6 @@ export class StreamClient { params.append('end_time', String(endTime)); } - if ( - likeWithTweetAuthorFields !== undefined && - likeWithTweetAuthorFields.length > 0 - ) { - params.append( - 'like_with_tweet_author.fields', - likeWithTweetAuthorFields.join(',') - ); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Make the authenticated request using the main client's request method // We need raw: true to get the raw Response object for streaming const url = path + (params.toString() ? `?${params.toString()}` : ''); @@ -2344,8 +2363,8 @@ export class StreamClient { } /** - * Stream 10% sampled Posts - * Streams a 10% sample of public Posts in real-time. + * Stream all Posts + * Streams all public Posts in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -2359,9 +2378,9 @@ export class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsSample10( + async postsFirehose( partition: number, - options: PostsSample10StreamingOptions = {} + options: PostsFirehoseStreamingOptions = {} ): Promise { // Validate authentication requirements @@ -2369,7 +2388,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'postsSample10'); + this.client.validateAuthentication(requiredAuthTypes, 'postsFirehose'); // Normalize options to handle both camelCase and original API parameter names @@ -2422,7 +2441,7 @@ export class StreamClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/sample10/stream'; + let path = '/2/tweets/firehose/stream'; // Build query parameters const params = new URLSearchParams(); @@ -2510,8 +2529,8 @@ export class StreamClient { } /** - * Stream Japanese Posts - * Streams all public Japanese-language Posts in real-time. + * Stream sampled Likes + * Streams a 10% sample of public Likes in real-time. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -2525,9 +2544,9 @@ export class StreamClient { * @returns {Promise} Event-driven stream for handling streaming data */ - async postsFirehoseJa( + async likesSample10( partition: number, - options: PostsFirehoseJaStreamingOptions = {} + options: LikesSample10StreamingOptions = {} ): Promise { // Validate authentication requirements @@ -2535,7 +2554,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'postsFirehoseJa'); + this.client.validateAuthentication(requiredAuthTypes, 'likesSample10'); // Normalize options to handle both camelCase and original API parameter names @@ -2546,15 +2565,11 @@ export class StreamClient { end_time: 'endTime', - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', + 'like_with_tweet_author.fields': 'likeWithTweetAuthorFields', 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2570,17 +2585,13 @@ export class StreamClient { endTime = undefined, - tweetFields = [], + likeWithTweetAuthorFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - userFields = [], - placeFields = [], + tweetFields = [], headers = {}, signal, @@ -2588,7 +2599,7 @@ export class StreamClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/firehose/stream/lang/ja'; + let path = '/2/likes/sample10/stream'; // Build query parameters const params = new URLSearchParams(); @@ -2609,28 +2620,26 @@ export class StreamClient { params.append('end_time', String(endTime)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if ( + likeWithTweetAuthorFields !== undefined && + likeWithTweetAuthorFields.length > 0 + ) { + params.append( + 'like_with_tweet_author.fields', + likeWithTweetAuthorFields.join(',') + ); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Make the authenticated request using the main client's request method @@ -2676,8 +2685,8 @@ export class StreamClient { } /** - * Stream Users compliance data - * Streams all compliance data related to Users. + * Stream Post labels + * Streams all labeling events applied to Posts. * * Returns an event-driven stream that's easy to use. * Use .on() to listen for events like 'data', 'error', 'close'. @@ -2685,15 +2694,10 @@ export class StreamClient { - * @param partition The partition number. - - - * @returns {Promise} Event-driven stream for handling streaming data */ - async usersCompliance( - partition: number, - options: UsersComplianceStreamingOptions = {} + async labelsCompliance( + options: LabelsComplianceStreamingOptions = {} ): Promise { // Validate authentication requirements @@ -2701,7 +2705,7 @@ export class StreamClient { requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'usersCompliance'); + this.client.validateAuthentication(requiredAuthTypes, 'labelsCompliance'); // Normalize options to handle both camelCase and original API parameter names @@ -2732,7 +2736,7 @@ export class StreamClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/compliance/stream'; + let path = '/2/tweets/label/stream'; // Build query parameters const params = new URLSearchParams(); @@ -2741,10 +2745,6 @@ export class StreamClient { params.append('backfill_minutes', String(backfillMinutes)); } - if (partition !== undefined) { - params.append('partition', String(partition)); - } - if (startTime !== undefined) { params.append('start_time', String(startTime)); } @@ -2796,28 +2796,26 @@ export class StreamClient { } /** - * Get stream rules - * Retrieves the active rule set or a subset of rules for the filtered stream. + * Get stream rule counts + * Retrieves the count of rules in the active rule set for the filtered stream. * * @returns Promise with the API response */ - async getRules( - options: GetRulesStreamingOptions = {} - ): Promise { + async getRuleCounts( + options: GetRuleCountsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getRules'); + this.client.validateAuthentication(requiredAuthTypes, 'getRuleCounts'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', + 'rules_count.fields': 'rulesCountFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2827,11 +2825,7 @@ export class StreamClient { // Destructure options (exclude path parameters, they're already function params) const { - ids = [], - - maxResults = undefined, - - paginationToken = undefined, + rulesCountFields = [], headers = {}, signal, @@ -2839,21 +2833,13 @@ export class StreamClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/stream/rules'; + let path = '/2/tweets/search/stream/rules/counts'; // Build query parameters const params = new URLSearchParams(); - if (ids !== undefined && ids.length > 0) { - params.append('ids', ids.join(',')); - } - - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); + if (rulesCountFields !== undefined && rulesCountFields.length > 0) { + params.append('rules_count.fields', rulesCountFields.join(',')); } // Prepare request options @@ -2868,7 +2854,7 @@ export class StreamClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2876,29 +2862,28 @@ export class StreamClient { } /** - * Update stream rules - * Adds or deletes rules from the active rule set for the filtered stream. + * Get stream rules + * Retrieves the active rule set or a subset of rules for the filtered stream. * * @returns Promise with the API response */ - async updateRules( - body: any, - options: UpdateRulesStreamingOptions = {} - ): Promise { + async getRules( + options: GetRulesStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'updateRules'); + this.client.validateAuthentication(requiredAuthTypes, 'getRules'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - dry_run: 'dryRun', + max_results: 'maxResults', - delete_all: 'deleteAll', + pagination_token: 'paginationToken', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2908,9 +2893,11 @@ export class StreamClient { // Destructure options (exclude path parameters, they're already function params) const { - dryRun = undefined, + ids = [], - deleteAll = undefined, + maxResults = undefined, + + paginationToken = undefined, headers = {}, signal, @@ -2923,12 +2910,16 @@ export class StreamClient { // Build query parameters const params = new URLSearchParams(); - if (dryRun !== undefined) { - params.append('dry_run', String(dryRun)); + if (ids !== undefined && ids.length > 0) { + params.append('ids', ids.join(',')); } - if (deleteAll !== undefined) { - params.append('delete_all', String(deleteAll)); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } // Prepare request options @@ -2939,40 +2930,41 @@ export class StreamClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get stream rule counts - * Retrieves the count of rules in the active rule set for the filtered stream. + * Update stream rules + * Adds or deletes rules from the active rule set for the filtered stream. * * @returns Promise with the API response */ - async getRuleCounts( - options: GetRuleCountsStreamingOptions = {} - ): Promise { + async updateRules( + body: any, + options: UpdateRulesStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getRuleCounts'); + this.client.validateAuthentication(requiredAuthTypes, 'updateRules'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'rules_count.fields': 'rulesCountFields', + dry_run: 'dryRun', + + delete_all: 'deleteAll', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2982,7 +2974,9 @@ export class StreamClient { // Destructure options (exclude path parameters, they're already function params) const { - rulesCountFields = [], + dryRun = undefined, + + deleteAll = undefined, headers = {}, signal, @@ -2990,13 +2984,17 @@ export class StreamClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/stream/rules/counts'; + let path = '/2/tweets/search/stream/rules'; // Build query parameters const params = new URLSearchParams(); - if (rulesCountFields !== undefined && rulesCountFields.length > 0) { - params.append('rules_count.fields', rulesCountFields.join(',')); + if (dryRun !== undefined) { + params.append('dry_run', String(dryRun)); + } + + if (deleteAll !== undefined) { + params.append('delete_all', String(deleteAll)); } // Prepare request options @@ -3007,12 +3005,14 @@ export class StreamClient { }, signal: signal, + body: JSON.stringify(body), + ...requestOptions, }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/trends/client.ts b/xdk/typescript/src/trends/client.ts index b7b9103c..e345c4a0 100644 --- a/xdk/typescript/src/trends/client.ts +++ b/xdk/typescript/src/trends/client.ts @@ -16,20 +16,20 @@ import { EventPaginator, } from '../paginator.js'; import { - GetAiResponse, - GetByWoeidResponse, GetPersonalizedResponse, + GetByWoeidResponse, + GetAiResponse, } from './models.js'; /** - * Options for getAi method + * Options for getPersonalized method * * @public */ -export interface GetAiOptions { - /** A comma separated list of News fields to display. - * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ - newsFields?: Array; +export interface GetPersonalizedOptions { + /** A comma separated list of PersonalizedTrend fields to display. + * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */ + personalizedTrendFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -58,14 +58,14 @@ export interface GetByWoeidOptions { } /** - * Options for getPersonalized method + * Options for getAi method * * @public */ -export interface GetPersonalizedOptions { - /** A comma separated list of PersonalizedTrend fields to display. - * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */ - personalizedTrendFields?: Array; +export interface GetAiOptions { + /** A comma separated list of News fields to display. + * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ + newsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -124,23 +124,21 @@ export class TrendsClient { } /** - * Get AI Trends by ID - * Retrieves an AI trend by its ID. - - - * @param id The ID of the ai trend. - + * Get personalized Trends + * Retrieves personalized trending topics for the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getAi(id: string, options: GetAiOptions = {}): Promise { + async getPersonalized( + options: GetPersonalizedOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'news.fields': 'newsFields', + 'personalized_trend.fields': 'personalizedTrendFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -149,21 +147,25 @@ export class TrendsClient { // Destructure options (exclude path parameters, they're already function params) const { - newsFields = [], + personalizedTrendFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/ai_trends/{id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/users/personalized_trends'; // Build query parameters const params = new URLSearchParams(); - if (newsFields !== undefined && newsFields.length > 0) { - params.append('news.fields', newsFields.join(',')); + if ( + personalizedTrendFields !== undefined && + personalizedTrendFields.length > 0 + ) { + params.append( + 'personalized_trend.fields', + personalizedTrendFields.join(',') + ); } // Prepare request options @@ -171,14 +173,18 @@ export class TrendsClient { // Pass security requirements for smart auth selection security: [ { - BearerToken: [], + OAuth2UserToken: ['tweet.read', 'users.read'], + }, + + { + UserToken: [], }, ], ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -259,21 +265,23 @@ export class TrendsClient { } /** - * Get personalized Trends - * Retrieves personalized trending topics for the authenticated user. + * Get AI Trends by ID + * Retrieves an AI trend by its ID. + * @param id The ID of the ai trend. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPersonalized( - options: GetPersonalizedOptions = {} - ): Promise { + async getAi(id: string, options: GetAiOptions = {}): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'personalized_trend.fields': 'personalizedTrendFields', + 'news.fields': 'newsFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -282,25 +290,21 @@ export class TrendsClient { // Destructure options (exclude path parameters, they're already function params) const { - personalizedTrendFields = [], + newsFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/personalized_trends'; + let path = '/2/ai_trends/{id}'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if ( - personalizedTrendFields !== undefined && - personalizedTrendFields.length > 0 - ) { - params.append( - 'personalized_trend.fields', - personalizedTrendFields.join(',') - ); + if (newsFields !== undefined && newsFields.length > 0) { + params.append('news.fields', newsFields.join(',')); } // Prepare request options @@ -308,18 +312,14 @@ export class TrendsClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['tweet.read', 'users.read'], - }, - - { - UserToken: [], + BearerToken: [], }, ], ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions diff --git a/xdk/typescript/src/trends/models.ts b/xdk/typescript/src/trends/models.ts index dcc15edb..146aa79d 100644 --- a/xdk/typescript/src/trends/models.ts +++ b/xdk/typescript/src/trends/models.ts @@ -11,11 +11,11 @@ import type * as Schemas from '../schemas.js'; /** - * Response for getAi + * Response for getPersonalized * * @public */ -export type GetAiResponse = Schemas.Get2AiTrendsIdResponse; +export type GetPersonalizedResponse = Schemas.Get2UsersPersonalizedTrendsResponse; /** * Response for getByWoeid * @@ -23,8 +23,8 @@ export type GetAiResponse = Schemas.Get2AiTrendsIdResponse; */ export type GetByWoeidResponse = Schemas.Get2TrendsByWoeidWoeidResponse; /** - * Response for getPersonalized + * Response for getAi * * @public */ -export type GetPersonalizedResponse = Schemas.Get2UsersPersonalizedTrendsResponse; \ No newline at end of file +export type GetAiResponse = Schemas.Get2AiTrendsIdResponse; \ No newline at end of file diff --git a/xdk/typescript/src/trends/stream_client.ts b/xdk/typescript/src/trends/stream_client.ts index cd18fdfc..03567c4b 100644 --- a/xdk/typescript/src/trends/stream_client.ts +++ b/xdk/typescript/src/trends/stream_client.ts @@ -10,20 +10,20 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { - GetAiResponse, - GetByWoeidResponse, GetPersonalizedResponse, + GetByWoeidResponse, + GetAiResponse, } from './models.js'; /** - * Options for getAi method + * Options for getPersonalized method * * @public */ -export interface GetAiStreamingOptions { - /** A comma separated list of News fields to display. - * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ - newsFields?: Array; +export interface GetPersonalizedStreamingOptions { + /** A comma separated list of PersonalizedTrend fields to display. + * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */ + personalizedTrendFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -58,14 +58,14 @@ export interface GetByWoeidStreamingOptions { [key: string]: any; } /** - * Options for getPersonalized method + * Options for getAi method * * @public */ -export interface GetPersonalizedStreamingOptions { - /** A comma separated list of PersonalizedTrend fields to display. - * Also accepts: personalized_trend.fields or proper camelCase (e.g., personalizedTrendFields) */ - personalizedTrendFields?: Array; +export interface GetAiStreamingOptions { + /** A comma separated list of News fields to display. + * Also accepts: news.fields or proper camelCase (e.g., newsFields) */ + newsFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -114,27 +114,28 @@ export class TrendsClient { } /** - * Get AI Trends by ID - * Retrieves an AI trend by its ID. + * Get personalized Trends + * Retrieves personalized trending topics for the authenticated user. * * @returns Promise with the API response */ - async getAi( - id: string, - options: GetAiStreamingOptions = {} - ): Promise { + async getPersonalized( + options: GetPersonalizedStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getAi'); + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'getPersonalized'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'news.fields': 'newsFields', + 'personalized_trend.fields': 'personalizedTrendFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -144,7 +145,7 @@ export class TrendsClient { // Destructure options (exclude path parameters, they're already function params) const { - newsFields = [], + personalizedTrendFields = [], headers = {}, signal, @@ -152,15 +153,19 @@ export class TrendsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/ai_trends/{id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/users/personalized_trends'; // Build query parameters const params = new URLSearchParams(); - if (newsFields !== undefined && newsFields.length > 0) { - params.append('news.fields', newsFields.join(',')); + if ( + personalizedTrendFields !== undefined && + personalizedTrendFields.length > 0 + ) { + params.append( + 'personalized_trend.fields', + personalizedTrendFields.join(',') + ); } // Prepare request options @@ -175,7 +180,7 @@ export class TrendsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -260,28 +265,27 @@ export class TrendsClient { } /** - * Get personalized Trends - * Retrieves personalized trending topics for the authenticated user. + * Get AI Trends by ID + * Retrieves an AI trend by its ID. * * @returns Promise with the API response */ - async getPersonalized( - options: GetPersonalizedStreamingOptions = {} - ): Promise { + async getAi( + id: string, + options: GetAiStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('OAuth2UserToken'); - - requiredAuthTypes.push('UserToken'); + requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getPersonalized'); + this.client.validateAuthentication(requiredAuthTypes, 'getAi'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'personalized_trend.fields': 'personalizedTrendFields', + 'news.fields': 'newsFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -291,7 +295,7 @@ export class TrendsClient { // Destructure options (exclude path parameters, they're already function params) const { - personalizedTrendFields = [], + newsFields = [], headers = {}, signal, @@ -299,19 +303,15 @@ export class TrendsClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/personalized_trends'; + let path = '/2/ai_trends/{id}'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if ( - personalizedTrendFields !== undefined && - personalizedTrendFields.length > 0 - ) { - params.append( - 'personalized_trend.fields', - personalizedTrendFields.join(',') - ); + if (newsFields !== undefined && newsFields.length > 0) { + params.append('news.fields', newsFields.join(',')); } // Prepare request options @@ -326,7 +326,7 @@ export class TrendsClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions diff --git a/xdk/typescript/src/users/client.ts b/xdk/typescript/src/users/client.ts index 65b0f943..ff4b32f6 100644 --- a/xdk/typescript/src/users/client.ts +++ b/xdk/typescript/src/users/client.ts @@ -16,59 +16,83 @@ import { EventPaginator, } from '../paginator.js'; import { - UnlikePostResponse, - GetOwnedListsResponse, - GetBlockingResponse, - DeleteBookmarkResponse, - GetByUsernameResponse, - UnpinListResponse, - GetPostsResponse, - GetBookmarksResponse, - CreateBookmarkRequest, - CreateBookmarkResponse, - BlockDmsResponse, + GetByUsernamesResponse, + GetListMembershipsResponse, + UnfollowUserResponse, UnfollowListResponse, + GetByIdsResponse, + LikePostRequest, + LikePostResponse, + BlockDmsResponse, + GetPostsResponse, + GetBookmarksByFolderIdResponse, GetMutingResponse, MuteUserRequest, MuteUserResponse, - GetByIdResponse, - GetMeResponse, - UnrepostPostResponse, - UnmuteUserResponse, - SearchResponse, - GetPinnedListsResponse, - PinListRequest, - PinListResponse, + GetOwnedListsResponse, + UnpinListResponse, + GetByUsernameResponse, + GetBlockingResponse, + GetLikedPostsResponse, + UnlikePostResponse, GetFollowedListsResponse, FollowListRequest, FollowListResponse, - LikePostRequest, - LikePostResponse, - GetLikedPostsResponse, - GetByUsernamesResponse, - RepostPostRequest, - RepostPostResponse, - UnfollowUserResponse, - GetFollowersResponse, - GetByIdsResponse, - GetBookmarksByFolderIdResponse, - GetBookmarkFoldersResponse, + GetTimelineResponse, + GetPinnedListsResponse, + PinListRequest, + PinListResponse, + GetRepostsOfMeResponse, GetFollowingResponse, FollowUserRequest, FollowUserResponse, - GetTimelineResponse, UnblockDmsResponse, GetMentionsResponse, - GetListMembershipsResponse, - GetRepostsOfMeResponse, + GetBookmarkFoldersResponse, + UnrepostPostResponse, + DeleteBookmarkResponse, + RepostPostRequest, + RepostPostResponse, + SearchResponse, + GetByIdResponse, + GetBookmarksResponse, + CreateBookmarkRequest, + CreateBookmarkResponse, + GetFollowersResponse, + GetMeResponse, + UnmuteUserResponse, } from './models.js'; /** - * Options for getOwnedLists method + * Options for getByUsernames method * * @public */ -export interface GetOwnedListsOptions { +export interface GetByUsernamesOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for getListMemberships method + * + * @public + */ +export interface GetListMembershipsOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -96,19 +120,11 @@ export interface GetOwnedListsOptions { } /** - * Options for getBlocking method + * Options for getByIds method * * @public */ -export interface GetBlockingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - +export interface GetByIdsOptions { /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; @@ -128,22 +144,13 @@ export interface GetBlockingOptions { } /** - * Options for getByUsername method + * Options for likePost method * * @public */ -export interface GetByUsernameOptions { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; +export interface LikePostOptions { + /** Request body */ + body?: LikePostRequest; /** Additional request options */ requestOptions?: RequestOptions; @@ -215,50 +222,6 @@ export interface GetPostsOptions { [key: string]: any; } -/** - * Options for getBookmarks method - * - * @public - */ -export interface GetBookmarksOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - /** * Options for getMuting method * @@ -307,22 +270,30 @@ export interface MuteUserOptions { } /** - * Options for getById method + * Options for getOwnedLists method * * @public */ -export interface GetByIdOptions { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; +export interface GetOwnedListsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -331,11 +302,11 @@ export interface GetByIdOptions { } /** - * Options for getMe method + * Options for getByUsername method * * @public */ -export interface GetMeOptions { +export interface GetByUsernameOptions { /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; @@ -355,18 +326,18 @@ export interface GetMeOptions { } /** - * Options for search method + * Options for getBlocking method * * @public */ -export interface SearchOptions { +export interface GetBlockingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ @@ -387,23 +358,43 @@ export interface SearchOptions { } /** - * Options for getPinnedLists method + * Options for getLikedPosts method * * @public */ -export interface GetPinnedListsOptions { - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; +export interface GetLikedPostsOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ @@ -458,26 +449,19 @@ export interface FollowListOptions { } /** - * Options for likePost method + * Options for getTimeline method * * @public */ -export interface LikePostOptions { - /** Request body */ - body?: LikePostRequest; +export interface GetTimelineOptions { + /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} + /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; -/** - * Options for getLikedPosts method - * - * @public - */ -export interface GetLikedPostsOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -486,6 +470,18 @@ export interface GetLikedPostsOptions { * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; + /** The set of entities to exclude (e.g. 'replies' or 'retweets'). + * Also accepts: exclude or proper camelCase (e.g., exclude) */ + exclude?: Array; + + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -517,37 +513,22 @@ export interface GetLikedPostsOptions { } /** - * Options for getByUsernames method + * Options for getPinnedLists method * * @public */ -export interface GetByUsernamesOptions { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; +export interface GetPinnedListsOptions { + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for repostPost method - * - * @public - */ -export interface RepostPostOptions { - /** Request body */ - body?: RepostPostRequest; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -556,74 +537,42 @@ export interface RepostPostOptions { } /** - * Options for getFollowers method + * Options for getRepostsOfMe method * * @public */ -export interface GetFollowersOptions { +export interface GetRepostsOfMeOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get a specified 'page' of results. + /** This parameter is used to get the next 'page' of results. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for getByIds method - * - * @public - */ -export interface GetByIdsOptions { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; -/** - * Options for getBookmarkFolders method - * - * @public - */ -export interface GetBookmarkFoldersOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -679,11 +628,11 @@ export interface FollowUserOptions { } /** - * Options for getTimeline method + * Options for getMentions method * * @public */ -export interface GetTimelineOptions { +export interface GetMentionsOptions { /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. * Also accepts: since_id or proper camelCase (e.g., sinceId) */ sinceId?: any; @@ -700,10 +649,6 @@ export interface GetTimelineOptions { * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** The set of entities to exclude (e.g. 'replies' or 'retweets'). - * Also accepts: exclude or proper camelCase (e.g., exclude) */ - exclude?: Array; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. * Also accepts: start_time or proper camelCase (e.g., startTime) */ startTime?: string; @@ -743,19 +688,11 @@ export interface GetTimelineOptions { } /** - * Options for getMentions method + * Options for getBookmarkFolders method * * @public */ -export interface GetMentionsOptions { - /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - - /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - +export interface GetBookmarkFoldersOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -764,37 +701,20 @@ export interface GetMentionsOptions { * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; +/** + * Options for repostPost method + * + * @public + */ +export interface RepostPostOptions { + /** Request body */ + body?: RepostPostRequest; /** Additional request options */ requestOptions?: RequestOptions; @@ -803,31 +723,55 @@ export interface GetMentionsOptions { } /** - * Options for getListMemberships method + * Options for search method * * @public */ -export interface GetListMembershipsOptions { +export interface SearchOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for getById method + * + * @public + */ +export interface GetByIdOptions { /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ requestOptions?: RequestOptions; /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ @@ -835,11 +779,11 @@ export interface GetListMembershipsOptions { } /** - * Options for getRepostsOfMe method + * Options for getBookmarks method * * @public */ -export interface GetRepostsOfMeOptions { +export interface GetBookmarksOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -879,41 +823,97 @@ export interface GetRepostsOfMeOptions { } /** - * Client for users operations - * - * This client provides methods for interacting with the users endpoints - * of the X API. It handles authentication, request formatting, and response - * parsing for all users related operations. + * Options for getFollowers method * - * @category users + * @public */ -export class UsersClient { - private client: Client; - - /** - * Creates a new users client instance - * - * @param client - The main X API client instance - */ - constructor(client: Client) { - this.client = client; - } +export interface GetFollowersOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; - /** - * Normalize options object to handle both camelCase and original API parameter names - * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) - */ - private _normalizeOptions>( - options: T, - paramMappings: Record - ): T { - if (!options || typeof options !== 'object') { - return options; - } + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; - const normalized: any = { ...options }; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; - // For each parameter mapping (original -> proper camelCase) + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for getMe method + * + * @public + */ +export interface GetMeOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Client for users operations + * + * This client provides methods for interacting with the users endpoints + * of the X API. It handles authentication, request formatting, and response + * parsing for all users related operations. + * + * @category users + */ +export class UsersClient { + private client: Client; + + /** + * Creates a new users client instance + * + * @param client - The main X API client instance + */ + constructor(client: Client) { + this.client = client; + } + + /** + * Normalize options object to handle both camelCase and original API parameter names + * Only accepts: proper camelCase (tweetFields) and original API format (tweet.fields) + */ + private _normalizeOptions>( + options: T, + paramMappings: Record + ): T { + if (!options || typeof options !== 'object') { + return options; + } + + const normalized: any = { ...options }; + + // For each parameter mapping (original -> proper camelCase) for (const [originalName, camelName] of Object.entries(paramMappings)) { // Check if original format is used (e.g., 'tweet.fields', 'tweet_fields') if (originalName in normalized && !(camelName in normalized)) { @@ -929,43 +929,77 @@ export class UsersClient { } /** - * Unlike Post - * Causes the authenticated user to Unlike a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to unlike the Post. - + * Get Users by usernames + * Retrieves details of multiple Users by their usernames. - * @param tweetId The ID of the Post that the User is requesting to unlike. + * @param usernames A list of usernames, comma-separated. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unlikePost(id: string, tweetId: string): Promise { + async getByUsernames( + usernames: Array, + options: GetByUsernamesOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const requestOptions = {}; + const paramMappings: Record = { + 'user.fields': 'userFields', - // Build the path with path parameters - let path = '/2/users/{id}/likes/{tweet_id}'; + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); - path = path.replace('{id}', encodeURIComponent(String(id))); + // Destructure options (exclude path parameters, they're already function params) + const { + userFields = [], - path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); + expansions = [], + + tweetFields = [], + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/by'; // Build query parameters const params = new URLSearchParams(); + if (usernames !== undefined && usernames.length > 0) { + params.append('usernames', usernames.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'], + BearerToken: [], + }, + + { + OAuth2UserToken: ['tweet.read', 'users.read'], }, { @@ -973,19 +1007,19 @@ export class UsersClient { }, ], - // No optional parameters, using empty request options + ...requestOptions, }; - return this.client.request( - 'DELETE', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get owned Lists - * Retrieves a list of Lists owned by a specific User by their ID. + * Get List memberships + * Retrieves a list of Lists that a specific User is a member of by their ID. * @param id The ID of the User to lookup. @@ -993,13 +1027,13 @@ export class UsersClient { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getOwnedLists( + async getListMemberships( id: string, - options: GetOwnedListsOptions = {} - ): Promise { + options: GetListMembershipsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -1032,7 +1066,7 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/owned_lists'; + let path = '/2/users/{id}/list_memberships'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -1079,7 +1113,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1087,87 +1121,52 @@ export class UsersClient { } /** - * Get blocking - * Retrieves a list of Users blocked by the specified User ID. + * Unfollow User + * Causes the authenticated user to unfollow a specific user by their ID. - * @param id The ID of the authenticated source User for whom to return results. + * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. + * @param targetUserId The ID of the User that the source User is requesting to unfollow. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBlocking( - id: string, - options: GetBlockingOptions = {} - ): Promise { + async unfollowUser( + sourceUserId: string, + targetUserId: string + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', + const requestOptions = {}; - 'user.fields': 'userFields', + // Build the path with path parameters + let path = '/2/users/{source_user_id}/following/{target_user_id}'; - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings + path = path.replace( + '{source_user_id}', + encodeURIComponent(String(sourceUserId)) ); - // Destructure options (exclude path parameters, they're already function params) - const { - maxResults = undefined, - - paginationToken = undefined, - - userFields = [], - - expansions = [], - - tweetFields = [], - - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/users/{id}/blocking'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace( + '{target_user_id}', + encodeURIComponent(String(targetUserId)) + ); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['block.read', 'tweet.read', 'users.read'], + OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'], }, { @@ -1175,47 +1174,47 @@ export class UsersClient { }, ], - ...requestOptions, + // No optional parameters, using empty request options }; - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Delete Bookmark - * Removes a Post from the authenticated user’s Bookmarks by its ID. + * Unfollow List + * Causes the authenticated user to unfollow a specific List by its ID. - * @param id The ID of the authenticated source User whose bookmark is to be removed. + * @param id The ID of the authenticated source User that will unfollow the List. - * @param tweetId The ID of the Post that the source User is removing from bookmarks. + * @param listId The ID of the List to unfollow. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteBookmark( + async unfollowList( id: string, - tweetId: string - ): Promise { + listId: string + ): Promise { // Normalize options to handle both camelCase and original API parameter names const requestOptions = {}; // Build the path with path parameters - let path = '/2/users/{id}/bookmarks/{tweet_id}'; + let path = '/2/users/{id}/followed_lists/{list_id}'; path = path.replace('{id}', encodeURIComponent(String(id))); - path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); + path = path.replace('{list_id}', encodeURIComponent(String(listId))); // Build query parameters const params = new URLSearchParams(); @@ -1225,14 +1224,18 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], + }, + + { + UserToken: [], }, ], // No optional parameters, using empty request options }; - return this.client.request( + return this.client.request( 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1240,22 +1243,22 @@ export class UsersClient { } /** - * Get User by username - * Retrieves details of a specific User by their username. + * Get Users by IDs + * Retrieves details of multiple Users by their IDs. - * @param username A username. + * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByUsername( - username: string, - options: GetByUsernameOptions = {} - ): Promise { + async getByIds( + ids: Array, + options: GetByIdsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -1280,13 +1283,15 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/by/username/{username}'; - - path = path.replace('{username}', encodeURIComponent(String(username))); + let path = '/2/users'; // Build query parameters const params = new URLSearchParams(); + if (ids !== undefined && ids.length > 0) { + params.append('ids', ids.join(',')); + } + if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } @@ -1319,7 +1324,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1327,34 +1332,89 @@ export class UsersClient { } /** - * Unpin List - * Causes the authenticated user to unpin a specific List by its ID. + * Like Post + * Causes the authenticated user to Like a specific Post by its ID. - * @param id The ID of the authenticated source User for whom to return results. + * @param id The ID of the authenticated source User that is requesting to like the Post. - * @param listId The ID of the List to unpin. + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async likePost( + id: string, + options: LikePostOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + const { + body, + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/{id}/likes'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + // Build query parameters + const params = new URLSearchParams(); + // Prepare request options + const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, - * @returns {Promise} Promise resolving to the API response + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'], + }, + + { + UserToken: [], + }, + ], + + ...requestOptions, + }; + + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Block DMs + * Blocks direct messages to or from a specific User by their ID for the authenticated user. + + + * @param id The ID of the target User that the authenticated user requesting to block dms for. + + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unpinList(id: string, listId: string): Promise { + async blockDms(id: string): Promise { // Normalize options to handle both camelCase and original API parameter names const requestOptions = {}; // Build the path with path parameters - let path = '/2/users/{id}/pinned_lists/{list_id}'; + let path = '/2/users/{id}/dm/block'; path = path.replace('{id}', encodeURIComponent(String(id))); - path = path.replace('{list_id}', encodeURIComponent(String(listId))); - // Build query parameters const params = new URLSearchParams(); @@ -1363,7 +1423,7 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], }, { @@ -1374,8 +1434,8 @@ export class UsersClient { // No optional parameters, using empty request options }; - return this.client.request( - 'DELETE', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); @@ -1547,38 +1607,86 @@ export class UsersClient { } /** - * Get Bookmarks - * Retrieves a list of Posts bookmarked by the authenticated user. + * Get Bookmarks by folder ID + * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. * @param id The ID of the authenticated source User for whom to return results. + * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getBookmarks( + async getBookmarksByFolderId( id: string, - options: GetBookmarksOptions = {} - ): Promise { + folderId: string + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', + const requestOptions = {}; - pagination_token: 'paginationToken', + // Build the path with path parameters + let path = '/2/users/{id}/bookmarks/folders/{folder_id}'; - 'tweet.fields': 'tweetFields', + path = path.replace('{id}', encodeURIComponent(String(id))); - 'media.fields': 'mediaFields', + path = path.replace('{folder_id}', encodeURIComponent(String(folderId))); - 'poll.fields': 'pollFields', + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'], + }, + ], + + // No optional parameters, using empty request options + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Get muting + * Retrieves a list of Users muted by the authenticated user. + + + * @param id The ID of the authenticated source User for whom to return results. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async getMuting( + id: string, + options: GetMutingOptions = {} + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1591,23 +1699,17 @@ export class UsersClient { paginationToken = undefined, - tweetFields = [], + userFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + tweetFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/bookmarks'; + let path = '/2/users/{id}/muting'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -1622,28 +1724,16 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -1651,14 +1741,18 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'], + OAuth2UserToken: ['mute.read', 'tweet.read', 'users.read'], + }, + + { + UserToken: [], }, ], ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1666,77 +1760,35 @@ export class UsersClient { } /** - * Create Bookmark - * Adds a post to the authenticated user’s bookmarks. - + * Mute User + * Causes the authenticated user to mute a specific User by their ID. - * @param id The ID of the authenticated source User for whom to add bookmarks. + * @param id The ID of the authenticated source User that is requesting to mute the target User. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createBookmark( + async muteUser( id: string, - body: CreateBookmarkRequest - ): Promise { + options: MuteUserOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const requestOptions = {}; + const normalizedOptions = options || {}; - // Build the path with path parameters - let path = '/2/users/{id}/bookmarks'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - body: JSON.stringify(body || {}), - - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'], - }, - ], - - // No optional parameters, using empty request options - }; - - return this.client.request( - 'POST', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Block DMs - * Blocks direct messages to or from a specific User by their ID for the authenticated user. - - - * @param id The ID of the target User that the authenticated user requesting to block dms for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async blockDms(id: string): Promise { - // Normalize options to handle both camelCase and original API parameter names + // Destructure options (exclude path parameters, they're already function params) + const { + body, - const requestOptions = {}; + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/dm/block'; + let path = '/2/users/{id}/muting'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -1745,68 +1797,12 @@ export class UsersClient { // Prepare request options const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - // No optional parameters, using empty request options - }; - - return this.client.request( - 'POST', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Unfollow List - * Causes the authenticated user to unfollow a specific List by its ID. - - - * @param id The ID of the authenticated source User that will unfollow the List. - - - - * @param listId The ID of the List to unfollow. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async unfollowList( - id: string, - listId: string - ): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const requestOptions = {}; - - // Build the path with path parameters - let path = '/2/users/{id}/followed_lists/{list_id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - path = path.replace('{list_id}', encodeURIComponent(String(listId))); - - // Build query parameters - const params = new URLSearchParams(); + body: body ? JSON.stringify(body) : undefined, - // Prepare request options - const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'], }, { @@ -1814,33 +1810,33 @@ export class UsersClient { }, ], - // No optional parameters, using empty request options + ...requestOptions, }; - return this.client.request( - 'DELETE', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get muting - * Retrieves a list of Users muted by the authenticated user. + * Get owned Lists + * Retrieves a list of Lists owned by a specific User by their ID. - * @param id The ID of the authenticated source User for whom to return results. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMuting( + async getOwnedLists( id: string, - options: GetMutingOptions = {} - ): Promise { + options: GetOwnedListsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -1848,9 +1844,9 @@ export class UsersClient { pagination_token: 'paginationToken', - 'user.fields': 'userFields', + 'list.fields': 'listFields', - 'tweet.fields': 'tweetFields', + 'user.fields': 'userFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -1863,17 +1859,17 @@ export class UsersClient { paginationToken = undefined, - userFields = [], + listFields = [], expansions = [], - tweetFields = [], + userFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/muting'; + let path = '/2/users/{id}/owned_lists'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -1888,16 +1884,16 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (listFields !== undefined && listFields.length > 0) { + params.append('list.fields', listFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } // Prepare request options @@ -1905,7 +1901,11 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['mute.read', 'tweet.read', 'users.read'], + BearerToken: [], + }, + + { + OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'], }, { @@ -1916,7 +1916,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1924,49 +1924,43 @@ export class UsersClient { } /** - * Mute User - * Causes the authenticated user to mute a specific User by their ID. + * Unpin List + * Causes the authenticated user to unpin a specific List by its ID. - * @param id The ID of the authenticated source User that is requesting to mute the target User. + * @param id The ID of the authenticated source User for whom to return results. + * @param listId The ID of the List to unpin. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async muteUser( - id: string, - options: MuteUserOptions = {} - ): Promise { + async unpinList(id: string, listId: string): Promise { // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) - const { - body, - - requestOptions: requestOptions = {}, - } = normalizedOptions; + const requestOptions = {}; // Build the path with path parameters - let path = '/2/users/{id}/muting'; + let path = '/2/users/{id}/pinned_lists/{list_id}'; path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace('{list_id}', encodeURIComponent(String(listId))); + // Build query parameters const params = new URLSearchParams(); // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], }, { @@ -1974,33 +1968,33 @@ export class UsersClient { }, ], - ...requestOptions, + // No optional parameters, using empty request options }; - return this.client.request( - 'POST', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get User by ID - * Retrieves details of a specific User by their ID. + * Get User by username + * Retrieves details of a specific User by their username. - * @param id The ID of the User to lookup. + * @param username A username. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getById( - id: string, - options: GetByIdOptions = {} - ): Promise { + async getByUsername( + username: string, + options: GetByUsernameOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -2025,9 +2019,9 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}'; + let path = '/2/users/by/username/{username}'; - path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace('{username}', encodeURIComponent(String(username))); // Build query parameters const params = new URLSearchParams(); @@ -2064,7 +2058,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2072,18 +2066,29 @@ export class UsersClient { } /** - * Get my User - * Retrieves details of the authenticated user. + * Get blocking + * Retrieves a list of Users blocked by the specified User ID. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMe(options: GetMeOptions = {}): Promise { + async getBlocking( + id: string, + options: GetBlockingOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + 'user.fields': 'userFields', 'tweet.fields': 'tweetFields', @@ -2095,6 +2100,10 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { + maxResults = undefined, + + paginationToken = undefined, + userFields = [], expansions = [], @@ -2105,11 +2114,21 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/me'; + let path = '/2/users/{id}/blocking'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } @@ -2127,7 +2146,7 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['tweet.read', 'users.read'], + OAuth2UserToken: ['block.read', 'tweet.read', 'users.read'], }, { @@ -2138,7 +2157,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2146,49 +2165,111 @@ export class UsersClient { } /** - * Unrepost Post - * Causes the authenticated user to unrepost a specific Post by its ID. - - - * @param id The ID of the authenticated source User that is requesting to repost the Post. - + * Get liked Posts + * Retrieves a list of Posts liked by a specific User by their ID. - * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unrepostPost( + async getLikedPosts( id: string, - sourceTweetId: string - ): Promise { + options: GetLikedPostsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const requestOptions = {}; + const paramMappings: Record = { + max_results: 'maxResults', - // Build the path with path parameters - let path = '/2/users/{id}/retweets/{source_tweet_id}'; + pagination_token: 'paginationToken', - path = path.replace('{id}', encodeURIComponent(String(id))); + 'tweet.fields': 'tweetFields', - path = path.replace( - '{source_tweet_id}', - encodeURIComponent(String(sourceTweetId)) + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings ); + // Destructure options (exclude path parameters, they're already function params) + const { + maxResults = undefined, + + paginationToken = undefined, + + tweetFields = [], + + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], + + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/{id}/liked_tweets'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'], + OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'], }, { @@ -2196,53 +2277,44 @@ export class UsersClient { }, ], - // No optional parameters, using empty request options + ...requestOptions, }; - return this.client.request( - 'DELETE', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Unmute User - * Causes the authenticated user to unmute a specific user by their ID. + * Unlike Post + * Causes the authenticated user to Unlike a specific Post by its ID. - * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. + * @param id The ID of the authenticated source User that is requesting to unlike the Post. - * @param targetUserId The ID of the User that the source User is requesting to unmute. + * @param tweetId The ID of the Post that the User is requesting to unlike. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unmuteUser( - sourceUserId: string, - targetUserId: string - ): Promise { + async unlikePost(id: string, tweetId: string): Promise { // Normalize options to handle both camelCase and original API parameter names const requestOptions = {}; // Build the path with path parameters - let path = '/2/users/{source_user_id}/muting/{target_user_id}'; + let path = '/2/users/{id}/likes/{tweet_id}'; - path = path.replace( - '{source_user_id}', - encodeURIComponent(String(sourceUserId)) - ); + path = path.replace('{id}', encodeURIComponent(String(id))); - path = path.replace( - '{target_user_id}', - encodeURIComponent(String(targetUserId)) - ); + path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); // Build query parameters const params = new URLSearchParams(); @@ -2252,7 +2324,7 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'], }, { @@ -2263,7 +2335,7 @@ export class UsersClient { // No optional parameters, using empty request options }; - return this.client.request( + return this.client.request( 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2271,32 +2343,32 @@ export class UsersClient { } /** - * Search Users - * Retrieves a list of Users matching a search query. + * Get followed Lists + * Retrieves a list of Lists followed by a specific User by their ID. + * @param id The ID of the User to lookup. - * @param query TThe the query string by which to query for users. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async search( - query: any, - options: SearchOptions = {} - ): Promise { + async getFollowedLists( + id: string, + options: GetFollowedListsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { max_results: 'maxResults', - next_token: 'nextToken', + pagination_token: 'paginationToken', - 'user.fields': 'userFields', + 'list.fields': 'listFields', - 'tweet.fields': 'tweetFields', + 'user.fields': 'userFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2307,45 +2379,43 @@ export class UsersClient { const { maxResults = undefined, - nextToken = undefined, + paginationToken = undefined, - userFields = [], + listFields = [], expansions = [], - tweetFields = [], + userFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/search'; + let path = '/2/users/{id}/followed_lists'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (query !== undefined) { - params.append('query', String(query)); - } - if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (nextToken !== undefined) { - params.append('next_token', String(nextToken)); + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (listFields !== undefined && listFields.length > 0) { + params.append('list.fields', listFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } // Prepare request options @@ -2353,7 +2423,11 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['tweet.read', 'users.read'], + BearerToken: [], + }, + + { + OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'], }, { @@ -2364,7 +2438,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2372,71 +2446,49 @@ export class UsersClient { } /** - * Get pinned Lists - * Retrieves a list of Lists pinned by the authenticated user. + * Follow List + * Causes the authenticated user to follow a specific List by its ID. - * @param id The ID of the authenticated source User for whom to return results. + * @param id The ID of the authenticated source User that will follow the List. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getPinnedLists( + async followList( id: string, - options: GetPinnedListsOptions = {} - ): Promise { + options: FollowListOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - 'list.fields': 'listFields', - - 'user.fields': 'userFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) const { - listFields = [], - - expansions = [], - - userFields = [], + body, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/pinned_lists'; + let path = '/2/users/{id}/followed_lists'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (listFields !== undefined && listFields.length > 0) { - params.append('list.fields', listFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'], + OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], }, { @@ -2447,93 +2499,54 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Pin List - * Causes the authenticated user to pin a specific List by its ID. - + * Get Timeline + * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. - * @param id The ID of the authenticated source User that will pin the List. + * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. - * @param body Request body - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async pinList(id: string, body: PinListRequest): Promise { + async getTimeline( + id: string, + options: GetTimelineOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const requestOptions = {}; - - // Build the path with path parameters - let path = '/2/users/{id}/pinned_lists'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - body: JSON.stringify(body || {}), - - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - // No optional parameters, using empty request options - }; - - return this.client.request( - 'POST', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get followed Lists - * Retrieves a list of Lists followed by a specific User by their ID. - + const paramMappings: Record = { + since_id: 'sinceId', - * @param id The ID of the User to lookup. + until_id: 'untilId', + max_results: 'maxResults', + pagination_token: 'paginationToken', + start_time: 'startTime', - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getFollowedLists( - id: string, - options: GetFollowedListsOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names + end_time: 'endTime', - const paramMappings: Record = { - max_results: 'maxResults', + 'tweet.fields': 'tweetFields', - pagination_token: 'paginationToken', + 'media.fields': 'mediaFields', - 'list.fields': 'listFields', + 'poll.fields': 'pollFields', 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2542,27 +2555,51 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { + sinceId = undefined, + + untilId = undefined, + maxResults = undefined, paginationToken = undefined, - listFields = [], + exclude = [], + + startTime = undefined, + + endTime = undefined, + + tweetFields = [], expansions = [], + mediaFields = [], + + pollFields = [], + userFields = [], + placeFields = [], + requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/followed_lists'; + let path = '/2/users/{id}/timelines/reverse_chronological'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); + } + + if (untilId !== undefined) { + params.append('until_id', String(untilId)); + } + if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } @@ -2571,28 +2608,48 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (listFields !== undefined && listFields.length > 0) { - params.append('list.fields', listFields.join(',')); + if (exclude !== undefined && exclude.length > 0) { + params.append('exclude', exclude.join(',')); + } + + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [], - }, - - { - OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'], + OAuth2UserToken: ['tweet.read', 'users.read'], }, { @@ -2603,7 +2660,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2611,49 +2668,71 @@ export class UsersClient { } /** - * Follow List - * Causes the authenticated user to follow a specific List by its ID. + * Get pinned Lists + * Retrieves a list of Lists pinned by the authenticated user. - * @param id The ID of the authenticated source User that will follow the List. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async followList( + async getPinnedLists( id: string, - options: FollowListOptions = {} - ): Promise { + options: GetPinnedListsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + 'list.fields': 'listFields', + + 'user.fields': 'userFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - body, + listFields = [], + + expansions = [], + + userFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/followed_lists'; + let path = '/2/users/{id}/pinned_lists'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (listFields !== undefined && listFields.length > 0) { + params.append('list.fields', listFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'], }, { @@ -2664,43 +2743,35 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Like Post - * Causes the authenticated user to Like a specific Post by its ID. + * Pin List + * Causes the authenticated user to pin a specific List by its ID. - * @param id The ID of the authenticated source User that is requesting to like the Post. + * @param id The ID of the authenticated source User that will pin the List. - * @returns {Promise} Promise resolving to the API response + * @param body Request body + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async likePost( - id: string, - options: LikePostOptions = {} - ): Promise { + async pinList(id: string, body: PinListRequest): Promise { // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) - const { - body, - - requestOptions: requestOptions = {}, - } = normalizedOptions; + const requestOptions = {}; // Build the path with path parameters - let path = '/2/users/{id}/likes'; + let path = '/2/users/{id}/pinned_lists'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -2709,12 +2780,12 @@ export class UsersClient { // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, + body: JSON.stringify(body || {}), // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['like.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['list.write', 'tweet.read', 'users.read'], }, { @@ -2722,10 +2793,10 @@ export class UsersClient { }, ], - ...requestOptions, + // No optional parameters, using empty request options }; - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2733,22 +2804,17 @@ export class UsersClient { } /** - * Get liked Posts - * Retrieves a list of Posts liked by a specific User by their ID. - - - * @param id The ID of the User to lookup. - + * Get Reposts of me + * Retrieves a list of Posts that repost content from the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getLikedPosts( - id: string, - options: GetLikedPostsOptions = {} - ): Promise { + async getRepostsOfMe( + options: GetRepostsOfMeOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -2793,9 +2859,7 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/liked_tweets'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/users/reposts_of_me'; // Build query parameters const params = new URLSearchParams(); @@ -2837,7 +2901,7 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['like.read', 'tweet.read', 'users.read'], + OAuth2UserToken: ['timeline.read', 'tweet.read'], }, { @@ -2848,7 +2912,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2856,25 +2920,29 @@ export class UsersClient { } /** - * Get Users by usernames - * Retrieves details of multiple Users by their usernames. + * Get following + * Retrieves a list of Users followed by a specific User by their ID. + * @param id The ID of the User to lookup. - * @param usernames A list of usernames, comma-separated. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getByUsernames( - usernames: Array, - options: GetByUsernamesOptions = {} - ): Promise { + async getFollowing( + id: string, + options: GetFollowingOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + 'user.fields': 'userFields', 'tweet.fields': 'tweetFields', @@ -2886,6 +2954,10 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { + maxResults = undefined, + + paginationToken = undefined, + userFields = [], expansions = [], @@ -2896,13 +2968,19 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/by'; + let path = '/2/users/{id}/following'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (usernames !== undefined && usernames.length > 0) { - params.append('usernames', usernames.join(',')); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } if (userFields !== undefined && userFields.length > 0) { @@ -2926,7 +3004,7 @@ export class UsersClient { }, { - OAuth2UserToken: ['tweet.read', 'users.read'], + OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'], }, { @@ -2937,7 +3015,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2945,22 +3023,22 @@ export class UsersClient { } /** - * Repost Post - * Causes the authenticated user to repost a specific Post by its ID. + * Follow User + * Causes the authenticated user to follow a specific user by their ID. - * @param id The ID of the authenticated source User that is requesting to repost the Post. + * @param id The ID of the authenticated source User that is requesting to follow the target User. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async repostPost( + async followUser( id: string, - options: RepostPostOptions = {} - ): Promise { + options: FollowUserOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const normalizedOptions = options || {}; @@ -2973,7 +3051,7 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/retweets'; + let path = '/2/users/{id}/following'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -2987,7 +3065,7 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'], + OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'], }, { @@ -2998,7 +3076,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -3006,42 +3084,27 @@ export class UsersClient { } /** - * Unfollow User - * Causes the authenticated user to unfollow a specific user by their ID. - - - * @param sourceUserId The ID of the authenticated source User that is requesting to unfollow the target User. - + * Unblock DMs + * Unblocks direct messages to or from a specific User by their ID for the authenticated user. - * @param targetUserId The ID of the User that the source User is requesting to unfollow. + * @param id The ID of the target User that the authenticated user requesting to unblock dms for. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unfollowUser( - sourceUserId: string, - targetUserId: string - ): Promise { + async unblockDms(id: string): Promise { // Normalize options to handle both camelCase and original API parameter names const requestOptions = {}; // Build the path with path parameters - let path = '/2/users/{source_user_id}/following/{target_user_id}'; - - path = path.replace( - '{source_user_id}', - encodeURIComponent(String(sourceUserId)) - ); + let path = '/2/users/{id}/dm/unblock'; - path = path.replace( - '{target_user_id}', - encodeURIComponent(String(targetUserId)) - ); + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); @@ -3051,7 +3114,7 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], }, { @@ -3062,16 +3125,16 @@ export class UsersClient { // No optional parameters, using empty request options }; - return this.client.request( - 'DELETE', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get followers - * Retrieves a list of Users who follow a specific User by their ID. + * Get mentions + * Retrieves a list of Posts that mention a specific User by their ID. * @param id The ID of the User to lookup. @@ -3079,23 +3142,37 @@ export class UsersClient { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowers( + async getMentions( id: string, - options: GetFollowersOptions = {} - ): Promise { + options: GetMentionsOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { + since_id: 'sinceId', + + until_id: 'untilId', + max_results: 'maxResults', pagination_token: 'paginationToken', - 'user.fields': 'userFields', + start_time: 'startTime', + + end_time: 'endTime', 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -3104,27 +3181,49 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { + sinceId = undefined, + + untilId = undefined, + maxResults = undefined, paginationToken = undefined, - userFields = [], + startTime = undefined, - expansions = [], + endTime = undefined, tweetFields = [], + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], + requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/followers'; + let path = '/2/users/{id}/mentions'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); + } + + if (untilId !== undefined) { + params.append('until_id', String(untilId)); + } + if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } @@ -3133,105 +3232,36 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (startTime !== undefined) { + params.append('start_time', String(startTime)); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); + if (endTime !== undefined) { + params.append('end_time', String(endTime)); } if (tweetFields !== undefined && tweetFields.length > 0) { params.append('tweet.fields', tweetFields.join(',')); } - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - BearerToken: [], - }, - - { - OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'], - }, - - { - UserToken: [], - }, - ], - - ...requestOptions, - }; - - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get Users by IDs - * Retrieves details of multiple Users by their IDs. - - - - * @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getByIds( - ids: Array, - options: GetByIdsOptions = {} - ): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - const { - userFields = [], - - expansions = [], - - tweetFields = [], - - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/users'; + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } - // Build query parameters - const params = new URLSearchParams(); + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } - if (ids !== undefined && ids.length > 0) { - params.append('ids', ids.join(',')); + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); } if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); } // Prepare request options @@ -3254,61 +3284,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get Bookmarks by folder ID - * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. - - - * @param id The ID of the authenticated source User for whom to return results. - - - - * @param folderId The ID of the Bookmark Folder that the authenticated User is trying to fetch Posts for. - - - - - * @returns {Promise} Promise resolving to the API response - */ - // Overload 1: Default behavior (unwrapped response) - async getBookmarksByFolderId( - id: string, - folderId: string - ): Promise { - // Normalize options to handle both camelCase and original API parameter names - - const requestOptions = {}; - - // Build the path with path parameters - let path = '/2/users/{id}/bookmarks/folders/{folder_id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - path = path.replace('{folder_id}', encodeURIComponent(String(folderId))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - // Pass security requirements for smart auth selection - security: [ - { - OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'], - }, - ], - - // No optional parameters, using empty request options - }; - - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -3389,125 +3365,137 @@ export class UsersClient { } /** - * Get following - * Retrieves a list of Users followed by a specific User by their ID. + * Unrepost Post + * Causes the authenticated user to unrepost a specific Post by its ID. - * @param id The ID of the User to lookup. + * @param id The ID of the authenticated source User that is requesting to repost the Post. + * @param sourceTweetId The ID of the Post that the User is requesting to unretweet. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getFollowing( + async unrepostPost( id: string, - options: GetFollowingOptions = {} - ): Promise { + sourceTweetId: string + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', + const requestOptions = {}; - pagination_token: 'paginationToken', + // Build the path with path parameters + let path = '/2/users/{id}/retweets/{source_tweet_id}'; - 'user.fields': 'userFields', + path = path.replace('{id}', encodeURIComponent(String(id))); - 'tweet.fields': 'tweetFields', + path = path.replace( + '{source_tweet_id}', + encodeURIComponent(String(sourceTweetId)) + ); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'], + }, + + { + UserToken: [], + }, + ], + + // No optional parameters, using empty request options }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings + + return this.client.request( + 'DELETE', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions ); + } - // Destructure options (exclude path parameters, they're already function params) - const { - maxResults = undefined, + /** + * Delete Bookmark + * Removes a Post from the authenticated user’s Bookmarks by its ID. + + + * @param id The ID of the authenticated source User whose bookmark is to be removed. + + + + * @param tweetId The ID of the Post that the source User is removing from bookmarks. - paginationToken = undefined, - userFields = [], - expansions = [], - tweetFields = [], + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async deleteBookmark( + id: string, + tweetId: string + ): Promise { + // Normalize options to handle both camelCase and original API parameter names - requestOptions: requestOptions = {}, - } = normalizedOptions; + const requestOptions = {}; // Build the path with path parameters - let path = '/2/users/{id}/following'; + let path = '/2/users/{id}/bookmarks/{tweet_id}'; path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); + // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ { - BearerToken: [], - }, - - { - OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'], - }, - - { - UserToken: [], + OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'], }, ], - ...requestOptions, + // No optional parameters, using empty request options }; - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Follow User - * Causes the authenticated user to follow a specific user by their ID. + * Repost Post + * Causes the authenticated user to repost a specific Post by its ID. - * @param id The ID of the authenticated source User that is requesting to follow the target User. + * @param id The ID of the authenticated source User that is requesting to repost the Post. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async followUser( + async repostPost( id: string, - options: FollowUserOptions = {} - ): Promise { + options: RepostPostOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const normalizedOptions = options || {}; @@ -3520,7 +3508,7 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/following'; + let path = '/2/users/{id}/retweets'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -3534,7 +3522,7 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['follows.write', 'tweet.read', 'users.read'], + OAuth2UserToken: ['tweet.read', 'tweet.write', 'users.read'], }, { @@ -3545,7 +3533,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -3553,46 +3541,32 @@ export class UsersClient { } /** - * Get Timeline - * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. + * Search Users + * Retrieves a list of Users matching a search query. - * @param id The ID of the authenticated source User to list Reverse Chronological Timeline Posts of. + * @param query TThe the query string by which to query for users. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getTimeline( - id: string, - options: GetTimelineOptions = {} - ): Promise { + async search( + query: any, + options: SearchOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - since_id: 'sinceId', - - until_id: 'untilId', - max_results: 'maxResults', - pagination_token: 'paginationToken', - - start_time: 'startTime', - - end_time: 'endTime', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', + next_token: 'nextToken', 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -3601,93 +3575,47 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { - sinceId = undefined, - - untilId = undefined, - maxResults = undefined, - paginationToken = undefined, - - exclude = [], - - startTime = undefined, - - endTime = undefined, + nextToken = undefined, - tweetFields = [], + userFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + tweetFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/timelines/reverse_chronological'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/users/search'; // Build query parameters const params = new URLSearchParams(); - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); + if (query !== undefined) { + params.append('query', String(query)); } if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (exclude !== undefined && exclude.length > 0) { - params.append('exclude', exclude.join(',')); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); + if (nextToken !== undefined) { + params.append('next_token', String(nextToken)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -3706,7 +3634,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -3714,37 +3642,75 @@ export class UsersClient { } /** - * Unblock DMs - * Unblocks direct messages to or from a specific User by their ID for the authenticated user. + * Get User by ID + * Retrieves details of a specific User by their ID. - * @param id The ID of the target User that the authenticated user requesting to unblock dms for. + * @param id The ID of the User to lookup. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async unblockDms(id: string): Promise { + async getById( + id: string, + options: GetByIdOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const requestOptions = {}; + const paramMappings: Record = { + 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + const { + userFields = [], + + expansions = [], + + tweetFields = [], + + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/dm/unblock'; + let path = '/2/users/{id}'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['dm.write', 'tweet.read', 'users.read'], + BearerToken: [], + }, + + { + OAuth2UserToken: ['tweet.read', 'users.read'], }, { @@ -3752,48 +3718,40 @@ export class UsersClient { }, ], - // No optional parameters, using empty request options + ...requestOptions, }; - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get mentions - * Retrieves a list of Posts that mention a specific User by their ID. + * Get Bookmarks + * Retrieves a list of Posts bookmarked by the authenticated user. - * @param id The ID of the User to lookup. + * @param id The ID of the authenticated source User for whom to return results. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getMentions( + async getBookmarks( id: string, - options: GetMentionsOptions = {} - ): Promise { + options: GetBookmarksOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - since_id: 'sinceId', - - until_id: 'untilId', - max_results: 'maxResults', pagination_token: 'paginationToken', - start_time: 'startTime', - - end_time: 'endTime', - 'tweet.fields': 'tweetFields', 'media.fields': 'mediaFields', @@ -3811,18 +3769,10 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { - sinceId = undefined, - - untilId = undefined, - maxResults = undefined, paginationToken = undefined, - startTime = undefined, - - endTime = undefined, - tweetFields = [], expansions = [], @@ -3839,21 +3789,13 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/mentions'; + let path = '/2/users/{id}/bookmarks'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); - } - if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } @@ -3862,14 +3804,6 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - if (tweetFields !== undefined && tweetFields.length > 0) { params.append('tweet.fields', tweetFields.join(',')); } @@ -3899,31 +3833,75 @@ export class UsersClient { // Pass security requirements for smart auth selection security: [ { - BearerToken: [], + OAuth2UserToken: ['bookmark.read', 'tweet.read', 'users.read'], }, + ], - { - OAuth2UserToken: ['tweet.read', 'users.read'], - }, + ...requestOptions, + }; + + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Create Bookmark + * Adds a post to the authenticated user’s bookmarks. + + + * @param id The ID of the authenticated source User for whom to add bookmarks. + + + + + * @param body Request body + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async createBookmark( + id: string, + body: CreateBookmarkRequest + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const requestOptions = {}; + + // Build the path with path parameters + let path = '/2/users/{id}/bookmarks'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + // Build query parameters + const params = new URLSearchParams(); + // Prepare request options + const finalRequestOptions: RequestOptions = { + body: JSON.stringify(body || {}), + + // Pass security requirements for smart auth selection + security: [ { - UserToken: [], + OAuth2UserToken: ['bookmark.write', 'tweet.read', 'users.read'], }, ], - ...requestOptions, + // No optional parameters, using empty request options }; - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get List memberships - * Retrieves a list of Lists that a specific User is a member of by their ID. + * Get followers + * Retrieves a list of Users who follow a specific User by their ID. * @param id The ID of the User to lookup. @@ -3931,13 +3909,13 @@ export class UsersClient { - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getListMemberships( + async getFollowers( id: string, - options: GetListMembershipsOptions = {} - ): Promise { + options: GetFollowersOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { @@ -3945,9 +3923,9 @@ export class UsersClient { pagination_token: 'paginationToken', - 'list.fields': 'listFields', - 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -3960,17 +3938,17 @@ export class UsersClient { paginationToken = undefined, - listFields = [], + userFields = [], expansions = [], - userFields = [], + tweetFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/list_memberships'; + let path = '/2/users/{id}/followers'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -3985,16 +3963,16 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (listFields !== undefined && listFields.length > 0) { - params.append('list.fields', listFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -4006,7 +3984,7 @@ export class UsersClient { }, { - OAuth2UserToken: ['list.read', 'tweet.read', 'users.read'], + OAuth2UserToken: ['follows.read', 'tweet.read', 'users.read'], }, { @@ -4017,7 +3995,7 @@ export class UsersClient { ...requestOptions, }; - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -4025,33 +4003,21 @@ export class UsersClient { } /** - * Get Reposts of me - * Retrieves a list of Posts that repost content from the authenticated user. + * Get my User + * Retrieves details of the authenticated user. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getRepostsOfMe( - options: GetRepostsOfMeOptions = {} - ): Promise { + async getMe(options: GetMeOptions = {}): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -4060,69 +4026,103 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - tweetFields = [], + userFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + tweetFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/reposts_of_me'; + let path = '/2/users/me'; // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); } if (tweetFields !== undefined && tweetFields.length > 0) { params.append('tweet.fields', tweetFields.join(',')); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } + // Prepare request options + const finalRequestOptions: RequestOptions = { + // Pass security requirements for smart auth selection + security: [ + { + OAuth2UserToken: ['tweet.read', 'users.read'], + }, - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } + { + UserToken: [], + }, + ], - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } + ...requestOptions, + }; - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); - } + /** + * Unmute User + * Causes the authenticated user to unmute a specific user by their ID. + + + * @param sourceUserId The ID of the authenticated source User that is requesting to unmute the target User. + + + + * @param targetUserId The ID of the User that the source User is requesting to unmute. + + + + + * @returns {Promise} Promise resolving to the API response + */ + // Overload 1: Default behavior (unwrapped response) + async unmuteUser( + sourceUserId: string, + targetUserId: string + ): Promise { + // Normalize options to handle both camelCase and original API parameter names + + const requestOptions = {}; + + // Build the path with path parameters + let path = '/2/users/{source_user_id}/muting/{target_user_id}'; + + path = path.replace( + '{source_user_id}', + encodeURIComponent(String(sourceUserId)) + ); + + path = path.replace( + '{target_user_id}', + encodeURIComponent(String(targetUserId)) + ); + + // Build query parameters + const params = new URLSearchParams(); // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection security: [ { - OAuth2UserToken: ['timeline.read', 'tweet.read'], + OAuth2UserToken: ['mute.write', 'tweet.read', 'users.read'], }, { @@ -4130,11 +4130,11 @@ export class UsersClient { }, ], - ...requestOptions, + // No optional parameters, using empty request options }; - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/users/models.ts b/xdk/typescript/src/users/models.ts index f90a0d21..ec9c185e 100644 --- a/xdk/typescript/src/users/models.ts +++ b/xdk/typescript/src/users/models.ts @@ -11,273 +11,273 @@ import type * as Schemas from '../schemas.js'; /** - * Response for unlikePost + * Response for getByUsernames * * @public */ -export type UnlikePostResponse = Schemas.UsersLikesDeleteResponse; +export type GetByUsernamesResponse = Schemas.Get2UsersByResponse; /** - * Response for getOwnedLists + * Response for getListMemberships * * @public */ -export type GetOwnedListsResponse = Schemas.Get2UsersIdOwnedListsResponse; +export type GetListMembershipsResponse = Schemas.Get2UsersIdListMembershipsResponse; /** - * Response for getBlocking + * Response for unfollowUser * * @public */ -export type GetBlockingResponse = Schemas.Get2UsersIdBlockingResponse; +export type UnfollowUserResponse = Schemas.UsersFollowingDeleteResponse; /** - * Response for deleteBookmark + * Response for unfollowList * * @public */ -export type DeleteBookmarkResponse = Schemas.BookmarkMutationResponse; +export type UnfollowListResponse = Schemas.ListFollowedResponse; /** - * Response for getByUsername + * Response for getByIds * * @public */ -export type GetByUsernameResponse = Schemas.Get2UsersByUsernameUsernameResponse; +export type GetByIdsResponse = Schemas.Get2UsersResponse; /** - * Response for unpinList + * Request for likePost * * @public */ -export type UnpinListResponse = Schemas.ListUnpinResponse; +export type LikePostRequest = Schemas.UsersLikesCreateRequest; /** - * Response for getPosts + * Response for likePost * * @public */ -export type GetPostsResponse = Schemas.Get2UsersIdTweetsResponse; +export type LikePostResponse = Schemas.UsersLikesCreateResponse; /** - * Response for getBookmarks + * Response for blockDms * * @public */ -export type GetBookmarksResponse = Schemas.Get2UsersIdBookmarksResponse; +export type BlockDmsResponse = Schemas.UsersDMBlockCreateResponse; /** - * Request for createBookmark + * Response for getPosts * * @public */ -export type CreateBookmarkRequest = Schemas.BookmarkAddRequest; +export type GetPostsResponse = Schemas.Get2UsersIdTweetsResponse; /** - * Response for createBookmark + * Response for getBookmarksByFolderId * * @public */ -export type CreateBookmarkResponse = Schemas.BookmarkMutationResponse; +export type GetBookmarksByFolderIdResponse = Schemas.BookmarkFolderPostsResponse; /** - * Response for blockDms + * Response for getMuting * * @public */ -export type BlockDmsResponse = Schemas.UsersDMBlockCreateResponse; +export type GetMutingResponse = Schemas.Get2UsersIdMutingResponse; + /** - * Response for unfollowList + * Request for muteUser * * @public */ -export type UnfollowListResponse = Schemas.ListFollowedResponse; +export type { MuteUserRequest as MuteUserRequest } from '../schemas.js'; /** - * Response for getMuting + * Response for muteUser * * @public */ -export type GetMutingResponse = Schemas.Get2UsersIdMutingResponse; - +export type MuteUserResponse = Schemas.MuteUserMutationResponse; /** - * Request for muteUser + * Response for getOwnedLists * * @public */ -export type { MuteUserRequest as MuteUserRequest } from '../schemas.js'; +export type GetOwnedListsResponse = Schemas.Get2UsersIdOwnedListsResponse; /** - * Response for muteUser + * Response for unpinList * * @public */ -export type MuteUserResponse = Schemas.MuteUserMutationResponse; +export type UnpinListResponse = Schemas.ListUnpinResponse; /** - * Response for getById + * Response for getByUsername * * @public */ -export type GetByIdResponse = Schemas.Get2UsersIdResponse; +export type GetByUsernameResponse = Schemas.Get2UsersByUsernameUsernameResponse; /** - * Response for getMe + * Response for getBlocking * * @public */ -export type GetMeResponse = Schemas.Get2UsersMeResponse; +export type GetBlockingResponse = Schemas.Get2UsersIdBlockingResponse; /** - * Response for unrepostPost + * Response for getLikedPosts * * @public */ -export type UnrepostPostResponse = Schemas.UsersRetweetsDeleteResponse; +export type GetLikedPostsResponse = Schemas.Get2UsersIdLikedTweetsResponse; /** - * Response for unmuteUser + * Response for unlikePost * * @public */ -export type UnmuteUserResponse = Schemas.MuteUserMutationResponse; +export type UnlikePostResponse = Schemas.UsersLikesDeleteResponse; /** - * Response for search + * Response for getFollowedLists * * @public */ -export type SearchResponse = Schemas.Get2UsersSearchResponse; +export type GetFollowedListsResponse = Schemas.Get2UsersIdFollowedListsResponse; /** - * Response for getPinnedLists + * Request for followList * * @public */ -export type GetPinnedListsResponse = Schemas.Get2UsersIdPinnedListsResponse; +export type FollowListRequest = Schemas.ListFollowedRequest; /** - * Request for pinList + * Response for followList * * @public */ -export type PinListRequest = Schemas.ListPinnedRequest; +export type FollowListResponse = Schemas.ListFollowedResponse; /** - * Response for pinList + * Response for getTimeline * * @public */ -export type PinListResponse = Schemas.ListPinnedResponse; +export type GetTimelineResponse = Schemas.Get2UsersIdTimelinesReverseChronologicalResponse; /** - * Response for getFollowedLists + * Response for getPinnedLists * * @public */ -export type GetFollowedListsResponse = Schemas.Get2UsersIdFollowedListsResponse; +export type GetPinnedListsResponse = Schemas.Get2UsersIdPinnedListsResponse; /** - * Request for followList + * Request for pinList * * @public */ -export type FollowListRequest = Schemas.ListFollowedRequest; +export type PinListRequest = Schemas.ListPinnedRequest; /** - * Response for followList + * Response for pinList * * @public */ -export type FollowListResponse = Schemas.ListFollowedResponse; +export type PinListResponse = Schemas.ListPinnedResponse; /** - * Request for likePost + * Response for getRepostsOfMe * * @public */ -export type LikePostRequest = Schemas.UsersLikesCreateRequest; +export type GetRepostsOfMeResponse = Schemas.Get2UsersRepostsOfMeResponse; /** - * Response for likePost + * Response for getFollowing * * @public */ -export type LikePostResponse = Schemas.UsersLikesCreateResponse; +export type GetFollowingResponse = Schemas.Get2UsersIdFollowingResponse; /** - * Response for getLikedPosts + * Request for followUser * * @public */ -export type GetLikedPostsResponse = Schemas.Get2UsersIdLikedTweetsResponse; +export type FollowUserRequest = Schemas.UsersFollowingCreateRequest; /** - * Response for getByUsernames + * Response for followUser * * @public */ -export type GetByUsernamesResponse = Schemas.Get2UsersByResponse; +export type FollowUserResponse = Schemas.UsersFollowingCreateResponse; /** - * Request for repostPost + * Response for unblockDms * * @public */ -export type RepostPostRequest = Schemas.UsersRetweetsCreateRequest; +export type UnblockDmsResponse = Schemas.UsersDMUnBlockCreateResponse; /** - * Response for repostPost + * Response for getMentions * * @public */ -export type RepostPostResponse = Schemas.UsersRetweetsCreateResponse; +export type GetMentionsResponse = Schemas.Get2UsersIdMentionsResponse; /** - * Response for unfollowUser + * Response for getBookmarkFolders * * @public */ -export type UnfollowUserResponse = Schemas.UsersFollowingDeleteResponse; +export type GetBookmarkFoldersResponse = Schemas.BookmarkFoldersResponse; /** - * Response for getFollowers + * Response for unrepostPost * * @public */ -export type GetFollowersResponse = Schemas.Get2UsersIdFollowersResponse; +export type UnrepostPostResponse = Schemas.UsersRetweetsDeleteResponse; /** - * Response for getByIds + * Response for deleteBookmark * * @public */ -export type GetByIdsResponse = Schemas.Get2UsersResponse; +export type DeleteBookmarkResponse = Schemas.BookmarkMutationResponse; /** - * Response for getBookmarksByFolderId + * Request for repostPost * * @public */ -export type GetBookmarksByFolderIdResponse = Schemas.BookmarkFolderPostsResponse; +export type RepostPostRequest = Schemas.UsersRetweetsCreateRequest; /** - * Response for getBookmarkFolders + * Response for repostPost * * @public */ -export type GetBookmarkFoldersResponse = Schemas.BookmarkFoldersResponse; +export type RepostPostResponse = Schemas.UsersRetweetsCreateResponse; /** - * Response for getFollowing + * Response for search * * @public */ -export type GetFollowingResponse = Schemas.Get2UsersIdFollowingResponse; +export type SearchResponse = Schemas.Get2UsersSearchResponse; /** - * Request for followUser + * Response for getById * * @public */ -export type FollowUserRequest = Schemas.UsersFollowingCreateRequest; +export type GetByIdResponse = Schemas.Get2UsersIdResponse; /** - * Response for followUser + * Response for getBookmarks * * @public */ -export type FollowUserResponse = Schemas.UsersFollowingCreateResponse; +export type GetBookmarksResponse = Schemas.Get2UsersIdBookmarksResponse; /** - * Response for getTimeline + * Request for createBookmark * * @public */ -export type GetTimelineResponse = Schemas.Get2UsersIdTimelinesReverseChronologicalResponse; +export type CreateBookmarkRequest = Schemas.BookmarkAddRequest; /** - * Response for unblockDms + * Response for createBookmark * * @public */ -export type UnblockDmsResponse = Schemas.UsersDMUnBlockCreateResponse; +export type CreateBookmarkResponse = Schemas.BookmarkMutationResponse; /** - * Response for getMentions + * Response for getFollowers * * @public */ -export type GetMentionsResponse = Schemas.Get2UsersIdMentionsResponse; +export type GetFollowersResponse = Schemas.Get2UsersIdFollowersResponse; /** - * Response for getListMemberships + * Response for getMe * * @public */ -export type GetListMembershipsResponse = Schemas.Get2UsersIdListMembershipsResponse; +export type GetMeResponse = Schemas.Get2UsersMeResponse; /** - * Response for getRepostsOfMe + * Response for unmuteUser * * @public */ -export type GetRepostsOfMeResponse = Schemas.Get2UsersRepostsOfMeResponse; \ No newline at end of file +export type UnmuteUserResponse = Schemas.MuteUserMutationResponse; \ No newline at end of file diff --git a/xdk/typescript/src/users/stream_client.ts b/xdk/typescript/src/users/stream_client.ts index 26acb871..10080c4b 100644 --- a/xdk/typescript/src/users/stream_client.ts +++ b/xdk/typescript/src/users/stream_client.ts @@ -10,52 +10,64 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { - UnlikePostResponse, - GetOwnedListsResponse, - GetBlockingResponse, - DeleteBookmarkResponse, - GetByUsernameResponse, - UnpinListResponse, - GetPostsResponse, - GetBookmarksResponse, - CreateBookmarkResponse, - BlockDmsResponse, + GetByUsernamesResponse, + GetListMembershipsResponse, + UnfollowUserResponse, UnfollowListResponse, + GetByIdsResponse, + LikePostResponse, + BlockDmsResponse, + GetPostsResponse, + GetBookmarksByFolderIdResponse, GetMutingResponse, MuteUserResponse, - GetByIdResponse, - GetMeResponse, - UnrepostPostResponse, - UnmuteUserResponse, - SearchResponse, - GetPinnedListsResponse, - PinListResponse, + GetOwnedListsResponse, + UnpinListResponse, + GetByUsernameResponse, + GetBlockingResponse, + GetLikedPostsResponse, + UnlikePostResponse, GetFollowedListsResponse, FollowListResponse, - LikePostResponse, - GetLikedPostsResponse, - GetByUsernamesResponse, - RepostPostResponse, - UnfollowUserResponse, - GetFollowersResponse, - GetByIdsResponse, - GetBookmarksByFolderIdResponse, - GetBookmarkFoldersResponse, + GetTimelineResponse, + GetPinnedListsResponse, + PinListResponse, + GetRepostsOfMeResponse, GetFollowingResponse, FollowUserResponse, - GetTimelineResponse, UnblockDmsResponse, GetMentionsResponse, - GetListMembershipsResponse, - GetRepostsOfMeResponse, + GetBookmarkFoldersResponse, + UnrepostPostResponse, + DeleteBookmarkResponse, + RepostPostResponse, + SearchResponse, + GetByIdResponse, + GetBookmarksResponse, + CreateBookmarkResponse, + GetFollowersResponse, + GetMeResponse, + UnmuteUserResponse, } from './models.js'; /** - * Options for unlikePost method + * Options for getByUsernames method * * @public */ -export interface UnlikePostStreamingOptions { +export interface GetByUsernamesStreamingOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -66,11 +78,11 @@ export interface UnlikePostStreamingOptions { [key: string]: any; } /** - * Options for getOwnedLists method + * Options for getListMemberships method * * @public */ -export interface GetOwnedListsStreamingOptions { +export interface GetListMembershipsStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -101,31 +113,11 @@ export interface GetOwnedListsStreamingOptions { [key: string]: any; } /** - * Options for getBlocking method + * Options for unfollowUser method * * @public */ -export interface GetBlockingStreamingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - +export interface UnfollowUserStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -136,11 +128,11 @@ export interface GetBlockingStreamingOptions { [key: string]: any; } /** - * Options for deleteBookmark method + * Options for unfollowList method * * @public */ -export interface DeleteBookmarkStreamingOptions { +export interface UnfollowListStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -151,11 +143,11 @@ export interface DeleteBookmarkStreamingOptions { [key: string]: any; } /** - * Options for getByUsername method + * Options for getByIds method * * @public */ -export interface GetByUsernameStreamingOptions { +export interface GetByIdsStreamingOptions { /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; @@ -178,11 +170,29 @@ export interface GetByUsernameStreamingOptions { [key: string]: any; } /** - * Options for unpinList method + * Options for likePost method * * @public */ -export interface UnpinListStreamingOptions { +export interface LikePostStreamingOptions { + /** Request body */ + body?: any; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for blockDms method + * + * @public + */ +export interface BlockDmsStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -260,11 +270,26 @@ export interface GetPostsStreamingOptions { [key: string]: any; } /** - * Options for getBookmarks method + * Options for getBookmarksByFolderId method * * @public */ -export interface GetBookmarksStreamingOptions { +export interface GetBookmarksByFolderIdStreamingOptions { + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for getMuting method + * + * @public + */ +export interface GetMutingStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -273,29 +298,17 @@ export interface GetBookmarksStreamingOptions { * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -307,41 +320,14 @@ export interface GetBookmarksStreamingOptions { [key: string]: any; } /** - * Options for createBookmark method - * - * @public - */ -export interface CreateBookmarkStreamingOptions { - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for blockDms method - * - * @public - */ -export interface BlockDmsStreamingOptions { - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for unfollowList method + * Options for muteUser method * * @public */ -export interface UnfollowListStreamingOptions { +export interface MuteUserStreamingOptions { + /** Request body */ + body?: any; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -352,30 +338,30 @@ export interface UnfollowListStreamingOptions { [key: string]: any; } /** - * Options for getMuting method + * Options for getOwnedLists method * * @public */ -export interface GetMutingStreamingOptions { +export interface GetOwnedListsStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. + /** This parameter is used to get a specified 'page' of results. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -387,14 +373,11 @@ export interface GetMutingStreamingOptions { [key: string]: any; } /** - * Options for muteUser method + * Options for unpinList method * * @public */ -export interface MuteUserStreamingOptions { - /** Request body */ - body?: any; - +export interface UnpinListStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -405,11 +388,11 @@ export interface MuteUserStreamingOptions { [key: string]: any; } /** - * Options for getById method + * Options for getByUsername method * * @public */ -export interface GetByIdStreamingOptions { +export interface GetByUsernameStreamingOptions { /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; @@ -432,11 +415,19 @@ export interface GetByIdStreamingOptions { [key: string]: any; } /** - * Options for getMe method + * Options for getBlocking method * * @public */ -export interface GetMeStreamingOptions { +export interface GetBlockingStreamingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; @@ -459,11 +450,43 @@ export interface GetMeStreamingOptions { [key: string]: any; } /** - * Options for unrepostPost method + * Options for getLikedPosts method * * @public */ -export interface UnrepostPostStreamingOptions { +export interface GetLikedPostsStreamingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -474,11 +497,11 @@ export interface UnrepostPostStreamingOptions { [key: string]: any; } /** - * Options for unmuteUser method + * Options for unlikePost method * * @public */ -export interface UnmuteUserStreamingOptions { +export interface UnlikePostStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -489,46 +512,19 @@ export interface UnmuteUserStreamingOptions { [key: string]: any; } /** - * Options for search method + * Options for getFollowedLists method * * @public */ -export interface SearchStreamingOptions { +export interface GetFollowedListsStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. - * Also accepts: next_token or proper camelCase (e.g., nextToken) */ - nextToken?: any; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; - /** Additional request options */ - requestOptions?: RequestOptions; - /** Additional headers */ - headers?: Record; - /** AbortSignal for cancelling the request */ - signal?: AbortSignal; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} -/** - * Options for getPinnedLists method - * - * @public - */ -export interface GetPinnedListsStreamingOptions { /** A comma separated list of List fields to display. * Also accepts: list.fields or proper camelCase (e.g., listFields) */ listFields?: Array; @@ -551,11 +547,14 @@ export interface GetPinnedListsStreamingOptions { [key: string]: any; } /** - * Options for pinList method + * Options for followList method * * @public */ -export interface PinListStreamingOptions { +export interface FollowListStreamingOptions { + /** Request body */ + body?: any; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -566,31 +565,63 @@ export interface PinListStreamingOptions { [key: string]: any; } /** - * Options for getFollowedLists method + * Options for getTimeline method * * @public */ -export interface GetFollowedListsStreamingOptions { +export interface GetTimelineStreamingOptions { + /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + + /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get a specified 'page' of results. + /** This parameter is used to get the next 'page' of results. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; + /** The set of entities to exclude (e.g. 'replies' or 'retweets'). + * Also accepts: exclude or proper camelCase (e.g., exclude) */ + exclude?: Array; + + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; + + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -601,13 +632,22 @@ export interface GetFollowedListsStreamingOptions { [key: string]: any; } /** - * Options for followList method + * Options for getPinnedLists method * * @public */ -export interface FollowListStreamingOptions { - /** Request body */ - body?: any; +export interface GetPinnedListsStreamingOptions { + /** A comma separated list of List fields to display. + * Also accepts: list.fields or proper camelCase (e.g., listFields) */ + listFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -619,14 +659,11 @@ export interface FollowListStreamingOptions { [key: string]: any; } /** - * Options for likePost method + * Options for pinList method * * @public */ -export interface LikePostStreamingOptions { - /** Request body */ - body?: any; - +export interface PinListStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -637,11 +674,11 @@ export interface LikePostStreamingOptions { [key: string]: any; } /** - * Options for getLikedPosts method + * Options for getRepostsOfMe method * * @public */ -export interface GetLikedPostsStreamingOptions { +export interface GetRepostsOfMeStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -684,11 +721,19 @@ export interface GetLikedPostsStreamingOptions { [key: string]: any; } /** - * Options for getByUsernames method + * Options for getFollowing method * * @public */ -export interface GetByUsernamesStreamingOptions { +export interface GetFollowingStreamingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; + + /** This parameter is used to get a specified 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; + /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ userFields?: Array; @@ -711,11 +756,11 @@ export interface GetByUsernamesStreamingOptions { [key: string]: any; } /** - * Options for repostPost method + * Options for followUser method * * @public */ -export interface RepostPostStreamingOptions { +export interface FollowUserStreamingOptions { /** Request body */ body?: any; @@ -729,11 +774,11 @@ export interface RepostPostStreamingOptions { [key: string]: any; } /** - * Options for unfollowUser method + * Options for unblockDms method * * @public */ -export interface UnfollowUserStreamingOptions { +export interface UnblockDmsStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -744,31 +789,59 @@ export interface UnfollowUserStreamingOptions { [key: string]: any; } /** - * Options for getFollowers method + * Options for getMentions method * * @public */ -export interface GetFollowersStreamingOptions { +export interface GetMentionsStreamingOptions { + /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. + * Also accepts: since_id or proper camelCase (e.g., sinceId) */ + sinceId?: any; + + /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. + * Also accepts: until_id or proper camelCase (e.g., untilId) */ + untilId?: any; + /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get a specified 'page' of results. + /** This parameter is used to get the next 'page' of results. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; + /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. + * Also accepts: start_time or proper camelCase (e.g., startTime) */ + startTime?: string; - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; + /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. + * Also accepts: end_time or proper camelCase (e.g., endTime) */ + endTime?: string; /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: Array; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: Array; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: Array; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -779,22 +852,18 @@ export interface GetFollowersStreamingOptions { [key: string]: any; } /** - * Options for getByIds method + * Options for getBookmarkFolders method * * @public */ -export interface GetByIdsStreamingOptions { - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; +export interface GetBookmarkFoldersStreamingOptions { + /** The maximum number of results. + * Also accepts: max_results or proper camelCase (e.g., maxResults) */ + maxResults?: number; - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** This parameter is used to get the next 'page' of results. + * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ + paginationToken?: any; /** Additional request options */ requestOptions?: RequestOptions; @@ -806,11 +875,11 @@ export interface GetByIdsStreamingOptions { [key: string]: any; } /** - * Options for getBookmarksByFolderId method + * Options for unrepostPost method * * @public */ -export interface GetBookmarksByFolderIdStreamingOptions { +export interface UnrepostPostStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -821,19 +890,11 @@ export interface GetBookmarksByFolderIdStreamingOptions { [key: string]: any; } /** - * Options for getBookmarkFolders method + * Options for deleteBookmark method * * @public */ -export interface GetBookmarkFoldersStreamingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - +export interface DeleteBookmarkStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -844,18 +905,36 @@ export interface GetBookmarkFoldersStreamingOptions { [key: string]: any; } /** - * Options for getFollowing method + * Options for repostPost method * * @public */ -export interface GetFollowingStreamingOptions { +export interface RepostPostStreamingOptions { + /** Request body */ + body?: any; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Additional headers */ + headers?: Record; + /** AbortSignal for cancelling the request */ + signal?: AbortSignal; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} +/** + * Options for search method + * + * @public + */ +export interface SearchStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; + /** This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified. + * Also accepts: next_token or proper camelCase (e.g., nextToken) */ + nextToken?: any; /** A comma separated list of User fields to display. * Also accepts: user.fields or proper camelCase (e.g., userFields) */ @@ -879,13 +958,22 @@ export interface GetFollowingStreamingOptions { [key: string]: any; } /** - * Options for followUser method + * Options for getById method * * @public */ -export interface FollowUserStreamingOptions { - /** Request body */ - body?: any; +export interface GetByIdStreamingOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: Array; + + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -897,19 +985,11 @@ export interface FollowUserStreamingOptions { [key: string]: any; } /** - * Options for getTimeline method + * Options for getBookmarks method * * @public */ -export interface GetTimelineStreamingOptions { - /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - - /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - +export interface GetBookmarksStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; @@ -918,18 +998,6 @@ export interface GetTimelineStreamingOptions { * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** The set of entities to exclude (e.g. 'replies' or 'retweets'). - * Also accepts: exclude or proper camelCase (e.g., exclude) */ - exclude?: Array; - - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - /** A comma separated list of Tweet fields to display. * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ tweetFields?: Array; @@ -964,11 +1032,11 @@ export interface GetTimelineStreamingOptions { [key: string]: any; } /** - * Options for unblockDms method + * Options for createBookmark method * * @public */ -export interface UnblockDmsStreamingOptions { +export interface CreateBookmarkStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -979,58 +1047,30 @@ export interface UnblockDmsStreamingOptions { [key: string]: any; } /** - * Options for getMentions method + * Options for getFollowers method * * @public */ -export interface GetMentionsStreamingOptions { - /** The minimum Post ID to be included in the result set. This parameter takes precedence over start_time if both are specified. - * Also accepts: since_id or proper camelCase (e.g., sinceId) */ - sinceId?: any; - - /** The maximum Post ID to be included in the result set. This parameter takes precedence over end_time if both are specified. - * Also accepts: until_id or proper camelCase (e.g., untilId) */ - untilId?: any; - +export interface GetFollowersStreamingOptions { /** The maximum number of results. * Also accepts: max_results or proper camelCase (e.g., maxResults) */ maxResults?: number; - /** This parameter is used to get the next 'page' of results. + /** This parameter is used to get a specified 'page' of results. * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ paginationToken?: any; - /** YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Posts will be provided. The since_id parameter takes precedence if it is also specified. - * Also accepts: start_time or proper camelCase (e.g., startTime) */ - startTime?: string; - - /** YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp to which the Posts will be provided. The until_id parameter takes precedence if it is also specified. - * Also accepts: end_time or proper camelCase (e.g., endTime) */ - endTime?: string; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -1042,30 +1082,22 @@ export interface GetMentionsStreamingOptions { [key: string]: any; } /** - * Options for getListMemberships method + * Options for getMe method * * @public */ -export interface GetListMembershipsStreamingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get a specified 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - - /** A comma separated list of List fields to display. - * Also accepts: list.fields or proper camelCase (e.g., listFields) */ - listFields?: Array; +export interface GetMeStreamingOptions { + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: Array; /** A comma separated list of fields to expand. * Also accepts: expansions or proper camelCase (e.g., expansions) */ expansions?: Array; - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -1077,43 +1109,11 @@ export interface GetListMembershipsStreamingOptions { [key: string]: any; } /** - * Options for getRepostsOfMe method + * Options for unmuteUser method * * @public */ -export interface GetRepostsOfMeStreamingOptions { - /** The maximum number of results. - * Also accepts: max_results or proper camelCase (e.g., maxResults) */ - maxResults?: number; - - /** This parameter is used to get the next 'page' of results. - * Also accepts: pagination_token or proper camelCase (e.g., paginationToken) */ - paginationToken?: any; - - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: Array; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: Array; - - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: Array; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: Array; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: Array; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: Array; - +export interface UnmuteUserStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -1161,44 +1161,75 @@ export class UsersClient { } /** - * Unlike Post - * Causes the authenticated user to Unlike a specific Post by its ID. + * Get Users by usernames + * Retrieves details of multiple Users by their usernames. * * @returns Promise with the API response */ - async unlikePost( - id: string, - tweetId: string, - options: UnlikePostStreamingOptions = {} - ): Promise { + async getByUsernames( + usernames: Array, + options: GetByUsernamesStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'unlikePost'); + this.client.validateAuthentication(requiredAuthTypes, 'getByUsernames'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + userFields = [], - // Build the path with path parameters - let path = '/2/users/{id}/likes/{tweet_id}'; + expansions = [], - path = path.replace('{id}', encodeURIComponent(String(id))); + tweetFields = [], - path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/by'; // Build query parameters const params = new URLSearchParams(); + if (usernames !== undefined && usernames.length > 0) { + params.append('usernames', usernames.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -1211,23 +1242,23 @@ export class UsersClient { }; // Make the request - return this.client.request( - 'DELETE', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get owned Lists - * Retrieves a list of Lists owned by a specific User by their ID. + * Get List memberships + * Retrieves a list of Lists that a specific User is a member of by their ID. * * @returns Promise with the API response */ - async getOwnedLists( + async getListMemberships( id: string, - options: GetOwnedListsStreamingOptions = {} - ): Promise { + options: GetListMembershipsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -1238,7 +1269,7 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getOwnedLists'); + this.client.validateAuthentication(requiredAuthTypes, 'getListMemberships'); // Normalize options to handle both camelCase and original API parameter names @@ -1275,7 +1306,7 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/owned_lists'; + let path = '/2/users/{id}/list_memberships'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -1314,7 +1345,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1322,15 +1353,16 @@ export class UsersClient { } /** - * Get blocking - * Retrieves a list of Users blocked by the specified User ID. + * Unfollow User + * Causes the authenticated user to unfollow a specific user by their ID. * * @returns Promise with the API response */ - async getBlocking( - id: string, - options: GetBlockingStreamingOptions = {} - ): Promise { + async unfollowUser( + sourceUserId: string, + targetUserId: string, + options: UnfollowUserStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -1339,70 +1371,32 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getBlocking'); + this.client.validateAuthentication(requiredAuthTypes, 'unfollowUser'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) - const { - maxResults = undefined, - - paginationToken = undefined, - - userFields = [], - - expansions = [], - - tweetFields = [], - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/blocking'; + let path = '/2/users/{source_user_id}/following/{target_user_id}'; - path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace( + '{source_user_id}', + encodeURIComponent(String(sourceUserId)) + ); + + path = path.replace( + '{target_user_id}', + encodeURIComponent(String(targetUserId)) + ); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -1415,31 +1409,33 @@ export class UsersClient { }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Delete Bookmark - * Removes a Post from the authenticated user’s Bookmarks by its ID. + * Unfollow List + * Causes the authenticated user to unfollow a specific List by its ID. * * @returns Promise with the API response */ - async deleteBookmark( + async unfollowList( id: string, - tweetId: string, - options: DeleteBookmarkStreamingOptions = {} - ): Promise { + listId: string, + options: UnfollowListStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'deleteBookmark'); + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'unfollowList'); // Normalize options to handle both camelCase and original API parameter names @@ -1450,11 +1446,11 @@ export class UsersClient { const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/bookmarks/{tweet_id}'; + let path = '/2/users/{id}/followed_lists/{list_id}'; path = path.replace('{id}', encodeURIComponent(String(id))); - path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); + path = path.replace('{list_id}', encodeURIComponent(String(listId))); // Build query parameters const params = new URLSearchParams(); @@ -1471,7 +1467,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1479,15 +1475,15 @@ export class UsersClient { } /** - * Get User by username - * Retrieves details of a specific User by their username. + * Get Users by IDs + * Retrieves details of multiple Users by their IDs. * * @returns Promise with the API response */ - async getByUsername( - username: string, - options: GetByUsernameStreamingOptions = {} - ): Promise { + async getByIds( + ids: Array, + options: GetByIdsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -1498,7 +1494,7 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getByUsername'); + this.client.validateAuthentication(requiredAuthTypes, 'getByIds'); // Normalize options to handle both camelCase and original API parameter names @@ -1527,13 +1523,15 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/by/username/{username}'; - - path = path.replace('{username}', encodeURIComponent(String(username))); + let path = '/2/users'; // Build query parameters const params = new URLSearchParams(); + if (ids !== undefined && ids.length > 0) { + params.append('ids', ids.join(',')); + } + if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } @@ -1558,7 +1556,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1566,16 +1564,15 @@ export class UsersClient { } /** - * Unpin List - * Causes the authenticated user to unpin a specific List by its ID. + * Like Post + * Causes the authenticated user to Like a specific Post by its ID. * * @returns Promise with the API response */ - async unpinList( + async likePost( id: string, - listId: string, - options: UnpinListStreamingOptions = {} - ): Promise { + options: LikePostStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -1584,7 +1581,7 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'unpinList'); + this.client.validateAuthentication(requiredAuthTypes, 'likePost'); // Normalize options to handle both camelCase and original API parameter names @@ -1592,14 +1589,75 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + body, + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/pinned_lists/{list_id}'; + let path = '/2/users/{id}/likes'; path = path.replace('{id}', encodeURIComponent(String(id))); - path = path.replace('{list_id}', encodeURIComponent(String(listId))); + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, + + body: JSON.stringify(body), + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Block DMs + * Blocks direct messages to or from a specific User by their ID for the authenticated user. + * + * @returns Promise with the API response + */ + async blockDms( + id: string, + options: BlockDmsStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('OAuth2UserToken'); + + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'blockDms'); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/{id}/dm/block'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); @@ -1616,8 +1674,8 @@ export class UsersClient { }; // Make the request - return this.client.request( - 'DELETE', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); @@ -1789,63 +1847,112 @@ export class UsersClient { } /** - * Get Bookmarks - * Retrieves a list of Posts bookmarked by the authenticated user. + * Get Bookmarks by folder ID + * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. * * @returns Promise with the API response */ - async getBookmarks( + async getBookmarksByFolderId( id: string, - options: GetBookmarksStreamingOptions = {} - ): Promise { + folderId: string, + options: GetBookmarksByFolderIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getBookmarks'); + this.client.validateAuthentication( + requiredAuthTypes, + 'getBookmarksByFolderId' + ); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - 'tweet.fields': 'tweetFields', + const normalizedOptions = options || {}; - 'media.fields': 'mediaFields', + // Destructure options (exclude path parameters, they're already function params) - 'poll.fields': 'pollFields', + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; - 'user.fields': 'userFields', + // Build the path with path parameters + let path = '/2/users/{id}/bookmarks/folders/{folder_id}'; - 'place.fields': 'placeFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + path = path.replace('{id}', encodeURIComponent(String(id))); - // Destructure options (exclude path parameters, they're already function params) + path = path.replace('{folder_id}', encodeURIComponent(String(folderId))); - const { - maxResults = undefined, + // Build query parameters + const params = new URLSearchParams(); - paginationToken = undefined, + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, - tweetFields = [], + ...requestOptions, + }; - expansions = [], + // Make the request + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } - mediaFields = [], + /** + * Get muting + * Retrieves a list of Users muted by the authenticated user. + * + * @returns Promise with the API response + */ + async getMuting( + id: string, + options: GetMutingStreamingOptions = {} + ): Promise { + // Validate authentication requirements - pollFields = [], + const requiredAuthTypes = []; + + requiredAuthTypes.push('OAuth2UserToken'); + + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'getMuting'); + + // Normalize options to handle both camelCase and original API parameter names + + const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + + 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + + const { + maxResults = undefined, + + paginationToken = undefined, userFields = [], - placeFields = [], + expansions = [], + + tweetFields = [], headers = {}, signal, @@ -1853,7 +1960,7 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/bookmarks'; + let path = '/2/users/{id}/muting'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -1868,28 +1975,16 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -1904,7 +1999,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1912,23 +2007,24 @@ export class UsersClient { } /** - * Create Bookmark - * Adds a post to the authenticated user’s bookmarks. + * Mute User + * Causes the authenticated user to mute a specific User by their ID. * * @returns Promise with the API response */ - async createBookmark( + async muteUser( id: string, - body: any, - options: CreateBookmarkStreamingOptions = {} - ): Promise { + options: MuteUserStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('OAuth2UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'createBookmark'); + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'muteUser'); // Normalize options to handle both camelCase and original API parameter names @@ -1936,10 +2032,16 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + body, + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/bookmarks'; + let path = '/2/users/{id}/muting'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -1960,7 +2062,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -1968,41 +2070,89 @@ export class UsersClient { } /** - * Block DMs - * Blocks direct messages to or from a specific User by their ID for the authenticated user. + * Get owned Lists + * Retrieves a list of Lists owned by a specific User by their ID. * * @returns Promise with the API response */ - async blockDms( + async getOwnedLists( id: string, - options: BlockDmsStreamingOptions = {} - ): Promise { + options: GetOwnedListsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'blockDms'); + this.client.validateAuthentication(requiredAuthTypes, 'getOwnedLists'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + + 'list.fields': 'listFields', + + 'user.fields': 'userFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + maxResults = undefined, + + paginationToken = undefined, + + listFields = [], + + expansions = [], + + userFields = [], + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/dm/block'; + let path = '/2/users/{id}/owned_lists'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (listFields !== undefined && listFields.length > 0) { + params.append('list.fields', listFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -2015,24 +2165,24 @@ export class UsersClient { }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Unfollow List - * Causes the authenticated user to unfollow a specific List by its ID. + * Unpin List + * Causes the authenticated user to unpin a specific List by its ID. * * @returns Promise with the API response */ - async unfollowList( + async unpinList( id: string, listId: string, - options: UnfollowListStreamingOptions = {} - ): Promise { + options: UnpinListStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -2041,7 +2191,7 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'unfollowList'); + this.client.validateAuthentication(requiredAuthTypes, 'unpinList'); // Normalize options to handle both camelCase and original API parameter names @@ -2052,7 +2202,7 @@ export class UsersClient { const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/followed_lists/{list_id}'; + let path = '/2/users/{id}/pinned_lists/{list_id}'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -2073,7 +2223,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2081,32 +2231,30 @@ export class UsersClient { } /** - * Get muting - * Retrieves a list of Users muted by the authenticated user. + * Get User by username + * Retrieves details of a specific User by their username. * * @returns Promise with the API response */ - async getMuting( - id: string, - options: GetMutingStreamingOptions = {} - ): Promise { + async getByUsername( + username: string, + options: GetByUsernameStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getMuting'); + this.client.validateAuthentication(requiredAuthTypes, 'getByUsername'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - 'user.fields': 'userFields', 'tweet.fields': 'tweetFields', @@ -2119,10 +2267,6 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - userFields = [], expansions = [], @@ -2135,21 +2279,13 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/muting'; + let path = '/2/users/by/username/{username}'; - path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace('{username}', encodeURIComponent(String(username))); // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } @@ -2174,7 +2310,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2182,15 +2318,15 @@ export class UsersClient { } /** - * Mute User - * Causes the authenticated user to mute a specific User by their ID. + * Get blocking + * Retrieves a list of Users blocked by the specified User ID. * * @returns Promise with the API response */ - async muteUser( + async getBlocking( id: string, - options: MuteUserStreamingOptions = {} - ): Promise { + options: GetBlockingStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -2199,76 +2335,15 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'muteUser'); + this.client.validateAuthentication(requiredAuthTypes, 'getBlocking'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + max_results: 'maxResults', - // Destructure options (exclude path parameters, they're already function params) - - const { - body, - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/users/{id}/muting'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - body: JSON.stringify(body), - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'POST', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get User by ID - * Retrieves details of a specific User by their ID. - * - * @returns Promise with the API response - */ - async getById( - id: string, - options: GetByIdStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('BearerToken'); - - requiredAuthTypes.push('OAuth2UserToken'); - - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'getById'); - - // Normalize options to handle both camelCase and original API parameter names + pagination_token: 'paginationToken', - const paramMappings: Record = { 'user.fields': 'userFields', 'tweet.fields': 'tweetFields', @@ -2281,6 +2356,10 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { + maxResults = undefined, + + paginationToken = undefined, + userFields = [], expansions = [], @@ -2293,13 +2372,21 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}'; + let path = '/2/users/{id}/blocking'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } @@ -2324,7 +2411,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2332,12 +2419,15 @@ export class UsersClient { } /** - * Get my User - * Retrieves details of the authenticated user. + * Get liked Posts + * Retrieves a list of Posts liked by a specific User by their ID. * * @returns Promise with the API response */ - async getMe(options: GetMeStreamingOptions = {}): Promise { + async getLikedPosts( + id: string, + options: GetLikedPostsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -2346,14 +2436,24 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getMe'); + this.client.validateAuthentication(requiredAuthTypes, 'getLikedPosts'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'user.fields': 'userFields', + max_results: 'maxResults', + + pagination_token: 'paginationToken', 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2363,35 +2463,67 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { - userFields = [], + maxResults = undefined, - expansions = [], + paginationToken = undefined, tweetFields = [], + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], + headers = {}, signal, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/me'; + let path = '/2/users/{id}/liked_tweets'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } if (tweetFields !== undefined && tweetFields.length > 0) { params.append('tweet.fields', tweetFields.join(',')); } + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -2404,7 +2536,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2412,16 +2544,16 @@ export class UsersClient { } /** - * Unrepost Post - * Causes the authenticated user to unrepost a specific Post by its ID. + * Unlike Post + * Causes the authenticated user to Unlike a specific Post by its ID. * * @returns Promise with the API response */ - async unrepostPost( + async unlikePost( id: string, - sourceTweetId: string, - options: UnrepostPostStreamingOptions = {} - ): Promise { + tweetId: string, + options: UnlikePostStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -2430,7 +2562,7 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'unrepostPost'); + this.client.validateAuthentication(requiredAuthTypes, 'unlikePost'); // Normalize options to handle both camelCase and original API parameter names @@ -2441,14 +2573,11 @@ export class UsersClient { const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/retweets/{source_tweet_id}'; + let path = '/2/users/{id}/likes/{tweet_id}'; path = path.replace('{id}', encodeURIComponent(String(id))); - path = path.replace( - '{source_tweet_id}', - encodeURIComponent(String(sourceTweetId)) - ); + path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); // Build query parameters const params = new URLSearchParams(); @@ -2465,7 +2594,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2473,50 +2602,89 @@ export class UsersClient { } /** - * Unmute User - * Causes the authenticated user to unmute a specific user by their ID. + * Get followed Lists + * Retrieves a list of Lists followed by a specific User by their ID. * * @returns Promise with the API response */ - async unmuteUser( - sourceUserId: string, - targetUserId: string, - options: UnmuteUserStreamingOptions = {} - ): Promise { + async getFollowedLists( + id: string, + options: GetFollowedListsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'unmuteUser'); + this.client.validateAuthentication(requiredAuthTypes, 'getFollowedLists'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + + 'list.fields': 'listFields', + + 'user.fields': 'userFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + maxResults = undefined, - // Build the path with path parameters - let path = '/2/users/{source_user_id}/muting/{target_user_id}'; + paginationToken = undefined, - path = path.replace( - '{source_user_id}', - encodeURIComponent(String(sourceUserId)) - ); + listFields = [], - path = path.replace( - '{target_user_id}', - encodeURIComponent(String(targetUserId)) - ); + expansions = [], + + userFields = [], + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/{id}/followed_lists'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (listFields !== undefined && listFields.length > 0) { + params.append('list.fields', listFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -2529,23 +2697,23 @@ export class UsersClient { }; // Make the request - return this.client.request( - 'DELETE', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Search Users - * Retrieves a list of Users matching a search query. + * Follow List + * Causes the authenticated user to follow a specific List by its ID. * * @returns Promise with the API response */ - async search( - query: any, - options: SearchStreamingOptions = {} - ): Promise { + async followList( + id: string, + options: FollowListStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -2554,18 +2722,95 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'search'); + this.client.validateAuthentication(requiredAuthTypes, 'followList'); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { + body, + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/{id}/followed_lists'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, + + body: JSON.stringify(body), + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Get Timeline + * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. + * + * @returns Promise with the API response + */ + async getTimeline( + id: string, + options: GetTimelineStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('OAuth2UserToken'); + + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'getTimeline'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { + since_id: 'sinceId', + + until_id: 'untilId', + max_results: 'maxResults', - next_token: 'nextToken', + pagination_token: 'paginationToken', - 'user.fields': 'userFields', + start_time: 'startTime', + + end_time: 'endTime', 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2575,51 +2820,97 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { + sinceId = undefined, + + untilId = undefined, + maxResults = undefined, - nextToken = undefined, + paginationToken = undefined, - userFields = [], + exclude = [], - expansions = [], + startTime = undefined, + + endTime = undefined, tweetFields = [], + expansions = [], + + mediaFields = [], + + pollFields = [], + + userFields = [], + + placeFields = [], + headers = {}, signal, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/search'; + let path = '/2/users/{id}/timelines/reverse_chronological'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (query !== undefined) { - params.append('query', String(query)); + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); + } + + if (untilId !== undefined) { + params.append('until_id', String(untilId)); } if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (nextToken !== undefined) { - params.append('next_token', String(nextToken)); + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (exclude !== undefined && exclude.length > 0) { + params.append('exclude', exclude.join(',')); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (endTime !== undefined) { + params.append('end_time', String(endTime)); } if (tweetFields !== undefined && tweetFields.length > 0) { params.append('tweet.fields', tweetFields.join(',')); } + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -2632,7 +2923,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2783,26 +3074,23 @@ export class UsersClient { } /** - * Get followed Lists - * Retrieves a list of Lists followed by a specific User by their ID. + * Get Reposts of me + * Retrieves a list of Posts that repost content from the authenticated user. * * @returns Promise with the API response */ - async getFollowedLists( - id: string, - options: GetFollowedListsStreamingOptions = {} - ): Promise { + async getRepostsOfMe( + options: GetRepostsOfMeStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getFollowedLists'); + this.client.validateAuthentication(requiredAuthTypes, 'getRepostsOfMe'); // Normalize options to handle both camelCase and original API parameter names @@ -2811,9 +3099,15 @@ export class UsersClient { pagination_token: 'paginationToken', - 'list.fields': 'listFields', + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', 'user.fields': 'userFields', + + 'place.fields': 'placeFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -2827,21 +3121,25 @@ export class UsersClient { paginationToken = undefined, - listFields = [], + tweetFields = [], expansions = [], + mediaFields = [], + + pollFields = [], + userFields = [], + placeFields = [], + headers = {}, signal, requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/followed_lists'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/users/reposts_of_me'; // Build query parameters const params = new URLSearchParams(); @@ -2854,18 +3152,30 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (listFields !== undefined && listFields.length > 0) { - params.append('list.fields', listFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } + if (mediaFields !== undefined && mediaFields.length > 0) { + params.append('media.fields', mediaFields.join(',')); + } + + if (pollFields !== undefined && pollFields.length > 0) { + params.append('poll.fields', pollFields.join(',')); + } + if (userFields !== undefined && userFields.length > 0) { params.append('user.fields', userFields.join(',')); } + if (placeFields !== undefined && placeFields.length > 0) { + params.append('place.fields', placeFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -2878,7 +3188,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -2886,47 +3196,89 @@ export class UsersClient { } /** - * Follow List - * Causes the authenticated user to follow a specific List by its ID. + * Get following + * Retrieves a list of Users followed by a specific User by their ID. * * @returns Promise with the API response */ - async followList( + async getFollowing( id: string, - options: FollowListStreamingOptions = {} - ): Promise { + options: GetFollowingStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'followList'); + this.client.validateAuthentication(requiredAuthTypes, 'getFollowing'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + max_results: 'maxResults', + + pagination_token: 'paginationToken', + + 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) const { - body, + maxResults = undefined, - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + paginationToken = undefined, - // Build the path with path parameters - let path = '/2/users/{id}/followed_lists'; + userFields = [], + + expansions = [], + + tweetFields = [], + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/{id}/following'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); + } + + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); + } + + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -2935,29 +3287,27 @@ export class UsersClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Like Post - * Causes the authenticated user to Like a specific Post by its ID. + * Follow User + * Causes the authenticated user to follow a specific user by their ID. * * @returns Promise with the API response */ - async likePost( + async followUser( id: string, - options: LikePostStreamingOptions = {} - ): Promise { + options: FollowUserStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -2966,7 +3316,7 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'likePost'); + this.client.validateAuthentication(requiredAuthTypes, 'followUser'); // Normalize options to handle both camelCase and original API parameter names @@ -2983,7 +3333,7 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/likes'; + let path = '/2/users/{id}/following'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -3004,7 +3354,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -3012,15 +3362,15 @@ export class UsersClient { } /** - * Get liked Posts - * Retrieves a list of Posts liked by a specific User by their ID. + * Unblock DMs + * Unblocks direct messages to or from a specific User by their ID for the authenticated user. * * @returns Promise with the API response */ - async getLikedPosts( + async unblockDms( id: string, - options: GetLikedPostsStreamingOptions = {} - ): Promise { + options: UnblockDmsStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -3029,15 +3379,80 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getLikedPosts'); + this.client.validateAuthentication(requiredAuthTypes, 'unblockDms'); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/{id}/dm/unblock'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Get mentions + * Retrieves a list of Posts that mention a specific User by their ID. + * + * @returns Promise with the API response + */ + async getMentions( + id: string, + options: GetMentionsStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('BearerToken'); + + requiredAuthTypes.push('OAuth2UserToken'); + + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'getMentions'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { + since_id: 'sinceId', + + until_id: 'untilId', + max_results: 'maxResults', pagination_token: 'paginationToken', + start_time: 'startTime', + + end_time: 'endTime', + 'tweet.fields': 'tweetFields', 'media.fields': 'mediaFields', @@ -3056,10 +3471,18 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { + sinceId = undefined, + + untilId = undefined, + maxResults = undefined, paginationToken = undefined, + startTime = undefined, + + endTime = undefined, + tweetFields = [], expansions = [], @@ -3078,13 +3501,21 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/liked_tweets'; + let path = '/2/users/{id}/mentions'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (sinceId !== undefined) { + params.append('since_id', String(sinceId)); + } + + if (untilId !== undefined) { + params.append('until_id', String(untilId)); + } + if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } @@ -3093,6 +3524,14 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } + if (startTime !== undefined) { + params.append('start_time', String(startTime)); + } + + if (endTime !== undefined) { + params.append('end_time', String(endTime)); + } + if (tweetFields !== undefined && tweetFields.length > 0) { params.append('tweet.fields', tweetFields.join(',')); } @@ -3129,7 +3568,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -3137,33 +3576,29 @@ export class UsersClient { } /** - * Get Users by usernames - * Retrieves details of multiple Users by their usernames. + * Get Bookmark folders + * Retrieves a list of Bookmark folders created by the authenticated user. * * @returns Promise with the API response */ - async getByUsernames( - usernames: Array, - options: GetByUsernamesStreamingOptions = {} - ): Promise { + async getBookmarkFolders( + id: string, + options: GetBookmarkFoldersStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'getByUsernames'); + this.client.validateAuthentication(requiredAuthTypes, 'getBookmarkFolders'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'user.fields': 'userFields', + max_results: 'maxResults', - 'tweet.fields': 'tweetFields', + pagination_token: 'paginationToken', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -3173,11 +3608,9 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { - userFields = [], - - expansions = [], + maxResults = undefined, - tweetFields = [], + paginationToken = undefined, headers = {}, signal, @@ -3185,25 +3618,19 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/by'; + let path = '/2/users/{id}/bookmarks/folders'; + + path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (usernames !== undefined && usernames.length > 0) { - params.append('usernames', usernames.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); + if (maxResults !== undefined) { + params.append('max_results', String(maxResults)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (paginationToken !== undefined) { + params.append('pagination_token', String(paginationToken)); } // Prepare request options @@ -3218,7 +3645,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -3226,15 +3653,16 @@ export class UsersClient { } /** - * Repost Post - * Causes the authenticated user to repost a specific Post by its ID. + * Unrepost Post + * Causes the authenticated user to unrepost a specific Post by its ID. * * @returns Promise with the API response */ - async repostPost( + async unrepostPost( id: string, - options: RepostPostStreamingOptions = {} - ): Promise { + sourceTweetId: string, + options: UnrepostPostStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -3243,7 +3671,7 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'repostPost'); + this.client.validateAuthentication(requiredAuthTypes, 'unrepostPost'); // Normalize options to handle both camelCase and original API parameter names @@ -3251,19 +3679,18 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) - const { - body, - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/retweets'; + let path = '/2/users/{id}/retweets/{source_tweet_id}'; path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace( + '{source_tweet_id}', + encodeURIComponent(String(sourceTweetId)) + ); + // Build query parameters const params = new URLSearchParams(); @@ -3275,495 +3702,54 @@ export class UsersClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } - /** - * Unfollow User - * Causes the authenticated user to unfollow a specific user by their ID. - * - * @returns Promise with the API response - */ - async unfollowUser( - sourceUserId: string, - targetUserId: string, - options: UnfollowUserStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('OAuth2UserToken'); - - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'unfollowUser'); - - // Normalize options to handle both camelCase and original API parameter names - - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) - - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/users/{source_user_id}/following/{target_user_id}'; - - path = path.replace( - '{source_user_id}', - encodeURIComponent(String(sourceUserId)) - ); - - path = path.replace( - '{target_user_id}', - encodeURIComponent(String(targetUserId)) - ); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'DELETE', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get followers - * Retrieves a list of Users who follow a specific User by their ID. - * - * @returns Promise with the API response - */ - async getFollowers( - id: string, - options: GetFollowersStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('BearerToken'); - - requiredAuthTypes.push('OAuth2UserToken'); - - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'getFollowers'); - - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - - const { - maxResults = undefined, - - paginationToken = undefined, - - userFields = [], - - expansions = [], - - tweetFields = [], - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/users/{id}/followers'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get Users by IDs - * Retrieves details of multiple Users by their IDs. - * - * @returns Promise with the API response - */ - async getByIds( - ids: Array, - options: GetByIdsStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('BearerToken'); - - requiredAuthTypes.push('OAuth2UserToken'); - - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'getByIds'); - - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - - const { - userFields = [], - - expansions = [], - - tweetFields = [], - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/users'; - - // Build query parameters - const params = new URLSearchParams(); - - if (ids !== undefined && ids.length > 0) { - params.append('ids', ids.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get Bookmarks by folder ID - * Retrieves Posts in a specific Bookmark folder by its ID for the authenticated user. - * - * @returns Promise with the API response - */ - async getBookmarksByFolderId( - id: string, - folderId: string, - options: GetBookmarksByFolderIdStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('OAuth2UserToken'); - - this.client.validateAuthentication( - requiredAuthTypes, - 'getBookmarksByFolderId' - ); - - // Normalize options to handle both camelCase and original API parameter names - - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) - - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/users/{id}/bookmarks/folders/{folder_id}'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - path = path.replace('{folder_id}', encodeURIComponent(String(folderId))); - - // Build query parameters - const params = new URLSearchParams(); - - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get Bookmark folders - * Retrieves a list of Bookmark folders created by the authenticated user. - * - * @returns Promise with the API response - */ - async getBookmarkFolders( - id: string, - options: GetBookmarkFoldersStreamingOptions = {} - ): Promise { - // Validate authentication requirements - - const requiredAuthTypes = []; - - requiredAuthTypes.push('OAuth2UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'getBookmarkFolders'); - - // Normalize options to handle both camelCase and original API parameter names - - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - - const { - maxResults = undefined, - - paginationToken = undefined, - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; - - // Build the path with path parameters - let path = '/2/users/{id}/bookmarks/folders'; - - path = path.replace('{id}', encodeURIComponent(String(id))); - - // Build query parameters - const params = new URLSearchParams(); - - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - // Prepare request options - const finalRequestOptions: RequestOptions = { - headers: { - 'Content-Type': 'application/json', - ...headers, - }, - signal: signal, - - ...requestOptions, - }; - - // Make the request - return this.client.request( - 'GET', - path + (params.toString() ? `?${params.toString()}` : ''), - finalRequestOptions - ); - } - - /** - * Get following - * Retrieves a list of Users followed by a specific User by their ID. + /** + * Delete Bookmark + * Removes a Post from the authenticated user’s Bookmarks by its ID. * * @returns Promise with the API response */ - async getFollowing( + async deleteBookmark( id: string, - options: GetFollowingStreamingOptions = {} - ): Promise { + tweetId: string, + options: DeleteBookmarkStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'getFollowing'); + this.client.validateAuthentication(requiredAuthTypes, 'deleteBookmark'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - 'user.fields': 'userFields', - - 'tweet.fields': 'tweetFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) - const { - maxResults = undefined, - - paginationToken = undefined, - - userFields = [], - - expansions = [], - - tweetFields = [], - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/following'; + let path = '/2/users/{id}/bookmarks/{tweet_id}'; path = path.replace('{id}', encodeURIComponent(String(id))); + path = path.replace('{tweet_id}', encodeURIComponent(String(tweetId))); + // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); - } - - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } - - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -3776,23 +3762,23 @@ export class UsersClient { }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Follow User - * Causes the authenticated user to follow a specific user by their ID. + * Repost Post + * Causes the authenticated user to repost a specific Post by its ID. * * @returns Promise with the API response */ - async followUser( + async repostPost( id: string, - options: FollowUserStreamingOptions = {} - ): Promise { + options: RepostPostStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -3801,7 +3787,7 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'followUser'); + this.client.validateAuthentication(requiredAuthTypes, 'repostPost'); // Normalize options to handle both camelCase and original API parameter names @@ -3818,7 +3804,7 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/following'; + let path = '/2/users/{id}/retweets'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -3839,7 +3825,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -3847,15 +3833,15 @@ export class UsersClient { } /** - * Get Timeline - * Retrieves a reverse chronological list of Posts in the authenticated User’s Timeline. + * Search Users + * Retrieves a list of Users matching a search query. * * @returns Promise with the API response */ - async getTimeline( - id: string, - options: GetTimelineStreamingOptions = {} - ): Promise { + async search( + query: any, + options: SearchStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -3864,32 +3850,18 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getTimeline'); + this.client.validateAuthentication(requiredAuthTypes, 'search'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - since_id: 'sinceId', - - until_id: 'untilId', - max_results: 'maxResults', - pagination_token: 'paginationToken', - - start_time: 'startTime', - - end_time: 'endTime', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', + next_token: 'nextToken', 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -3899,31 +3871,15 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { - sinceId = undefined, - - untilId = undefined, - maxResults = undefined, - paginationToken = undefined, - - exclude = [], - - startTime = undefined, - - endTime = undefined, + nextToken = undefined, - tweetFields = [], + userFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + tweetFields = [], headers = {}, signal, @@ -3931,63 +3887,33 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/timelines/reverse_chronological'; - - path = path.replace('{id}', encodeURIComponent(String(id))); + let path = '/2/users/search'; // Build query parameters const params = new URLSearchParams(); - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); + if (query !== undefined) { + params.append('query', String(query)); } if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); - } - - if (exclude !== undefined && exclude.length > 0) { - params.append('exclude', exclude.join(',')); - } - - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); + if (nextToken !== undefined) { + params.append('next_token', String(nextToken)); } - if (tweetFields !== undefined && tweetFields.length > 0) { - params.append('tweet.fields', tweetFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } - - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } - - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } - - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -4002,7 +3928,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -4010,41 +3936,73 @@ export class UsersClient { } /** - * Unblock DMs - * Unblocks direct messages to or from a specific User by their ID for the authenticated user. + * Get User by ID + * Retrieves details of a specific User by their ID. * * @returns Promise with the API response */ - async unblockDms( + async getById( id: string, - options: UnblockDmsStreamingOptions = {} - ): Promise { + options: GetByIdStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; + requiredAuthTypes.push('BearerToken'); + requiredAuthTypes.push('OAuth2UserToken'); requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'unblockDms'); + this.client.validateAuthentication(requiredAuthTypes, 'getById'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + userFields = [], + + expansions = [], + + tweetFields = [], + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/dm/unblock'; + let path = '/2/users/{id}'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); + } + + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); + } + + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -4057,50 +4015,38 @@ export class UsersClient { }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get mentions - * Retrieves a list of Posts that mention a specific User by their ID. + * Get Bookmarks + * Retrieves a list of Posts bookmarked by the authenticated user. * * @returns Promise with the API response */ - async getMentions( + async getBookmarks( id: string, - options: GetMentionsStreamingOptions = {} - ): Promise { + options: GetBookmarksStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; - requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('OAuth2UserToken'); - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'getMentions'); + this.client.validateAuthentication(requiredAuthTypes, 'getBookmarks'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - since_id: 'sinceId', - - until_id: 'untilId', - max_results: 'maxResults', pagination_token: 'paginationToken', - start_time: 'startTime', - - end_time: 'endTime', - 'tweet.fields': 'tweetFields', 'media.fields': 'mediaFields', @@ -4119,18 +4065,10 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { - sinceId = undefined, - - untilId = undefined, - maxResults = undefined, paginationToken = undefined, - startTime = undefined, - - endTime = undefined, - tweetFields = [], expansions = [], @@ -4149,21 +4087,13 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/mentions'; + let path = '/2/users/{id}/bookmarks'; path = path.replace('{id}', encodeURIComponent(String(id))); // Build query parameters const params = new URLSearchParams(); - if (sinceId !== undefined) { - params.append('since_id', String(sinceId)); - } - - if (untilId !== undefined) { - params.append('until_id', String(untilId)); - } - if (maxResults !== undefined) { params.append('max_results', String(maxResults)); } @@ -4172,14 +4102,6 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (startTime !== undefined) { - params.append('start_time', String(startTime)); - } - - if (endTime !== undefined) { - params.append('end_time', String(endTime)); - } - if (tweetFields !== undefined && tweetFields.length > 0) { params.append('tweet.fields', tweetFields.join(',')); } @@ -4216,7 +4138,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -4224,15 +4146,71 @@ export class UsersClient { } /** - * Get List memberships - * Retrieves a list of Lists that a specific User is a member of by their ID. + * Create Bookmark + * Adds a post to the authenticated user’s bookmarks. * * @returns Promise with the API response */ - async getListMemberships( + async createBookmark( id: string, - options: GetListMembershipsStreamingOptions = {} - ): Promise { + body: any, + options: CreateBookmarkStreamingOptions = {} + ): Promise { + // Validate authentication requirements + + const requiredAuthTypes = []; + + requiredAuthTypes.push('OAuth2UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'createBookmark'); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/{id}/bookmarks'; + + path = path.replace('{id}', encodeURIComponent(String(id))); + + // Build query parameters + const params = new URLSearchParams(); + + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, + + body: JSON.stringify(body), + + ...requestOptions, + }; + + // Make the request + return this.client.request( + 'POST', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } + + /** + * Get followers + * Retrieves a list of Users who follow a specific User by their ID. + * + * @returns Promise with the API response + */ + async getFollowers( + id: string, + options: GetFollowersStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -4243,7 +4221,7 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getListMemberships'); + this.client.validateAuthentication(requiredAuthTypes, 'getFollowers'); // Normalize options to handle both camelCase and original API parameter names @@ -4252,9 +4230,9 @@ export class UsersClient { pagination_token: 'paginationToken', - 'list.fields': 'listFields', - 'user.fields': 'userFields', + + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -4268,11 +4246,11 @@ export class UsersClient { paginationToken = undefined, - listFields = [], + userFields = [], expansions = [], - userFields = [], + tweetFields = [], headers = {}, signal, @@ -4280,7 +4258,7 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/{id}/list_memberships'; + let path = '/2/users/{id}/followers'; path = path.replace('{id}', encodeURIComponent(String(id))); @@ -4295,16 +4273,16 @@ export class UsersClient { params.append('pagination_token', String(paginationToken)); } - if (listFields !== undefined && listFields.length > 0) { - params.append('list.fields', listFields.join(',')); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } if (expansions !== undefined && expansions.length > 0) { params.append('expansions', expansions.join(',')); } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); + if (tweetFields !== undefined && tweetFields.length > 0) { + params.append('tweet.fields', tweetFields.join(',')); } // Prepare request options @@ -4319,7 +4297,7 @@ export class UsersClient { }; // Make the request - return this.client.request( + return this.client.request( 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions @@ -4327,14 +4305,12 @@ export class UsersClient { } /** - * Get Reposts of me - * Retrieves a list of Posts that repost content from the authenticated user. + * Get my User + * Retrieves details of the authenticated user. * * @returns Promise with the API response */ - async getRepostsOfMe( - options: GetRepostsOfMeStreamingOptions = {} - ): Promise { + async getMe(options: GetMeStreamingOptions = {}): Promise { // Validate authentication requirements const requiredAuthTypes = []; @@ -4343,24 +4319,14 @@ export class UsersClient { requiredAuthTypes.push('UserToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getRepostsOfMe'); + this.client.validateAuthentication(requiredAuthTypes, 'getMe'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - max_results: 'maxResults', - - pagination_token: 'paginationToken', - - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - 'user.fields': 'userFields', - 'place.fields': 'placeFields', + 'tweet.fields': 'tweetFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -4370,21 +4336,11 @@ export class UsersClient { // Destructure options (exclude path parameters, they're already function params) const { - maxResults = undefined, - - paginationToken = undefined, - - tweetFields = [], + userFields = [], expansions = [], - mediaFields = [], - - pollFields = [], - - userFields = [], - - placeFields = [], + tweetFields = [], headers = {}, signal, @@ -4392,42 +4348,86 @@ export class UsersClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/users/reposts_of_me'; + let path = '/2/users/me'; // Build query parameters const params = new URLSearchParams(); - if (maxResults !== undefined) { - params.append('max_results', String(maxResults)); + if (userFields !== undefined && userFields.length > 0) { + params.append('user.fields', userFields.join(',')); } - if (paginationToken !== undefined) { - params.append('pagination_token', String(paginationToken)); + if (expansions !== undefined && expansions.length > 0) { + params.append('expansions', expansions.join(',')); } if (tweetFields !== undefined && tweetFields.length > 0) { params.append('tweet.fields', tweetFields.join(',')); } - if (expansions !== undefined && expansions.length > 0) { - params.append('expansions', expansions.join(',')); - } + // Prepare request options + const finalRequestOptions: RequestOptions = { + headers: { + 'Content-Type': 'application/json', + ...headers, + }, + signal: signal, - if (mediaFields !== undefined && mediaFields.length > 0) { - params.append('media.fields', mediaFields.join(',')); - } + ...requestOptions, + }; - if (pollFields !== undefined && pollFields.length > 0) { - params.append('poll.fields', pollFields.join(',')); - } + // Make the request + return this.client.request( + 'GET', + path + (params.toString() ? `?${params.toString()}` : ''), + finalRequestOptions + ); + } - if (userFields !== undefined && userFields.length > 0) { - params.append('user.fields', userFields.join(',')); - } + /** + * Unmute User + * Causes the authenticated user to unmute a specific user by their ID. + * + * @returns Promise with the API response + */ + async unmuteUser( + sourceUserId: string, + targetUserId: string, + options: UnmuteUserStreamingOptions = {} + ): Promise { + // Validate authentication requirements - if (placeFields !== undefined && placeFields.length > 0) { - params.append('place.fields', placeFields.join(',')); - } + const requiredAuthTypes = []; + + requiredAuthTypes.push('OAuth2UserToken'); + + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'unmuteUser'); + + // Normalize options to handle both camelCase and original API parameter names + + const normalizedOptions = options || {}; + + // Destructure options (exclude path parameters, they're already function params) + + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/users/{source_user_id}/muting/{target_user_id}'; + + path = path.replace( + '{source_user_id}', + encodeURIComponent(String(sourceUserId)) + ); + + path = path.replace( + '{target_user_id}', + encodeURIComponent(String(targetUserId)) + ); + + // Build query parameters + const params = new URLSearchParams(); // Prepare request options const finalRequestOptions: RequestOptions = { @@ -4441,8 +4441,8 @@ export class UsersClient { }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/webhooks/client.ts b/xdk/typescript/src/webhooks/client.ts index 16feb532..5a1763a8 100644 --- a/xdk/typescript/src/webhooks/client.ts +++ b/xdk/typescript/src/webhooks/client.ts @@ -16,16 +16,47 @@ import { EventPaginator, } from '../paginator.js'; import { - CreateStreamLinkResponse, - DeleteStreamLinkResponse, - ValidateResponse, - DeleteResponse, - GetStreamLinksResponse, GetResponse, CreateRequest, CreateResponse, + ValidateResponse, + DeleteResponse, + CreateStreamLinkResponse, + DeleteStreamLinkResponse, + GetStreamLinksResponse, } from './models.js'; +/** + * Options for get method + * + * @public + */ +export interface GetOptions { + /** A comma separated list of WebhookConfig fields to display. + * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */ + webhookConfigFields?: Array; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + +/** + * Options for create method + * + * @public + */ +export interface CreateOptions { + /** Request body */ + body?: CreateRequest; + + /** Additional request options */ + requestOptions?: RequestOptions; + /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ + [key: string]: any; +} + /** * Options for createStreamLink method * @@ -62,37 +93,6 @@ export interface CreateStreamLinkOptions { [key: string]: any; } -/** - * Options for get method - * - * @public - */ -export interface GetOptions { - /** A comma separated list of WebhookConfig fields to display. - * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */ - webhookConfigFields?: Array; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - -/** - * Options for create method - * - * @public - */ -export interface CreateOptions { - /** Request body */ - body?: CreateRequest; - - /** Additional request options */ - requestOptions?: RequestOptions; - /** Allow original API parameter names (e.g., 'tweet.fields', 'user.fields') and proper camelCase (e.g., 'tweetFields', 'userFields') */ - [key: string]: any; -} - /** * Client for webhooks operations * @@ -144,34 +144,19 @@ export class WebhooksClient { } /** - * Create stream link - * Creates a link to deliver FilteredStream events to the given webhook. - - - * @param webhookId The webhook ID to link to your FilteredStream ruleset. - + * Get webhook + * Get a list of webhook configs associated with a client app. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async createStreamLink( - webhookId: string, - options: CreateStreamLinkOptions = {} - ): Promise { + async get(options: GetOptions = {}): Promise { // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - - 'user.fields': 'userFields', - - 'place.fields': 'placeFields', + 'webhook_config.fields': 'webhookConfigFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -180,51 +165,19 @@ export class WebhooksClient { // Destructure options (exclude path parameters, they're already function params) const { - tweetFields = undefined, - - expansions = undefined, - - mediaFields = undefined, - - pollFields = undefined, - - userFields = undefined, - - placeFields = undefined, + webhookConfigFields = [], requestOptions: requestOptions = {}, } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/webhooks/{webhook_id}'; - - path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); + let path = '/2/webhooks'; // Build query parameters const params = new URLSearchParams(); - if (tweetFields !== undefined) { - params.append('tweet.fields', String(tweetFields)); - } - - if (expansions !== undefined) { - params.append('expansions', String(expansions)); - } - - if (mediaFields !== undefined) { - params.append('media.fields', String(mediaFields)); - } - - if (pollFields !== undefined) { - params.append('poll.fields', String(pollFields)); - } - - if (userFields !== undefined) { - params.append('user.fields', String(userFields)); - } - - if (placeFields !== undefined) { - params.append('place.fields', String(placeFields)); + if (webhookConfigFields !== undefined && webhookConfigFields.length > 0) { + params.append('webhook_config.fields', webhookConfigFields.join(',')); } // Prepare request options @@ -239,53 +192,60 @@ export class WebhooksClient { ...requestOptions, }; - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Delete stream link - * Deletes a link from FilteredStream events to the given webhook. - - - * @param webhookId The webhook ID to link to your FilteredStream ruleset. - + * Create webhook + * Creates a new webhook configuration. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async deleteStreamLink(webhookId: string): Promise { + async create(options: CreateOptions = {}): Promise { // Normalize options to handle both camelCase and original API parameter names - const requestOptions = {}; + const normalizedOptions = options || {}; - // Build the path with path parameters - let path = '/2/tweets/search/webhooks/{webhook_id}'; + // Destructure options (exclude path parameters, they're already function params) + const { + body, - path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); + requestOptions: requestOptions = {}, + } = normalizedOptions; + + // Build the path with path parameters + let path = '/2/webhooks'; // Build query parameters const params = new URLSearchParams(); // Prepare request options const finalRequestOptions: RequestOptions = { + body: body ? JSON.stringify(body) : undefined, + // Pass security requirements for smart auth selection security: [ { BearerToken: [], }, + + { + UserToken: [], + }, ], - // No optional parameters, using empty request options + ...requestOptions, }; - return this.client.request( - 'DELETE', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); @@ -390,25 +350,89 @@ export class WebhooksClient { } /** - * Get stream links - * Get a list of webhook links associated with a filtered stream ruleset. + * Create stream link + * Creates a link to deliver FilteredStream events to the given webhook. + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @returns {Promise} Promise resolving to the API response + + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async getStreamLinks(): Promise { + async createStreamLink( + webhookId: string, + options: CreateStreamLinkOptions = {} + ): Promise { // Normalize options to handle both camelCase and original API parameter names - const requestOptions = {}; + const paramMappings: Record = { + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); + + // Destructure options (exclude path parameters, they're already function params) + const { + tweetFields = undefined, + + expansions = undefined, + + mediaFields = undefined, + + pollFields = undefined, + + userFields = undefined, + + placeFields = undefined, + + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/webhooks'; + let path = '/2/tweets/search/webhooks/{webhook_id}'; + + path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); // Build query parameters const params = new URLSearchParams(); + if (tweetFields !== undefined) { + params.append('tweet.fields', String(tweetFields)); + } + + if (expansions !== undefined) { + params.append('expansions', String(expansions)); + } + + if (mediaFields !== undefined) { + params.append('media.fields', String(mediaFields)); + } + + if (pollFields !== undefined) { + params.append('poll.fields', String(pollFields)); + } + + if (userFields !== undefined) { + params.append('user.fields', String(userFields)); + } + + if (placeFields !== undefined) { + params.append('place.fields', String(placeFields)); + } + // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection @@ -418,53 +442,42 @@ export class WebhooksClient { }, ], - // No optional parameters, using empty request options + ...requestOptions, }; - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get webhook - * Get a list of webhook configs associated with a client app. + * Delete stream link + * Deletes a link from FilteredStream events to the given webhook. + + * @param webhookId The webhook ID to link to your FilteredStream ruleset. - * @returns {Promise} Promise resolving to the API response + + + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async get(options: GetOptions = {}): Promise { + async deleteStreamLink(webhookId: string): Promise { // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - 'webhook_config.fields': 'webhookConfigFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); - - // Destructure options (exclude path parameters, they're already function params) - const { - webhookConfigFields = [], - - requestOptions: requestOptions = {}, - } = normalizedOptions; + const requestOptions = {}; // Build the path with path parameters - let path = '/2/webhooks'; + let path = '/2/tweets/search/webhooks/{webhook_id}'; + + path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); // Build query parameters const params = new URLSearchParams(); - if (webhookConfigFields !== undefined && webhookConfigFields.length > 0) { - params.append('webhook_config.fields', webhookConfigFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { // Pass security requirements for smart auth selection @@ -474,63 +487,50 @@ export class WebhooksClient { }, ], - ...requestOptions, + // No optional parameters, using empty request options }; - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Create webhook - * Creates a new webhook configuration. + * Get stream links + * Get a list of webhook links associated with a filtered stream ruleset. - * @returns {Promise} Promise resolving to the API response + * @returns {Promise} Promise resolving to the API response */ // Overload 1: Default behavior (unwrapped response) - async create(options: CreateOptions = {}): Promise { + async getStreamLinks(): Promise { // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; - - // Destructure options (exclude path parameters, they're already function params) - const { - body, - - requestOptions: requestOptions = {}, - } = normalizedOptions; + const requestOptions = {}; // Build the path with path parameters - let path = '/2/webhooks'; + let path = '/2/tweets/search/webhooks'; // Build query parameters const params = new URLSearchParams(); // Prepare request options const finalRequestOptions: RequestOptions = { - body: body ? JSON.stringify(body) : undefined, - // Pass security requirements for smart auth selection security: [ { BearerToken: [], }, - - { - UserToken: [], - }, ], - ...requestOptions, + // No optional parameters, using empty request options }; - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/src/webhooks/models.ts b/xdk/typescript/src/webhooks/models.ts index 107131f3..404cbfbf 100644 --- a/xdk/typescript/src/webhooks/models.ts +++ b/xdk/typescript/src/webhooks/models.ts @@ -11,50 +11,50 @@ import type * as Schemas from '../schemas.js'; /** - * Response for createStreamLink + * Response for get * * @public */ -export type CreateStreamLinkResponse = Schemas.WebhookLinksCreateResponse; +export type GetResponse = Schemas.Get2WebhooksResponse; /** - * Response for deleteStreamLink + * Request for create * * @public */ -export type DeleteStreamLinkResponse = Schemas.WebhookLinksDeleteResponse; +export type CreateRequest = Schemas.WebhookConfigCreateRequest; /** - * Response for validate + * Response for create * * @public */ -export type ValidateResponse = Schemas.WebhookConfigPutResponse; +export type CreateResponse = Schemas.WebhookConfigCreateResponse; /** - * Response for delete + * Response for validate * * @public */ -export type DeleteResponse = Schemas.WebhookConfigDeleteResponse; +export type ValidateResponse = Schemas.WebhookConfigPutResponse; /** - * Response for getStreamLinks + * Response for delete * * @public */ -export type GetStreamLinksResponse = Schemas.WebhookLinksGetResponse; +export type DeleteResponse = Schemas.WebhookConfigDeleteResponse; /** - * Response for get + * Response for createStreamLink * * @public */ -export type GetResponse = Schemas.Get2WebhooksResponse; +export type CreateStreamLinkResponse = Schemas.WebhookLinksCreateResponse; /** - * Request for create + * Response for deleteStreamLink * * @public */ -export type CreateRequest = Schemas.WebhookConfigCreateRequest; +export type DeleteStreamLinkResponse = Schemas.WebhookLinksDeleteResponse; /** - * Response for create + * Response for getStreamLinks * * @public */ -export type CreateResponse = Schemas.WebhookConfigCreateResponse; \ No newline at end of file +export type GetStreamLinksResponse = Schemas.WebhookLinksGetResponse; \ No newline at end of file diff --git a/xdk/typescript/src/webhooks/stream_client.ts b/xdk/typescript/src/webhooks/stream_client.ts index 3d7ef38c..13504081 100644 --- a/xdk/typescript/src/webhooks/stream_client.ts +++ b/xdk/typescript/src/webhooks/stream_client.ts @@ -10,44 +10,24 @@ import { Client, ApiResponse, RequestOptions } from '../client.js'; import { EventDrivenStream, StreamEvent } from './event_driven_stream.js'; import { - CreateStreamLinkResponse, - DeleteStreamLinkResponse, + GetResponse, + CreateResponse, ValidateResponse, DeleteResponse, + CreateStreamLinkResponse, + DeleteStreamLinkResponse, GetStreamLinksResponse, - GetResponse, - CreateResponse, } from './models.js'; /** - * Options for createStreamLink method + * Options for get method * * @public */ -export interface CreateStreamLinkStreamingOptions { - /** A comma separated list of Tweet fields to display. - * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ - tweetFields?: string; - - /** A comma separated list of fields to expand. - * Also accepts: expansions or proper camelCase (e.g., expansions) */ - expansions?: string; - - /** A comma separated list of Media fields to display. - * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ - mediaFields?: string; - - /** A comma separated list of Poll fields to display. - * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ - pollFields?: string; - - /** A comma separated list of User fields to display. - * Also accepts: user.fields or proper camelCase (e.g., userFields) */ - userFields?: string; - - /** A comma separated list of Place fields to display. - * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ - placeFields?: string; +export interface GetStreamingOptions { + /** A comma separated list of WebhookConfig fields to display. + * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */ + webhookConfigFields?: Array; /** Additional request options */ requestOptions?: RequestOptions; @@ -59,11 +39,14 @@ export interface CreateStreamLinkStreamingOptions { [key: string]: any; } /** - * Options for deleteStreamLink method + * Options for create method * * @public */ -export interface DeleteStreamLinkStreamingOptions { +export interface CreateStreamingOptions { + /** Request body */ + body?: any; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -104,11 +87,35 @@ export interface DeleteStreamingOptions { [key: string]: any; } /** - * Options for getStreamLinks method + * Options for createStreamLink method * * @public */ -export interface GetStreamLinksStreamingOptions { +export interface CreateStreamLinkStreamingOptions { + /** A comma separated list of Tweet fields to display. + * Also accepts: tweet.fields or proper camelCase (e.g., tweetFields) */ + tweetFields?: string; + + /** A comma separated list of fields to expand. + * Also accepts: expansions or proper camelCase (e.g., expansions) */ + expansions?: string; + + /** A comma separated list of Media fields to display. + * Also accepts: media.fields or proper camelCase (e.g., mediaFields) */ + mediaFields?: string; + + /** A comma separated list of Poll fields to display. + * Also accepts: poll.fields or proper camelCase (e.g., pollFields) */ + pollFields?: string; + + /** A comma separated list of User fields to display. + * Also accepts: user.fields or proper camelCase (e.g., userFields) */ + userFields?: string; + + /** A comma separated list of Place fields to display. + * Also accepts: place.fields or proper camelCase (e.g., placeFields) */ + placeFields?: string; + /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -119,15 +126,11 @@ export interface GetStreamLinksStreamingOptions { [key: string]: any; } /** - * Options for get method + * Options for deleteStreamLink method * * @public */ -export interface GetStreamingOptions { - /** A comma separated list of WebhookConfig fields to display. - * Also accepts: webhook_config.fields or proper camelCase (e.g., webhookConfigFields) */ - webhookConfigFields?: Array; - +export interface DeleteStreamLinkStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -138,14 +141,11 @@ export interface GetStreamingOptions { [key: string]: any; } /** - * Options for create method + * Options for getStreamLinks method * * @public */ -export interface CreateStreamingOptions { - /** Request body */ - body?: any; - +export interface GetStreamLinksStreamingOptions { /** Additional request options */ requestOptions?: RequestOptions; /** Additional headers */ @@ -193,35 +193,24 @@ export class WebhooksClient { } /** - * Create stream link - * Creates a link to deliver FilteredStream events to the given webhook. + * Get webhook + * Get a list of webhook configs associated with a client app. * * @returns Promise with the API response */ - async createStreamLink( - webhookId: string, - options: CreateStreamLinkStreamingOptions = {} - ): Promise { + async get(options: GetStreamingOptions = {}): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'createStreamLink'); + this.client.validateAuthentication(requiredAuthTypes, 'get'); // Normalize options to handle both camelCase and original API parameter names const paramMappings: Record = { - 'tweet.fields': 'tweetFields', - - 'media.fields': 'mediaFields', - - 'poll.fields': 'pollFields', - - 'user.fields': 'userFields', - - 'place.fields': 'placeFields', + 'webhook_config.fields': 'webhookConfigFields', }; const normalizedOptions = this._normalizeOptions( options || {}, @@ -231,17 +220,7 @@ export class WebhooksClient { // Destructure options (exclude path parameters, they're already function params) const { - tweetFields = undefined, - - expansions = undefined, - - mediaFields = undefined, - - pollFields = undefined, - - userFields = undefined, - - placeFields = undefined, + webhookConfigFields = [], headers = {}, signal, @@ -249,35 +228,13 @@ export class WebhooksClient { } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/webhooks/{webhook_id}'; - - path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); + let path = '/2/webhooks'; // Build query parameters const params = new URLSearchParams(); - if (tweetFields !== undefined) { - params.append('tweet.fields', String(tweetFields)); - } - - if (expansions !== undefined) { - params.append('expansions', String(expansions)); - } - - if (mediaFields !== undefined) { - params.append('media.fields', String(mediaFields)); - } - - if (pollFields !== undefined) { - params.append('poll.fields', String(pollFields)); - } - - if (userFields !== undefined) { - params.append('user.fields', String(userFields)); - } - - if (placeFields !== undefined) { - params.append('place.fields', String(placeFields)); + if (webhookConfigFields !== undefined && webhookConfigFields.length > 0) { + params.append('webhook_config.fields', webhookConfigFields.join(',')); } // Prepare request options @@ -292,30 +249,29 @@ export class WebhooksClient { }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Delete stream link - * Deletes a link from FilteredStream events to the given webhook. + * Create webhook + * Creates a new webhook configuration. * * @returns Promise with the API response */ - async deleteStreamLink( - webhookId: string, - options: DeleteStreamLinkStreamingOptions = {} - ): Promise { + async create(options: CreateStreamingOptions = {}): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'deleteStreamLink'); + requiredAuthTypes.push('UserToken'); + + this.client.validateAuthentication(requiredAuthTypes, 'create'); // Normalize options to handle both camelCase and original API parameter names @@ -323,12 +279,16 @@ export class WebhooksClient { // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + body, - // Build the path with path parameters - let path = '/2/tweets/search/webhooks/{webhook_id}'; + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; - path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); + // Build the path with path parameters + let path = '/2/webhooks'; // Build query parameters const params = new URLSearchParams(); @@ -341,12 +301,14 @@ export class WebhooksClient { }, signal: signal, + body: JSON.stringify(body), + ...requestOptions, }; // Make the request - return this.client.request( - 'DELETE', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); @@ -463,36 +425,93 @@ export class WebhooksClient { } /** - * Get stream links - * Get a list of webhook links associated with a filtered stream ruleset. + * Create stream link + * Creates a link to deliver FilteredStream events to the given webhook. * * @returns Promise with the API response */ - async getStreamLinks( - options: GetStreamLinksStreamingOptions = {} - ): Promise { + async createStreamLink( + webhookId: string, + options: CreateStreamLinkStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'getStreamLinks'); + this.client.validateAuthentication(requiredAuthTypes, 'createStreamLink'); // Normalize options to handle both camelCase and original API parameter names - const normalizedOptions = options || {}; + const paramMappings: Record = { + 'tweet.fields': 'tweetFields', + + 'media.fields': 'mediaFields', + + 'poll.fields': 'pollFields', + + 'user.fields': 'userFields', + + 'place.fields': 'placeFields', + }; + const normalizedOptions = this._normalizeOptions( + options || {}, + paramMappings + ); // Destructure options (exclude path parameters, they're already function params) - const { headers = {}, signal, requestOptions = {} } = normalizedOptions; + const { + tweetFields = undefined, + + expansions = undefined, + + mediaFields = undefined, + + pollFields = undefined, + + userFields = undefined, + + placeFields = undefined, + + headers = {}, + signal, + requestOptions: requestOptions = {}, + } = normalizedOptions; // Build the path with path parameters - let path = '/2/tweets/search/webhooks'; + let path = '/2/tweets/search/webhooks/{webhook_id}'; + + path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); // Build query parameters const params = new URLSearchParams(); + if (tweetFields !== undefined) { + params.append('tweet.fields', String(tweetFields)); + } + + if (expansions !== undefined) { + params.append('expansions', String(expansions)); + } + + if (mediaFields !== undefined) { + params.append('media.fields', String(mediaFields)); + } + + if (pollFields !== undefined) { + params.append('poll.fields', String(pollFields)); + } + + if (userFields !== undefined) { + params.append('user.fields', String(userFields)); + } + + if (placeFields !== undefined) { + params.append('place.fields', String(placeFields)); + } + // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -505,58 +524,47 @@ export class WebhooksClient { }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'POST', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Get webhook - * Get a list of webhook configs associated with a client app. + * Delete stream link + * Deletes a link from FilteredStream events to the given webhook. * * @returns Promise with the API response */ - async get(options: GetStreamingOptions = {}): Promise { + async deleteStreamLink( + webhookId: string, + options: DeleteStreamLinkStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - this.client.validateAuthentication(requiredAuthTypes, 'get'); + this.client.validateAuthentication(requiredAuthTypes, 'deleteStreamLink'); // Normalize options to handle both camelCase and original API parameter names - const paramMappings: Record = { - 'webhook_config.fields': 'webhookConfigFields', - }; - const normalizedOptions = this._normalizeOptions( - options || {}, - paramMappings - ); + const normalizedOptions = options || {}; // Destructure options (exclude path parameters, they're already function params) - const { - webhookConfigFields = [], - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/webhooks'; + let path = '/2/tweets/search/webhooks/{webhook_id}'; + + path = path.replace('{webhook_id}', encodeURIComponent(String(webhookId))); // Build query parameters const params = new URLSearchParams(); - if (webhookConfigFields !== undefined && webhookConfigFields.length > 0) { - params.append('webhook_config.fields', webhookConfigFields.join(',')); - } - // Prepare request options const finalRequestOptions: RequestOptions = { headers: { @@ -569,29 +577,29 @@ export class WebhooksClient { }; // Make the request - return this.client.request( - 'GET', + return this.client.request( + 'DELETE', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); } /** - * Create webhook - * Creates a new webhook configuration. + * Get stream links + * Get a list of webhook links associated with a filtered stream ruleset. * * @returns Promise with the API response */ - async create(options: CreateStreamingOptions = {}): Promise { + async getStreamLinks( + options: GetStreamLinksStreamingOptions = {} + ): Promise { // Validate authentication requirements const requiredAuthTypes = []; requiredAuthTypes.push('BearerToken'); - requiredAuthTypes.push('UserToken'); - - this.client.validateAuthentication(requiredAuthTypes, 'create'); + this.client.validateAuthentication(requiredAuthTypes, 'getStreamLinks'); // Normalize options to handle both camelCase and original API parameter names @@ -599,16 +607,10 @@ export class WebhooksClient { // Destructure options (exclude path parameters, they're already function params) - const { - body, - - headers = {}, - signal, - requestOptions: requestOptions = {}, - } = normalizedOptions; + const { headers = {}, signal, requestOptions = {} } = normalizedOptions; // Build the path with path parameters - let path = '/2/webhooks'; + let path = '/2/tweets/search/webhooks'; // Build query parameters const params = new URLSearchParams(); @@ -621,14 +623,12 @@ export class WebhooksClient { }, signal: signal, - body: JSON.stringify(body), - ...requestOptions, }; // Make the request - return this.client.request( - 'POST', + return this.client.request( + 'GET', path + (params.toString() ? `?${params.toString()}` : ''), finalRequestOptions ); diff --git a/xdk/typescript/tests/account_activity/test_contracts.test.ts b/xdk/typescript/tests/account_activity/test_contracts.test.ts index 089ad3ed..365cdbff 100644 --- a/xdk/typescript/tests/account_activity/test_contracts.test.ts +++ b/xdk/typescript/tests/account_activity/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('AccountActivityClient Contracts', () => { }); - it('should have correct request structure for validateSubscription', async () => { + it('should have correct request structure for getSubscriptions', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -68,7 +68,7 @@ describe('AccountActivityClient Contracts', () => { const options: any = {}; // Call the method - const method = (accountActivityClient as any)['validateSubscription']; + const method = (accountActivityClient as any)['getSubscriptions']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify the request was made @@ -80,7 +80,7 @@ describe('AccountActivityClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all'; + const expectedPath = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -93,7 +93,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should handle required parameters correctly for validateSubscription', async () => { + it('should handle required parameters correctly for getSubscriptions', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -111,7 +111,7 @@ describe('AccountActivityClient Contracts', () => { } as Response); try { - const method = (accountActivityClient as any)['validateSubscription']; + const method = (accountActivityClient as any)['getSubscriptions']; // Method has required parameters - verify it can be called with proper args @@ -136,7 +136,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should validate response structure for validateSubscription', async () => { + it('should validate response structure for getSubscriptions', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -172,7 +172,7 @@ describe('AccountActivityClient Contracts', () => { ]; const options: any = {}; - const method = (accountActivityClient as any)['validateSubscription']; + const method = (accountActivityClient as any)['getSubscriptions']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -190,7 +190,7 @@ describe('AccountActivityClient Contracts', () => { }); - it('should have correct request structure for createSubscription', async () => { + it('should have correct request structure for validateSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -230,7 +230,7 @@ describe('AccountActivityClient Contracts', () => { const options: any = {}; // Call the method - const method = (accountActivityClient as any)['createSubscription']; + const method = (accountActivityClient as any)['validateSubscription']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify the request was made @@ -255,7 +255,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should handle required parameters correctly for createSubscription', async () => { + it('should handle required parameters correctly for validateSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -273,7 +273,7 @@ describe('AccountActivityClient Contracts', () => { } as Response); try { - const method = (accountActivityClient as any)['createSubscription']; + const method = (accountActivityClient as any)['validateSubscription']; // Method has required parameters - verify it can be called with proper args @@ -298,7 +298,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should validate response structure for createSubscription', async () => { + it('should validate response structure for validateSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -334,7 +334,7 @@ describe('AccountActivityClient Contracts', () => { ]; const options: any = {}; - const method = (accountActivityClient as any)['createSubscription']; + const method = (accountActivityClient as any)['validateSubscription']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -352,7 +352,7 @@ describe('AccountActivityClient Contracts', () => { }); - it('should have correct request structure for getSubscriptionCount', async () => { + it('should have correct request structure for createSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -382,13 +382,17 @@ describe('AccountActivityClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (accountActivityClient as any)['getSubscriptionCount']; + const method = (accountActivityClient as any)['createSubscription']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify the request was made @@ -400,7 +404,7 @@ describe('AccountActivityClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/account_activity/subscriptions/count'; + const expectedPath = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -413,7 +417,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should handle required parameters correctly for getSubscriptionCount', async () => { + it('should handle required parameters correctly for createSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -431,13 +435,17 @@ describe('AccountActivityClient Contracts', () => { } as Response); try { - const method = (accountActivityClient as any)['getSubscriptionCount']; + const method = (accountActivityClient as any)['createSubscription']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -452,7 +460,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should validate response structure for getSubscriptionCount', async () => { + it('should validate response structure for createSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -481,10 +489,14 @@ describe('AccountActivityClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (accountActivityClient as any)['getSubscriptionCount']; + const method = (accountActivityClient as any)['createSubscription']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -502,7 +514,7 @@ describe('AccountActivityClient Contracts', () => { }); - it('should have correct request structure for getSubscriptions', async () => { + it('should have correct request structure for getSubscriptionCount', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -532,17 +544,13 @@ describe('AccountActivityClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (accountActivityClient as any)['getSubscriptions']; + const method = (accountActivityClient as any)['getSubscriptionCount']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify the request was made @@ -554,7 +562,7 @@ describe('AccountActivityClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/account_activity/webhooks/{webhook_id}/subscriptions/all/list'; + const expectedPath = '/2/account_activity/subscriptions/count'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -567,7 +575,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should handle required parameters correctly for getSubscriptions', async () => { + it('should handle required parameters correctly for getSubscriptionCount', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -585,17 +593,13 @@ describe('AccountActivityClient Contracts', () => { } as Response); try { - const method = (accountActivityClient as any)['getSubscriptions']; + const method = (accountActivityClient as any)['getSubscriptionCount']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -610,7 +614,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should validate response structure for getSubscriptions', async () => { + it('should validate response structure for getSubscriptionCount', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -639,14 +643,10 @@ describe('AccountActivityClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (accountActivityClient as any)['getSubscriptions']; + const method = (accountActivityClient as any)['getSubscriptionCount']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -664,7 +664,7 @@ describe('AccountActivityClient Contracts', () => { }); - it('should have correct request structure for createReplayJob', async () => { + it('should have correct request structure for deleteSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -699,11 +699,7 @@ describe('AccountActivityClient Contracts', () => { - 'test_from_date', - - - - 'test_to_date', + 'test_value', ]; @@ -712,7 +708,7 @@ describe('AccountActivityClient Contracts', () => { const options: any = {}; // Call the method - const method = (accountActivityClient as any)['createReplayJob']; + const method = (accountActivityClient as any)['deleteSubscription']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify the request was made @@ -724,7 +720,7 @@ describe('AccountActivityClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all'; + const expectedPath = '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -737,7 +733,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should handle required parameters correctly for createReplayJob', async () => { + it('should handle required parameters correctly for deleteSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -755,7 +751,7 @@ describe('AccountActivityClient Contracts', () => { } as Response); try { - const method = (accountActivityClient as any)['createReplayJob']; + const method = (accountActivityClient as any)['deleteSubscription']; // Method has required parameters - verify it can be called with proper args @@ -767,11 +763,7 @@ describe('AccountActivityClient Contracts', () => { - 'test_from_date', - - - - 'test_to_date', + 'test_value', ]; @@ -788,7 +780,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should validate response structure for createReplayJob', async () => { + it('should validate response structure for deleteSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -822,17 +814,13 @@ describe('AccountActivityClient Contracts', () => { - 'test_from_date', - - - - 'test_to_date', + 'test_value', ]; const options: any = {}; - const method = (accountActivityClient as any)['createReplayJob']; + const method = (accountActivityClient as any)['deleteSubscription']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -850,7 +838,7 @@ describe('AccountActivityClient Contracts', () => { }); - it('should have correct request structure for deleteSubscription', async () => { + it('should have correct request structure for createReplayJob', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -885,7 +873,11 @@ describe('AccountActivityClient Contracts', () => { - 'test_value', + 'test_from_date', + + + + 'test_to_date', ]; @@ -894,7 +886,7 @@ describe('AccountActivityClient Contracts', () => { const options: any = {}; // Call the method - const method = (accountActivityClient as any)['deleteSubscription']; + const method = (accountActivityClient as any)['createReplayJob']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify the request was made @@ -906,7 +898,7 @@ describe('AccountActivityClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/account_activity/webhooks/{webhook_id}/subscriptions/{user_id}/all'; + const expectedPath = '/2/account_activity/replay/webhooks/{webhook_id}/subscriptions/all'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -919,7 +911,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should handle required parameters correctly for deleteSubscription', async () => { + it('should handle required parameters correctly for createReplayJob', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -937,7 +929,7 @@ describe('AccountActivityClient Contracts', () => { } as Response); try { - const method = (accountActivityClient as any)['deleteSubscription']; + const method = (accountActivityClient as any)['createReplayJob']; // Method has required parameters - verify it can be called with proper args @@ -949,7 +941,11 @@ describe('AccountActivityClient Contracts', () => { - 'test_value', + 'test_from_date', + + + + 'test_to_date', ]; @@ -966,7 +962,7 @@ describe('AccountActivityClient Contracts', () => { } }); - it('should validate response structure for deleteSubscription', async () => { + it('should validate response structure for createReplayJob', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1000,13 +996,17 @@ describe('AccountActivityClient Contracts', () => { - 'test_value', + 'test_from_date', + + + + 'test_to_date', ]; const options: any = {}; - const method = (accountActivityClient as any)['deleteSubscription']; + const method = (accountActivityClient as any)['createReplayJob']; const result = await method.apply(accountActivityClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/account_activity/test_structure.test.ts b/xdk/typescript/tests/account_activity/test_structure.test.ts index ce80bfb9..4f90323b 100644 --- a/xdk/typescript/tests/account_activity/test_structure.test.ts +++ b/xdk/typescript/tests/account_activity/test_structure.test.ts @@ -30,12 +30,12 @@ describe('AccountActivityClient Structure', () => { - it('should have validateSubscription method with correct signature', () => { + it('should have getSubscriptions method with correct signature', () => { // Check method exists - expect(AccountActivityClient.prototype).toHaveProperty('validateSubscription'); + expect(AccountActivityClient.prototype).toHaveProperty('getSubscriptions'); // Check method is callable - const method = accountActivityClient.validateSubscription; + const method = accountActivityClient.getSubscriptions; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -61,8 +61,8 @@ describe('AccountActivityClient Structure', () => { } }); - it('should have validateSubscription method with return type annotation', () => { - const method = accountActivityClient.validateSubscription; + it('should have getSubscriptions method with return type annotation', () => { + const method = accountActivityClient.getSubscriptions; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -71,12 +71,12 @@ describe('AccountActivityClient Structure', () => { - it('should have createSubscription method with correct signature', () => { + it('should have validateSubscription method with correct signature', () => { // Check method exists - expect(AccountActivityClient.prototype).toHaveProperty('createSubscription'); + expect(AccountActivityClient.prototype).toHaveProperty('validateSubscription'); // Check method is callable - const method = accountActivityClient.createSubscription; + const method = accountActivityClient.validateSubscription; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -102,8 +102,8 @@ describe('AccountActivityClient Structure', () => { } }); - it('should have createSubscription method with return type annotation', () => { - const method = accountActivityClient.createSubscription; + it('should have validateSubscription method with return type annotation', () => { + const method = accountActivityClient.validateSubscription; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -112,12 +112,12 @@ describe('AccountActivityClient Structure', () => { - it('should have getSubscriptionCount method with correct signature', () => { + it('should have createSubscription method with correct signature', () => { // Check method exists - expect(AccountActivityClient.prototype).toHaveProperty('getSubscriptionCount'); + expect(AccountActivityClient.prototype).toHaveProperty('createSubscription'); // Check method is callable - const method = accountActivityClient.getSubscriptionCount; + const method = accountActivityClient.createSubscription; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -128,6 +128,8 @@ describe('AccountActivityClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'webhookId', + ]; for (const requiredParam of requiredParams) { @@ -141,8 +143,8 @@ describe('AccountActivityClient Structure', () => { } }); - it('should have getSubscriptionCount method with return type annotation', () => { - const method = accountActivityClient.getSubscriptionCount; + it('should have createSubscription method with return type annotation', () => { + const method = accountActivityClient.createSubscription; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -151,12 +153,12 @@ describe('AccountActivityClient Structure', () => { - it('should have getSubscriptions method with correct signature', () => { + it('should have getSubscriptionCount method with correct signature', () => { // Check method exists - expect(AccountActivityClient.prototype).toHaveProperty('getSubscriptions'); + expect(AccountActivityClient.prototype).toHaveProperty('getSubscriptionCount'); // Check method is callable - const method = accountActivityClient.getSubscriptions; + const method = accountActivityClient.getSubscriptionCount; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -167,8 +169,6 @@ describe('AccountActivityClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'webhookId', - ]; for (const requiredParam of requiredParams) { @@ -182,8 +182,8 @@ describe('AccountActivityClient Structure', () => { } }); - it('should have getSubscriptions method with return type annotation', () => { - const method = accountActivityClient.getSubscriptions; + it('should have getSubscriptionCount method with return type annotation', () => { + const method = accountActivityClient.getSubscriptionCount; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -192,12 +192,12 @@ describe('AccountActivityClient Structure', () => { - it('should have createReplayJob method with correct signature', () => { + it('should have deleteSubscription method with correct signature', () => { // Check method exists - expect(AccountActivityClient.prototype).toHaveProperty('createReplayJob'); + expect(AccountActivityClient.prototype).toHaveProperty('deleteSubscription'); // Check method is callable - const method = accountActivityClient.createReplayJob; + const method = accountActivityClient.deleteSubscription; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -210,9 +210,7 @@ describe('AccountActivityClient Structure', () => { 'webhookId', - 'fromDate', - - 'toDate', + 'userId', ]; @@ -227,8 +225,8 @@ describe('AccountActivityClient Structure', () => { } }); - it('should have createReplayJob method with return type annotation', () => { - const method = accountActivityClient.createReplayJob; + it('should have deleteSubscription method with return type annotation', () => { + const method = accountActivityClient.deleteSubscription; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -237,12 +235,12 @@ describe('AccountActivityClient Structure', () => { - it('should have deleteSubscription method with correct signature', () => { + it('should have createReplayJob method with correct signature', () => { // Check method exists - expect(AccountActivityClient.prototype).toHaveProperty('deleteSubscription'); + expect(AccountActivityClient.prototype).toHaveProperty('createReplayJob'); // Check method is callable - const method = accountActivityClient.deleteSubscription; + const method = accountActivityClient.createReplayJob; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -255,7 +253,9 @@ describe('AccountActivityClient Structure', () => { 'webhookId', - 'userId', + 'fromDate', + + 'toDate', ]; @@ -270,8 +270,8 @@ describe('AccountActivityClient Structure', () => { } }); - it('should have deleteSubscription method with return type annotation', () => { - const method = accountActivityClient.deleteSubscription; + it('should have createReplayJob method with return type annotation', () => { + const method = accountActivityClient.createReplayJob; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -284,18 +284,18 @@ describe('AccountActivityClient Structure', () => { it('should have all expected methods', () => { const expectedMethods = [ + 'getSubscriptions', + 'validateSubscription', 'createSubscription', 'getSubscriptionCount', - 'getSubscriptions', + 'deleteSubscription', 'createReplayJob', - 'deleteSubscription', - ]; for (const expectedMethod of expectedMethods) { diff --git a/xdk/typescript/tests/activity/test_contracts.test.ts b/xdk/typescript/tests/activity/test_contracts.test.ts index 4ce927aa..1edda708 100644 --- a/xdk/typescript/tests/activity/test_contracts.test.ts +++ b/xdk/typescript/tests/activity/test_contracts.test.ts @@ -328,7 +328,7 @@ describe('ActivityClient Contracts', () => { }); - it('should have correct request structure for updateSubscription', async () => { + it('should have correct request structure for stream', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -358,17 +358,13 @@ describe('ActivityClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (activityClient as any)['updateSubscription']; + const method = (activityClient as any)['stream']; const result = await method.apply(activityClient, [...requiredArgs, options]); // Verify the request was made @@ -380,7 +376,7 @@ describe('ActivityClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/activity/subscriptions/{subscription_id}'; + const expectedPath = '/2/activity/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -393,7 +389,7 @@ describe('ActivityClient Contracts', () => { } }); - it('should handle required parameters correctly for updateSubscription', async () => { + it('should handle required parameters correctly for stream', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -411,17 +407,13 @@ describe('ActivityClient Contracts', () => { } as Response); try { - const method = (activityClient as any)['updateSubscription']; + const method = (activityClient as any)['stream']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -436,7 +428,7 @@ describe('ActivityClient Contracts', () => { } }); - it('should validate response structure for updateSubscription', async () => { + it('should validate response structure for stream', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -465,14 +457,10 @@ describe('ActivityClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (activityClient as any)['updateSubscription']; + const method = (activityClient as any)['stream']; const result = await method.apply(activityClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -490,7 +478,7 @@ describe('ActivityClient Contracts', () => { }); - it('should have correct request structure for deleteSubscription', async () => { + it('should have correct request structure for updateSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -530,7 +518,7 @@ describe('ActivityClient Contracts', () => { const options: any = {}; // Call the method - const method = (activityClient as any)['deleteSubscription']; + const method = (activityClient as any)['updateSubscription']; const result = await method.apply(activityClient, [...requiredArgs, options]); // Verify the request was made @@ -555,7 +543,7 @@ describe('ActivityClient Contracts', () => { } }); - it('should handle required parameters correctly for deleteSubscription', async () => { + it('should handle required parameters correctly for updateSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -573,7 +561,7 @@ describe('ActivityClient Contracts', () => { } as Response); try { - const method = (activityClient as any)['deleteSubscription']; + const method = (activityClient as any)['updateSubscription']; // Method has required parameters - verify it can be called with proper args @@ -598,7 +586,7 @@ describe('ActivityClient Contracts', () => { } }); - it('should validate response structure for deleteSubscription', async () => { + it('should validate response structure for updateSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -634,7 +622,7 @@ describe('ActivityClient Contracts', () => { ]; const options: any = {}; - const method = (activityClient as any)['deleteSubscription']; + const method = (activityClient as any)['updateSubscription']; const result = await method.apply(activityClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -652,7 +640,7 @@ describe('ActivityClient Contracts', () => { }); - it('should have correct request structure for stream', async () => { + it('should have correct request structure for deleteSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -682,13 +670,17 @@ describe('ActivityClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (activityClient as any)['stream']; + const method = (activityClient as any)['deleteSubscription']; const result = await method.apply(activityClient, [...requiredArgs, options]); // Verify the request was made @@ -700,7 +692,7 @@ describe('ActivityClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/activity/stream'; + const expectedPath = '/2/activity/subscriptions/{subscription_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -713,7 +705,7 @@ describe('ActivityClient Contracts', () => { } }); - it('should handle required parameters correctly for stream', async () => { + it('should handle required parameters correctly for deleteSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -731,13 +723,17 @@ describe('ActivityClient Contracts', () => { } as Response); try { - const method = (activityClient as any)['stream']; + const method = (activityClient as any)['deleteSubscription']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -752,7 +748,7 @@ describe('ActivityClient Contracts', () => { } }); - it('should validate response structure for stream', async () => { + it('should validate response structure for deleteSubscription', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -781,10 +777,14 @@ describe('ActivityClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (activityClient as any)['stream']; + const method = (activityClient as any)['deleteSubscription']; const result = await method.apply(activityClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/activity/test_structure.test.ts b/xdk/typescript/tests/activity/test_structure.test.ts index 10619ae5..0240bfea 100644 --- a/xdk/typescript/tests/activity/test_structure.test.ts +++ b/xdk/typescript/tests/activity/test_structure.test.ts @@ -108,12 +108,12 @@ describe('ActivityClient Structure', () => { - it('should have updateSubscription method with correct signature', () => { + it('should have stream method with correct signature', () => { // Check method exists - expect(ActivityClient.prototype).toHaveProperty('updateSubscription'); + expect(ActivityClient.prototype).toHaveProperty('stream'); // Check method is callable - const method = activityClient.updateSubscription; + const method = activityClient.stream; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -124,8 +124,6 @@ describe('ActivityClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'subscriptionId', - ]; for (const requiredParam of requiredParams) { @@ -139,8 +137,8 @@ describe('ActivityClient Structure', () => { } }); - it('should have updateSubscription method with return type annotation', () => { - const method = activityClient.updateSubscription; + it('should have stream method with return type annotation', () => { + const method = activityClient.stream; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -149,12 +147,12 @@ describe('ActivityClient Structure', () => { - it('should have deleteSubscription method with correct signature', () => { + it('should have updateSubscription method with correct signature', () => { // Check method exists - expect(ActivityClient.prototype).toHaveProperty('deleteSubscription'); + expect(ActivityClient.prototype).toHaveProperty('updateSubscription'); // Check method is callable - const method = activityClient.deleteSubscription; + const method = activityClient.updateSubscription; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -180,8 +178,8 @@ describe('ActivityClient Structure', () => { } }); - it('should have deleteSubscription method with return type annotation', () => { - const method = activityClient.deleteSubscription; + it('should have updateSubscription method with return type annotation', () => { + const method = activityClient.updateSubscription; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -190,12 +188,12 @@ describe('ActivityClient Structure', () => { - it('should have stream method with correct signature', () => { + it('should have deleteSubscription method with correct signature', () => { // Check method exists - expect(ActivityClient.prototype).toHaveProperty('stream'); + expect(ActivityClient.prototype).toHaveProperty('deleteSubscription'); // Check method is callable - const method = activityClient.stream; + const method = activityClient.deleteSubscription; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -206,6 +204,8 @@ describe('ActivityClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'subscriptionId', + ]; for (const requiredParam of requiredParams) { @@ -219,8 +219,8 @@ describe('ActivityClient Structure', () => { } }); - it('should have stream method with return type annotation', () => { - const method = activityClient.stream; + it('should have deleteSubscription method with return type annotation', () => { + const method = activityClient.deleteSubscription; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -237,12 +237,12 @@ describe('ActivityClient Structure', () => { 'createSubscription', + 'stream', + 'updateSubscription', 'deleteSubscription', - 'stream', - ]; for (const expectedMethod of expectedMethods) { diff --git a/xdk/typescript/tests/community_notes/test_contracts.test.ts b/xdk/typescript/tests/community_notes/test_contracts.test.ts index 521e1a9e..0f7ff1f4 100644 --- a/xdk/typescript/tests/community_notes/test_contracts.test.ts +++ b/xdk/typescript/tests/community_notes/test_contracts.test.ts @@ -190,7 +190,7 @@ describe('CommunityNotesClient Contracts', () => { }); - it('should have correct request structure for searchEligiblePosts', async () => { + it('should have correct request structure for evaluate', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -220,17 +220,13 @@ describe('CommunityNotesClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - true, - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (communityNotesClient as any)['searchEligiblePosts']; + const method = (communityNotesClient as any)['evaluate']; const result = await method.apply(communityNotesClient, [...requiredArgs, options]); // Verify the request was made @@ -242,7 +238,7 @@ describe('CommunityNotesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/notes/search/posts_eligible_for_notes'; + const expectedPath = '/2/evaluate_note'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -255,7 +251,7 @@ describe('CommunityNotesClient Contracts', () => { } }); - it('should handle required parameters correctly for searchEligiblePosts', async () => { + it('should handle required parameters correctly for evaluate', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -273,17 +269,13 @@ describe('CommunityNotesClient Contracts', () => { } as Response); try { - const method = (communityNotesClient as any)['searchEligiblePosts']; + const method = (communityNotesClient as any)['evaluate']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - true, - - ]; // Build options object (empty for required params, optional params go here) @@ -298,7 +290,7 @@ describe('CommunityNotesClient Contracts', () => { } }); - it('should validate response structure for searchEligiblePosts', async () => { + it('should validate response structure for evaluate', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -327,14 +319,10 @@ describe('CommunityNotesClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - true, - - ]; const options: any = {}; - const method = (communityNotesClient as any)['searchEligiblePosts']; + const method = (communityNotesClient as any)['evaluate']; const result = await method.apply(communityNotesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -352,7 +340,7 @@ describe('CommunityNotesClient Contracts', () => { }); - it('should have correct request structure for evaluate', async () => { + it('should have correct request structure for searchWritten', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -382,13 +370,17 @@ describe('CommunityNotesClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + true, + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (communityNotesClient as any)['evaluate']; + const method = (communityNotesClient as any)['searchWritten']; const result = await method.apply(communityNotesClient, [...requiredArgs, options]); // Verify the request was made @@ -400,7 +392,7 @@ describe('CommunityNotesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/evaluate_note'; + const expectedPath = '/2/notes/search/notes_written'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -413,7 +405,7 @@ describe('CommunityNotesClient Contracts', () => { } }); - it('should handle required parameters correctly for evaluate', async () => { + it('should handle required parameters correctly for searchWritten', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -431,13 +423,17 @@ describe('CommunityNotesClient Contracts', () => { } as Response); try { - const method = (communityNotesClient as any)['evaluate']; + const method = (communityNotesClient as any)['searchWritten']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + true, + + ]; // Build options object (empty for required params, optional params go here) @@ -452,7 +448,7 @@ describe('CommunityNotesClient Contracts', () => { } }); - it('should validate response structure for evaluate', async () => { + it('should validate response structure for searchWritten', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -481,10 +477,14 @@ describe('CommunityNotesClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + true, + + ]; const options: any = {}; - const method = (communityNotesClient as any)['evaluate']; + const method = (communityNotesClient as any)['searchWritten']; const result = await method.apply(communityNotesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -502,7 +502,7 @@ describe('CommunityNotesClient Contracts', () => { }); - it('should have correct request structure for searchWritten', async () => { + it('should have correct request structure for create', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -532,17 +532,13 @@ describe('CommunityNotesClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - true, - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (communityNotesClient as any)['searchWritten']; + const method = (communityNotesClient as any)['create']; const result = await method.apply(communityNotesClient, [...requiredArgs, options]); // Verify the request was made @@ -554,7 +550,7 @@ describe('CommunityNotesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/notes/search/notes_written'; + const expectedPath = '/2/notes'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -567,7 +563,7 @@ describe('CommunityNotesClient Contracts', () => { } }); - it('should handle required parameters correctly for searchWritten', async () => { + it('should handle required parameters correctly for create', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -585,17 +581,13 @@ describe('CommunityNotesClient Contracts', () => { } as Response); try { - const method = (communityNotesClient as any)['searchWritten']; + const method = (communityNotesClient as any)['create']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - true, - - ]; // Build options object (empty for required params, optional params go here) @@ -610,7 +602,7 @@ describe('CommunityNotesClient Contracts', () => { } }); - it('should validate response structure for searchWritten', async () => { + it('should validate response structure for create', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -639,14 +631,10 @@ describe('CommunityNotesClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - true, - - ]; const options: any = {}; - const method = (communityNotesClient as any)['searchWritten']; + const method = (communityNotesClient as any)['create']; const result = await method.apply(communityNotesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -664,7 +652,7 @@ describe('CommunityNotesClient Contracts', () => { }); - it('should have correct request structure for create', async () => { + it('should have correct request structure for searchEligiblePosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -694,13 +682,17 @@ describe('CommunityNotesClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + true, + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (communityNotesClient as any)['create']; + const method = (communityNotesClient as any)['searchEligiblePosts']; const result = await method.apply(communityNotesClient, [...requiredArgs, options]); // Verify the request was made @@ -712,7 +704,7 @@ describe('CommunityNotesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/notes'; + const expectedPath = '/2/notes/search/posts_eligible_for_notes'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -725,7 +717,7 @@ describe('CommunityNotesClient Contracts', () => { } }); - it('should handle required parameters correctly for create', async () => { + it('should handle required parameters correctly for searchEligiblePosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -743,13 +735,17 @@ describe('CommunityNotesClient Contracts', () => { } as Response); try { - const method = (communityNotesClient as any)['create']; + const method = (communityNotesClient as any)['searchEligiblePosts']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + true, + + ]; // Build options object (empty for required params, optional params go here) @@ -764,7 +760,7 @@ describe('CommunityNotesClient Contracts', () => { } }); - it('should validate response structure for create', async () => { + it('should validate response structure for searchEligiblePosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -793,10 +789,14 @@ describe('CommunityNotesClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + true, + + ]; const options: any = {}; - const method = (communityNotesClient as any)['create']; + const method = (communityNotesClient as any)['searchEligiblePosts']; const result = await method.apply(communityNotesClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/community_notes/test_pagination.test.ts b/xdk/typescript/tests/community_notes/test_pagination.test.ts index 4a1ee3c8..6711fcd0 100644 --- a/xdk/typescript/tests/community_notes/test_pagination.test.ts +++ b/xdk/typescript/tests/community_notes/test_pagination.test.ts @@ -30,8 +30,8 @@ describe('CommunityNotesClient Pagination', () => { }); - it('should create paginator for searchEligiblePosts', () => { - const method = (communityNotesClient as any)['searchEligiblePosts']; + it('should create paginator for searchWritten', () => { + const method = (communityNotesClient as any)['searchWritten']; // Should be able to create paginator without error const params: any = { @@ -48,7 +48,7 @@ describe('CommunityNotesClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for searchEligiblePosts', async () => { + it('should paginate through pages for searchWritten', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -100,7 +100,7 @@ describe('CommunityNotesClient Pagination', () => { }); try { - const method = (communityNotesClient as any)['searchEligiblePosts']; + const method = (communityNotesClient as any)['searchWritten']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -142,7 +142,7 @@ describe('CommunityNotesClient Pagination', () => { } }); - it('should handle pagination parameters correctly for searchEligiblePosts', async () => { + it('should handle pagination parameters correctly for searchWritten', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -162,7 +162,7 @@ describe('CommunityNotesClient Pagination', () => { } as Response); try { - const method = (communityNotesClient as any)['searchEligiblePosts']; + const method = (communityNotesClient as any)['searchWritten']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -193,8 +193,8 @@ describe('CommunityNotesClient Pagination', () => { }); - it('should create paginator for searchWritten', () => { - const method = (communityNotesClient as any)['searchWritten']; + it('should create paginator for searchEligiblePosts', () => { + const method = (communityNotesClient as any)['searchEligiblePosts']; // Should be able to create paginator without error const params: any = { @@ -211,7 +211,7 @@ describe('CommunityNotesClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for searchWritten', async () => { + it('should paginate through pages for searchEligiblePosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -263,7 +263,7 @@ describe('CommunityNotesClient Pagination', () => { }); try { - const method = (communityNotesClient as any)['searchWritten']; + const method = (communityNotesClient as any)['searchEligiblePosts']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -305,7 +305,7 @@ describe('CommunityNotesClient Pagination', () => { } }); - it('should handle pagination parameters correctly for searchWritten', async () => { + it('should handle pagination parameters correctly for searchEligiblePosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -325,7 +325,7 @@ describe('CommunityNotesClient Pagination', () => { } as Response); try { - const method = (communityNotesClient as any)['searchWritten']; + const method = (communityNotesClient as any)['searchEligiblePosts']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ diff --git a/xdk/typescript/tests/community_notes/test_structure.test.ts b/xdk/typescript/tests/community_notes/test_structure.test.ts index aff42dd9..db041eb9 100644 --- a/xdk/typescript/tests/community_notes/test_structure.test.ts +++ b/xdk/typescript/tests/community_notes/test_structure.test.ts @@ -71,12 +71,51 @@ describe('CommunityNotesClient Structure', () => { - it('should have searchEligiblePosts method with correct signature', () => { + it('should have evaluate method with correct signature', () => { // Check method exists - expect(CommunityNotesClient.prototype).toHaveProperty('searchEligiblePosts'); + expect(CommunityNotesClient.prototype).toHaveProperty('evaluate'); // Check method is callable - const method = communityNotesClient.searchEligiblePosts; + const method = communityNotesClient.evaluate; + expect(typeof method).toBe('function'); + + // Check method signature by examining parameter count + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Check required parameters exist (convert to camelCase for TypeScript) + const requiredParams = [ + + ]; + + for (const requiredParam of requiredParams) { + // Check if parameter exists (may be in camelCase or snake_case) + const paramExists = params.some(p => + p === requiredParam || + p.toLowerCase() === requiredParam.toLowerCase() || + p.replace(/_/g, '') === requiredParam.replace(/_/g, '') + ); + expect(paramExists).toBe(true); + } + }); + + it('should have evaluate method with return type annotation', () => { + const method = communityNotesClient.evaluate; + expect(typeof method).toBe('function'); + // TypeScript will enforce return types at compile time + // This test ensures the method exists and is callable + }); + + + + + it('should have searchWritten method with correct signature', () => { + // Check method exists + expect(CommunityNotesClient.prototype).toHaveProperty('searchWritten'); + + // Check method is callable + const method = communityNotesClient.searchWritten; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -102,16 +141,16 @@ describe('CommunityNotesClient Structure', () => { } }); - it('should have searchEligiblePosts method with return type annotation', () => { - const method = communityNotesClient.searchEligiblePosts; + it('should have searchWritten method with return type annotation', () => { + const method = communityNotesClient.searchWritten; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have searchEligiblePosts method with pagination parameters', () => { - const method = communityNotesClient.searchEligiblePosts; + it('should have searchWritten method with pagination parameters', () => { + const method = communityNotesClient.searchWritten; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -130,12 +169,12 @@ describe('CommunityNotesClient Structure', () => { - it('should have evaluate method with correct signature', () => { + it('should have create method with correct signature', () => { // Check method exists - expect(CommunityNotesClient.prototype).toHaveProperty('evaluate'); + expect(CommunityNotesClient.prototype).toHaveProperty('create'); // Check method is callable - const method = communityNotesClient.evaluate; + const method = communityNotesClient.create; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -159,8 +198,8 @@ describe('CommunityNotesClient Structure', () => { } }); - it('should have evaluate method with return type annotation', () => { - const method = communityNotesClient.evaluate; + it('should have create method with return type annotation', () => { + const method = communityNotesClient.create; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -169,12 +208,12 @@ describe('CommunityNotesClient Structure', () => { - it('should have searchWritten method with correct signature', () => { + it('should have searchEligiblePosts method with correct signature', () => { // Check method exists - expect(CommunityNotesClient.prototype).toHaveProperty('searchWritten'); + expect(CommunityNotesClient.prototype).toHaveProperty('searchEligiblePosts'); // Check method is callable - const method = communityNotesClient.searchWritten; + const method = communityNotesClient.searchEligiblePosts; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -200,16 +239,16 @@ describe('CommunityNotesClient Structure', () => { } }); - it('should have searchWritten method with return type annotation', () => { - const method = communityNotesClient.searchWritten; + it('should have searchEligiblePosts method with return type annotation', () => { + const method = communityNotesClient.searchEligiblePosts; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have searchWritten method with pagination parameters', () => { - const method = communityNotesClient.searchWritten; + it('should have searchEligiblePosts method with pagination parameters', () => { + const method = communityNotesClient.searchEligiblePosts; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -228,59 +267,20 @@ describe('CommunityNotesClient Structure', () => { - it('should have create method with correct signature', () => { - // Check method exists - expect(CommunityNotesClient.prototype).toHaveProperty('create'); - - // Check method is callable - const method = communityNotesClient.create; - expect(typeof method).toBe('function'); - - // Check method signature by examining parameter count - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Check required parameters exist (convert to camelCase for TypeScript) - const requiredParams = [ - - ]; - - for (const requiredParam of requiredParams) { - // Check if parameter exists (may be in camelCase or snake_case) - const paramExists = params.some(p => - p === requiredParam || - p.toLowerCase() === requiredParam.toLowerCase() || - p.replace(/_/g, '') === requiredParam.replace(/_/g, '') - ); - expect(paramExists).toBe(true); - } - }); - - it('should have create method with return type annotation', () => { - const method = communityNotesClient.create; - expect(typeof method).toBe('function'); - // TypeScript will enforce return types at compile time - // This test ensures the method exists and is callable - }); - - - - it('should have all expected methods', () => { const expectedMethods = [ 'delete', - 'searchEligiblePosts', - 'evaluate', 'searchWritten', 'create', + 'searchEligiblePosts', + ]; for (const expectedMethod of expectedMethods) { diff --git a/xdk/typescript/tests/compliance/test_contracts.test.ts b/xdk/typescript/tests/compliance/test_contracts.test.ts index 01847d6c..51d16fd4 100644 --- a/xdk/typescript/tests/compliance/test_contracts.test.ts +++ b/xdk/typescript/tests/compliance/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('ComplianceClient Contracts', () => { }); - it('should have correct request structure for getJobsById', async () => { + it('should have correct request structure for getJobs', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -59,7 +59,7 @@ describe('ComplianceClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + 'test_type', ]; @@ -68,7 +68,7 @@ describe('ComplianceClient Contracts', () => { const options: any = {}; // Call the method - const method = (complianceClient as any)['getJobsById']; + const method = (complianceClient as any)['getJobs']; const result = await method.apply(complianceClient, [...requiredArgs, options]); // Verify the request was made @@ -80,7 +80,7 @@ describe('ComplianceClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/compliance/jobs/{id}'; + const expectedPath = '/2/compliance/jobs'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -93,7 +93,7 @@ describe('ComplianceClient Contracts', () => { } }); - it('should handle required parameters correctly for getJobsById', async () => { + it('should handle required parameters correctly for getJobs', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -111,7 +111,7 @@ describe('ComplianceClient Contracts', () => { } as Response); try { - const method = (complianceClient as any)['getJobsById']; + const method = (complianceClient as any)['getJobs']; // Method has required parameters - verify it can be called with proper args @@ -119,7 +119,7 @@ describe('ComplianceClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + 'test_type', ]; @@ -136,7 +136,7 @@ describe('ComplianceClient Contracts', () => { } }); - it('should validate response structure for getJobsById', async () => { + it('should validate response structure for getJobs', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -166,13 +166,13 @@ describe('ComplianceClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + 'test_type', ]; const options: any = {}; - const method = (complianceClient as any)['getJobsById']; + const method = (complianceClient as any)['getJobs']; const result = await method.apply(complianceClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -190,7 +190,7 @@ describe('ComplianceClient Contracts', () => { }); - it('should have correct request structure for getJobs', async () => { + it('should have correct request structure for createJobs', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -220,17 +220,13 @@ describe('ComplianceClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_type', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (complianceClient as any)['getJobs']; + const method = (complianceClient as any)['createJobs']; const result = await method.apply(complianceClient, [...requiredArgs, options]); // Verify the request was made @@ -255,7 +251,7 @@ describe('ComplianceClient Contracts', () => { } }); - it('should handle required parameters correctly for getJobs', async () => { + it('should handle required parameters correctly for createJobs', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -273,17 +269,13 @@ describe('ComplianceClient Contracts', () => { } as Response); try { - const method = (complianceClient as any)['getJobs']; + const method = (complianceClient as any)['createJobs']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_type', - - ]; // Build options object (empty for required params, optional params go here) @@ -298,7 +290,7 @@ describe('ComplianceClient Contracts', () => { } }); - it('should validate response structure for getJobs', async () => { + it('should validate response structure for createJobs', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -327,14 +319,10 @@ describe('ComplianceClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_type', - - ]; const options: any = {}; - const method = (complianceClient as any)['getJobs']; + const method = (complianceClient as any)['createJobs']; const result = await method.apply(complianceClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -352,7 +340,7 @@ describe('ComplianceClient Contracts', () => { }); - it('should have correct request structure for createJobs', async () => { + it('should have correct request structure for getJobsById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -382,13 +370,17 @@ describe('ComplianceClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (complianceClient as any)['createJobs']; + const method = (complianceClient as any)['getJobsById']; const result = await method.apply(complianceClient, [...requiredArgs, options]); // Verify the request was made @@ -400,7 +392,7 @@ describe('ComplianceClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/compliance/jobs'; + const expectedPath = '/2/compliance/jobs/{id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -413,7 +405,7 @@ describe('ComplianceClient Contracts', () => { } }); - it('should handle required parameters correctly for createJobs', async () => { + it('should handle required parameters correctly for getJobsById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -431,13 +423,17 @@ describe('ComplianceClient Contracts', () => { } as Response); try { - const method = (complianceClient as any)['createJobs']; + const method = (complianceClient as any)['getJobsById']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -452,7 +448,7 @@ describe('ComplianceClient Contracts', () => { } }); - it('should validate response structure for createJobs', async () => { + it('should validate response structure for getJobsById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -481,10 +477,14 @@ describe('ComplianceClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (complianceClient as any)['createJobs']; + const method = (complianceClient as any)['getJobsById']; const result = await method.apply(complianceClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/compliance/test_structure.test.ts b/xdk/typescript/tests/compliance/test_structure.test.ts index 32be73a8..def5ccb5 100644 --- a/xdk/typescript/tests/compliance/test_structure.test.ts +++ b/xdk/typescript/tests/compliance/test_structure.test.ts @@ -30,12 +30,12 @@ describe('ComplianceClient Structure', () => { - it('should have getJobsById method with correct signature', () => { + it('should have getJobs method with correct signature', () => { // Check method exists - expect(ComplianceClient.prototype).toHaveProperty('getJobsById'); + expect(ComplianceClient.prototype).toHaveProperty('getJobs'); // Check method is callable - const method = complianceClient.getJobsById; + const method = complianceClient.getJobs; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -46,7 +46,7 @@ describe('ComplianceClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', + 'type', ]; @@ -61,8 +61,8 @@ describe('ComplianceClient Structure', () => { } }); - it('should have getJobsById method with return type annotation', () => { - const method = complianceClient.getJobsById; + it('should have getJobs method with return type annotation', () => { + const method = complianceClient.getJobs; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -71,12 +71,12 @@ describe('ComplianceClient Structure', () => { - it('should have getJobs method with correct signature', () => { + it('should have createJobs method with correct signature', () => { // Check method exists - expect(ComplianceClient.prototype).toHaveProperty('getJobs'); + expect(ComplianceClient.prototype).toHaveProperty('createJobs'); // Check method is callable - const method = complianceClient.getJobs; + const method = complianceClient.createJobs; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -87,8 +87,6 @@ describe('ComplianceClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'type', - ]; for (const requiredParam of requiredParams) { @@ -102,8 +100,8 @@ describe('ComplianceClient Structure', () => { } }); - it('should have getJobs method with return type annotation', () => { - const method = complianceClient.getJobs; + it('should have createJobs method with return type annotation', () => { + const method = complianceClient.createJobs; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -112,12 +110,12 @@ describe('ComplianceClient Structure', () => { - it('should have createJobs method with correct signature', () => { + it('should have getJobsById method with correct signature', () => { // Check method exists - expect(ComplianceClient.prototype).toHaveProperty('createJobs'); + expect(ComplianceClient.prototype).toHaveProperty('getJobsById'); // Check method is callable - const method = complianceClient.createJobs; + const method = complianceClient.getJobsById; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -128,6 +126,8 @@ describe('ComplianceClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'id', + ]; for (const requiredParam of requiredParams) { @@ -141,8 +141,8 @@ describe('ComplianceClient Structure', () => { } }); - it('should have createJobs method with return type annotation', () => { - const method = complianceClient.createJobs; + it('should have getJobsById method with return type annotation', () => { + const method = complianceClient.getJobsById; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -155,12 +155,12 @@ describe('ComplianceClient Structure', () => { it('should have all expected methods', () => { const expectedMethods = [ - 'getJobsById', - 'getJobs', 'createJobs', + 'getJobsById', + ]; for (const expectedMethod of expectedMethods) { diff --git a/xdk/typescript/tests/direct_messages/test_contracts.test.ts b/xdk/typescript/tests/direct_messages/test_contracts.test.ts index 729392ee..7a2d80b0 100644 --- a/xdk/typescript/tests/direct_messages/test_contracts.test.ts +++ b/xdk/typescript/tests/direct_messages/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('DirectMessagesClient Contracts', () => { }); - it('should have correct request structure for getEventsByParticipantId', async () => { + it('should have correct request structure for createByParticipantId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -37,7 +37,7 @@ describe('DirectMessagesClient Contracts', () => { const originalRequest = client.httpClient.request; (client.httpClient.request as any) = jest.fn().mockResolvedValue({ ok: true, - status: 200, + status: 201, statusText: 'OK', headers: new Headers({ 'content-type': 'application/json' }), @@ -68,7 +68,7 @@ describe('DirectMessagesClient Contracts', () => { const options: any = {}; // Call the method - const method = (directMessagesClient as any)['getEventsByParticipantId']; + const method = (directMessagesClient as any)['createByParticipantId']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify the request was made @@ -80,7 +80,7 @@ describe('DirectMessagesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/dm_conversations/with/{participant_id}/dm_events'; + const expectedPath = '/2/dm_conversations/with/{participant_id}/messages'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -93,7 +93,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should handle required parameters correctly for getEventsByParticipantId', async () => { + it('should handle required parameters correctly for createByParticipantId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -111,7 +111,7 @@ describe('DirectMessagesClient Contracts', () => { } as Response); try { - const method = (directMessagesClient as any)['getEventsByParticipantId']; + const method = (directMessagesClient as any)['createByParticipantId']; // Method has required parameters - verify it can be called with proper args @@ -136,7 +136,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should validate response structure for getEventsByParticipantId', async () => { + it('should validate response structure for createByParticipantId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -172,7 +172,7 @@ describe('DirectMessagesClient Contracts', () => { ]; const options: any = {}; - const method = (directMessagesClient as any)['getEventsByParticipantId']; + const method = (directMessagesClient as any)['createByParticipantId']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -190,7 +190,7 @@ describe('DirectMessagesClient Contracts', () => { }); - it('should have correct request structure for createByConversationId', async () => { + it('should have correct request structure for getEvents', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -220,17 +220,13 @@ describe('DirectMessagesClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_dm_conversation_id', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (directMessagesClient as any)['createByConversationId']; + const method = (directMessagesClient as any)['getEvents']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify the request was made @@ -242,7 +238,7 @@ describe('DirectMessagesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/dm_conversations/{dm_conversation_id}/messages'; + const expectedPath = '/2/dm_events'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -255,7 +251,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should handle required parameters correctly for createByConversationId', async () => { + it('should handle required parameters correctly for getEvents', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -273,17 +269,13 @@ describe('DirectMessagesClient Contracts', () => { } as Response); try { - const method = (directMessagesClient as any)['createByConversationId']; + const method = (directMessagesClient as any)['getEvents']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_dm_conversation_id', - - ]; // Build options object (empty for required params, optional params go here) @@ -298,7 +290,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should validate response structure for createByConversationId', async () => { + it('should validate response structure for getEvents', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -327,14 +319,10 @@ describe('DirectMessagesClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_dm_conversation_id', - - ]; const options: any = {}; - const method = (directMessagesClient as any)['createByConversationId']; + const method = (directMessagesClient as any)['getEvents']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -352,7 +340,7 @@ describe('DirectMessagesClient Contracts', () => { }); - it('should have correct request structure for createByParticipantId', async () => { + it('should have correct request structure for getEventsByParticipantId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -361,7 +349,7 @@ describe('DirectMessagesClient Contracts', () => { const originalRequest = client.httpClient.request; (client.httpClient.request as any) = jest.fn().mockResolvedValue({ ok: true, - status: 201, + status: 200, statusText: 'OK', headers: new Headers({ 'content-type': 'application/json' }), @@ -392,7 +380,7 @@ describe('DirectMessagesClient Contracts', () => { const options: any = {}; // Call the method - const method = (directMessagesClient as any)['createByParticipantId']; + const method = (directMessagesClient as any)['getEventsByParticipantId']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify the request was made @@ -404,7 +392,7 @@ describe('DirectMessagesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/dm_conversations/with/{participant_id}/messages'; + const expectedPath = '/2/dm_conversations/with/{participant_id}/dm_events'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -417,7 +405,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should handle required parameters correctly for createByParticipantId', async () => { + it('should handle required parameters correctly for getEventsByParticipantId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -435,7 +423,7 @@ describe('DirectMessagesClient Contracts', () => { } as Response); try { - const method = (directMessagesClient as any)['createByParticipantId']; + const method = (directMessagesClient as any)['getEventsByParticipantId']; // Method has required parameters - verify it can be called with proper args @@ -460,7 +448,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should validate response structure for createByParticipantId', async () => { + it('should validate response structure for getEventsByParticipantId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -496,7 +484,7 @@ describe('DirectMessagesClient Contracts', () => { ]; const options: any = {}; - const method = (directMessagesClient as any)['createByParticipantId']; + const method = (directMessagesClient as any)['getEventsByParticipantId']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -514,7 +502,7 @@ describe('DirectMessagesClient Contracts', () => { }); - it('should have correct request structure for createConversation', async () => { + it('should have correct request structure for getEventsByConversationId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -523,7 +511,7 @@ describe('DirectMessagesClient Contracts', () => { const originalRequest = client.httpClient.request; (client.httpClient.request as any) = jest.fn().mockResolvedValue({ ok: true, - status: 201, + status: 200, statusText: 'OK', headers: new Headers({ 'content-type': 'application/json' }), @@ -544,13 +532,17 @@ describe('DirectMessagesClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (directMessagesClient as any)['createConversation']; + const method = (directMessagesClient as any)['getEventsByConversationId']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify the request was made @@ -562,7 +554,7 @@ describe('DirectMessagesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/dm_conversations'; + const expectedPath = '/2/dm_conversations/{id}/dm_events'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -575,7 +567,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should handle required parameters correctly for createConversation', async () => { + it('should handle required parameters correctly for getEventsByConversationId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -593,13 +585,17 @@ describe('DirectMessagesClient Contracts', () => { } as Response); try { - const method = (directMessagesClient as any)['createConversation']; + const method = (directMessagesClient as any)['getEventsByConversationId']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -614,7 +610,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should validate response structure for createConversation', async () => { + it('should validate response structure for getEventsByConversationId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -643,10 +639,14 @@ describe('DirectMessagesClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (directMessagesClient as any)['createConversation']; + const method = (directMessagesClient as any)['getEventsByConversationId']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -988,7 +988,7 @@ describe('DirectMessagesClient Contracts', () => { }); - it('should have correct request structure for getEvents', async () => { + it('should have correct request structure for createByConversationId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1018,13 +1018,17 @@ describe('DirectMessagesClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_dm_conversation_id', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (directMessagesClient as any)['getEvents']; + const method = (directMessagesClient as any)['createByConversationId']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify the request was made @@ -1036,7 +1040,7 @@ describe('DirectMessagesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/dm_events'; + const expectedPath = '/2/dm_conversations/{dm_conversation_id}/messages'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1049,7 +1053,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should handle required parameters correctly for getEvents', async () => { + it('should handle required parameters correctly for createByConversationId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1067,13 +1071,17 @@ describe('DirectMessagesClient Contracts', () => { } as Response); try { - const method = (directMessagesClient as any)['getEvents']; + const method = (directMessagesClient as any)['createByConversationId']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_dm_conversation_id', + + ]; // Build options object (empty for required params, optional params go here) @@ -1088,7 +1096,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should validate response structure for getEvents', async () => { + it('should validate response structure for createByConversationId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1117,10 +1125,14 @@ describe('DirectMessagesClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_dm_conversation_id', + + ]; const options: any = {}; - const method = (directMessagesClient as any)['getEvents']; + const method = (directMessagesClient as any)['createByConversationId']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1138,7 +1150,7 @@ describe('DirectMessagesClient Contracts', () => { }); - it('should have correct request structure for getEventsByConversationId', async () => { + it('should have correct request structure for createConversation', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1168,17 +1180,13 @@ describe('DirectMessagesClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (directMessagesClient as any)['getEventsByConversationId']; + const method = (directMessagesClient as any)['createConversation']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify the request was made @@ -1190,7 +1198,7 @@ describe('DirectMessagesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/dm_conversations/{id}/dm_events'; + const expectedPath = '/2/dm_conversations'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1203,7 +1211,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should handle required parameters correctly for getEventsByConversationId', async () => { + it('should handle required parameters correctly for createConversation', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1221,17 +1229,13 @@ describe('DirectMessagesClient Contracts', () => { } as Response); try { - const method = (directMessagesClient as any)['getEventsByConversationId']; + const method = (directMessagesClient as any)['createConversation']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -1246,7 +1250,7 @@ describe('DirectMessagesClient Contracts', () => { } }); - it('should validate response structure for getEventsByConversationId', async () => { + it('should validate response structure for createConversation', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1275,14 +1279,10 @@ describe('DirectMessagesClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (directMessagesClient as any)['getEventsByConversationId']; + const method = (directMessagesClient as any)['createConversation']; const result = await method.apply(directMessagesClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/direct_messages/test_pagination.test.ts b/xdk/typescript/tests/direct_messages/test_pagination.test.ts index c0bb6c10..8c340270 100644 --- a/xdk/typescript/tests/direct_messages/test_pagination.test.ts +++ b/xdk/typescript/tests/direct_messages/test_pagination.test.ts @@ -30,16 +30,12 @@ describe('DirectMessagesClient Pagination', () => { }); - it('should create paginator for getEventsByParticipantId', () => { - const method = (directMessagesClient as any)['getEventsByParticipantId']; + it('should create paginator for getEvents', () => { + const method = (directMessagesClient as any)['getEvents']; // Should be able to create paginator without error const params: any = { - - participant_id: 'test_value', - - maxResults: 10 }; @@ -48,7 +44,7 @@ describe('DirectMessagesClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getEventsByParticipantId', async () => { + it('should paginate through pages for getEvents', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -100,15 +96,11 @@ describe('DirectMessagesClient Pagination', () => { }); try { - const method = (directMessagesClient as any)['getEventsByParticipantId']; + const method = (directMessagesClient as any)['getEvents']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object with optional query parameters (maxResults is always in options) @@ -142,7 +134,7 @@ describe('DirectMessagesClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getEventsByParticipantId', async () => { + it('should handle pagination parameters correctly for getEvents', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -162,15 +154,11 @@ describe('DirectMessagesClient Pagination', () => { } as Response); try { - const method = (directMessagesClient as any)['getEventsByParticipantId']; + const method = (directMessagesClient as any)['getEvents']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object with optional query parameters (maxResults is always in options) @@ -193,12 +181,16 @@ describe('DirectMessagesClient Pagination', () => { }); - it('should create paginator for getEvents', () => { - const method = (directMessagesClient as any)['getEvents']; + it('should create paginator for getEventsByParticipantId', () => { + const method = (directMessagesClient as any)['getEventsByParticipantId']; // Should be able to create paginator without error const params: any = { + + participant_id: 'test_value', + + maxResults: 10 }; @@ -207,7 +199,7 @@ describe('DirectMessagesClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getEvents', async () => { + it('should paginate through pages for getEventsByParticipantId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -259,11 +251,15 @@ describe('DirectMessagesClient Pagination', () => { }); try { - const method = (directMessagesClient as any)['getEvents']; + const method = (directMessagesClient as any)['getEventsByParticipantId']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object with optional query parameters (maxResults is always in options) @@ -297,7 +293,7 @@ describe('DirectMessagesClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getEvents', async () => { + it('should handle pagination parameters correctly for getEventsByParticipantId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -317,11 +313,15 @@ describe('DirectMessagesClient Pagination', () => { } as Response); try { - const method = (directMessagesClient as any)['getEvents']; + const method = (directMessagesClient as any)['getEventsByParticipantId']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object with optional query parameters (maxResults is always in options) diff --git a/xdk/typescript/tests/direct_messages/test_structure.test.ts b/xdk/typescript/tests/direct_messages/test_structure.test.ts index 4d17d08a..eb10849e 100644 --- a/xdk/typescript/tests/direct_messages/test_structure.test.ts +++ b/xdk/typescript/tests/direct_messages/test_structure.test.ts @@ -30,12 +30,12 @@ describe('DirectMessagesClient Structure', () => { - it('should have getEventsByParticipantId method with correct signature', () => { + it('should have createByParticipantId method with correct signature', () => { // Check method exists - expect(DirectMessagesClient.prototype).toHaveProperty('getEventsByParticipantId'); + expect(DirectMessagesClient.prototype).toHaveProperty('createByParticipantId'); // Check method is callable - const method = directMessagesClient.getEventsByParticipantId; + const method = directMessagesClient.createByParticipantId; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -61,40 +61,22 @@ describe('DirectMessagesClient Structure', () => { } }); - it('should have getEventsByParticipantId method with return type annotation', () => { - const method = directMessagesClient.getEventsByParticipantId; + it('should have createByParticipantId method with return type annotation', () => { + const method = directMessagesClient.createByParticipantId; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getEventsByParticipantId method with pagination parameters', () => { - const method = directMessagesClient.getEventsByParticipantId; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have createByConversationId method with correct signature', () => { + it('should have getEvents method with correct signature', () => { // Check method exists - expect(DirectMessagesClient.prototype).toHaveProperty('createByConversationId'); + expect(DirectMessagesClient.prototype).toHaveProperty('getEvents'); // Check method is callable - const method = directMessagesClient.createByConversationId; + const method = directMessagesClient.getEvents; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -105,8 +87,6 @@ describe('DirectMessagesClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'dmConversationId', - ]; for (const requiredParam of requiredParams) { @@ -120,22 +100,40 @@ describe('DirectMessagesClient Structure', () => { } }); - it('should have createByConversationId method with return type annotation', () => { - const method = directMessagesClient.createByConversationId; + it('should have getEvents method with return type annotation', () => { + const method = directMessagesClient.getEvents; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getEvents method with pagination parameters', () => { + const method = directMessagesClient.getEvents; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have createByParticipantId method with correct signature', () => { + it('should have getEventsByParticipantId method with correct signature', () => { // Check method exists - expect(DirectMessagesClient.prototype).toHaveProperty('createByParticipantId'); + expect(DirectMessagesClient.prototype).toHaveProperty('getEventsByParticipantId'); // Check method is callable - const method = directMessagesClient.createByParticipantId; + const method = directMessagesClient.getEventsByParticipantId; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -161,22 +159,40 @@ describe('DirectMessagesClient Structure', () => { } }); - it('should have createByParticipantId method with return type annotation', () => { - const method = directMessagesClient.createByParticipantId; + it('should have getEventsByParticipantId method with return type annotation', () => { + const method = directMessagesClient.getEventsByParticipantId; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getEventsByParticipantId method with pagination parameters', () => { + const method = directMessagesClient.getEventsByParticipantId; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have createConversation method with correct signature', () => { + it('should have getEventsByConversationId method with correct signature', () => { // Check method exists - expect(DirectMessagesClient.prototype).toHaveProperty('createConversation'); + expect(DirectMessagesClient.prototype).toHaveProperty('getEventsByConversationId'); // Check method is callable - const method = directMessagesClient.createConversation; + const method = directMessagesClient.getEventsByConversationId; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -187,6 +203,8 @@ describe('DirectMessagesClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'id', + ]; for (const requiredParam of requiredParams) { @@ -200,14 +218,32 @@ describe('DirectMessagesClient Structure', () => { } }); - it('should have createConversation method with return type annotation', () => { - const method = directMessagesClient.createConversation; + it('should have getEventsByConversationId method with return type annotation', () => { + const method = directMessagesClient.getEventsByConversationId; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getEventsByConversationId method with pagination parameters', () => { + const method = directMessagesClient.getEventsByConversationId; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + it('should have getEventsById method with correct signature', () => { @@ -292,12 +328,12 @@ describe('DirectMessagesClient Structure', () => { - it('should have getEvents method with correct signature', () => { + it('should have createByConversationId method with correct signature', () => { // Check method exists - expect(DirectMessagesClient.prototype).toHaveProperty('getEvents'); + expect(DirectMessagesClient.prototype).toHaveProperty('createByConversationId'); // Check method is callable - const method = directMessagesClient.getEvents; + const method = directMessagesClient.createByConversationId; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -308,6 +344,8 @@ describe('DirectMessagesClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'dmConversationId', + ]; for (const requiredParam of requiredParams) { @@ -321,40 +359,22 @@ describe('DirectMessagesClient Structure', () => { } }); - it('should have getEvents method with return type annotation', () => { - const method = directMessagesClient.getEvents; + it('should have createByConversationId method with return type annotation', () => { + const method = directMessagesClient.createByConversationId; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getEvents method with pagination parameters', () => { - const method = directMessagesClient.getEvents; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have getEventsByConversationId method with correct signature', () => { + it('should have createConversation method with correct signature', () => { // Check method exists - expect(DirectMessagesClient.prototype).toHaveProperty('getEventsByConversationId'); + expect(DirectMessagesClient.prototype).toHaveProperty('createConversation'); // Check method is callable - const method = directMessagesClient.getEventsByConversationId; + const method = directMessagesClient.createConversation; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -365,8 +385,6 @@ describe('DirectMessagesClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', - ]; for (const requiredParam of requiredParams) { @@ -380,53 +398,35 @@ describe('DirectMessagesClient Structure', () => { } }); - it('should have getEventsByConversationId method with return type annotation', () => { - const method = directMessagesClient.getEventsByConversationId; + it('should have createConversation method with return type annotation', () => { + const method = directMessagesClient.createConversation; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getEventsByConversationId method with pagination parameters', () => { - const method = directMessagesClient.getEventsByConversationId; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - it('should have all expected methods', () => { const expectedMethods = [ - 'getEventsByParticipantId', + 'createByParticipantId', - 'createByConversationId', + 'getEvents', - 'createByParticipantId', + 'getEventsByParticipantId', - 'createConversation', + 'getEventsByConversationId', 'getEventsById', 'deleteEvents', - 'getEvents', + 'createByConversationId', - 'getEventsByConversationId', + 'createConversation', ]; diff --git a/xdk/typescript/tests/lists/test_contracts.test.ts b/xdk/typescript/tests/lists/test_contracts.test.ts index 69d8ecb8..abada3a1 100644 --- a/xdk/typescript/tests/lists/test_contracts.test.ts +++ b/xdk/typescript/tests/lists/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('ListsClient Contracts', () => { }); - it('should have correct request structure for removeMemberByUserId', async () => { + it('should have correct request structure for getMembers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -59,10 +59,6 @@ describe('ListsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -72,7 +68,7 @@ describe('ListsClient Contracts', () => { const options: any = {}; // Call the method - const method = (listsClient as any)['removeMemberByUserId']; + const method = (listsClient as any)['getMembers']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify the request was made @@ -84,7 +80,7 @@ describe('ListsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/lists/{id}/members/{user_id}'; + const expectedPath = '/2/lists/{id}/members'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -97,7 +93,7 @@ describe('ListsClient Contracts', () => { } }); - it('should handle required parameters correctly for removeMemberByUserId', async () => { + it('should handle required parameters correctly for getMembers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -115,7 +111,7 @@ describe('ListsClient Contracts', () => { } as Response); try { - const method = (listsClient as any)['removeMemberByUserId']; + const method = (listsClient as any)['getMembers']; // Method has required parameters - verify it can be called with proper args @@ -123,10 +119,6 @@ describe('ListsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -144,7 +136,7 @@ describe('ListsClient Contracts', () => { } }); - it('should validate response structure for removeMemberByUserId', async () => { + it('should validate response structure for getMembers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -174,17 +166,13 @@ describe('ListsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', ]; const options: any = {}; - const method = (listsClient as any)['removeMemberByUserId']; + const method = (listsClient as any)['getMembers']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -202,7 +190,7 @@ describe('ListsClient Contracts', () => { }); - it('should have correct request structure for getById', async () => { + it('should have correct request structure for addMember', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -242,7 +230,7 @@ describe('ListsClient Contracts', () => { const options: any = {}; // Call the method - const method = (listsClient as any)['getById']; + const method = (listsClient as any)['addMember']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify the request was made @@ -254,7 +242,7 @@ describe('ListsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/lists/{id}'; + const expectedPath = '/2/lists/{id}/members'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -267,7 +255,7 @@ describe('ListsClient Contracts', () => { } }); - it('should handle required parameters correctly for getById', async () => { + it('should handle required parameters correctly for addMember', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -285,7 +273,7 @@ describe('ListsClient Contracts', () => { } as Response); try { - const method = (listsClient as any)['getById']; + const method = (listsClient as any)['addMember']; // Method has required parameters - verify it can be called with proper args @@ -310,7 +298,7 @@ describe('ListsClient Contracts', () => { } }); - it('should validate response structure for getById', async () => { + it('should validate response structure for addMember', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -346,7 +334,7 @@ describe('ListsClient Contracts', () => { ]; const options: any = {}; - const method = (listsClient as any)['getById']; + const method = (listsClient as any)['addMember']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -364,7 +352,7 @@ describe('ListsClient Contracts', () => { }); - it('should have correct request structure for update', async () => { + it('should have correct request structure for getFollowers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -404,7 +392,7 @@ describe('ListsClient Contracts', () => { const options: any = {}; // Call the method - const method = (listsClient as any)['update']; + const method = (listsClient as any)['getFollowers']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify the request was made @@ -416,7 +404,7 @@ describe('ListsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/lists/{id}'; + const expectedPath = '/2/lists/{id}/followers'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -429,7 +417,7 @@ describe('ListsClient Contracts', () => { } }); - it('should handle required parameters correctly for update', async () => { + it('should handle required parameters correctly for getFollowers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -447,7 +435,7 @@ describe('ListsClient Contracts', () => { } as Response); try { - const method = (listsClient as any)['update']; + const method = (listsClient as any)['getFollowers']; // Method has required parameters - verify it can be called with proper args @@ -472,7 +460,7 @@ describe('ListsClient Contracts', () => { } }); - it('should validate response structure for update', async () => { + it('should validate response structure for getFollowers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -508,7 +496,7 @@ describe('ListsClient Contracts', () => { ]; const options: any = {}; - const method = (listsClient as any)['update']; + const method = (listsClient as any)['getFollowers']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -526,7 +514,7 @@ describe('ListsClient Contracts', () => { }); - it('should have correct request structure for delete', async () => { + it('should have correct request structure for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -566,7 +554,7 @@ describe('ListsClient Contracts', () => { const options: any = {}; // Call the method - const method = (listsClient as any)['delete']; + const method = (listsClient as any)['getPosts']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify the request was made @@ -578,7 +566,7 @@ describe('ListsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/lists/{id}'; + const expectedPath = '/2/lists/{id}/tweets'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -591,7 +579,7 @@ describe('ListsClient Contracts', () => { } }); - it('should handle required parameters correctly for delete', async () => { + it('should handle required parameters correctly for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -609,7 +597,7 @@ describe('ListsClient Contracts', () => { } as Response); try { - const method = (listsClient as any)['delete']; + const method = (listsClient as any)['getPosts']; // Method has required parameters - verify it can be called with proper args @@ -634,7 +622,7 @@ describe('ListsClient Contracts', () => { } }); - it('should validate response structure for delete', async () => { + it('should validate response structure for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -670,7 +658,7 @@ describe('ListsClient Contracts', () => { ]; const options: any = {}; - const method = (listsClient as any)['delete']; + const method = (listsClient as any)['getPosts']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -688,7 +676,7 @@ describe('ListsClient Contracts', () => { }); - it('should have correct request structure for getMembers', async () => { + it('should have correct request structure for removeMemberByUserId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -719,6 +707,10 @@ describe('ListsClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', @@ -728,7 +720,7 @@ describe('ListsClient Contracts', () => { const options: any = {}; // Call the method - const method = (listsClient as any)['getMembers']; + const method = (listsClient as any)['removeMemberByUserId']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify the request was made @@ -740,7 +732,7 @@ describe('ListsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/lists/{id}/members'; + const expectedPath = '/2/lists/{id}/members/{user_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -753,7 +745,7 @@ describe('ListsClient Contracts', () => { } }); - it('should handle required parameters correctly for getMembers', async () => { + it('should handle required parameters correctly for removeMemberByUserId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -771,7 +763,7 @@ describe('ListsClient Contracts', () => { } as Response); try { - const method = (listsClient as any)['getMembers']; + const method = (listsClient as any)['removeMemberByUserId']; // Method has required parameters - verify it can be called with proper args @@ -779,6 +771,10 @@ describe('ListsClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', @@ -796,7 +792,7 @@ describe('ListsClient Contracts', () => { } }); - it('should validate response structure for getMembers', async () => { + it('should validate response structure for removeMemberByUserId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -826,13 +822,17 @@ describe('ListsClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', ]; const options: any = {}; - const method = (listsClient as any)['getMembers']; + const method = (listsClient as any)['removeMemberByUserId']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -850,7 +850,7 @@ describe('ListsClient Contracts', () => { }); - it('should have correct request structure for addMember', async () => { + it('should have correct request structure for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -890,7 +890,7 @@ describe('ListsClient Contracts', () => { const options: any = {}; // Call the method - const method = (listsClient as any)['addMember']; + const method = (listsClient as any)['getById']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify the request was made @@ -902,7 +902,7 @@ describe('ListsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/lists/{id}/members'; + const expectedPath = '/2/lists/{id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -915,7 +915,7 @@ describe('ListsClient Contracts', () => { } }); - it('should handle required parameters correctly for addMember', async () => { + it('should handle required parameters correctly for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -933,7 +933,7 @@ describe('ListsClient Contracts', () => { } as Response); try { - const method = (listsClient as any)['addMember']; + const method = (listsClient as any)['getById']; // Method has required parameters - verify it can be called with proper args @@ -958,7 +958,7 @@ describe('ListsClient Contracts', () => { } }); - it('should validate response structure for addMember', async () => { + it('should validate response structure for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -994,7 +994,7 @@ describe('ListsClient Contracts', () => { ]; const options: any = {}; - const method = (listsClient as any)['addMember']; + const method = (listsClient as any)['getById']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1012,7 +1012,7 @@ describe('ListsClient Contracts', () => { }); - it('should have correct request structure for getFollowers', async () => { + it('should have correct request structure for update', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1052,7 +1052,7 @@ describe('ListsClient Contracts', () => { const options: any = {}; // Call the method - const method = (listsClient as any)['getFollowers']; + const method = (listsClient as any)['update']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify the request was made @@ -1064,7 +1064,7 @@ describe('ListsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/lists/{id}/followers'; + const expectedPath = '/2/lists/{id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1077,7 +1077,7 @@ describe('ListsClient Contracts', () => { } }); - it('should handle required parameters correctly for getFollowers', async () => { + it('should handle required parameters correctly for update', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1095,7 +1095,7 @@ describe('ListsClient Contracts', () => { } as Response); try { - const method = (listsClient as any)['getFollowers']; + const method = (listsClient as any)['update']; // Method has required parameters - verify it can be called with proper args @@ -1120,7 +1120,7 @@ describe('ListsClient Contracts', () => { } }); - it('should validate response structure for getFollowers', async () => { + it('should validate response structure for update', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1156,7 +1156,7 @@ describe('ListsClient Contracts', () => { ]; const options: any = {}; - const method = (listsClient as any)['getFollowers']; + const method = (listsClient as any)['update']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1174,7 +1174,7 @@ describe('ListsClient Contracts', () => { }); - it('should have correct request structure for getPosts', async () => { + it('should have correct request structure for delete', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1214,7 +1214,7 @@ describe('ListsClient Contracts', () => { const options: any = {}; // Call the method - const method = (listsClient as any)['getPosts']; + const method = (listsClient as any)['delete']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify the request was made @@ -1226,7 +1226,7 @@ describe('ListsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/lists/{id}/tweets'; + const expectedPath = '/2/lists/{id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1239,7 +1239,7 @@ describe('ListsClient Contracts', () => { } }); - it('should handle required parameters correctly for getPosts', async () => { + it('should handle required parameters correctly for delete', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1257,7 +1257,7 @@ describe('ListsClient Contracts', () => { } as Response); try { - const method = (listsClient as any)['getPosts']; + const method = (listsClient as any)['delete']; // Method has required parameters - verify it can be called with proper args @@ -1282,7 +1282,7 @@ describe('ListsClient Contracts', () => { } }); - it('should validate response structure for getPosts', async () => { + it('should validate response structure for delete', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1318,7 +1318,7 @@ describe('ListsClient Contracts', () => { ]; const options: any = {}; - const method = (listsClient as any)['getPosts']; + const method = (listsClient as any)['delete']; const result = await method.apply(listsClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/lists/test_structure.test.ts b/xdk/typescript/tests/lists/test_structure.test.ts index 03af4944..2b0dec4e 100644 --- a/xdk/typescript/tests/lists/test_structure.test.ts +++ b/xdk/typescript/tests/lists/test_structure.test.ts @@ -30,12 +30,12 @@ describe('ListsClient Structure', () => { - it('should have removeMemberByUserId method with correct signature', () => { + it('should have getMembers method with correct signature', () => { // Check method exists - expect(ListsClient.prototype).toHaveProperty('removeMemberByUserId'); + expect(ListsClient.prototype).toHaveProperty('getMembers'); // Check method is callable - const method = listsClient.removeMemberByUserId; + const method = listsClient.getMembers; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -48,8 +48,6 @@ describe('ListsClient Structure', () => { 'id', - 'userId', - ]; for (const requiredParam of requiredParams) { @@ -63,22 +61,40 @@ describe('ListsClient Structure', () => { } }); - it('should have removeMemberByUserId method with return type annotation', () => { - const method = listsClient.removeMemberByUserId; + it('should have getMembers method with return type annotation', () => { + const method = listsClient.getMembers; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getMembers method with pagination parameters', () => { + const method = listsClient.getMembers; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have getById method with correct signature', () => { + it('should have addMember method with correct signature', () => { // Check method exists - expect(ListsClient.prototype).toHaveProperty('getById'); + expect(ListsClient.prototype).toHaveProperty('addMember'); // Check method is callable - const method = listsClient.getById; + const method = listsClient.addMember; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -104,8 +120,8 @@ describe('ListsClient Structure', () => { } }); - it('should have getById method with return type annotation', () => { - const method = listsClient.getById; + it('should have addMember method with return type annotation', () => { + const method = listsClient.addMember; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -114,12 +130,12 @@ describe('ListsClient Structure', () => { - it('should have update method with correct signature', () => { + it('should have getFollowers method with correct signature', () => { // Check method exists - expect(ListsClient.prototype).toHaveProperty('update'); + expect(ListsClient.prototype).toHaveProperty('getFollowers'); // Check method is callable - const method = listsClient.update; + const method = listsClient.getFollowers; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -145,22 +161,40 @@ describe('ListsClient Structure', () => { } }); - it('should have update method with return type annotation', () => { - const method = listsClient.update; + it('should have getFollowers method with return type annotation', () => { + const method = listsClient.getFollowers; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getFollowers method with pagination parameters', () => { + const method = listsClient.getFollowers; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have delete method with correct signature', () => { + it('should have getPosts method with correct signature', () => { // Check method exists - expect(ListsClient.prototype).toHaveProperty('delete'); + expect(ListsClient.prototype).toHaveProperty('getPosts'); // Check method is callable - const method = listsClient.delete; + const method = listsClient.getPosts; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -186,22 +220,40 @@ describe('ListsClient Structure', () => { } }); - it('should have delete method with return type annotation', () => { - const method = listsClient.delete; + it('should have getPosts method with return type annotation', () => { + const method = listsClient.getPosts; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getPosts method with pagination parameters', () => { + const method = listsClient.getPosts; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have getMembers method with correct signature', () => { + it('should have removeMemberByUserId method with correct signature', () => { // Check method exists - expect(ListsClient.prototype).toHaveProperty('getMembers'); + expect(ListsClient.prototype).toHaveProperty('removeMemberByUserId'); // Check method is callable - const method = listsClient.getMembers; + const method = listsClient.removeMemberByUserId; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -214,6 +266,8 @@ describe('ListsClient Structure', () => { 'id', + 'userId', + ]; for (const requiredParam of requiredParams) { @@ -227,40 +281,22 @@ describe('ListsClient Structure', () => { } }); - it('should have getMembers method with return type annotation', () => { - const method = listsClient.getMembers; + it('should have removeMemberByUserId method with return type annotation', () => { + const method = listsClient.removeMemberByUserId; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getMembers method with pagination parameters', () => { - const method = listsClient.getMembers; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have addMember method with correct signature', () => { + it('should have getById method with correct signature', () => { // Check method exists - expect(ListsClient.prototype).toHaveProperty('addMember'); + expect(ListsClient.prototype).toHaveProperty('getById'); // Check method is callable - const method = listsClient.addMember; + const method = listsClient.getById; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -286,8 +322,8 @@ describe('ListsClient Structure', () => { } }); - it('should have addMember method with return type annotation', () => { - const method = listsClient.addMember; + it('should have getById method with return type annotation', () => { + const method = listsClient.getById; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -296,12 +332,12 @@ describe('ListsClient Structure', () => { - it('should have getFollowers method with correct signature', () => { + it('should have update method with correct signature', () => { // Check method exists - expect(ListsClient.prototype).toHaveProperty('getFollowers'); + expect(ListsClient.prototype).toHaveProperty('update'); // Check method is callable - const method = listsClient.getFollowers; + const method = listsClient.update; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -327,40 +363,22 @@ describe('ListsClient Structure', () => { } }); - it('should have getFollowers method with return type annotation', () => { - const method = listsClient.getFollowers; + it('should have update method with return type annotation', () => { + const method = listsClient.update; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getFollowers method with pagination parameters', () => { - const method = listsClient.getFollowers; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have getPosts method with correct signature', () => { + it('should have delete method with correct signature', () => { // Check method exists - expect(ListsClient.prototype).toHaveProperty('getPosts'); + expect(ListsClient.prototype).toHaveProperty('delete'); // Check method is callable - const method = listsClient.getPosts; + const method = listsClient.delete; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -386,32 +404,14 @@ describe('ListsClient Structure', () => { } }); - it('should have getPosts method with return type annotation', () => { - const method = listsClient.getPosts; + it('should have delete method with return type annotation', () => { + const method = listsClient.delete; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getPosts method with pagination parameters', () => { - const method = listsClient.getPosts; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - it('should have create method with correct signature', () => { @@ -457,14 +457,6 @@ describe('ListsClient Structure', () => { it('should have all expected methods', () => { const expectedMethods = [ - 'removeMemberByUserId', - - 'getById', - - 'update', - - 'delete', - 'getMembers', 'addMember', @@ -473,6 +465,14 @@ describe('ListsClient Structure', () => { 'getPosts', + 'removeMemberByUserId', + + 'getById', + + 'update', + + 'delete', + 'create', ]; diff --git a/xdk/typescript/tests/media/test_contracts.test.ts b/xdk/typescript/tests/media/test_contracts.test.ts index ff6d9d4b..f38b1332 100644 --- a/xdk/typescript/tests/media/test_contracts.test.ts +++ b/xdk/typescript/tests/media/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for getAnalytics', async () => { + it('should have correct request structure for getByKey', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -59,19 +59,7 @@ describe('MediaClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_end_time', - - - - 'test_start_time', - - - - 'test_granularity', + 'test_value', ]; @@ -80,7 +68,7 @@ describe('MediaClient Contracts', () => { const options: any = {}; // Call the method - const method = (mediaClient as any)['getAnalytics']; + const method = (mediaClient as any)['getByKey']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -92,7 +80,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/analytics'; + const expectedPath = '/2/media/{media_key}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -105,7 +93,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for getAnalytics', async () => { + it('should handle required parameters correctly for getByKey', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -123,7 +111,7 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['getAnalytics']; + const method = (mediaClient as any)['getByKey']; // Method has required parameters - verify it can be called with proper args @@ -131,19 +119,7 @@ describe('MediaClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_end_time', - - - - 'test_start_time', - - - - 'test_granularity', + 'test_value', ]; @@ -160,7 +136,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for getAnalytics', async () => { + it('should validate response structure for getByKey', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -190,25 +166,13 @@ describe('MediaClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_end_time', - - - - 'test_start_time', - - - - 'test_granularity', + 'test_value', ]; const options: any = {}; - const method = (mediaClient as any)['getAnalytics']; + const method = (mediaClient as any)['getByKey']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -226,7 +190,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for createSubtitles', async () => { + it('should have correct request structure for createMetadata', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -262,7 +226,7 @@ describe('MediaClient Contracts', () => { const options: any = {}; // Call the method - const method = (mediaClient as any)['createSubtitles']; + const method = (mediaClient as any)['createMetadata']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -274,7 +238,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/subtitles'; + const expectedPath = '/2/media/metadata'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -287,7 +251,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for createSubtitles', async () => { + it('should handle required parameters correctly for createMetadata', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -305,7 +269,7 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['createSubtitles']; + const method = (mediaClient as any)['createMetadata']; // Method has required parameters - verify it can be called with proper args @@ -326,7 +290,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for createSubtitles', async () => { + it('should validate response structure for createMetadata', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -358,7 +322,7 @@ describe('MediaClient Contracts', () => { ]; const options: any = {}; - const method = (mediaClient as any)['createSubtitles']; + const method = (mediaClient as any)['createMetadata']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -376,7 +340,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for deleteSubtitles', async () => { + it('should have correct request structure for finalizeUpload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -406,13 +370,17 @@ describe('MediaClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (mediaClient as any)['deleteSubtitles']; + const method = (mediaClient as any)['finalizeUpload']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -424,7 +392,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/subtitles'; + const expectedPath = '/2/media/upload/{id}/finalize'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -437,7 +405,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for deleteSubtitles', async () => { + it('should handle required parameters correctly for finalizeUpload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -455,13 +423,17 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['deleteSubtitles']; + const method = (mediaClient as any)['finalizeUpload']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -476,7 +448,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for deleteSubtitles', async () => { + it('should validate response structure for finalizeUpload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -505,10 +477,14 @@ describe('MediaClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (mediaClient as any)['deleteSubtitles']; + const method = (mediaClient as any)['finalizeUpload']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -526,7 +502,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for initializeUpload', async () => { + it('should have correct request structure for appendUpload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -556,13 +532,17 @@ describe('MediaClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (mediaClient as any)['initializeUpload']; + const method = (mediaClient as any)['appendUpload']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -574,7 +554,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/upload/initialize'; + const expectedPath = '/2/media/upload/{id}/append'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -587,7 +567,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for initializeUpload', async () => { + it('should handle required parameters correctly for appendUpload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -605,13 +585,17 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['initializeUpload']; + const method = (mediaClient as any)['appendUpload']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -626,7 +610,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for initializeUpload', async () => { + it('should validate response structure for appendUpload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -655,10 +639,14 @@ describe('MediaClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (mediaClient as any)['initializeUpload']; + const method = (mediaClient as any)['appendUpload']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -676,7 +664,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for getUploadStatus', async () => { + it('should have correct request structure for initializeUpload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -706,17 +694,13 @@ describe('MediaClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (mediaClient as any)['getUploadStatus']; + const method = (mediaClient as any)['initializeUpload']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -728,7 +712,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/upload'; + const expectedPath = '/2/media/upload/initialize'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -741,7 +725,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for getUploadStatus', async () => { + it('should handle required parameters correctly for initializeUpload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -759,17 +743,13 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['getUploadStatus']; + const method = (mediaClient as any)['initializeUpload']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -784,7 +764,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for getUploadStatus', async () => { + it('should validate response structure for initializeUpload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -813,14 +793,10 @@ describe('MediaClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (mediaClient as any)['getUploadStatus']; + const method = (mediaClient as any)['initializeUpload']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -838,7 +814,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for upload', async () => { + it('should have correct request structure for getByKeys', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -868,13 +844,17 @@ describe('MediaClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + ['test_item'], + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (mediaClient as any)['upload']; + const method = (mediaClient as any)['getByKeys']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -886,7 +866,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/upload'; + const expectedPath = '/2/media'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -899,7 +879,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for upload', async () => { + it('should handle required parameters correctly for getByKeys', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -917,13 +897,17 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['upload']; + const method = (mediaClient as any)['getByKeys']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + ['test_item'], + + ]; // Build options object (empty for required params, optional params go here) @@ -938,7 +922,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for upload', async () => { + it('should validate response structure for getByKeys', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -967,10 +951,14 @@ describe('MediaClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + ['test_item'], + + ]; const options: any = {}; - const method = (mediaClient as any)['upload']; + const method = (mediaClient as any)['getByKeys']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -988,7 +976,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for getByKey', async () => { + it('should have correct request structure for getUploadStatus', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1028,7 +1016,7 @@ describe('MediaClient Contracts', () => { const options: any = {}; // Call the method - const method = (mediaClient as any)['getByKey']; + const method = (mediaClient as any)['getUploadStatus']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -1040,7 +1028,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/{media_key}'; + const expectedPath = '/2/media/upload'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1053,7 +1041,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for getByKey', async () => { + it('should handle required parameters correctly for getUploadStatus', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1071,7 +1059,7 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['getByKey']; + const method = (mediaClient as any)['getUploadStatus']; // Method has required parameters - verify it can be called with proper args @@ -1096,7 +1084,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for getByKey', async () => { + it('should validate response structure for getUploadStatus', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1132,7 +1120,7 @@ describe('MediaClient Contracts', () => { ]; const options: any = {}; - const method = (mediaClient as any)['getByKey']; + const method = (mediaClient as any)['getUploadStatus']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1150,7 +1138,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for appendUpload', async () => { + it('should have correct request structure for upload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1180,17 +1168,13 @@ describe('MediaClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (mediaClient as any)['appendUpload']; + const method = (mediaClient as any)['upload']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -1202,7 +1186,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/upload/{id}/append'; + const expectedPath = '/2/media/upload'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1215,7 +1199,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for appendUpload', async () => { + it('should handle required parameters correctly for upload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1233,17 +1217,13 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['appendUpload']; + const method = (mediaClient as any)['upload']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -1258,7 +1238,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for appendUpload', async () => { + it('should validate response structure for upload', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1287,14 +1267,10 @@ describe('MediaClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (mediaClient as any)['appendUpload']; + const method = (mediaClient as any)['upload']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1312,7 +1288,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for getByKeys', async () => { + it('should have correct request structure for getAnalytics', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1346,13 +1322,25 @@ describe('MediaClient Contracts', () => { ['test_item'], + + 'test_end_time', + + + + 'test_start_time', + + + + 'test_granularity', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (mediaClient as any)['getByKeys']; + const method = (mediaClient as any)['getAnalytics']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -1364,7 +1352,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media'; + const expectedPath = '/2/media/analytics'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1377,7 +1365,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for getByKeys', async () => { + it('should handle required parameters correctly for getAnalytics', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1395,7 +1383,7 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['getByKeys']; + const method = (mediaClient as any)['getAnalytics']; // Method has required parameters - verify it can be called with proper args @@ -1406,6 +1394,18 @@ describe('MediaClient Contracts', () => { ['test_item'], + + 'test_end_time', + + + + 'test_start_time', + + + + 'test_granularity', + + ]; // Build options object (empty for required params, optional params go here) @@ -1420,7 +1420,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for getByKeys', async () => { + it('should validate response structure for getAnalytics', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1453,10 +1453,22 @@ describe('MediaClient Contracts', () => { ['test_item'], + + 'test_end_time', + + + + 'test_start_time', + + + + 'test_granularity', + + ]; const options: any = {}; - const method = (mediaClient as any)['getByKeys']; + const method = (mediaClient as any)['getAnalytics']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1474,7 +1486,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for finalizeUpload', async () => { + it('should have correct request structure for createSubtitles', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1504,17 +1516,13 @@ describe('MediaClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (mediaClient as any)['finalizeUpload']; + const method = (mediaClient as any)['createSubtitles']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -1526,7 +1534,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/upload/{id}/finalize'; + const expectedPath = '/2/media/subtitles'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1539,7 +1547,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for finalizeUpload', async () => { + it('should handle required parameters correctly for createSubtitles', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1557,17 +1565,13 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['finalizeUpload']; + const method = (mediaClient as any)['createSubtitles']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -1582,7 +1586,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for finalizeUpload', async () => { + it('should validate response structure for createSubtitles', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1611,14 +1615,10 @@ describe('MediaClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (mediaClient as any)['finalizeUpload']; + const method = (mediaClient as any)['createSubtitles']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1636,7 +1636,7 @@ describe('MediaClient Contracts', () => { }); - it('should have correct request structure for createMetadata', async () => { + it('should have correct request structure for deleteSubtitles', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1672,7 +1672,7 @@ describe('MediaClient Contracts', () => { const options: any = {}; // Call the method - const method = (mediaClient as any)['createMetadata']; + const method = (mediaClient as any)['deleteSubtitles']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify the request was made @@ -1684,7 +1684,7 @@ describe('MediaClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/media/metadata'; + const expectedPath = '/2/media/subtitles'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1697,7 +1697,7 @@ describe('MediaClient Contracts', () => { } }); - it('should handle required parameters correctly for createMetadata', async () => { + it('should handle required parameters correctly for deleteSubtitles', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1715,7 +1715,7 @@ describe('MediaClient Contracts', () => { } as Response); try { - const method = (mediaClient as any)['createMetadata']; + const method = (mediaClient as any)['deleteSubtitles']; // Method has required parameters - verify it can be called with proper args @@ -1736,7 +1736,7 @@ describe('MediaClient Contracts', () => { } }); - it('should validate response structure for createMetadata', async () => { + it('should validate response structure for deleteSubtitles', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1768,7 +1768,7 @@ describe('MediaClient Contracts', () => { ]; const options: any = {}; - const method = (mediaClient as any)['createMetadata']; + const method = (mediaClient as any)['deleteSubtitles']; const result = await method.apply(mediaClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/media/test_structure.test.ts b/xdk/typescript/tests/media/test_structure.test.ts index 7b536a11..69e78a5c 100644 --- a/xdk/typescript/tests/media/test_structure.test.ts +++ b/xdk/typescript/tests/media/test_structure.test.ts @@ -30,12 +30,12 @@ describe('MediaClient Structure', () => { - it('should have getAnalytics method with correct signature', () => { + it('should have getByKey method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('getAnalytics'); + expect(MediaClient.prototype).toHaveProperty('getByKey'); // Check method is callable - const method = mediaClient.getAnalytics; + const method = mediaClient.getByKey; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -46,13 +46,7 @@ describe('MediaClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'mediaKeys', - - 'endTime', - - 'startTime', - - 'granularity', + 'mediaKey', ]; @@ -67,8 +61,8 @@ describe('MediaClient Structure', () => { } }); - it('should have getAnalytics method with return type annotation', () => { - const method = mediaClient.getAnalytics; + it('should have getByKey method with return type annotation', () => { + const method = mediaClient.getByKey; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -77,12 +71,12 @@ describe('MediaClient Structure', () => { - it('should have createSubtitles method with correct signature', () => { + it('should have createMetadata method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('createSubtitles'); + expect(MediaClient.prototype).toHaveProperty('createMetadata'); // Check method is callable - const method = mediaClient.createSubtitles; + const method = mediaClient.createMetadata; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -106,8 +100,8 @@ describe('MediaClient Structure', () => { } }); - it('should have createSubtitles method with return type annotation', () => { - const method = mediaClient.createSubtitles; + it('should have createMetadata method with return type annotation', () => { + const method = mediaClient.createMetadata; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -116,12 +110,12 @@ describe('MediaClient Structure', () => { - it('should have deleteSubtitles method with correct signature', () => { + it('should have finalizeUpload method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('deleteSubtitles'); + expect(MediaClient.prototype).toHaveProperty('finalizeUpload'); // Check method is callable - const method = mediaClient.deleteSubtitles; + const method = mediaClient.finalizeUpload; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -132,6 +126,8 @@ describe('MediaClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'id', + ]; for (const requiredParam of requiredParams) { @@ -145,8 +141,8 @@ describe('MediaClient Structure', () => { } }); - it('should have deleteSubtitles method with return type annotation', () => { - const method = mediaClient.deleteSubtitles; + it('should have finalizeUpload method with return type annotation', () => { + const method = mediaClient.finalizeUpload; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -155,12 +151,12 @@ describe('MediaClient Structure', () => { - it('should have initializeUpload method with correct signature', () => { + it('should have appendUpload method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('initializeUpload'); + expect(MediaClient.prototype).toHaveProperty('appendUpload'); // Check method is callable - const method = mediaClient.initializeUpload; + const method = mediaClient.appendUpload; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -171,6 +167,8 @@ describe('MediaClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'id', + ]; for (const requiredParam of requiredParams) { @@ -184,8 +182,8 @@ describe('MediaClient Structure', () => { } }); - it('should have initializeUpload method with return type annotation', () => { - const method = mediaClient.initializeUpload; + it('should have appendUpload method with return type annotation', () => { + const method = mediaClient.appendUpload; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -194,12 +192,12 @@ describe('MediaClient Structure', () => { - it('should have getUploadStatus method with correct signature', () => { + it('should have initializeUpload method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('getUploadStatus'); + expect(MediaClient.prototype).toHaveProperty('initializeUpload'); // Check method is callable - const method = mediaClient.getUploadStatus; + const method = mediaClient.initializeUpload; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -210,8 +208,6 @@ describe('MediaClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'mediaId', - ]; for (const requiredParam of requiredParams) { @@ -225,8 +221,8 @@ describe('MediaClient Structure', () => { } }); - it('should have getUploadStatus method with return type annotation', () => { - const method = mediaClient.getUploadStatus; + it('should have initializeUpload method with return type annotation', () => { + const method = mediaClient.initializeUpload; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -235,12 +231,12 @@ describe('MediaClient Structure', () => { - it('should have upload method with correct signature', () => { + it('should have getByKeys method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('upload'); + expect(MediaClient.prototype).toHaveProperty('getByKeys'); // Check method is callable - const method = mediaClient.upload; + const method = mediaClient.getByKeys; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -251,6 +247,8 @@ describe('MediaClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'mediaKeys', + ]; for (const requiredParam of requiredParams) { @@ -264,8 +262,8 @@ describe('MediaClient Structure', () => { } }); - it('should have upload method with return type annotation', () => { - const method = mediaClient.upload; + it('should have getByKeys method with return type annotation', () => { + const method = mediaClient.getByKeys; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -274,12 +272,12 @@ describe('MediaClient Structure', () => { - it('should have getByKey method with correct signature', () => { + it('should have getUploadStatus method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('getByKey'); + expect(MediaClient.prototype).toHaveProperty('getUploadStatus'); // Check method is callable - const method = mediaClient.getByKey; + const method = mediaClient.getUploadStatus; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -290,7 +288,7 @@ describe('MediaClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'mediaKey', + 'mediaId', ]; @@ -305,8 +303,8 @@ describe('MediaClient Structure', () => { } }); - it('should have getByKey method with return type annotation', () => { - const method = mediaClient.getByKey; + it('should have getUploadStatus method with return type annotation', () => { + const method = mediaClient.getUploadStatus; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -315,12 +313,12 @@ describe('MediaClient Structure', () => { - it('should have appendUpload method with correct signature', () => { + it('should have upload method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('appendUpload'); + expect(MediaClient.prototype).toHaveProperty('upload'); // Check method is callable - const method = mediaClient.appendUpload; + const method = mediaClient.upload; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -331,8 +329,6 @@ describe('MediaClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', - ]; for (const requiredParam of requiredParams) { @@ -346,8 +342,8 @@ describe('MediaClient Structure', () => { } }); - it('should have appendUpload method with return type annotation', () => { - const method = mediaClient.appendUpload; + it('should have upload method with return type annotation', () => { + const method = mediaClient.upload; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -356,12 +352,12 @@ describe('MediaClient Structure', () => { - it('should have getByKeys method with correct signature', () => { + it('should have getAnalytics method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('getByKeys'); + expect(MediaClient.prototype).toHaveProperty('getAnalytics'); // Check method is callable - const method = mediaClient.getByKeys; + const method = mediaClient.getAnalytics; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -374,6 +370,12 @@ describe('MediaClient Structure', () => { 'mediaKeys', + 'endTime', + + 'startTime', + + 'granularity', + ]; for (const requiredParam of requiredParams) { @@ -387,8 +389,8 @@ describe('MediaClient Structure', () => { } }); - it('should have getByKeys method with return type annotation', () => { - const method = mediaClient.getByKeys; + it('should have getAnalytics method with return type annotation', () => { + const method = mediaClient.getAnalytics; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -397,12 +399,12 @@ describe('MediaClient Structure', () => { - it('should have finalizeUpload method with correct signature', () => { + it('should have createSubtitles method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('finalizeUpload'); + expect(MediaClient.prototype).toHaveProperty('createSubtitles'); // Check method is callable - const method = mediaClient.finalizeUpload; + const method = mediaClient.createSubtitles; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -413,8 +415,6 @@ describe('MediaClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', - ]; for (const requiredParam of requiredParams) { @@ -428,8 +428,8 @@ describe('MediaClient Structure', () => { } }); - it('should have finalizeUpload method with return type annotation', () => { - const method = mediaClient.finalizeUpload; + it('should have createSubtitles method with return type annotation', () => { + const method = mediaClient.createSubtitles; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -438,12 +438,12 @@ describe('MediaClient Structure', () => { - it('should have createMetadata method with correct signature', () => { + it('should have deleteSubtitles method with correct signature', () => { // Check method exists - expect(MediaClient.prototype).toHaveProperty('createMetadata'); + expect(MediaClient.prototype).toHaveProperty('deleteSubtitles'); // Check method is callable - const method = mediaClient.createMetadata; + const method = mediaClient.deleteSubtitles; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -467,8 +467,8 @@ describe('MediaClient Structure', () => { } }); - it('should have createMetadata method with return type annotation', () => { - const method = mediaClient.createMetadata; + it('should have deleteSubtitles method with return type annotation', () => { + const method = mediaClient.deleteSubtitles; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -481,27 +481,27 @@ describe('MediaClient Structure', () => { it('should have all expected methods', () => { const expectedMethods = [ - 'getAnalytics', + 'getByKey', - 'createSubtitles', + 'createMetadata', - 'deleteSubtitles', + 'finalizeUpload', + + 'appendUpload', 'initializeUpload', + 'getByKeys', + 'getUploadStatus', 'upload', - 'getByKey', - - 'appendUpload', - - 'getByKeys', + 'getAnalytics', - 'finalizeUpload', + 'createSubtitles', - 'createMetadata', + 'deleteSubtitles', ]; diff --git a/xdk/typescript/tests/news/test_contracts.test.ts b/xdk/typescript/tests/news/test_contracts.test.ts index 7ae0b393..4a7ba04b 100644 --- a/xdk/typescript/tests/news/test_contracts.test.ts +++ b/xdk/typescript/tests/news/test_contracts.test.ts @@ -190,4 +190,166 @@ describe('NewsClient Contracts', () => { }); + it('should have correct request structure for search', async () => { + // Mock validateAuthentication to bypass auth checks (like Python mocks session) + const originalValidateAuth = client.validateAuthentication; + client.validateAuthentication = jest.fn(); + + // Mock httpClient.request to capture request details (like Python mocks session) + const originalRequest = client.httpClient.request; + (client.httpClient.request as any) = jest.fn().mockResolvedValue({ + ok: true, + status: 200, + statusText: 'OK', + headers: new Headers({ 'content-type': 'application/json' }), + + json: async () => ({ + + + data: null, + + + }), + text: async () => '{}' + } as Response); + + try { + // Prepare test parameters + // In TypeScript, ALL required parameters (path and query) are direct function arguments + // Only optional parameters go in the options object + // Build required parameter arguments + const requiredArgs: any[] = [ + + + 'test_query', + + + ]; + + // Build options object (empty for required params test, optional params go here) + const options: any = {}; + + // Call the method + const method = (newsClient as any)['search']; + const result = await method.apply(newsClient, [...requiredArgs, options]); + + // Verify the request was made + expect(client.httpClient.request).toHaveBeenCalled(); + + // Verify request structure + const callArgs = (client.httpClient.request as jest.Mock).mock.calls[0]; + const url = callArgs[0] as string; + const requestOptions = callArgs[1] as RequestInit; + + // Check URL structure - path parameters are replaced in the URL + const expectedPath = '/2/news/search'; + // Path parameters are replaced with actual values, so check for the base path structure + const basePath = expectedPath.split('{')[0]; + expect(url).toContain(basePath); + + // Verify response structure + expect(result).toBeDefined(); + } finally { + client.httpClient.request = originalRequest; + client.validateAuthentication = originalValidateAuth; + } + }); + + it('should handle required parameters correctly for search', async () => { + // Mock validateAuthentication to bypass auth checks (like Python mocks session) + const originalValidateAuth = client.validateAuthentication; + client.validateAuthentication = jest.fn(); + + // Mock httpClient.request (like Python mocks session) + const originalRequest = client.httpClient.request; + (client.httpClient.request as any) = jest.fn().mockResolvedValue({ + ok: true, + status: 200, + statusText: 'OK', + headers: new Headers({ 'content-type': 'application/json' }), + + json: async () => ({}), + text: async () => '{}' + } as Response); + + try { + const method = (newsClient as any)['search']; + + + // Method has required parameters - verify it can be called with proper args + // Build required parameter arguments (all required params are direct args in TypeScript) + const requiredArgs: any[] = [ + + + 'test_query', + + + ]; + + // Build options object (empty for required params, optional params go here) + const options: any = {}; + + // Method should be callable with required parameters + await expect(method.apply(newsClient, [...requiredArgs, options])).resolves.toBeDefined(); + + } finally { + client.httpClient.request = originalRequest; + client.validateAuthentication = originalValidateAuth; + } + }); + + it('should validate response structure for search', async () => { + // Mock validateAuthentication to bypass auth checks (like Python mocks session) + const originalValidateAuth = client.validateAuthentication; + client.validateAuthentication = jest.fn(); + + const mockResponseData = { + + + data: null, + + + }; + + // Mock httpClient.request (like Python mocks session) + const originalRequest = client.httpClient.request; + (client.httpClient.request as any) = jest.fn().mockResolvedValue({ + ok: true, + status: 200, + statusText: 'OK', + headers: new Headers({ 'content-type': 'application/json' }), + + json: async () => mockResponseData, + text: async () => JSON.stringify(mockResponseData) + } as Response); + + try { + // Build arguments (all required params are direct args in TypeScript) + const requiredArgs: any[] = [ + + + 'test_query', + + + ]; + const options: any = {}; + + const method = (newsClient as any)['search']; + const result = await method.apply(newsClient, [...requiredArgs, options]); + + // Verify response object has expected structure + expect(result).toBeDefined(); + + // Regular JSON response - check for expected fields + + expect(result).toHaveProperty('data'); + + + } finally { + client.httpClient.request = originalRequest; + client.validateAuthentication = originalValidateAuth; + } + }); + + }); diff --git a/xdk/typescript/tests/news/test_structure.test.ts b/xdk/typescript/tests/news/test_structure.test.ts index 1b9dad4f..f93cac03 100644 --- a/xdk/typescript/tests/news/test_structure.test.ts +++ b/xdk/typescript/tests/news/test_structure.test.ts @@ -71,12 +71,55 @@ describe('NewsClient Structure', () => { + it('should have search method with correct signature', () => { + // Check method exists + expect(NewsClient.prototype).toHaveProperty('search'); + + // Check method is callable + const method = newsClient.search; + expect(typeof method).toBe('function'); + + // Check method signature by examining parameter count + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Check required parameters exist (convert to camelCase for TypeScript) + const requiredParams = [ + + 'query', + + ]; + + for (const requiredParam of requiredParams) { + // Check if parameter exists (may be in camelCase or snake_case) + const paramExists = params.some(p => + p === requiredParam || + p.toLowerCase() === requiredParam.toLowerCase() || + p.replace(/_/g, '') === requiredParam.replace(/_/g, '') + ); + expect(paramExists).toBe(true); + } + }); + + it('should have search method with return type annotation', () => { + const method = newsClient.search; + expect(typeof method).toBe('function'); + // TypeScript will enforce return types at compile time + // This test ensures the method exists and is callable + }); + + + + it('should have all expected methods', () => { const expectedMethods = [ 'get', + 'search', + ]; for (const expectedMethod of expectedMethods) { diff --git a/xdk/typescript/tests/posts/test_contracts.test.ts b/xdk/typescript/tests/posts/test_contracts.test.ts index fb598000..6dc6dca9 100644 --- a/xdk/typescript/tests/posts/test_contracts.test.ts +++ b/xdk/typescript/tests/posts/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for hideReply', async () => { + it('should have correct request structure for getInsights28hr', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -59,7 +59,15 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + ['test_item'], + + + + 'test_granularity', + + + + ['test_item'], ]; @@ -68,7 +76,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['hideReply']; + const method = (postsClient as any)['getInsights28hr']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -80,7 +88,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/{tweet_id}/hidden'; + const expectedPath = '/2/insights/28hr'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -93,7 +101,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for hideReply', async () => { + it('should handle required parameters correctly for getInsights28hr', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -111,7 +119,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['hideReply']; + const method = (postsClient as any)['getInsights28hr']; // Method has required parameters - verify it can be called with proper args @@ -119,7 +127,15 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + ['test_item'], + + + + 'test_granularity', + + + + ['test_item'], ]; @@ -136,7 +152,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for hideReply', async () => { + it('should validate response structure for getInsights28hr', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -166,13 +182,21 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + ['test_item'], + + + + 'test_granularity', + + + + ['test_item'], ]; const options: any = {}; - const method = (postsClient as any)['hideReply']; + const method = (postsClient as any)['getInsights28hr']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -190,7 +214,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getAnalytics', async () => { + it('should have correct request structure for getReposts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -221,19 +245,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_end_time', - - - - 'test_start_time', - - - - 'test_granularity', + 'test_value', ]; @@ -242,7 +254,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['getAnalytics']; + const method = (postsClient as any)['getReposts']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -254,7 +266,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/analytics'; + const expectedPath = '/2/tweets/{id}/retweets'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -267,7 +279,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getAnalytics', async () => { + it('should handle required parameters correctly for getReposts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -285,7 +297,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getAnalytics']; + const method = (postsClient as any)['getReposts']; // Method has required parameters - verify it can be called with proper args @@ -293,19 +305,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_end_time', - - - - 'test_start_time', - - - - 'test_granularity', + 'test_value', ]; @@ -322,7 +322,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getAnalytics', async () => { + it('should validate response structure for getReposts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -352,25 +352,13 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_end_time', - - - - 'test_start_time', - - - - 'test_granularity', + 'test_value', ]; const options: any = {}; - const method = (postsClient as any)['getAnalytics']; + const method = (postsClient as any)['getReposts']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -388,7 +376,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getInsightsHistorical', async () => { + it('should have correct request structure for searchAll', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -419,23 +407,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_end_time', - - - - 'test_start_time', - - - - 'test_granularity', - - - - ['test_item'], + 'test_query', ]; @@ -444,7 +416,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['getInsightsHistorical']; + const method = (postsClient as any)['searchAll']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -456,7 +428,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/insights/historical'; + const expectedPath = '/2/tweets/search/all'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -469,7 +441,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getInsightsHistorical', async () => { + it('should handle required parameters correctly for searchAll', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -487,7 +459,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getInsightsHistorical']; + const method = (postsClient as any)['searchAll']; // Method has required parameters - verify it can be called with proper args @@ -495,23 +467,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_end_time', - - - - 'test_start_time', - - - - 'test_granularity', - - - - ['test_item'], + 'test_query', ]; @@ -528,7 +484,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getInsightsHistorical', async () => { + it('should validate response structure for searchAll', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -558,29 +514,13 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_end_time', - - - - 'test_start_time', - - - - 'test_granularity', - - - - ['test_item'], + 'test_query', ]; const options: any = {}; - const method = (postsClient as any)['getInsightsHistorical']; + const method = (postsClient as any)['searchAll']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -598,7 +538,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getCountsRecent', async () => { + it('should have correct request structure for getInsightsHistorical', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -629,7 +569,23 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + ['test_item'], + + + + 'test_end_time', + + + + 'test_start_time', + + + + 'test_granularity', + + + + ['test_item'], ]; @@ -638,7 +594,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['getCountsRecent']; + const method = (postsClient as any)['getInsightsHistorical']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -650,7 +606,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/counts/recent'; + const expectedPath = '/2/insights/historical'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -663,7 +619,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getCountsRecent', async () => { + it('should handle required parameters correctly for getInsightsHistorical', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -681,7 +637,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getCountsRecent']; + const method = (postsClient as any)['getInsightsHistorical']; // Method has required parameters - verify it can be called with proper args @@ -689,7 +645,23 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + ['test_item'], + + + + 'test_end_time', + + + + 'test_start_time', + + + + 'test_granularity', + + + + ['test_item'], ]; @@ -706,7 +678,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getCountsRecent', async () => { + it('should validate response structure for getInsightsHistorical', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -736,13 +708,29 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + ['test_item'], + + + + 'test_end_time', + + + + 'test_start_time', + + + + 'test_granularity', + + + + ['test_item'], ]; const options: any = {}; - const method = (postsClient as any)['getCountsRecent']; + const method = (postsClient as any)['getInsightsHistorical']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -760,7 +748,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getCountsAll', async () => { + it('should have correct request structure for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -791,7 +779,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_value', ]; @@ -800,7 +788,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['getCountsAll']; + const method = (postsClient as any)['getById']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -812,7 +800,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/counts/all'; + const expectedPath = '/2/tweets/{id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -825,7 +813,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getCountsAll', async () => { + it('should handle required parameters correctly for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -843,7 +831,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getCountsAll']; + const method = (postsClient as any)['getById']; // Method has required parameters - verify it can be called with proper args @@ -851,7 +839,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_value', ]; @@ -868,7 +856,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getCountsAll', async () => { + it('should validate response structure for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -898,13 +886,13 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_value', ]; const options: any = {}; - const method = (postsClient as any)['getCountsAll']; + const method = (postsClient as any)['getById']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -922,7 +910,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getReposts', async () => { + it('should have correct request structure for delete', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -962,7 +950,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['getReposts']; + const method = (postsClient as any)['delete']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -974,7 +962,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/{id}/retweets'; + const expectedPath = '/2/tweets/{id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -987,7 +975,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getReposts', async () => { + it('should handle required parameters correctly for delete', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1005,7 +993,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getReposts']; + const method = (postsClient as any)['delete']; // Method has required parameters - verify it can be called with proper args @@ -1030,7 +1018,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getReposts', async () => { + it('should validate response structure for delete', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1066,7 +1054,7 @@ describe('PostsClient Contracts', () => { ]; const options: any = {}; - const method = (postsClient as any)['getReposts']; + const method = (postsClient as any)['delete']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1084,7 +1072,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getById', async () => { + it('should have correct request structure for getAnalytics', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1115,7 +1103,19 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + ['test_item'], + + + + 'test_end_time', + + + + 'test_start_time', + + + + 'test_granularity', ]; @@ -1124,7 +1124,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['getById']; + const method = (postsClient as any)['getAnalytics']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -1136,7 +1136,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/{id}'; + const expectedPath = '/2/tweets/analytics'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1149,7 +1149,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getById', async () => { + it('should handle required parameters correctly for getAnalytics', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1167,7 +1167,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getById']; + const method = (postsClient as any)['getAnalytics']; // Method has required parameters - verify it can be called with proper args @@ -1175,7 +1175,19 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + ['test_item'], + + + + 'test_end_time', + + + + 'test_start_time', + + + + 'test_granularity', ]; @@ -1192,7 +1204,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getById', async () => { + it('should validate response structure for getAnalytics', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1222,13 +1234,25 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + ['test_item'], + + + + 'test_end_time', + + + + 'test_start_time', + + + + 'test_granularity', ]; const options: any = {}; - const method = (postsClient as any)['getById']; + const method = (postsClient as any)['getAnalytics']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1246,7 +1270,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for delete', async () => { + it('should have correct request structure for getByIds', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1277,7 +1301,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + ['test_item'], ]; @@ -1286,7 +1310,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['delete']; + const method = (postsClient as any)['getByIds']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -1298,7 +1322,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/{id}'; + const expectedPath = '/2/tweets'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1311,7 +1335,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for delete', async () => { + it('should handle required parameters correctly for getByIds', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1329,7 +1353,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['delete']; + const method = (postsClient as any)['getByIds']; // Method has required parameters - verify it can be called with proper args @@ -1337,7 +1361,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + ['test_item'], ]; @@ -1354,7 +1378,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for delete', async () => { + it('should validate response structure for getByIds', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1384,13 +1408,13 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + ['test_item'], ]; const options: any = {}; - const method = (postsClient as any)['delete']; + const method = (postsClient as any)['getByIds']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1408,7 +1432,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getRepostedBy', async () => { + it('should have correct request structure for create', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1417,7 +1441,7 @@ describe('PostsClient Contracts', () => { const originalRequest = client.httpClient.request; (client.httpClient.request as any) = jest.fn().mockResolvedValue({ ok: true, - status: 200, + status: 201, statusText: 'OK', headers: new Headers({ 'content-type': 'application/json' }), @@ -1438,17 +1462,13 @@ describe('PostsClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (postsClient as any)['getRepostedBy']; + const method = (postsClient as any)['create']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -1460,7 +1480,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/{id}/retweeted_by'; + const expectedPath = '/2/tweets'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1473,7 +1493,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getRepostedBy', async () => { + it('should handle required parameters correctly for create', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1491,17 +1511,13 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getRepostedBy']; + const method = (postsClient as any)['create']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -1516,7 +1532,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getRepostedBy', async () => { + it('should validate response structure for create', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1545,14 +1561,10 @@ describe('PostsClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (postsClient as any)['getRepostedBy']; + const method = (postsClient as any)['create']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1570,7 +1582,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getInsights28hr', async () => { + it('should have correct request structure for getCountsRecent', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1601,15 +1613,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_granularity', - - - - ['test_item'], + 'test_query', ]; @@ -1618,7 +1622,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['getInsights28hr']; + const method = (postsClient as any)['getCountsRecent']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -1630,7 +1634,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/insights/28hr'; + const expectedPath = '/2/tweets/counts/recent'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1643,7 +1647,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getInsights28hr', async () => { + it('should handle required parameters correctly for getCountsRecent', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1661,7 +1665,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getInsights28hr']; + const method = (postsClient as any)['getCountsRecent']; // Method has required parameters - verify it can be called with proper args @@ -1669,15 +1673,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_granularity', - - - - ['test_item'], + 'test_query', ]; @@ -1694,7 +1690,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getInsights28hr', async () => { + it('should validate response structure for getCountsRecent', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1724,21 +1720,13 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], - - - - 'test_granularity', - - - - ['test_item'], + 'test_query', ]; const options: any = {}; - const method = (postsClient as any)['getInsights28hr']; + const method = (postsClient as any)['getCountsRecent']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1756,7 +1744,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getByIds', async () => { + it('should have correct request structure for getCountsAll', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1787,7 +1775,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_query', ]; @@ -1796,7 +1784,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['getByIds']; + const method = (postsClient as any)['getCountsAll']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -1808,7 +1796,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets'; + const expectedPath = '/2/tweets/counts/all'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1821,7 +1809,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getByIds', async () => { + it('should handle required parameters correctly for getCountsAll', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1839,7 +1827,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getByIds']; + const method = (postsClient as any)['getCountsAll']; // Method has required parameters - verify it can be called with proper args @@ -1847,7 +1835,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_query', ]; @@ -1864,7 +1852,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getByIds', async () => { + it('should validate response structure for getCountsAll', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1894,13 +1882,13 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_query', ]; const options: any = {}; - const method = (postsClient as any)['getByIds']; + const method = (postsClient as any)['getCountsAll']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1918,7 +1906,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for create', async () => { + it('should have correct request structure for searchRecent', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1927,7 +1915,7 @@ describe('PostsClient Contracts', () => { const originalRequest = client.httpClient.request; (client.httpClient.request as any) = jest.fn().mockResolvedValue({ ok: true, - status: 201, + status: 200, statusText: 'OK', headers: new Headers({ 'content-type': 'application/json' }), @@ -1948,13 +1936,17 @@ describe('PostsClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_query', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (postsClient as any)['create']; + const method = (postsClient as any)['searchRecent']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -1966,7 +1958,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets'; + const expectedPath = '/2/tweets/search/recent'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1979,7 +1971,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for create', async () => { + it('should handle required parameters correctly for searchRecent', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1997,13 +1989,17 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['create']; + const method = (postsClient as any)['searchRecent']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_query', + + ]; // Build options object (empty for required params, optional params go here) @@ -2018,7 +2014,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for create', async () => { + it('should validate response structure for searchRecent', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2047,10 +2043,14 @@ describe('PostsClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_query', + + ]; const options: any = {}; - const method = (postsClient as any)['create']; + const method = (postsClient as any)['searchRecent']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2068,7 +2068,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for getLikingUsers', async () => { + it('should have correct request structure for hideReply', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2108,7 +2108,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['getLikingUsers']; + const method = (postsClient as any)['hideReply']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -2120,7 +2120,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/{id}/liking_users'; + const expectedPath = '/2/tweets/{tweet_id}/hidden'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2133,7 +2133,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for getLikingUsers', async () => { + it('should handle required parameters correctly for hideReply', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2151,7 +2151,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['getLikingUsers']; + const method = (postsClient as any)['hideReply']; // Method has required parameters - verify it can be called with proper args @@ -2176,7 +2176,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for getLikingUsers', async () => { + it('should validate response structure for hideReply', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2212,7 +2212,7 @@ describe('PostsClient Contracts', () => { ]; const options: any = {}; - const method = (postsClient as any)['getLikingUsers']; + const method = (postsClient as any)['hideReply']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2230,7 +2230,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for searchAll', async () => { + it('should have correct request structure for getRepostedBy', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2261,7 +2261,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_value', ]; @@ -2270,7 +2270,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['searchAll']; + const method = (postsClient as any)['getRepostedBy']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -2282,7 +2282,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/search/all'; + const expectedPath = '/2/tweets/{id}/retweeted_by'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2295,7 +2295,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for searchAll', async () => { + it('should handle required parameters correctly for getRepostedBy', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2313,7 +2313,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['searchAll']; + const method = (postsClient as any)['getRepostedBy']; // Method has required parameters - verify it can be called with proper args @@ -2321,7 +2321,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_value', ]; @@ -2338,7 +2338,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for searchAll', async () => { + it('should validate response structure for getRepostedBy', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2368,13 +2368,13 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_value', ]; const options: any = {}; - const method = (postsClient as any)['searchAll']; + const method = (postsClient as any)['getRepostedBy']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2554,7 +2554,7 @@ describe('PostsClient Contracts', () => { }); - it('should have correct request structure for searchRecent', async () => { + it('should have correct request structure for getLikingUsers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2585,7 +2585,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_value', ]; @@ -2594,7 +2594,7 @@ describe('PostsClient Contracts', () => { const options: any = {}; // Call the method - const method = (postsClient as any)['searchRecent']; + const method = (postsClient as any)['getLikingUsers']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify the request was made @@ -2606,7 +2606,7 @@ describe('PostsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/search/recent'; + const expectedPath = '/2/tweets/{id}/liking_users'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2619,7 +2619,7 @@ describe('PostsClient Contracts', () => { } }); - it('should handle required parameters correctly for searchRecent', async () => { + it('should handle required parameters correctly for getLikingUsers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2637,7 +2637,7 @@ describe('PostsClient Contracts', () => { } as Response); try { - const method = (postsClient as any)['searchRecent']; + const method = (postsClient as any)['getLikingUsers']; // Method has required parameters - verify it can be called with proper args @@ -2645,7 +2645,7 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_value', ]; @@ -2662,7 +2662,7 @@ describe('PostsClient Contracts', () => { } }); - it('should validate response structure for searchRecent', async () => { + it('should validate response structure for getLikingUsers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2692,13 +2692,13 @@ describe('PostsClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_value', ]; const options: any = {}; - const method = (postsClient as any)['searchRecent']; + const method = (postsClient as any)['getLikingUsers']; const result = await method.apply(postsClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/posts/test_pagination.test.ts b/xdk/typescript/tests/posts/test_pagination.test.ts index f113b039..0c10222d 100644 --- a/xdk/typescript/tests/posts/test_pagination.test.ts +++ b/xdk/typescript/tests/posts/test_pagination.test.ts @@ -193,14 +193,16 @@ describe('PostsClient Pagination', () => { }); - it('should create paginator for getRepostedBy', () => { - const method = (postsClient as any)['getRepostedBy']; + it('should create paginator for searchAll', () => { + const method = (postsClient as any)['searchAll']; // Should be able to create paginator without error const params: any = { - id: 'test_value', + + query: 'test_query', + maxResults: 10 @@ -211,7 +213,7 @@ describe('PostsClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getRepostedBy', async () => { + it('should paginate through pages for searchAll', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -263,13 +265,15 @@ describe('PostsClient Pagination', () => { }); try { - const method = (postsClient as any)['getRepostedBy']; + const method = (postsClient as any)['searchAll']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - 'test_value', + + 'test_query', + ]; @@ -305,7 +309,7 @@ describe('PostsClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getRepostedBy', async () => { + it('should handle pagination parameters correctly for searchAll', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -325,13 +329,15 @@ describe('PostsClient Pagination', () => { } as Response); try { - const method = (postsClient as any)['getRepostedBy']; + const method = (postsClient as any)['searchAll']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - 'test_value', + + 'test_query', + ]; @@ -356,14 +362,16 @@ describe('PostsClient Pagination', () => { }); - it('should create paginator for getLikingUsers', () => { - const method = (postsClient as any)['getLikingUsers']; + it('should create paginator for searchRecent', () => { + const method = (postsClient as any)['searchRecent']; // Should be able to create paginator without error const params: any = { - id: 'test_value', + + query: 'test_query', + maxResults: 10 @@ -374,7 +382,7 @@ describe('PostsClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getLikingUsers', async () => { + it('should paginate through pages for searchRecent', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -426,13 +434,15 @@ describe('PostsClient Pagination', () => { }); try { - const method = (postsClient as any)['getLikingUsers']; + const method = (postsClient as any)['searchRecent']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - 'test_value', + + 'test_query', + ]; @@ -468,7 +478,7 @@ describe('PostsClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getLikingUsers', async () => { + it('should handle pagination parameters correctly for searchRecent', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -488,13 +498,15 @@ describe('PostsClient Pagination', () => { } as Response); try { - const method = (postsClient as any)['getLikingUsers']; + const method = (postsClient as any)['searchRecent']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - 'test_value', + + 'test_query', + ]; @@ -519,16 +531,14 @@ describe('PostsClient Pagination', () => { }); - it('should create paginator for searchAll', () => { - const method = (postsClient as any)['searchAll']; + it('should create paginator for getRepostedBy', () => { + const method = (postsClient as any)['getRepostedBy']; // Should be able to create paginator without error const params: any = { - - query: 'test_query', - + id: 'test_value', maxResults: 10 @@ -539,7 +549,7 @@ describe('PostsClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for searchAll', async () => { + it('should paginate through pages for getRepostedBy', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -591,15 +601,13 @@ describe('PostsClient Pagination', () => { }); try { - const method = (postsClient as any)['searchAll']; + const method = (postsClient as any)['getRepostedBy']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - - 'test_query', - + 'test_value', ]; @@ -635,7 +643,7 @@ describe('PostsClient Pagination', () => { } }); - it('should handle pagination parameters correctly for searchAll', async () => { + it('should handle pagination parameters correctly for getRepostedBy', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -655,15 +663,13 @@ describe('PostsClient Pagination', () => { } as Response); try { - const method = (postsClient as any)['searchAll']; + const method = (postsClient as any)['getRepostedBy']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - - 'test_query', - + 'test_value', ]; @@ -851,16 +857,14 @@ describe('PostsClient Pagination', () => { }); - it('should create paginator for searchRecent', () => { - const method = (postsClient as any)['searchRecent']; + it('should create paginator for getLikingUsers', () => { + const method = (postsClient as any)['getLikingUsers']; // Should be able to create paginator without error const params: any = { - - query: 'test_query', - + id: 'test_value', maxResults: 10 @@ -871,7 +875,7 @@ describe('PostsClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for searchRecent', async () => { + it('should paginate through pages for getLikingUsers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -923,15 +927,13 @@ describe('PostsClient Pagination', () => { }); try { - const method = (postsClient as any)['searchRecent']; + const method = (postsClient as any)['getLikingUsers']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - - 'test_query', - + 'test_value', ]; @@ -967,7 +969,7 @@ describe('PostsClient Pagination', () => { } }); - it('should handle pagination parameters correctly for searchRecent', async () => { + it('should handle pagination parameters correctly for getLikingUsers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -987,15 +989,13 @@ describe('PostsClient Pagination', () => { } as Response); try { - const method = (postsClient as any)['searchRecent']; + const method = (postsClient as any)['getLikingUsers']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - - 'test_query', - + 'test_value', ]; diff --git a/xdk/typescript/tests/posts/test_structure.test.ts b/xdk/typescript/tests/posts/test_structure.test.ts index 41eddebd..099012b3 100644 --- a/xdk/typescript/tests/posts/test_structure.test.ts +++ b/xdk/typescript/tests/posts/test_structure.test.ts @@ -30,12 +30,12 @@ describe('PostsClient Structure', () => { - it('should have hideReply method with correct signature', () => { + it('should have getInsights28hr method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('hideReply'); + expect(PostsClient.prototype).toHaveProperty('getInsights28hr'); // Check method is callable - const method = postsClient.hideReply; + const method = postsClient.getInsights28hr; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -46,7 +46,11 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'tweetId', + 'tweetIds', + + 'granularity', + + 'requestedMetrics', ]; @@ -61,8 +65,8 @@ describe('PostsClient Structure', () => { } }); - it('should have hideReply method with return type annotation', () => { - const method = postsClient.hideReply; + it('should have getInsights28hr method with return type annotation', () => { + const method = postsClient.getInsights28hr; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -71,12 +75,12 @@ describe('PostsClient Structure', () => { - it('should have getAnalytics method with correct signature', () => { + it('should have getReposts method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getAnalytics'); + expect(PostsClient.prototype).toHaveProperty('getReposts'); // Check method is callable - const method = postsClient.getAnalytics; + const method = postsClient.getReposts; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -87,13 +91,7 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'ids', - - 'endTime', - - 'startTime', - - 'granularity', + 'id', ]; @@ -108,22 +106,40 @@ describe('PostsClient Structure', () => { } }); - it('should have getAnalytics method with return type annotation', () => { - const method = postsClient.getAnalytics; + it('should have getReposts method with return type annotation', () => { + const method = postsClient.getReposts; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getReposts method with pagination parameters', () => { + const method = postsClient.getReposts; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have getInsightsHistorical method with correct signature', () => { + it('should have searchAll method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getInsightsHistorical'); + expect(PostsClient.prototype).toHaveProperty('searchAll'); // Check method is callable - const method = postsClient.getInsightsHistorical; + const method = postsClient.searchAll; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -134,15 +150,7 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'tweetIds', - - 'endTime', - - 'startTime', - - 'granularity', - - 'requestedMetrics', + 'query', ]; @@ -157,22 +165,40 @@ describe('PostsClient Structure', () => { } }); - it('should have getInsightsHistorical method with return type annotation', () => { - const method = postsClient.getInsightsHistorical; + it('should have searchAll method with return type annotation', () => { + const method = postsClient.searchAll; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have searchAll method with pagination parameters', () => { + const method = postsClient.searchAll; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have getCountsRecent method with correct signature', () => { + it('should have getInsightsHistorical method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getCountsRecent'); + expect(PostsClient.prototype).toHaveProperty('getInsightsHistorical'); // Check method is callable - const method = postsClient.getCountsRecent; + const method = postsClient.getInsightsHistorical; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -183,7 +209,15 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'query', + 'tweetIds', + + 'endTime', + + 'startTime', + + 'granularity', + + 'requestedMetrics', ]; @@ -198,8 +232,8 @@ describe('PostsClient Structure', () => { } }); - it('should have getCountsRecent method with return type annotation', () => { - const method = postsClient.getCountsRecent; + it('should have getInsightsHistorical method with return type annotation', () => { + const method = postsClient.getInsightsHistorical; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -208,12 +242,12 @@ describe('PostsClient Structure', () => { - it('should have getCountsAll method with correct signature', () => { + it('should have getById method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getCountsAll'); + expect(PostsClient.prototype).toHaveProperty('getById'); // Check method is callable - const method = postsClient.getCountsAll; + const method = postsClient.getById; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -224,7 +258,7 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'query', + 'id', ]; @@ -239,8 +273,8 @@ describe('PostsClient Structure', () => { } }); - it('should have getCountsAll method with return type annotation', () => { - const method = postsClient.getCountsAll; + it('should have getById method with return type annotation', () => { + const method = postsClient.getById; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -249,12 +283,12 @@ describe('PostsClient Structure', () => { - it('should have getReposts method with correct signature', () => { + it('should have delete method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getReposts'); + expect(PostsClient.prototype).toHaveProperty('delete'); // Check method is callable - const method = postsClient.getReposts; + const method = postsClient.delete; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -280,40 +314,22 @@ describe('PostsClient Structure', () => { } }); - it('should have getReposts method with return type annotation', () => { - const method = postsClient.getReposts; + it('should have delete method with return type annotation', () => { + const method = postsClient.delete; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getReposts method with pagination parameters', () => { - const method = postsClient.getReposts; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have getById method with correct signature', () => { + it('should have getAnalytics method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getById'); + expect(PostsClient.prototype).toHaveProperty('getAnalytics'); // Check method is callable - const method = postsClient.getById; + const method = postsClient.getAnalytics; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -324,7 +340,13 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', + 'ids', + + 'endTime', + + 'startTime', + + 'granularity', ]; @@ -339,8 +361,8 @@ describe('PostsClient Structure', () => { } }); - it('should have getById method with return type annotation', () => { - const method = postsClient.getById; + it('should have getAnalytics method with return type annotation', () => { + const method = postsClient.getAnalytics; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -349,12 +371,12 @@ describe('PostsClient Structure', () => { - it('should have delete method with correct signature', () => { + it('should have getByIds method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('delete'); + expect(PostsClient.prototype).toHaveProperty('getByIds'); // Check method is callable - const method = postsClient.delete; + const method = postsClient.getByIds; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -365,7 +387,7 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', + 'ids', ]; @@ -380,8 +402,8 @@ describe('PostsClient Structure', () => { } }); - it('should have delete method with return type annotation', () => { - const method = postsClient.delete; + it('should have getByIds method with return type annotation', () => { + const method = postsClient.getByIds; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -390,12 +412,12 @@ describe('PostsClient Structure', () => { - it('should have getRepostedBy method with correct signature', () => { + it('should have create method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getRepostedBy'); + expect(PostsClient.prototype).toHaveProperty('create'); // Check method is callable - const method = postsClient.getRepostedBy; + const method = postsClient.create; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -406,8 +428,6 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', - ]; for (const requiredParam of requiredParams) { @@ -421,40 +441,22 @@ describe('PostsClient Structure', () => { } }); - it('should have getRepostedBy method with return type annotation', () => { - const method = postsClient.getRepostedBy; + it('should have create method with return type annotation', () => { + const method = postsClient.create; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getRepostedBy method with pagination parameters', () => { - const method = postsClient.getRepostedBy; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have getInsights28hr method with correct signature', () => { + it('should have getCountsRecent method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getInsights28hr'); + expect(PostsClient.prototype).toHaveProperty('getCountsRecent'); // Check method is callable - const method = postsClient.getInsights28hr; + const method = postsClient.getCountsRecent; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -465,11 +467,7 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'tweetIds', - - 'granularity', - - 'requestedMetrics', + 'query', ]; @@ -484,8 +482,8 @@ describe('PostsClient Structure', () => { } }); - it('should have getInsights28hr method with return type annotation', () => { - const method = postsClient.getInsights28hr; + it('should have getCountsRecent method with return type annotation', () => { + const method = postsClient.getCountsRecent; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -494,12 +492,12 @@ describe('PostsClient Structure', () => { - it('should have getByIds method with correct signature', () => { + it('should have getCountsAll method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getByIds'); + expect(PostsClient.prototype).toHaveProperty('getCountsAll'); // Check method is callable - const method = postsClient.getByIds; + const method = postsClient.getCountsAll; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -510,7 +508,7 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'ids', + 'query', ]; @@ -525,8 +523,8 @@ describe('PostsClient Structure', () => { } }); - it('should have getByIds method with return type annotation', () => { - const method = postsClient.getByIds; + it('should have getCountsAll method with return type annotation', () => { + const method = postsClient.getCountsAll; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -535,12 +533,12 @@ describe('PostsClient Structure', () => { - it('should have create method with correct signature', () => { + it('should have searchRecent method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('create'); + expect(PostsClient.prototype).toHaveProperty('searchRecent'); // Check method is callable - const method = postsClient.create; + const method = postsClient.searchRecent; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -551,6 +549,8 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'query', + ]; for (const requiredParam of requiredParams) { @@ -564,22 +564,40 @@ describe('PostsClient Structure', () => { } }); - it('should have create method with return type annotation', () => { - const method = postsClient.create; + it('should have searchRecent method with return type annotation', () => { + const method = postsClient.searchRecent; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have searchRecent method with pagination parameters', () => { + const method = postsClient.searchRecent; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have getLikingUsers method with correct signature', () => { + it('should have hideReply method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('getLikingUsers'); + expect(PostsClient.prototype).toHaveProperty('hideReply'); // Check method is callable - const method = postsClient.getLikingUsers; + const method = postsClient.hideReply; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -590,7 +608,7 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', + 'tweetId', ]; @@ -605,40 +623,22 @@ describe('PostsClient Structure', () => { } }); - it('should have getLikingUsers method with return type annotation', () => { - const method = postsClient.getLikingUsers; + it('should have hideReply method with return type annotation', () => { + const method = postsClient.hideReply; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getLikingUsers method with pagination parameters', () => { - const method = postsClient.getLikingUsers; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have searchAll method with correct signature', () => { + it('should have getRepostedBy method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('searchAll'); + expect(PostsClient.prototype).toHaveProperty('getRepostedBy'); // Check method is callable - const method = postsClient.searchAll; + const method = postsClient.getRepostedBy; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -649,7 +649,7 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'query', + 'id', ]; @@ -664,16 +664,16 @@ describe('PostsClient Structure', () => { } }); - it('should have searchAll method with return type annotation', () => { - const method = postsClient.searchAll; + it('should have getRepostedBy method with return type annotation', () => { + const method = postsClient.getRepostedBy; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have searchAll method with pagination parameters', () => { - const method = postsClient.searchAll; + it('should have getRepostedBy method with pagination parameters', () => { + const method = postsClient.getRepostedBy; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -751,12 +751,12 @@ describe('PostsClient Structure', () => { - it('should have searchRecent method with correct signature', () => { + it('should have getLikingUsers method with correct signature', () => { // Check method exists - expect(PostsClient.prototype).toHaveProperty('searchRecent'); + expect(PostsClient.prototype).toHaveProperty('getLikingUsers'); // Check method is callable - const method = postsClient.searchRecent; + const method = postsClient.getLikingUsers; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -767,7 +767,7 @@ describe('PostsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'query', + 'id', ]; @@ -782,16 +782,16 @@ describe('PostsClient Structure', () => { } }); - it('should have searchRecent method with return type annotation', () => { - const method = postsClient.searchRecent; + it('should have getLikingUsers method with return type annotation', () => { + const method = postsClient.getLikingUsers; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have searchRecent method with pagination parameters', () => { - const method = postsClient.searchRecent; + it('should have getLikingUsers method with pagination parameters', () => { + const method = postsClient.getLikingUsers; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -814,37 +814,37 @@ describe('PostsClient Structure', () => { it('should have all expected methods', () => { const expectedMethods = [ - 'hideReply', - - 'getAnalytics', - - 'getInsightsHistorical', + 'getInsights28hr', - 'getCountsRecent', + 'getReposts', - 'getCountsAll', + 'searchAll', - 'getReposts', + 'getInsightsHistorical', 'getById', 'delete', - 'getRepostedBy', - - 'getInsights28hr', + 'getAnalytics', 'getByIds', 'create', - 'getLikingUsers', + 'getCountsRecent', - 'searchAll', + 'getCountsAll', + + 'searchRecent', + + 'hideReply', + + 'getRepostedBy', 'getQuoted', - 'searchRecent', + 'getLikingUsers', ]; diff --git a/xdk/typescript/tests/spaces/test_contracts.test.ts b/xdk/typescript/tests/spaces/test_contracts.test.ts index 796e2a7d..3e6db4f7 100644 --- a/xdk/typescript/tests/spaces/test_contracts.test.ts +++ b/xdk/typescript/tests/spaces/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('SpacesClient Contracts', () => { }); - it('should have correct request structure for getPosts', async () => { + it('should have correct request structure for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -68,7 +68,7 @@ describe('SpacesClient Contracts', () => { const options: any = {}; // Call the method - const method = (spacesClient as any)['getPosts']; + const method = (spacesClient as any)['getById']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify the request was made @@ -80,7 +80,7 @@ describe('SpacesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/spaces/{id}/tweets'; + const expectedPath = '/2/spaces/{id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -93,7 +93,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should handle required parameters correctly for getPosts', async () => { + it('should handle required parameters correctly for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -111,7 +111,7 @@ describe('SpacesClient Contracts', () => { } as Response); try { - const method = (spacesClient as any)['getPosts']; + const method = (spacesClient as any)['getById']; // Method has required parameters - verify it can be called with proper args @@ -136,7 +136,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should validate response structure for getPosts', async () => { + it('should validate response structure for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -172,7 +172,7 @@ describe('SpacesClient Contracts', () => { ]; const options: any = {}; - const method = (spacesClient as any)['getPosts']; + const method = (spacesClient as any)['getById']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -190,7 +190,7 @@ describe('SpacesClient Contracts', () => { }); - it('should have correct request structure for search', async () => { + it('should have correct request structure for getBuyers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -221,7 +221,7 @@ describe('SpacesClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_id', ]; @@ -230,7 +230,7 @@ describe('SpacesClient Contracts', () => { const options: any = {}; // Call the method - const method = (spacesClient as any)['search']; + const method = (spacesClient as any)['getBuyers']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify the request was made @@ -242,7 +242,7 @@ describe('SpacesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/spaces/search'; + const expectedPath = '/2/spaces/{id}/buyers'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -255,7 +255,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should handle required parameters correctly for search', async () => { + it('should handle required parameters correctly for getBuyers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -273,7 +273,7 @@ describe('SpacesClient Contracts', () => { } as Response); try { - const method = (spacesClient as any)['search']; + const method = (spacesClient as any)['getBuyers']; // Method has required parameters - verify it can be called with proper args @@ -281,7 +281,7 @@ describe('SpacesClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_id', ]; @@ -298,7 +298,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should validate response structure for search', async () => { + it('should validate response structure for getBuyers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -328,13 +328,13 @@ describe('SpacesClient Contracts', () => { const requiredArgs: any[] = [ - 'test_query', + 'test_id', ]; const options: any = {}; - const method = (spacesClient as any)['search']; + const method = (spacesClient as any)['getBuyers']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -352,7 +352,7 @@ describe('SpacesClient Contracts', () => { }); - it('should have correct request structure for getById', async () => { + it('should have correct request structure for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -392,7 +392,7 @@ describe('SpacesClient Contracts', () => { const options: any = {}; // Call the method - const method = (spacesClient as any)['getById']; + const method = (spacesClient as any)['getPosts']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify the request was made @@ -404,7 +404,7 @@ describe('SpacesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/spaces/{id}'; + const expectedPath = '/2/spaces/{id}/tweets'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -417,7 +417,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should handle required parameters correctly for getById', async () => { + it('should handle required parameters correctly for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -435,7 +435,7 @@ describe('SpacesClient Contracts', () => { } as Response); try { - const method = (spacesClient as any)['getById']; + const method = (spacesClient as any)['getPosts']; // Method has required parameters - verify it can be called with proper args @@ -460,7 +460,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should validate response structure for getById', async () => { + it('should validate response structure for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -496,7 +496,7 @@ describe('SpacesClient Contracts', () => { ]; const options: any = {}; - const method = (spacesClient as any)['getById']; + const method = (spacesClient as any)['getPosts']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -676,7 +676,7 @@ describe('SpacesClient Contracts', () => { }); - it('should have correct request structure for getBuyers', async () => { + it('should have correct request structure for getByIds', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -707,7 +707,7 @@ describe('SpacesClient Contracts', () => { const requiredArgs: any[] = [ - 'test_id', + ['test_item'], ]; @@ -716,7 +716,7 @@ describe('SpacesClient Contracts', () => { const options: any = {}; // Call the method - const method = (spacesClient as any)['getBuyers']; + const method = (spacesClient as any)['getByIds']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify the request was made @@ -728,7 +728,7 @@ describe('SpacesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/spaces/{id}/buyers'; + const expectedPath = '/2/spaces'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -741,7 +741,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should handle required parameters correctly for getBuyers', async () => { + it('should handle required parameters correctly for getByIds', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -759,7 +759,7 @@ describe('SpacesClient Contracts', () => { } as Response); try { - const method = (spacesClient as any)['getBuyers']; + const method = (spacesClient as any)['getByIds']; // Method has required parameters - verify it can be called with proper args @@ -767,7 +767,7 @@ describe('SpacesClient Contracts', () => { const requiredArgs: any[] = [ - 'test_id', + ['test_item'], ]; @@ -784,7 +784,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should validate response structure for getBuyers', async () => { + it('should validate response structure for getByIds', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -814,13 +814,13 @@ describe('SpacesClient Contracts', () => { const requiredArgs: any[] = [ - 'test_id', + ['test_item'], ]; const options: any = {}; - const method = (spacesClient as any)['getBuyers']; + const method = (spacesClient as any)['getByIds']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -838,7 +838,7 @@ describe('SpacesClient Contracts', () => { }); - it('should have correct request structure for getByIds', async () => { + it('should have correct request structure for search', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -869,7 +869,7 @@ describe('SpacesClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_query', ]; @@ -878,7 +878,7 @@ describe('SpacesClient Contracts', () => { const options: any = {}; // Call the method - const method = (spacesClient as any)['getByIds']; + const method = (spacesClient as any)['search']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify the request was made @@ -890,7 +890,7 @@ describe('SpacesClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/spaces'; + const expectedPath = '/2/spaces/search'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -903,7 +903,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should handle required parameters correctly for getByIds', async () => { + it('should handle required parameters correctly for search', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -921,7 +921,7 @@ describe('SpacesClient Contracts', () => { } as Response); try { - const method = (spacesClient as any)['getByIds']; + const method = (spacesClient as any)['search']; // Method has required parameters - verify it can be called with proper args @@ -929,7 +929,7 @@ describe('SpacesClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_query', ]; @@ -946,7 +946,7 @@ describe('SpacesClient Contracts', () => { } }); - it('should validate response structure for getByIds', async () => { + it('should validate response structure for search', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -976,13 +976,13 @@ describe('SpacesClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_query', ]; const options: any = {}; - const method = (spacesClient as any)['getByIds']; + const method = (spacesClient as any)['search']; const result = await method.apply(spacesClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/spaces/test_structure.test.ts b/xdk/typescript/tests/spaces/test_structure.test.ts index ce47e724..dbae0567 100644 --- a/xdk/typescript/tests/spaces/test_structure.test.ts +++ b/xdk/typescript/tests/spaces/test_structure.test.ts @@ -30,12 +30,12 @@ describe('SpacesClient Structure', () => { - it('should have getPosts method with correct signature', () => { + it('should have getById method with correct signature', () => { // Check method exists - expect(SpacesClient.prototype).toHaveProperty('getPosts'); + expect(SpacesClient.prototype).toHaveProperty('getById'); // Check method is callable - const method = spacesClient.getPosts; + const method = spacesClient.getById; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -61,8 +61,8 @@ describe('SpacesClient Structure', () => { } }); - it('should have getPosts method with return type annotation', () => { - const method = spacesClient.getPosts; + it('should have getById method with return type annotation', () => { + const method = spacesClient.getById; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -71,12 +71,12 @@ describe('SpacesClient Structure', () => { - it('should have search method with correct signature', () => { + it('should have getBuyers method with correct signature', () => { // Check method exists - expect(SpacesClient.prototype).toHaveProperty('search'); + expect(SpacesClient.prototype).toHaveProperty('getBuyers'); // Check method is callable - const method = spacesClient.search; + const method = spacesClient.getBuyers; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -87,7 +87,7 @@ describe('SpacesClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'query', + 'id', ]; @@ -102,22 +102,40 @@ describe('SpacesClient Structure', () => { } }); - it('should have search method with return type annotation', () => { - const method = spacesClient.search; + it('should have getBuyers method with return type annotation', () => { + const method = spacesClient.getBuyers; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getBuyers method with pagination parameters', () => { + const method = spacesClient.getBuyers; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have getById method with correct signature', () => { + it('should have getPosts method with correct signature', () => { // Check method exists - expect(SpacesClient.prototype).toHaveProperty('getById'); + expect(SpacesClient.prototype).toHaveProperty('getPosts'); // Check method is callable - const method = spacesClient.getById; + const method = spacesClient.getPosts; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -143,8 +161,8 @@ describe('SpacesClient Structure', () => { } }); - it('should have getById method with return type annotation', () => { - const method = spacesClient.getById; + it('should have getPosts method with return type annotation', () => { + const method = spacesClient.getPosts; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -194,12 +212,12 @@ describe('SpacesClient Structure', () => { - it('should have getBuyers method with correct signature', () => { + it('should have getByIds method with correct signature', () => { // Check method exists - expect(SpacesClient.prototype).toHaveProperty('getBuyers'); + expect(SpacesClient.prototype).toHaveProperty('getByIds'); // Check method is callable - const method = spacesClient.getBuyers; + const method = spacesClient.getByIds; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -210,7 +228,7 @@ describe('SpacesClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', + 'ids', ]; @@ -225,40 +243,22 @@ describe('SpacesClient Structure', () => { } }); - it('should have getBuyers method with return type annotation', () => { - const method = spacesClient.getBuyers; + it('should have getByIds method with return type annotation', () => { + const method = spacesClient.getByIds; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getBuyers method with pagination parameters', () => { - const method = spacesClient.getBuyers; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have getByIds method with correct signature', () => { + it('should have search method with correct signature', () => { // Check method exists - expect(SpacesClient.prototype).toHaveProperty('getByIds'); + expect(SpacesClient.prototype).toHaveProperty('search'); // Check method is callable - const method = spacesClient.getByIds; + const method = spacesClient.search; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -269,7 +269,7 @@ describe('SpacesClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'ids', + 'query', ]; @@ -284,8 +284,8 @@ describe('SpacesClient Structure', () => { } }); - it('should have getByIds method with return type annotation', () => { - const method = spacesClient.getByIds; + it('should have search method with return type annotation', () => { + const method = spacesClient.search; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -298,18 +298,18 @@ describe('SpacesClient Structure', () => { it('should have all expected methods', () => { const expectedMethods = [ - 'getPosts', + 'getById', - 'search', + 'getBuyers', - 'getById', + 'getPosts', 'getByCreatorIds', - 'getBuyers', - 'getByIds', + 'search', + ]; for (const expectedMethod of expectedMethods) { diff --git a/xdk/typescript/tests/stream/test_contracts.test.ts b/xdk/typescript/tests/stream/test_contracts.test.ts index 884d1087..962beaef 100644 --- a/xdk/typescript/tests/stream/test_contracts.test.ts +++ b/xdk/typescript/tests/stream/test_contracts.test.ts @@ -208,7 +208,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for postsFirehose', async () => { + it('should have correct request structure for postsFirehosePt', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -256,7 +256,7 @@ describe('StreamClient Contracts', () => { const options: any = {}; // Call the method - const method = (streamClient as any)['postsFirehose']; + const method = (streamClient as any)['postsFirehosePt']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -268,7 +268,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/firehose/stream'; + const expectedPath = '/2/tweets/firehose/stream/lang/pt'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -281,7 +281,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for postsFirehose', async () => { + it('should handle required parameters correctly for postsFirehosePt', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -306,7 +306,7 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['postsFirehose']; + const method = (streamClient as any)['postsFirehosePt']; // Method has required parameters - verify it can be called with proper args @@ -331,7 +331,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for postsFirehose', async () => { + it('should validate response structure for postsFirehosePt', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -374,7 +374,7 @@ describe('StreamClient Contracts', () => { ]; const options: any = {}; - const method = (streamClient as any)['postsFirehose']; + const method = (streamClient as any)['postsFirehosePt']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -400,7 +400,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for labelsCompliance', async () => { + it('should have correct request structure for postsFirehoseJa', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -438,13 +438,17 @@ describe('StreamClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 42, + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (streamClient as any)['labelsCompliance']; + const method = (streamClient as any)['postsFirehoseJa']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -456,7 +460,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/label/stream'; + const expectedPath = '/2/tweets/firehose/stream/lang/ja'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -469,7 +473,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for labelsCompliance', async () => { + it('should handle required parameters correctly for postsFirehoseJa', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -494,13 +498,17 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['labelsCompliance']; + const method = (streamClient as any)['postsFirehoseJa']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 42, + + ]; // Build options object (empty for required params, optional params go here) @@ -515,7 +523,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for labelsCompliance', async () => { + it('should validate response structure for postsFirehoseJa', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -551,10 +559,14 @@ describe('StreamClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 42, + + ]; const options: any = {}; - const method = (streamClient as any)['labelsCompliance']; + const method = (streamClient as any)['postsFirehoseJa']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -580,7 +592,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for likesCompliance', async () => { + it('should have correct request structure for postsSample10', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -618,13 +630,17 @@ describe('StreamClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 42, + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (streamClient as any)['likesCompliance']; + const method = (streamClient as any)['postsSample10']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -636,7 +652,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/likes/compliance/stream'; + const expectedPath = '/2/tweets/sample10/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -649,7 +665,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for likesCompliance', async () => { + it('should handle required parameters correctly for postsSample10', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -674,13 +690,17 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['likesCompliance']; + const method = (streamClient as any)['postsSample10']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 42, + + ]; // Build options object (empty for required params, optional params go here) @@ -695,7 +715,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for likesCompliance', async () => { + it('should validate response structure for postsSample10', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -731,10 +751,14 @@ describe('StreamClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 42, + + ]; const options: any = {}; - const method = (streamClient as any)['likesCompliance']; + const method = (streamClient as any)['postsSample10']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -760,7 +784,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for likesSample10', async () => { + it('should have correct request structure for postsFirehoseKo', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -808,7 +832,7 @@ describe('StreamClient Contracts', () => { const options: any = {}; // Call the method - const method = (streamClient as any)['likesSample10']; + const method = (streamClient as any)['postsFirehoseKo']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -820,7 +844,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/likes/sample10/stream'; + const expectedPath = '/2/tweets/firehose/stream/lang/ko'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -833,7 +857,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for likesSample10', async () => { + it('should handle required parameters correctly for postsFirehoseKo', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -858,7 +882,7 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['likesSample10']; + const method = (streamClient as any)['postsFirehoseKo']; // Method has required parameters - verify it can be called with proper args @@ -883,7 +907,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for likesSample10', async () => { + it('should validate response structure for postsFirehoseKo', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -926,7 +950,7 @@ describe('StreamClient Contracts', () => { ]; const options: any = {}; - const method = (streamClient as any)['likesSample10']; + const method = (streamClient as any)['postsFirehoseKo']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -952,7 +976,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for postsFirehosePt', async () => { + it('should have correct request structure for likesCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -990,17 +1014,13 @@ describe('StreamClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 42, - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (streamClient as any)['postsFirehosePt']; + const method = (streamClient as any)['likesCompliance']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -1012,7 +1032,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/firehose/stream/lang/pt'; + const expectedPath = '/2/likes/compliance/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1025,7 +1045,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for postsFirehosePt', async () => { + it('should handle required parameters correctly for likesCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1050,17 +1070,13 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['postsFirehosePt']; + const method = (streamClient as any)['likesCompliance']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 42, - - ]; // Build options object (empty for required params, optional params go here) @@ -1075,7 +1091,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for postsFirehosePt', async () => { + it('should validate response structure for likesCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1111,14 +1127,10 @@ describe('StreamClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 42, - - ]; const options: any = {}; - const method = (streamClient as any)['postsFirehosePt']; + const method = (streamClient as any)['likesCompliance']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1144,7 +1156,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for postsFirehoseEn', async () => { + it('should have correct request structure for postsCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1192,7 +1204,7 @@ describe('StreamClient Contracts', () => { const options: any = {}; // Call the method - const method = (streamClient as any)['postsFirehoseEn']; + const method = (streamClient as any)['postsCompliance']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -1204,7 +1216,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/firehose/stream/lang/en'; + const expectedPath = '/2/tweets/compliance/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1217,7 +1229,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for postsFirehoseEn', async () => { + it('should handle required parameters correctly for postsCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1242,7 +1254,7 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['postsFirehoseEn']; + const method = (streamClient as any)['postsCompliance']; // Method has required parameters - verify it can be called with proper args @@ -1267,7 +1279,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for postsFirehoseEn', async () => { + it('should validate response structure for postsCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1310,7 +1322,7 @@ describe('StreamClient Contracts', () => { ]; const options: any = {}; - const method = (streamClient as any)['postsFirehoseEn']; + const method = (streamClient as any)['postsCompliance']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1336,7 +1348,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for posts', async () => { + it('should have correct request structure for getRuleCounts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1380,7 +1392,7 @@ describe('StreamClient Contracts', () => { const options: any = {}; // Call the method - const method = (streamClient as any)['posts']; + const method = (streamClient as any)['getRuleCounts']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -1392,7 +1404,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/search/stream'; + const expectedPath = '/2/tweets/search/stream/rules/counts'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1405,7 +1417,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for posts', async () => { + it('should handle required parameters correctly for getRuleCounts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1430,7 +1442,7 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['posts']; + const method = (streamClient as any)['getRuleCounts']; // Method has required parameters - verify it can be called with proper args @@ -1451,7 +1463,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for posts', async () => { + it('should validate response structure for getRuleCounts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1490,7 +1502,7 @@ describe('StreamClient Contracts', () => { ]; const options: any = {}; - const method = (streamClient as any)['posts']; + const method = (streamClient as any)['getRuleCounts']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1516,7 +1528,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for getRules', async () => { + it('should have correct request structure for likesFirehose', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1554,13 +1566,17 @@ describe('StreamClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 42, + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (streamClient as any)['getRules']; + const method = (streamClient as any)['likesFirehose']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -1572,7 +1588,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/search/stream/rules'; + const expectedPath = '/2/likes/firehose/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1585,7 +1601,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for getRules', async () => { + it('should handle required parameters correctly for likesFirehose', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1610,13 +1626,17 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['getRules']; + const method = (streamClient as any)['likesFirehose']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 42, + + ]; // Build options object (empty for required params, optional params go here) @@ -1631,7 +1651,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for getRules', async () => { + it('should validate response structure for likesFirehose', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1667,10 +1687,14 @@ describe('StreamClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 42, + + ]; const options: any = {}; - const method = (streamClient as any)['getRules']; + const method = (streamClient as any)['likesFirehose']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1696,7 +1720,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for updateRules', async () => { + it('should have correct request structure for postsFirehoseEn', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1734,13 +1758,17 @@ describe('StreamClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 42, + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (streamClient as any)['updateRules']; + const method = (streamClient as any)['postsFirehoseEn']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -1752,7 +1780,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/search/stream/rules'; + const expectedPath = '/2/tweets/firehose/stream/lang/en'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1765,7 +1793,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for updateRules', async () => { + it('should handle required parameters correctly for postsFirehoseEn', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1790,13 +1818,17 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['updateRules']; + const method = (streamClient as any)['postsFirehoseEn']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 42, + + ]; // Build options object (empty for required params, optional params go here) @@ -1811,7 +1843,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for updateRules', async () => { + it('should validate response structure for postsFirehoseEn', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1847,10 +1879,14 @@ describe('StreamClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 42, + + ]; const options: any = {}; - const method = (streamClient as any)['updateRules']; + const method = (streamClient as any)['postsFirehoseEn']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1876,7 +1912,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for postsCompliance', async () => { + it('should have correct request structure for posts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1914,17 +1950,13 @@ describe('StreamClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 42, - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (streamClient as any)['postsCompliance']; + const method = (streamClient as any)['posts']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -1936,7 +1968,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/compliance/stream'; + const expectedPath = '/2/tweets/search/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1949,7 +1981,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for postsCompliance', async () => { + it('should handle required parameters correctly for posts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1974,17 +2006,13 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['postsCompliance']; + const method = (streamClient as any)['posts']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 42, - - ]; // Build options object (empty for required params, optional params go here) @@ -1999,7 +2027,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for postsCompliance', async () => { + it('should validate response structure for posts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2035,14 +2063,10 @@ describe('StreamClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 42, - - ]; const options: any = {}; - const method = (streamClient as any)['postsCompliance']; + const method = (streamClient as any)['posts']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2068,7 +2092,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for postsFirehoseKo', async () => { + it('should have correct request structure for usersCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2116,7 +2140,7 @@ describe('StreamClient Contracts', () => { const options: any = {}; // Call the method - const method = (streamClient as any)['postsFirehoseKo']; + const method = (streamClient as any)['usersCompliance']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -2128,7 +2152,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/firehose/stream/lang/ko'; + const expectedPath = '/2/users/compliance/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2141,7 +2165,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for postsFirehoseKo', async () => { + it('should handle required parameters correctly for usersCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2166,7 +2190,7 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['postsFirehoseKo']; + const method = (streamClient as any)['usersCompliance']; // Method has required parameters - verify it can be called with proper args @@ -2191,7 +2215,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for postsFirehoseKo', async () => { + it('should validate response structure for usersCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2234,7 +2258,7 @@ describe('StreamClient Contracts', () => { ]; const options: any = {}; - const method = (streamClient as any)['postsFirehoseKo']; + const method = (streamClient as any)['usersCompliance']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2260,7 +2284,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for likesFirehose', async () => { + it('should have correct request structure for postsFirehose', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2308,7 +2332,7 @@ describe('StreamClient Contracts', () => { const options: any = {}; // Call the method - const method = (streamClient as any)['likesFirehose']; + const method = (streamClient as any)['postsFirehose']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -2320,7 +2344,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/likes/firehose/stream'; + const expectedPath = '/2/tweets/firehose/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2333,7 +2357,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for likesFirehose', async () => { + it('should handle required parameters correctly for postsFirehose', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2358,7 +2382,7 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['likesFirehose']; + const method = (streamClient as any)['postsFirehose']; // Method has required parameters - verify it can be called with proper args @@ -2383,7 +2407,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for likesFirehose', async () => { + it('should validate response structure for postsFirehose', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2426,7 +2450,7 @@ describe('StreamClient Contracts', () => { ]; const options: any = {}; - const method = (streamClient as any)['likesFirehose']; + const method = (streamClient as any)['postsFirehose']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2452,7 +2476,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for postsSample10', async () => { + it('should have correct request structure for likesSample10', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2500,7 +2524,7 @@ describe('StreamClient Contracts', () => { const options: any = {}; // Call the method - const method = (streamClient as any)['postsSample10']; + const method = (streamClient as any)['likesSample10']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -2512,7 +2536,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/sample10/stream'; + const expectedPath = '/2/likes/sample10/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2525,7 +2549,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for postsSample10', async () => { + it('should handle required parameters correctly for likesSample10', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2550,7 +2574,7 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['postsSample10']; + const method = (streamClient as any)['likesSample10']; // Method has required parameters - verify it can be called with proper args @@ -2575,7 +2599,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for postsSample10', async () => { + it('should validate response structure for likesSample10', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2618,7 +2642,7 @@ describe('StreamClient Contracts', () => { ]; const options: any = {}; - const method = (streamClient as any)['postsSample10']; + const method = (streamClient as any)['likesSample10']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2644,7 +2668,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for postsFirehoseJa', async () => { + it('should have correct request structure for getRules', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2682,17 +2706,13 @@ describe('StreamClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 42, - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (streamClient as any)['postsFirehoseJa']; + const method = (streamClient as any)['getRules']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -2704,7 +2724,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/firehose/stream/lang/ja'; + const expectedPath = '/2/tweets/search/stream/rules'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2717,7 +2737,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for postsFirehoseJa', async () => { + it('should handle required parameters correctly for getRules', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2742,17 +2762,13 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['postsFirehoseJa']; + const method = (streamClient as any)['getRules']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 42, - - ]; // Build options object (empty for required params, optional params go here) @@ -2767,7 +2783,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for postsFirehoseJa', async () => { + it('should validate response structure for getRules', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2803,14 +2819,10 @@ describe('StreamClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 42, - - ]; const options: any = {}; - const method = (streamClient as any)['postsFirehoseJa']; + const method = (streamClient as any)['getRules']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2836,7 +2848,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for getRuleCounts', async () => { + it('should have correct request structure for updateRules', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2880,7 +2892,7 @@ describe('StreamClient Contracts', () => { const options: any = {}; // Call the method - const method = (streamClient as any)['getRuleCounts']; + const method = (streamClient as any)['updateRules']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -2892,7 +2904,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/search/stream/rules/counts'; + const expectedPath = '/2/tweets/search/stream/rules'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2905,7 +2917,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for getRuleCounts', async () => { + it('should handle required parameters correctly for updateRules', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2930,7 +2942,7 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['getRuleCounts']; + const method = (streamClient as any)['updateRules']; // Method has required parameters - verify it can be called with proper args @@ -2951,7 +2963,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for getRuleCounts', async () => { + it('should validate response structure for updateRules', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2990,7 +3002,7 @@ describe('StreamClient Contracts', () => { ]; const options: any = {}; - const method = (streamClient as any)['getRuleCounts']; + const method = (streamClient as any)['updateRules']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -3016,7 +3028,7 @@ describe('StreamClient Contracts', () => { }); - it('should have correct request structure for usersCompliance', async () => { + it('should have correct request structure for labelsCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3054,17 +3066,13 @@ describe('StreamClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 42, - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (streamClient as any)['usersCompliance']; + const method = (streamClient as any)['labelsCompliance']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify the request was made @@ -3076,7 +3084,7 @@ describe('StreamClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/compliance/stream'; + const expectedPath = '/2/tweets/label/stream'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -3089,7 +3097,7 @@ describe('StreamClient Contracts', () => { } }); - it('should handle required parameters correctly for usersCompliance', async () => { + it('should handle required parameters correctly for labelsCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3114,17 +3122,13 @@ describe('StreamClient Contracts', () => { } as Response); try { - const method = (streamClient as any)['usersCompliance']; + const method = (streamClient as any)['labelsCompliance']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 42, - - ]; // Build options object (empty for required params, optional params go here) @@ -3139,7 +3143,7 @@ describe('StreamClient Contracts', () => { } }); - it('should validate response structure for usersCompliance', async () => { + it('should validate response structure for labelsCompliance', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3175,14 +3179,10 @@ describe('StreamClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 42, - - ]; const options: any = {}; - const method = (streamClient as any)['usersCompliance']; + const method = (streamClient as any)['labelsCompliance']; const result = await method.apply(streamClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/stream/test_structure.test.ts b/xdk/typescript/tests/stream/test_structure.test.ts index 974a1326..98b4f88e 100644 --- a/xdk/typescript/tests/stream/test_structure.test.ts +++ b/xdk/typescript/tests/stream/test_structure.test.ts @@ -69,12 +69,12 @@ describe('StreamClient Structure', () => { - it('should have postsFirehose method with correct signature', () => { + it('should have postsFirehosePt method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('postsFirehose'); + expect(StreamClient.prototype).toHaveProperty('postsFirehosePt'); // Check method is callable - const method = streamClient.postsFirehose; + const method = streamClient.postsFirehosePt; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -100,8 +100,8 @@ describe('StreamClient Structure', () => { } }); - it('should have postsFirehose method with return type annotation', () => { - const method = streamClient.postsFirehose; + it('should have postsFirehosePt method with return type annotation', () => { + const method = streamClient.postsFirehosePt; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -110,12 +110,12 @@ describe('StreamClient Structure', () => { - it('should have labelsCompliance method with correct signature', () => { + it('should have postsFirehoseJa method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('labelsCompliance'); + expect(StreamClient.prototype).toHaveProperty('postsFirehoseJa'); // Check method is callable - const method = streamClient.labelsCompliance; + const method = streamClient.postsFirehoseJa; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -126,6 +126,8 @@ describe('StreamClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'partition', + ]; for (const requiredParam of requiredParams) { @@ -139,8 +141,8 @@ describe('StreamClient Structure', () => { } }); - it('should have labelsCompliance method with return type annotation', () => { - const method = streamClient.labelsCompliance; + it('should have postsFirehoseJa method with return type annotation', () => { + const method = streamClient.postsFirehoseJa; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -149,12 +151,12 @@ describe('StreamClient Structure', () => { - it('should have likesCompliance method with correct signature', () => { + it('should have postsSample10 method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('likesCompliance'); + expect(StreamClient.prototype).toHaveProperty('postsSample10'); // Check method is callable - const method = streamClient.likesCompliance; + const method = streamClient.postsSample10; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -165,6 +167,8 @@ describe('StreamClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'partition', + ]; for (const requiredParam of requiredParams) { @@ -178,8 +182,8 @@ describe('StreamClient Structure', () => { } }); - it('should have likesCompliance method with return type annotation', () => { - const method = streamClient.likesCompliance; + it('should have postsSample10 method with return type annotation', () => { + const method = streamClient.postsSample10; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -188,12 +192,12 @@ describe('StreamClient Structure', () => { - it('should have likesSample10 method with correct signature', () => { + it('should have postsFirehoseKo method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('likesSample10'); + expect(StreamClient.prototype).toHaveProperty('postsFirehoseKo'); // Check method is callable - const method = streamClient.likesSample10; + const method = streamClient.postsFirehoseKo; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -219,8 +223,8 @@ describe('StreamClient Structure', () => { } }); - it('should have likesSample10 method with return type annotation', () => { - const method = streamClient.likesSample10; + it('should have postsFirehoseKo method with return type annotation', () => { + const method = streamClient.postsFirehoseKo; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -229,12 +233,12 @@ describe('StreamClient Structure', () => { - it('should have postsFirehosePt method with correct signature', () => { + it('should have likesCompliance method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('postsFirehosePt'); + expect(StreamClient.prototype).toHaveProperty('likesCompliance'); // Check method is callable - const method = streamClient.postsFirehosePt; + const method = streamClient.likesCompliance; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -245,8 +249,6 @@ describe('StreamClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'partition', - ]; for (const requiredParam of requiredParams) { @@ -260,8 +262,8 @@ describe('StreamClient Structure', () => { } }); - it('should have postsFirehosePt method with return type annotation', () => { - const method = streamClient.postsFirehosePt; + it('should have likesCompliance method with return type annotation', () => { + const method = streamClient.likesCompliance; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -270,12 +272,12 @@ describe('StreamClient Structure', () => { - it('should have postsFirehoseEn method with correct signature', () => { + it('should have postsCompliance method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('postsFirehoseEn'); + expect(StreamClient.prototype).toHaveProperty('postsCompliance'); // Check method is callable - const method = streamClient.postsFirehoseEn; + const method = streamClient.postsCompliance; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -301,8 +303,8 @@ describe('StreamClient Structure', () => { } }); - it('should have postsFirehoseEn method with return type annotation', () => { - const method = streamClient.postsFirehoseEn; + it('should have postsCompliance method with return type annotation', () => { + const method = streamClient.postsCompliance; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -311,12 +313,12 @@ describe('StreamClient Structure', () => { - it('should have posts method with correct signature', () => { + it('should have getRuleCounts method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('posts'); + expect(StreamClient.prototype).toHaveProperty('getRuleCounts'); // Check method is callable - const method = streamClient.posts; + const method = streamClient.getRuleCounts; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -340,8 +342,8 @@ describe('StreamClient Structure', () => { } }); - it('should have posts method with return type annotation', () => { - const method = streamClient.posts; + it('should have getRuleCounts method with return type annotation', () => { + const method = streamClient.getRuleCounts; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -350,12 +352,12 @@ describe('StreamClient Structure', () => { - it('should have getRules method with correct signature', () => { + it('should have likesFirehose method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('getRules'); + expect(StreamClient.prototype).toHaveProperty('likesFirehose'); // Check method is callable - const method = streamClient.getRules; + const method = streamClient.likesFirehose; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -366,6 +368,8 @@ describe('StreamClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'partition', + ]; for (const requiredParam of requiredParams) { @@ -379,40 +383,22 @@ describe('StreamClient Structure', () => { } }); - it('should have getRules method with return type annotation', () => { - const method = streamClient.getRules; + it('should have likesFirehose method with return type annotation', () => { + const method = streamClient.likesFirehose; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getRules method with pagination parameters', () => { - const method = streamClient.getRules; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have updateRules method with correct signature', () => { + it('should have postsFirehoseEn method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('updateRules'); + expect(StreamClient.prototype).toHaveProperty('postsFirehoseEn'); // Check method is callable - const method = streamClient.updateRules; + const method = streamClient.postsFirehoseEn; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -423,6 +409,8 @@ describe('StreamClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'partition', + ]; for (const requiredParam of requiredParams) { @@ -436,8 +424,8 @@ describe('StreamClient Structure', () => { } }); - it('should have updateRules method with return type annotation', () => { - const method = streamClient.updateRules; + it('should have postsFirehoseEn method with return type annotation', () => { + const method = streamClient.postsFirehoseEn; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -446,12 +434,12 @@ describe('StreamClient Structure', () => { - it('should have postsCompliance method with correct signature', () => { + it('should have posts method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('postsCompliance'); + expect(StreamClient.prototype).toHaveProperty('posts'); // Check method is callable - const method = streamClient.postsCompliance; + const method = streamClient.posts; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -462,8 +450,6 @@ describe('StreamClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'partition', - ]; for (const requiredParam of requiredParams) { @@ -477,8 +463,8 @@ describe('StreamClient Structure', () => { } }); - it('should have postsCompliance method with return type annotation', () => { - const method = streamClient.postsCompliance; + it('should have posts method with return type annotation', () => { + const method = streamClient.posts; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -487,12 +473,12 @@ describe('StreamClient Structure', () => { - it('should have postsFirehoseKo method with correct signature', () => { + it('should have usersCompliance method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('postsFirehoseKo'); + expect(StreamClient.prototype).toHaveProperty('usersCompliance'); // Check method is callable - const method = streamClient.postsFirehoseKo; + const method = streamClient.usersCompliance; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -518,8 +504,8 @@ describe('StreamClient Structure', () => { } }); - it('should have postsFirehoseKo method with return type annotation', () => { - const method = streamClient.postsFirehoseKo; + it('should have usersCompliance method with return type annotation', () => { + const method = streamClient.usersCompliance; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -528,12 +514,12 @@ describe('StreamClient Structure', () => { - it('should have likesFirehose method with correct signature', () => { + it('should have postsFirehose method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('likesFirehose'); + expect(StreamClient.prototype).toHaveProperty('postsFirehose'); // Check method is callable - const method = streamClient.likesFirehose; + const method = streamClient.postsFirehose; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -559,8 +545,8 @@ describe('StreamClient Structure', () => { } }); - it('should have likesFirehose method with return type annotation', () => { - const method = streamClient.likesFirehose; + it('should have postsFirehose method with return type annotation', () => { + const method = streamClient.postsFirehose; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -569,12 +555,12 @@ describe('StreamClient Structure', () => { - it('should have postsSample10 method with correct signature', () => { + it('should have likesSample10 method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('postsSample10'); + expect(StreamClient.prototype).toHaveProperty('likesSample10'); // Check method is callable - const method = streamClient.postsSample10; + const method = streamClient.likesSample10; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -600,8 +586,8 @@ describe('StreamClient Structure', () => { } }); - it('should have postsSample10 method with return type annotation', () => { - const method = streamClient.postsSample10; + it('should have likesSample10 method with return type annotation', () => { + const method = streamClient.likesSample10; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -610,12 +596,12 @@ describe('StreamClient Structure', () => { - it('should have postsFirehoseJa method with correct signature', () => { + it('should have getRules method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('postsFirehoseJa'); + expect(StreamClient.prototype).toHaveProperty('getRules'); // Check method is callable - const method = streamClient.postsFirehoseJa; + const method = streamClient.getRules; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -626,8 +612,6 @@ describe('StreamClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'partition', - ]; for (const requiredParam of requiredParams) { @@ -641,22 +625,40 @@ describe('StreamClient Structure', () => { } }); - it('should have postsFirehoseJa method with return type annotation', () => { - const method = streamClient.postsFirehoseJa; + it('should have getRules method with return type annotation', () => { + const method = streamClient.getRules; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getRules method with pagination parameters', () => { + const method = streamClient.getRules; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have getRuleCounts method with correct signature', () => { + it('should have updateRules method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('getRuleCounts'); + expect(StreamClient.prototype).toHaveProperty('updateRules'); // Check method is callable - const method = streamClient.getRuleCounts; + const method = streamClient.updateRules; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -680,8 +682,8 @@ describe('StreamClient Structure', () => { } }); - it('should have getRuleCounts method with return type annotation', () => { - const method = streamClient.getRuleCounts; + it('should have updateRules method with return type annotation', () => { + const method = streamClient.updateRules; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -690,12 +692,12 @@ describe('StreamClient Structure', () => { - it('should have usersCompliance method with correct signature', () => { + it('should have labelsCompliance method with correct signature', () => { // Check method exists - expect(StreamClient.prototype).toHaveProperty('usersCompliance'); + expect(StreamClient.prototype).toHaveProperty('labelsCompliance'); // Check method is callable - const method = streamClient.usersCompliance; + const method = streamClient.labelsCompliance; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -706,8 +708,6 @@ describe('StreamClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'partition', - ]; for (const requiredParam of requiredParams) { @@ -721,8 +721,8 @@ describe('StreamClient Structure', () => { } }); - it('should have usersCompliance method with return type annotation', () => { - const method = streamClient.usersCompliance; + it('should have labelsCompliance method with return type annotation', () => { + const method = streamClient.labelsCompliance; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -737,37 +737,37 @@ describe('StreamClient Structure', () => { 'postsSample', - 'postsFirehose', + 'postsFirehosePt', - 'labelsCompliance', + 'postsFirehoseJa', - 'likesCompliance', + 'postsSample10', - 'likesSample10', + 'postsFirehoseKo', - 'postsFirehosePt', + 'likesCompliance', - 'postsFirehoseEn', + 'postsCompliance', - 'posts', + 'getRuleCounts', - 'getRules', + 'likesFirehose', - 'updateRules', + 'postsFirehoseEn', - 'postsCompliance', + 'posts', - 'postsFirehoseKo', + 'usersCompliance', - 'likesFirehose', + 'postsFirehose', - 'postsSample10', + 'likesSample10', - 'postsFirehoseJa', + 'getRules', - 'getRuleCounts', + 'updateRules', - 'usersCompliance', + 'labelsCompliance', ]; diff --git a/xdk/typescript/tests/trends/test_contracts.test.ts b/xdk/typescript/tests/trends/test_contracts.test.ts index 416d3c61..5ac7aa82 100644 --- a/xdk/typescript/tests/trends/test_contracts.test.ts +++ b/xdk/typescript/tests/trends/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('TrendsClient Contracts', () => { }); - it('should have correct request structure for getAi', async () => { + it('should have correct request structure for getPersonalized', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -58,17 +58,13 @@ describe('TrendsClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (trendsClient as any)['getAi']; + const method = (trendsClient as any)['getPersonalized']; const result = await method.apply(trendsClient, [...requiredArgs, options]); // Verify the request was made @@ -80,7 +76,7 @@ describe('TrendsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/ai_trends/{id}'; + const expectedPath = '/2/users/personalized_trends'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -93,7 +89,7 @@ describe('TrendsClient Contracts', () => { } }); - it('should handle required parameters correctly for getAi', async () => { + it('should handle required parameters correctly for getPersonalized', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -111,17 +107,13 @@ describe('TrendsClient Contracts', () => { } as Response); try { - const method = (trendsClient as any)['getAi']; + const method = (trendsClient as any)['getPersonalized']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -136,7 +128,7 @@ describe('TrendsClient Contracts', () => { } }); - it('should validate response structure for getAi', async () => { + it('should validate response structure for getPersonalized', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -165,14 +157,10 @@ describe('TrendsClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (trendsClient as any)['getAi']; + const method = (trendsClient as any)['getPersonalized']; const result = await method.apply(trendsClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -352,7 +340,7 @@ describe('TrendsClient Contracts', () => { }); - it('should have correct request structure for getPersonalized', async () => { + it('should have correct request structure for getAi', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -382,13 +370,17 @@ describe('TrendsClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (trendsClient as any)['getPersonalized']; + const method = (trendsClient as any)['getAi']; const result = await method.apply(trendsClient, [...requiredArgs, options]); // Verify the request was made @@ -400,7 +392,7 @@ describe('TrendsClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/personalized_trends'; + const expectedPath = '/2/ai_trends/{id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -413,7 +405,7 @@ describe('TrendsClient Contracts', () => { } }); - it('should handle required parameters correctly for getPersonalized', async () => { + it('should handle required parameters correctly for getAi', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -431,13 +423,17 @@ describe('TrendsClient Contracts', () => { } as Response); try { - const method = (trendsClient as any)['getPersonalized']; + const method = (trendsClient as any)['getAi']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -452,7 +448,7 @@ describe('TrendsClient Contracts', () => { } }); - it('should validate response structure for getPersonalized', async () => { + it('should validate response structure for getAi', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -481,10 +477,14 @@ describe('TrendsClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (trendsClient as any)['getPersonalized']; + const method = (trendsClient as any)['getAi']; const result = await method.apply(trendsClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/trends/test_structure.test.ts b/xdk/typescript/tests/trends/test_structure.test.ts index 7c7ecace..f7bf1e17 100644 --- a/xdk/typescript/tests/trends/test_structure.test.ts +++ b/xdk/typescript/tests/trends/test_structure.test.ts @@ -30,12 +30,12 @@ describe('TrendsClient Structure', () => { - it('should have getAi method with correct signature', () => { + it('should have getPersonalized method with correct signature', () => { // Check method exists - expect(TrendsClient.prototype).toHaveProperty('getAi'); + expect(TrendsClient.prototype).toHaveProperty('getPersonalized'); // Check method is callable - const method = trendsClient.getAi; + const method = trendsClient.getPersonalized; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -46,8 +46,6 @@ describe('TrendsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', - ]; for (const requiredParam of requiredParams) { @@ -61,8 +59,8 @@ describe('TrendsClient Structure', () => { } }); - it('should have getAi method with return type annotation', () => { - const method = trendsClient.getAi; + it('should have getPersonalized method with return type annotation', () => { + const method = trendsClient.getPersonalized; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -112,12 +110,12 @@ describe('TrendsClient Structure', () => { - it('should have getPersonalized method with correct signature', () => { + it('should have getAi method with correct signature', () => { // Check method exists - expect(TrendsClient.prototype).toHaveProperty('getPersonalized'); + expect(TrendsClient.prototype).toHaveProperty('getAi'); // Check method is callable - const method = trendsClient.getPersonalized; + const method = trendsClient.getAi; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -128,6 +126,8 @@ describe('TrendsClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'id', + ]; for (const requiredParam of requiredParams) { @@ -141,8 +141,8 @@ describe('TrendsClient Structure', () => { } }); - it('should have getPersonalized method with return type annotation', () => { - const method = trendsClient.getPersonalized; + it('should have getAi method with return type annotation', () => { + const method = trendsClient.getAi; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -155,11 +155,11 @@ describe('TrendsClient Structure', () => { it('should have all expected methods', () => { const expectedMethods = [ - 'getAi', + 'getPersonalized', 'getByWoeid', - 'getPersonalized', + 'getAi', ]; diff --git a/xdk/typescript/tests/users/test_contracts.test.ts b/xdk/typescript/tests/users/test_contracts.test.ts index 54ae4cc2..6e9df5a5 100644 --- a/xdk/typescript/tests/users/test_contracts.test.ts +++ b/xdk/typescript/tests/users/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for unlikePost', async () => { + it('should have correct request structure for getByUsernames', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -59,11 +59,7 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - - 'test_value', + ['test_item'], ]; @@ -72,7 +68,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['unlikePost']; + const method = (usersClient as any)['getByUsernames']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -84,7 +80,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/likes/{tweet_id}'; + const expectedPath = '/2/users/by'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -97,7 +93,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for unlikePost', async () => { + it('should handle required parameters correctly for getByUsernames', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -115,7 +111,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['unlikePost']; + const method = (usersClient as any)['getByUsernames']; // Method has required parameters - verify it can be called with proper args @@ -123,11 +119,7 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - - 'test_value', + ['test_item'], ]; @@ -144,7 +136,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for unlikePost', async () => { + it('should validate response structure for getByUsernames', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -174,17 +166,13 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - - 'test_value', + ['test_item'], ]; const options: any = {}; - const method = (usersClient as any)['unlikePost']; + const method = (usersClient as any)['getByUsernames']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -202,7 +190,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getOwnedLists', async () => { + it('should have correct request structure for getListMemberships', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -242,7 +230,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getOwnedLists']; + const method = (usersClient as any)['getListMemberships']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -254,7 +242,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/owned_lists'; + const expectedPath = '/2/users/{id}/list_memberships'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -267,7 +255,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getOwnedLists', async () => { + it('should handle required parameters correctly for getListMemberships', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -285,7 +273,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getOwnedLists']; + const method = (usersClient as any)['getListMemberships']; // Method has required parameters - verify it can be called with proper args @@ -310,7 +298,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getOwnedLists', async () => { + it('should validate response structure for getListMemberships', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -346,7 +334,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getOwnedLists']; + const method = (usersClient as any)['getListMemberships']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -364,7 +352,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getBlocking', async () => { + it('should have correct request structure for unfollowUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -395,6 +383,10 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', @@ -404,7 +396,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getBlocking']; + const method = (usersClient as any)['unfollowUser']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -416,7 +408,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/blocking'; + const expectedPath = '/2/users/{source_user_id}/following/{target_user_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -429,7 +421,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getBlocking', async () => { + it('should handle required parameters correctly for unfollowUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -447,7 +439,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getBlocking']; + const method = (usersClient as any)['unfollowUser']; // Method has required parameters - verify it can be called with proper args @@ -455,6 +447,10 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', @@ -472,7 +468,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getBlocking', async () => { + it('should validate response structure for unfollowUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -502,13 +498,17 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', ]; const options: any = {}; - const method = (usersClient as any)['getBlocking']; + const method = (usersClient as any)['unfollowUser']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -526,7 +526,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for deleteBookmark', async () => { + it('should have correct request structure for unfollowList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -570,7 +570,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['deleteBookmark']; + const method = (usersClient as any)['unfollowList']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -582,7 +582,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/bookmarks/{tweet_id}'; + const expectedPath = '/2/users/{id}/followed_lists/{list_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -595,7 +595,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for deleteBookmark', async () => { + it('should handle required parameters correctly for unfollowList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -613,7 +613,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['deleteBookmark']; + const method = (usersClient as any)['unfollowList']; // Method has required parameters - verify it can be called with proper args @@ -642,7 +642,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for deleteBookmark', async () => { + it('should validate response structure for unfollowList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -682,7 +682,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['deleteBookmark']; + const method = (usersClient as any)['unfollowList']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -700,7 +700,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getByUsername', async () => { + it('should have correct request structure for getByIds', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -731,7 +731,7 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_username', + ['test_item'], ]; @@ -740,7 +740,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getByUsername']; + const method = (usersClient as any)['getByIds']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -752,7 +752,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/by/username/{username}'; + const expectedPath = '/2/users'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -765,7 +765,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getByUsername', async () => { + it('should handle required parameters correctly for getByIds', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -783,7 +783,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getByUsername']; + const method = (usersClient as any)['getByIds']; // Method has required parameters - verify it can be called with proper args @@ -791,7 +791,7 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_username', + ['test_item'], ]; @@ -808,7 +808,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getByUsername', async () => { + it('should validate response structure for getByIds', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -838,13 +838,13 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_username', + ['test_item'], ]; const options: any = {}; - const method = (usersClient as any)['getByUsername']; + const method = (usersClient as any)['getByIds']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -862,7 +862,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for unpinList', async () => { + it('should have correct request structure for likePost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -893,10 +893,6 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -906,7 +902,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['unpinList']; + const method = (usersClient as any)['likePost']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -918,7 +914,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/pinned_lists/{list_id}'; + const expectedPath = '/2/users/{id}/likes'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -931,7 +927,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for unpinList', async () => { + it('should handle required parameters correctly for likePost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -949,7 +945,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['unpinList']; + const method = (usersClient as any)['likePost']; // Method has required parameters - verify it can be called with proper args @@ -957,10 +953,6 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -978,7 +970,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for unpinList', async () => { + it('should validate response structure for likePost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1008,17 +1000,13 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', ]; const options: any = {}; - const method = (usersClient as any)['unpinList']; + const method = (usersClient as any)['likePost']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1036,7 +1024,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getPosts', async () => { + it('should have correct request structure for blockDms', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1076,7 +1064,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getPosts']; + const method = (usersClient as any)['blockDms']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -1088,7 +1076,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/tweets'; + const expectedPath = '/2/users/{id}/dm/block'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1101,7 +1089,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getPosts', async () => { + it('should handle required parameters correctly for blockDms', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1119,7 +1107,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getPosts']; + const method = (usersClient as any)['blockDms']; // Method has required parameters - verify it can be called with proper args @@ -1144,7 +1132,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getPosts', async () => { + it('should validate response structure for blockDms', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1180,7 +1168,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getPosts']; + const method = (usersClient as any)['blockDms']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1198,7 +1186,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getBookmarks', async () => { + it('should have correct request structure for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1238,7 +1226,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getBookmarks']; + const method = (usersClient as any)['getPosts']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -1250,7 +1238,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/bookmarks'; + const expectedPath = '/2/users/{id}/tweets'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1263,7 +1251,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getBookmarks', async () => { + it('should handle required parameters correctly for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1281,7 +1269,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getBookmarks']; + const method = (usersClient as any)['getPosts']; // Method has required parameters - verify it can be called with proper args @@ -1306,7 +1294,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getBookmarks', async () => { + it('should validate response structure for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1342,7 +1330,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getBookmarks']; + const method = (usersClient as any)['getPosts']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1360,7 +1348,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for createBookmark', async () => { + it('should have correct request structure for getBookmarksByFolderId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1391,6 +1379,10 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', @@ -1400,7 +1392,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['createBookmark']; + const method = (usersClient as any)['getBookmarksByFolderId']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -1412,7 +1404,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/bookmarks'; + const expectedPath = '/2/users/{id}/bookmarks/folders/{folder_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1425,7 +1417,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for createBookmark', async () => { + it('should handle required parameters correctly for getBookmarksByFolderId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1443,7 +1435,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['createBookmark']; + const method = (usersClient as any)['getBookmarksByFolderId']; // Method has required parameters - verify it can be called with proper args @@ -1451,6 +1443,10 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', @@ -1468,7 +1464,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for createBookmark', async () => { + it('should validate response structure for getBookmarksByFolderId', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1498,13 +1494,17 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', ]; const options: any = {}; - const method = (usersClient as any)['createBookmark']; + const method = (usersClient as any)['getBookmarksByFolderId']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1522,7 +1522,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for blockDms', async () => { + it('should have correct request structure for getMuting', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1562,7 +1562,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['blockDms']; + const method = (usersClient as any)['getMuting']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -1574,7 +1574,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/dm/block'; + const expectedPath = '/2/users/{id}/muting'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1587,7 +1587,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for blockDms', async () => { + it('should handle required parameters correctly for getMuting', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1605,7 +1605,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['blockDms']; + const method = (usersClient as any)['getMuting']; // Method has required parameters - verify it can be called with proper args @@ -1630,7 +1630,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for blockDms', async () => { + it('should validate response structure for getMuting', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1666,7 +1666,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['blockDms']; + const method = (usersClient as any)['getMuting']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1684,7 +1684,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for unfollowList', async () => { + it('should have correct request structure for muteUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1715,10 +1715,6 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -1728,7 +1724,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['unfollowList']; + const method = (usersClient as any)['muteUser']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -1740,7 +1736,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/followed_lists/{list_id}'; + const expectedPath = '/2/users/{id}/muting'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1753,7 +1749,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for unfollowList', async () => { + it('should handle required parameters correctly for muteUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1771,7 +1767,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['unfollowList']; + const method = (usersClient as any)['muteUser']; // Method has required parameters - verify it can be called with proper args @@ -1779,10 +1775,6 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -1800,7 +1792,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for unfollowList', async () => { + it('should validate response structure for muteUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1830,17 +1822,13 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', ]; const options: any = {}; - const method = (usersClient as any)['unfollowList']; + const method = (usersClient as any)['muteUser']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -1858,7 +1846,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getMuting', async () => { + it('should have correct request structure for getOwnedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1898,7 +1886,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getMuting']; + const method = (usersClient as any)['getOwnedLists']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -1910,7 +1898,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/muting'; + const expectedPath = '/2/users/{id}/owned_lists'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1923,7 +1911,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getMuting', async () => { + it('should handle required parameters correctly for getOwnedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1941,7 +1929,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getMuting']; + const method = (usersClient as any)['getOwnedLists']; // Method has required parameters - verify it can be called with proper args @@ -1966,7 +1954,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getMuting', async () => { + it('should validate response structure for getOwnedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2002,7 +1990,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getMuting']; + const method = (usersClient as any)['getOwnedLists']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2020,7 +2008,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for muteUser', async () => { + it('should have correct request structure for unpinList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2051,6 +2039,10 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', @@ -2060,7 +2052,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['muteUser']; + const method = (usersClient as any)['unpinList']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -2072,7 +2064,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/muting'; + const expectedPath = '/2/users/{id}/pinned_lists/{list_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2085,7 +2077,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for muteUser', async () => { + it('should handle required parameters correctly for unpinList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2103,7 +2095,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['muteUser']; + const method = (usersClient as any)['unpinList']; // Method has required parameters - verify it can be called with proper args @@ -2111,6 +2103,10 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', @@ -2128,7 +2124,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for muteUser', async () => { + it('should validate response structure for unpinList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2158,13 +2154,17 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ + 'test_value', + + + 'test_value', ]; const options: any = {}; - const method = (usersClient as any)['muteUser']; + const method = (usersClient as any)['unpinList']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2182,7 +2182,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getById', async () => { + it('should have correct request structure for getByUsername', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2213,7 +2213,7 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + 'test_username', ]; @@ -2222,7 +2222,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getById']; + const method = (usersClient as any)['getByUsername']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -2234,7 +2234,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}'; + const expectedPath = '/2/users/by/username/{username}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2247,7 +2247,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getById', async () => { + it('should handle required parameters correctly for getByUsername', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2265,7 +2265,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getById']; + const method = (usersClient as any)['getByUsername']; // Method has required parameters - verify it can be called with proper args @@ -2273,7 +2273,7 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + 'test_username', ]; @@ -2290,7 +2290,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getById', async () => { + it('should validate response structure for getByUsername', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2320,13 +2320,13 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', + 'test_username', ]; const options: any = {}; - const method = (usersClient as any)['getById']; + const method = (usersClient as any)['getByUsername']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2344,7 +2344,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getMe', async () => { + it('should have correct request structure for getBlocking', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2374,13 +2374,17 @@ describe('UsersClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (usersClient as any)['getMe']; + const method = (usersClient as any)['getBlocking']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -2392,7 +2396,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/me'; + const expectedPath = '/2/users/{id}/blocking'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2405,7 +2409,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getMe', async () => { + it('should handle required parameters correctly for getBlocking', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2423,13 +2427,17 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getMe']; + const method = (usersClient as any)['getBlocking']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -2444,7 +2452,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getMe', async () => { + it('should validate response structure for getBlocking', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2473,10 +2481,14 @@ describe('UsersClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (usersClient as any)['getMe']; + const method = (usersClient as any)['getBlocking']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2494,7 +2506,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for unrepostPost', async () => { + it('should have correct request structure for getLikedPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2525,10 +2537,6 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -2538,7 +2546,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['unrepostPost']; + const method = (usersClient as any)['getLikedPosts']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -2550,7 +2558,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/retweets/{source_tweet_id}'; + const expectedPath = '/2/users/{id}/liked_tweets'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2563,7 +2571,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for unrepostPost', async () => { + it('should handle required parameters correctly for getLikedPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2581,7 +2589,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['unrepostPost']; + const method = (usersClient as any)['getLikedPosts']; // Method has required parameters - verify it can be called with proper args @@ -2589,10 +2597,6 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -2610,7 +2614,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for unrepostPost', async () => { + it('should validate response structure for getLikedPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2640,17 +2644,13 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', ]; const options: any = {}; - const method = (usersClient as any)['unrepostPost']; + const method = (usersClient as any)['getLikedPosts']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2668,7 +2668,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for unmuteUser', async () => { + it('should have correct request structure for unlikePost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2712,7 +2712,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['unmuteUser']; + const method = (usersClient as any)['unlikePost']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -2724,7 +2724,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{source_user_id}/muting/{target_user_id}'; + const expectedPath = '/2/users/{id}/likes/{tweet_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2737,7 +2737,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for unmuteUser', async () => { + it('should handle required parameters correctly for unlikePost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2755,7 +2755,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['unmuteUser']; + const method = (usersClient as any)['unlikePost']; // Method has required parameters - verify it can be called with proper args @@ -2784,7 +2784,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for unmuteUser', async () => { + it('should validate response structure for unlikePost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2824,7 +2824,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['unmuteUser']; + const method = (usersClient as any)['unlikePost']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -2842,7 +2842,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for search', async () => { + it('should have correct request structure for getFollowedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2882,7 +2882,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['search']; + const method = (usersClient as any)['getFollowedLists']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -2894,7 +2894,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/search'; + const expectedPath = '/2/users/{id}/followed_lists'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -2907,7 +2907,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for search', async () => { + it('should handle required parameters correctly for getFollowedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2925,7 +2925,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['search']; + const method = (usersClient as any)['getFollowedLists']; // Method has required parameters - verify it can be called with proper args @@ -2950,7 +2950,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for search', async () => { + it('should validate response structure for getFollowedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2986,7 +2986,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['search']; + const method = (usersClient as any)['getFollowedLists']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -3004,7 +3004,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getPinnedLists', async () => { + it('should have correct request structure for followList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3044,7 +3044,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getPinnedLists']; + const method = (usersClient as any)['followList']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -3056,7 +3056,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/pinned_lists'; + const expectedPath = '/2/users/{id}/followed_lists'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -3069,7 +3069,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getPinnedLists', async () => { + it('should handle required parameters correctly for followList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3087,7 +3087,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getPinnedLists']; + const method = (usersClient as any)['followList']; // Method has required parameters - verify it can be called with proper args @@ -3112,7 +3112,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getPinnedLists', async () => { + it('should validate response structure for followList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3148,7 +3148,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getPinnedLists']; + const method = (usersClient as any)['followList']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -3166,7 +3166,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for pinList', async () => { + it('should have correct request structure for getTimeline', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3206,7 +3206,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['pinList']; + const method = (usersClient as any)['getTimeline']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -3218,7 +3218,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/pinned_lists'; + const expectedPath = '/2/users/{id}/timelines/reverse_chronological'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -3231,7 +3231,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for pinList', async () => { + it('should handle required parameters correctly for getTimeline', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3249,7 +3249,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['pinList']; + const method = (usersClient as any)['getTimeline']; // Method has required parameters - verify it can be called with proper args @@ -3274,7 +3274,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for pinList', async () => { + it('should validate response structure for getTimeline', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3310,7 +3310,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['pinList']; + const method = (usersClient as any)['getTimeline']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -3328,7 +3328,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getFollowedLists', async () => { + it('should have correct request structure for getPinnedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3368,7 +3368,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getFollowedLists']; + const method = (usersClient as any)['getPinnedLists']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -3380,7 +3380,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/followed_lists'; + const expectedPath = '/2/users/{id}/pinned_lists'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -3393,7 +3393,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getFollowedLists', async () => { + it('should handle required parameters correctly for getPinnedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3411,7 +3411,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getFollowedLists']; + const method = (usersClient as any)['getPinnedLists']; // Method has required parameters - verify it can be called with proper args @@ -3436,7 +3436,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getFollowedLists', async () => { + it('should validate response structure for getPinnedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3472,7 +3472,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getFollowedLists']; + const method = (usersClient as any)['getPinnedLists']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -3490,7 +3490,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for followList', async () => { + it('should have correct request structure for pinList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3530,7 +3530,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['followList']; + const method = (usersClient as any)['pinList']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -3542,7 +3542,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/followed_lists'; + const expectedPath = '/2/users/{id}/pinned_lists'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -3555,7 +3555,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for followList', async () => { + it('should handle required parameters correctly for pinList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3573,7 +3573,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['followList']; + const method = (usersClient as any)['pinList']; // Method has required parameters - verify it can be called with proper args @@ -3598,7 +3598,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for followList', async () => { + it('should validate response structure for pinList', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3634,7 +3634,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['followList']; + const method = (usersClient as any)['pinList']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -3652,7 +3652,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for likePost', async () => { + it('should have correct request structure for getRepostsOfMe', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3682,17 +3682,13 @@ describe('UsersClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (usersClient as any)['likePost']; + const method = (usersClient as any)['getRepostsOfMe']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -3704,7 +3700,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/likes'; + const expectedPath = '/2/users/reposts_of_me'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -3717,7 +3713,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for likePost', async () => { + it('should handle required parameters correctly for getRepostsOfMe', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3735,17 +3731,13 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['likePost']; + const method = (usersClient as any)['getRepostsOfMe']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -3760,7 +3752,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for likePost', async () => { + it('should validate response structure for getRepostsOfMe', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3789,14 +3781,10 @@ describe('UsersClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (usersClient as any)['likePost']; + const method = (usersClient as any)['getRepostsOfMe']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -3814,7 +3802,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getLikedPosts', async () => { + it('should have correct request structure for getFollowing', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3854,7 +3842,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getLikedPosts']; + const method = (usersClient as any)['getFollowing']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -3866,7 +3854,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/liked_tweets'; + const expectedPath = '/2/users/{id}/following'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -3879,7 +3867,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getLikedPosts', async () => { + it('should handle required parameters correctly for getFollowing', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3897,7 +3885,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getLikedPosts']; + const method = (usersClient as any)['getFollowing']; // Method has required parameters - verify it can be called with proper args @@ -3922,7 +3910,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getLikedPosts', async () => { + it('should validate response structure for getFollowing', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -3958,7 +3946,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getLikedPosts']; + const method = (usersClient as any)['getFollowing']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -3976,7 +3964,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getByUsernames', async () => { + it('should have correct request structure for followUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4007,7 +3995,7 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_value', ]; @@ -4016,7 +4004,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getByUsernames']; + const method = (usersClient as any)['followUser']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -4028,7 +4016,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/by'; + const expectedPath = '/2/users/{id}/following'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -4041,7 +4029,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getByUsernames', async () => { + it('should handle required parameters correctly for followUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4059,7 +4047,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getByUsernames']; + const method = (usersClient as any)['followUser']; // Method has required parameters - verify it can be called with proper args @@ -4067,7 +4055,7 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_value', ]; @@ -4084,7 +4072,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getByUsernames', async () => { + it('should validate response structure for followUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4114,13 +4102,13 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_value', ]; const options: any = {}; - const method = (usersClient as any)['getByUsernames']; + const method = (usersClient as any)['followUser']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -4138,7 +4126,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for repostPost', async () => { + it('should have correct request structure for unblockDms', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4178,7 +4166,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['repostPost']; + const method = (usersClient as any)['unblockDms']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -4190,7 +4178,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/retweets'; + const expectedPath = '/2/users/{id}/dm/unblock'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -4203,7 +4191,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for repostPost', async () => { + it('should handle required parameters correctly for unblockDms', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4221,7 +4209,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['repostPost']; + const method = (usersClient as any)['unblockDms']; // Method has required parameters - verify it can be called with proper args @@ -4246,7 +4234,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for repostPost', async () => { + it('should validate response structure for unblockDms', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4282,7 +4270,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['repostPost']; + const method = (usersClient as any)['unblockDms']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -4300,7 +4288,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for unfollowUser', async () => { + it('should have correct request structure for getMentions', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4331,10 +4319,6 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -4344,7 +4328,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['unfollowUser']; + const method = (usersClient as any)['getMentions']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -4356,7 +4340,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{source_user_id}/following/{target_user_id}'; + const expectedPath = '/2/users/{id}/mentions'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -4369,7 +4353,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for unfollowUser', async () => { + it('should handle required parameters correctly for getMentions', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4387,7 +4371,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['unfollowUser']; + const method = (usersClient as any)['getMentions']; // Method has required parameters - verify it can be called with proper args @@ -4395,10 +4379,6 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', @@ -4416,7 +4396,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for unfollowUser', async () => { + it('should validate response structure for getMentions', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4446,17 +4426,13 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - 'test_value', - - - 'test_value', ]; const options: any = {}; - const method = (usersClient as any)['unfollowUser']; + const method = (usersClient as any)['getMentions']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -4474,7 +4450,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getFollowers', async () => { + it('should have correct request structure for getBookmarkFolders', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4514,7 +4490,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getFollowers']; + const method = (usersClient as any)['getBookmarkFolders']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -4526,7 +4502,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/followers'; + const expectedPath = '/2/users/{id}/bookmarks/folders'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -4539,7 +4515,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getFollowers', async () => { + it('should handle required parameters correctly for getBookmarkFolders', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4557,7 +4533,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getFollowers']; + const method = (usersClient as any)['getBookmarkFolders']; // Method has required parameters - verify it can be called with proper args @@ -4582,7 +4558,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getFollowers', async () => { + it('should validate response structure for getBookmarkFolders', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4618,7 +4594,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getFollowers']; + const method = (usersClient as any)['getBookmarkFolders']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -4636,7 +4612,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getByIds', async () => { + it('should have correct request structure for unrepostPost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4667,7 +4643,11 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_value', + + + + 'test_value', ]; @@ -4676,7 +4656,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getByIds']; + const method = (usersClient as any)['unrepostPost']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -4688,7 +4668,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users'; + const expectedPath = '/2/users/{id}/retweets/{source_tweet_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -4701,7 +4681,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getByIds', async () => { + it('should handle required parameters correctly for unrepostPost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4719,7 +4699,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getByIds']; + const method = (usersClient as any)['unrepostPost']; // Method has required parameters - verify it can be called with proper args @@ -4727,7 +4707,11 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_value', + + + + 'test_value', ]; @@ -4744,7 +4728,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getByIds', async () => { + it('should validate response structure for unrepostPost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4774,13 +4758,17 @@ describe('UsersClient Contracts', () => { const requiredArgs: any[] = [ - ['test_item'], + 'test_value', + + + + 'test_value', ]; const options: any = {}; - const method = (usersClient as any)['getByIds']; + const method = (usersClient as any)['unrepostPost']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -4798,7 +4786,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getBookmarksByFolderId', async () => { + it('should have correct request structure for deleteBookmark', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4842,7 +4830,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getBookmarksByFolderId']; + const method = (usersClient as any)['deleteBookmark']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -4854,7 +4842,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/bookmarks/folders/{folder_id}'; + const expectedPath = '/2/users/{id}/bookmarks/{tweet_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -4867,7 +4855,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getBookmarksByFolderId', async () => { + it('should handle required parameters correctly for deleteBookmark', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4885,7 +4873,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getBookmarksByFolderId']; + const method = (usersClient as any)['deleteBookmark']; // Method has required parameters - verify it can be called with proper args @@ -4914,7 +4902,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getBookmarksByFolderId', async () => { + it('should validate response structure for deleteBookmark', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -4954,7 +4942,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getBookmarksByFolderId']; + const method = (usersClient as any)['deleteBookmark']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -4972,7 +4960,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getBookmarkFolders', async () => { + it('should have correct request structure for repostPost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5012,7 +5000,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getBookmarkFolders']; + const method = (usersClient as any)['repostPost']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -5024,7 +5012,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/bookmarks/folders'; + const expectedPath = '/2/users/{id}/retweets'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -5037,7 +5025,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getBookmarkFolders', async () => { + it('should handle required parameters correctly for repostPost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5055,7 +5043,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getBookmarkFolders']; + const method = (usersClient as any)['repostPost']; // Method has required parameters - verify it can be called with proper args @@ -5080,7 +5068,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getBookmarkFolders', async () => { + it('should validate response structure for repostPost', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5116,7 +5104,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getBookmarkFolders']; + const method = (usersClient as any)['repostPost']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -5134,7 +5122,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getFollowing', async () => { + it('should have correct request structure for search', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5174,7 +5162,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getFollowing']; + const method = (usersClient as any)['search']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -5186,7 +5174,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/following'; + const expectedPath = '/2/users/search'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -5199,7 +5187,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getFollowing', async () => { + it('should handle required parameters correctly for search', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5217,7 +5205,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getFollowing']; + const method = (usersClient as any)['search']; // Method has required parameters - verify it can be called with proper args @@ -5242,7 +5230,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getFollowing', async () => { + it('should validate response structure for search', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5278,7 +5266,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getFollowing']; + const method = (usersClient as any)['search']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -5296,7 +5284,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for followUser', async () => { + it('should have correct request structure for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5336,7 +5324,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['followUser']; + const method = (usersClient as any)['getById']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -5348,7 +5336,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/following'; + const expectedPath = '/2/users/{id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -5361,7 +5349,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for followUser', async () => { + it('should handle required parameters correctly for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5379,7 +5367,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['followUser']; + const method = (usersClient as any)['getById']; // Method has required parameters - verify it can be called with proper args @@ -5404,7 +5392,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for followUser', async () => { + it('should validate response structure for getById', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5440,7 +5428,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['followUser']; + const method = (usersClient as any)['getById']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -5458,7 +5446,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getTimeline', async () => { + it('should have correct request structure for getBookmarks', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5498,7 +5486,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getTimeline']; + const method = (usersClient as any)['getBookmarks']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -5510,7 +5498,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/timelines/reverse_chronological'; + const expectedPath = '/2/users/{id}/bookmarks'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -5523,7 +5511,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getTimeline', async () => { + it('should handle required parameters correctly for getBookmarks', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5541,7 +5529,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getTimeline']; + const method = (usersClient as any)['getBookmarks']; // Method has required parameters - verify it can be called with proper args @@ -5566,7 +5554,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getTimeline', async () => { + it('should validate response structure for getBookmarks', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5602,7 +5590,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getTimeline']; + const method = (usersClient as any)['getBookmarks']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -5620,7 +5608,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for unblockDms', async () => { + it('should have correct request structure for createBookmark', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5660,7 +5648,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['unblockDms']; + const method = (usersClient as any)['createBookmark']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -5672,7 +5660,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/dm/unblock'; + const expectedPath = '/2/users/{id}/bookmarks'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -5685,7 +5673,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for unblockDms', async () => { + it('should handle required parameters correctly for createBookmark', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5703,7 +5691,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['unblockDms']; + const method = (usersClient as any)['createBookmark']; // Method has required parameters - verify it can be called with proper args @@ -5728,7 +5716,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for unblockDms', async () => { + it('should validate response structure for createBookmark', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5764,7 +5752,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['unblockDms']; + const method = (usersClient as any)['createBookmark']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -5782,7 +5770,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getMentions', async () => { + it('should have correct request structure for getFollowers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5822,7 +5810,7 @@ describe('UsersClient Contracts', () => { const options: any = {}; // Call the method - const method = (usersClient as any)['getMentions']; + const method = (usersClient as any)['getFollowers']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -5834,7 +5822,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/mentions'; + const expectedPath = '/2/users/{id}/followers'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -5847,7 +5835,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getMentions', async () => { + it('should handle required parameters correctly for getFollowers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5865,7 +5853,7 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getMentions']; + const method = (usersClient as any)['getFollowers']; // Method has required parameters - verify it can be called with proper args @@ -5890,7 +5878,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getMentions', async () => { + it('should validate response structure for getFollowers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5926,7 +5914,7 @@ describe('UsersClient Contracts', () => { ]; const options: any = {}; - const method = (usersClient as any)['getMentions']; + const method = (usersClient as any)['getFollowers']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -5944,7 +5932,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getListMemberships', async () => { + it('should have correct request structure for getMe', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -5974,17 +5962,13 @@ describe('UsersClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (usersClient as any)['getListMemberships']; + const method = (usersClient as any)['getMe']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -5996,7 +5980,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/{id}/list_memberships'; + const expectedPath = '/2/users/me'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -6009,7 +5993,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getListMemberships', async () => { + it('should handle required parameters correctly for getMe', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -6027,17 +6011,13 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getListMemberships']; + const method = (usersClient as any)['getMe']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -6052,7 +6032,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getListMemberships', async () => { + it('should validate response structure for getMe', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -6081,14 +6061,10 @@ describe('UsersClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (usersClient as any)['getListMemberships']; + const method = (usersClient as any)['getMe']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -6106,7 +6082,7 @@ describe('UsersClient Contracts', () => { }); - it('should have correct request structure for getRepostsOfMe', async () => { + it('should have correct request structure for unmuteUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -6136,13 +6112,21 @@ describe('UsersClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (usersClient as any)['getRepostsOfMe']; + const method = (usersClient as any)['unmuteUser']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify the request was made @@ -6154,7 +6138,7 @@ describe('UsersClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/users/reposts_of_me'; + const expectedPath = '/2/users/{source_user_id}/muting/{target_user_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -6167,7 +6151,7 @@ describe('UsersClient Contracts', () => { } }); - it('should handle required parameters correctly for getRepostsOfMe', async () => { + it('should handle required parameters correctly for unmuteUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -6185,13 +6169,21 @@ describe('UsersClient Contracts', () => { } as Response); try { - const method = (usersClient as any)['getRepostsOfMe']; + const method = (usersClient as any)['unmuteUser']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -6206,7 +6198,7 @@ describe('UsersClient Contracts', () => { } }); - it('should validate response structure for getRepostsOfMe', async () => { + it('should validate response structure for unmuteUser', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -6235,10 +6227,18 @@ describe('UsersClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + + + 'test_value', + + ]; const options: any = {}; - const method = (usersClient as any)['getRepostsOfMe']; + const method = (usersClient as any)['unmuteUser']; const result = await method.apply(usersClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/users/test_pagination.test.ts b/xdk/typescript/tests/users/test_pagination.test.ts index 27990df6..b352c458 100644 --- a/xdk/typescript/tests/users/test_pagination.test.ts +++ b/xdk/typescript/tests/users/test_pagination.test.ts @@ -30,8 +30,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getOwnedLists', () => { - const method = (usersClient as any)['getOwnedLists']; + it('should create paginator for getListMemberships', () => { + const method = (usersClient as any)['getListMemberships']; // Should be able to create paginator without error const params: any = { @@ -48,7 +48,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getOwnedLists', async () => { + it('should paginate through pages for getListMemberships', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -100,7 +100,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getOwnedLists']; + const method = (usersClient as any)['getListMemberships']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -142,7 +142,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getOwnedLists', async () => { + it('should handle pagination parameters correctly for getListMemberships', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -162,7 +162,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getOwnedLists']; + const method = (usersClient as any)['getListMemberships']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -193,8 +193,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getBlocking', () => { - const method = (usersClient as any)['getBlocking']; + it('should create paginator for getPosts', () => { + const method = (usersClient as any)['getPosts']; // Should be able to create paginator without error const params: any = { @@ -211,7 +211,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getBlocking', async () => { + it('should paginate through pages for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -263,7 +263,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getBlocking']; + const method = (usersClient as any)['getPosts']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -305,7 +305,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getBlocking', async () => { + it('should handle pagination parameters correctly for getPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -325,7 +325,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getBlocking']; + const method = (usersClient as any)['getPosts']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -356,8 +356,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getPosts', () => { - const method = (usersClient as any)['getPosts']; + it('should create paginator for getMuting', () => { + const method = (usersClient as any)['getMuting']; // Should be able to create paginator without error const params: any = { @@ -374,7 +374,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getPosts', async () => { + it('should paginate through pages for getMuting', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -426,7 +426,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getPosts']; + const method = (usersClient as any)['getMuting']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -468,7 +468,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getPosts', async () => { + it('should handle pagination parameters correctly for getMuting', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -488,7 +488,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getPosts']; + const method = (usersClient as any)['getMuting']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -519,8 +519,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getBookmarks', () => { - const method = (usersClient as any)['getBookmarks']; + it('should create paginator for getOwnedLists', () => { + const method = (usersClient as any)['getOwnedLists']; // Should be able to create paginator without error const params: any = { @@ -537,7 +537,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getBookmarks', async () => { + it('should paginate through pages for getOwnedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -589,7 +589,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getBookmarks']; + const method = (usersClient as any)['getOwnedLists']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -631,7 +631,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getBookmarks', async () => { + it('should handle pagination parameters correctly for getOwnedLists', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -651,7 +651,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getBookmarks']; + const method = (usersClient as any)['getOwnedLists']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -682,8 +682,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getMuting', () => { - const method = (usersClient as any)['getMuting']; + it('should create paginator for getBlocking', () => { + const method = (usersClient as any)['getBlocking']; // Should be able to create paginator without error const params: any = { @@ -700,7 +700,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getMuting', async () => { + it('should paginate through pages for getBlocking', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -752,7 +752,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getMuting']; + const method = (usersClient as any)['getBlocking']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -794,7 +794,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getMuting', async () => { + it('should handle pagination parameters correctly for getBlocking', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -814,7 +814,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getMuting']; + const method = (usersClient as any)['getBlocking']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -845,14 +845,14 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for search', () => { - const method = (usersClient as any)['search']; + it('should create paginator for getLikedPosts', () => { + const method = (usersClient as any)['getLikedPosts']; // Should be able to create paginator without error const params: any = { - query: 'test_value', + id: 'test_value', maxResults: 10 @@ -863,7 +863,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for search', async () => { + it('should paginate through pages for getLikedPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -915,7 +915,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['search']; + const method = (usersClient as any)['getLikedPosts']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -957,7 +957,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for search', async () => { + it('should handle pagination parameters correctly for getLikedPosts', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -977,7 +977,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['search']; + const method = (usersClient as any)['getLikedPosts']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -1171,8 +1171,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getLikedPosts', () => { - const method = (usersClient as any)['getLikedPosts']; + it('should create paginator for getTimeline', () => { + const method = (usersClient as any)['getTimeline']; // Should be able to create paginator without error const params: any = { @@ -1189,7 +1189,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getLikedPosts', async () => { + it('should paginate through pages for getTimeline', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1241,7 +1241,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getLikedPosts']; + const method = (usersClient as any)['getTimeline']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -1283,7 +1283,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getLikedPosts', async () => { + it('should handle pagination parameters correctly for getTimeline', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1303,7 +1303,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getLikedPosts']; + const method = (usersClient as any)['getTimeline']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -1334,16 +1334,12 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getFollowers', () => { - const method = (usersClient as any)['getFollowers']; + it('should create paginator for getRepostsOfMe', () => { + const method = (usersClient as any)['getRepostsOfMe']; // Should be able to create paginator without error const params: any = { - - id: 'test_value', - - maxResults: 10 }; @@ -1352,7 +1348,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getFollowers', async () => { + it('should paginate through pages for getRepostsOfMe', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1404,15 +1400,11 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getFollowers']; + const method = (usersClient as any)['getRepostsOfMe']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object with optional query parameters (maxResults is always in options) @@ -1446,7 +1438,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getFollowers', async () => { + it('should handle pagination parameters correctly for getRepostsOfMe', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1466,15 +1458,11 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getFollowers']; + const method = (usersClient as any)['getRepostsOfMe']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object with optional query parameters (maxResults is always in options) @@ -1497,8 +1485,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getBookmarkFolders', () => { - const method = (usersClient as any)['getBookmarkFolders']; + it('should create paginator for getFollowing', () => { + const method = (usersClient as any)['getFollowing']; // Should be able to create paginator without error const params: any = { @@ -1515,7 +1503,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getBookmarkFolders', async () => { + it('should paginate through pages for getFollowing', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1567,7 +1555,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getBookmarkFolders']; + const method = (usersClient as any)['getFollowing']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -1609,7 +1597,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getBookmarkFolders', async () => { + it('should handle pagination parameters correctly for getFollowing', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1629,7 +1617,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getBookmarkFolders']; + const method = (usersClient as any)['getFollowing']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -1660,8 +1648,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getFollowing', () => { - const method = (usersClient as any)['getFollowing']; + it('should create paginator for getMentions', () => { + const method = (usersClient as any)['getMentions']; // Should be able to create paginator without error const params: any = { @@ -1678,7 +1666,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getFollowing', async () => { + it('should paginate through pages for getMentions', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1730,7 +1718,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getFollowing']; + const method = (usersClient as any)['getMentions']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -1772,7 +1760,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getFollowing', async () => { + it('should handle pagination parameters correctly for getMentions', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1792,7 +1780,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getFollowing']; + const method = (usersClient as any)['getMentions']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -1823,8 +1811,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getTimeline', () => { - const method = (usersClient as any)['getTimeline']; + it('should create paginator for getBookmarkFolders', () => { + const method = (usersClient as any)['getBookmarkFolders']; // Should be able to create paginator without error const params: any = { @@ -1841,7 +1829,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getTimeline', async () => { + it('should paginate through pages for getBookmarkFolders', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1893,7 +1881,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getTimeline']; + const method = (usersClient as any)['getBookmarkFolders']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -1935,7 +1923,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getTimeline', async () => { + it('should handle pagination parameters correctly for getBookmarkFolders', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1955,7 +1943,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getTimeline']; + const method = (usersClient as any)['getBookmarkFolders']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -1986,14 +1974,14 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getMentions', () => { - const method = (usersClient as any)['getMentions']; + it('should create paginator for search', () => { + const method = (usersClient as any)['search']; // Should be able to create paginator without error const params: any = { - id: 'test_value', + query: 'test_value', maxResults: 10 @@ -2004,7 +1992,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getMentions', async () => { + it('should paginate through pages for search', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2056,7 +2044,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getMentions']; + const method = (usersClient as any)['search']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -2098,7 +2086,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getMentions', async () => { + it('should handle pagination parameters correctly for search', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2118,7 +2106,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getMentions']; + const method = (usersClient as any)['search']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -2149,8 +2137,8 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getListMemberships', () => { - const method = (usersClient as any)['getListMemberships']; + it('should create paginator for getBookmarks', () => { + const method = (usersClient as any)['getBookmarks']; // Should be able to create paginator without error const params: any = { @@ -2167,7 +2155,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getListMemberships', async () => { + it('should paginate through pages for getBookmarks', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2219,7 +2207,7 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getListMemberships']; + const method = (usersClient as any)['getBookmarks']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -2261,7 +2249,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getListMemberships', async () => { + it('should handle pagination parameters correctly for getBookmarks', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2281,7 +2269,7 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getListMemberships']; + const method = (usersClient as any)['getBookmarks']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ @@ -2312,12 +2300,16 @@ describe('UsersClient Pagination', () => { }); - it('should create paginator for getRepostsOfMe', () => { - const method = (usersClient as any)['getRepostsOfMe']; + it('should create paginator for getFollowers', () => { + const method = (usersClient as any)['getFollowers']; // Should be able to create paginator without error const params: any = { + + id: 'test_value', + + maxResults: 10 }; @@ -2326,7 +2318,7 @@ describe('UsersClient Pagination', () => { expect(typeof method).toBe('function'); }); - it('should paginate through pages for getRepostsOfMe', async () => { + it('should paginate through pages for getFollowers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2378,11 +2370,15 @@ describe('UsersClient Pagination', () => { }); try { - const method = (usersClient as any)['getRepostsOfMe']; + const method = (usersClient as any)['getFollowers']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object with optional query parameters (maxResults is always in options) @@ -2416,7 +2412,7 @@ describe('UsersClient Pagination', () => { } }); - it('should handle pagination parameters correctly for getRepostsOfMe', async () => { + it('should handle pagination parameters correctly for getFollowers', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -2436,11 +2432,15 @@ describe('UsersClient Pagination', () => { } as Response); try { - const method = (usersClient as any)['getRepostsOfMe']; + const method = (usersClient as any)['getFollowers']; // Build required parameters as direct arguments (both path and required query params) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object with optional query parameters (maxResults is always in options) diff --git a/xdk/typescript/tests/users/test_structure.test.ts b/xdk/typescript/tests/users/test_structure.test.ts index 0bad7515..ff870253 100644 --- a/xdk/typescript/tests/users/test_structure.test.ts +++ b/xdk/typescript/tests/users/test_structure.test.ts @@ -30,12 +30,12 @@ describe('UsersClient Structure', () => { - it('should have unlikePost method with correct signature', () => { + it('should have getByUsernames method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('unlikePost'); + expect(UsersClient.prototype).toHaveProperty('getByUsernames'); // Check method is callable - const method = usersClient.unlikePost; + const method = usersClient.getByUsernames; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -46,9 +46,7 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', - - 'tweetId', + 'usernames', ]; @@ -63,8 +61,8 @@ describe('UsersClient Structure', () => { } }); - it('should have unlikePost method with return type annotation', () => { - const method = usersClient.unlikePost; + it('should have getByUsernames method with return type annotation', () => { + const method = usersClient.getByUsernames; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -73,12 +71,12 @@ describe('UsersClient Structure', () => { - it('should have getOwnedLists method with correct signature', () => { + it('should have getListMemberships method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getOwnedLists'); + expect(UsersClient.prototype).toHaveProperty('getListMemberships'); // Check method is callable - const method = usersClient.getOwnedLists; + const method = usersClient.getListMemberships; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -104,16 +102,16 @@ describe('UsersClient Structure', () => { } }); - it('should have getOwnedLists method with return type annotation', () => { - const method = usersClient.getOwnedLists; + it('should have getListMemberships method with return type annotation', () => { + const method = usersClient.getListMemberships; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getOwnedLists method with pagination parameters', () => { - const method = usersClient.getOwnedLists; + it('should have getListMemberships method with pagination parameters', () => { + const method = usersClient.getListMemberships; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -132,12 +130,12 @@ describe('UsersClient Structure', () => { - it('should have getBlocking method with correct signature', () => { + it('should have unfollowUser method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getBlocking'); + expect(UsersClient.prototype).toHaveProperty('unfollowUser'); // Check method is callable - const method = usersClient.getBlocking; + const method = usersClient.unfollowUser; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -148,7 +146,9 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', + 'sourceUserId', + + 'targetUserId', ]; @@ -163,40 +163,22 @@ describe('UsersClient Structure', () => { } }); - it('should have getBlocking method with return type annotation', () => { - const method = usersClient.getBlocking; + it('should have unfollowUser method with return type annotation', () => { + const method = usersClient.unfollowUser; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getBlocking method with pagination parameters', () => { - const method = usersClient.getBlocking; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have deleteBookmark method with correct signature', () => { + it('should have unfollowList method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('deleteBookmark'); + expect(UsersClient.prototype).toHaveProperty('unfollowList'); // Check method is callable - const method = usersClient.deleteBookmark; + const method = usersClient.unfollowList; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -209,7 +191,7 @@ describe('UsersClient Structure', () => { 'id', - 'tweetId', + 'listId', ]; @@ -224,8 +206,8 @@ describe('UsersClient Structure', () => { } }); - it('should have deleteBookmark method with return type annotation', () => { - const method = usersClient.deleteBookmark; + it('should have unfollowList method with return type annotation', () => { + const method = usersClient.unfollowList; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -234,12 +216,12 @@ describe('UsersClient Structure', () => { - it('should have getByUsername method with correct signature', () => { + it('should have getByIds method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getByUsername'); + expect(UsersClient.prototype).toHaveProperty('getByIds'); // Check method is callable - const method = usersClient.getByUsername; + const method = usersClient.getByIds; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -250,7 +232,7 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'username', + 'ids', ]; @@ -265,8 +247,8 @@ describe('UsersClient Structure', () => { } }); - it('should have getByUsername method with return type annotation', () => { - const method = usersClient.getByUsername; + it('should have getByIds method with return type annotation', () => { + const method = usersClient.getByIds; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -275,12 +257,12 @@ describe('UsersClient Structure', () => { - it('should have unpinList method with correct signature', () => { + it('should have likePost method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('unpinList'); + expect(UsersClient.prototype).toHaveProperty('likePost'); // Check method is callable - const method = usersClient.unpinList; + const method = usersClient.likePost; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -293,8 +275,6 @@ describe('UsersClient Structure', () => { 'id', - 'listId', - ]; for (const requiredParam of requiredParams) { @@ -308,8 +288,8 @@ describe('UsersClient Structure', () => { } }); - it('should have unpinList method with return type annotation', () => { - const method = usersClient.unpinList; + it('should have likePost method with return type annotation', () => { + const method = usersClient.likePost; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -318,12 +298,12 @@ describe('UsersClient Structure', () => { - it('should have getPosts method with correct signature', () => { + it('should have blockDms method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getPosts'); + expect(UsersClient.prototype).toHaveProperty('blockDms'); // Check method is callable - const method = usersClient.getPosts; + const method = usersClient.blockDms; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -349,40 +329,22 @@ describe('UsersClient Structure', () => { } }); - it('should have getPosts method with return type annotation', () => { - const method = usersClient.getPosts; + it('should have blockDms method with return type annotation', () => { + const method = usersClient.blockDms; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getPosts method with pagination parameters', () => { - const method = usersClient.getPosts; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have getBookmarks method with correct signature', () => { + it('should have getPosts method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getBookmarks'); + expect(UsersClient.prototype).toHaveProperty('getPosts'); // Check method is callable - const method = usersClient.getBookmarks; + const method = usersClient.getPosts; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -408,16 +370,16 @@ describe('UsersClient Structure', () => { } }); - it('should have getBookmarks method with return type annotation', () => { - const method = usersClient.getBookmarks; + it('should have getPosts method with return type annotation', () => { + const method = usersClient.getPosts; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getBookmarks method with pagination parameters', () => { - const method = usersClient.getBookmarks; + it('should have getPosts method with pagination parameters', () => { + const method = usersClient.getPosts; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -436,12 +398,12 @@ describe('UsersClient Structure', () => { - it('should have createBookmark method with correct signature', () => { + it('should have getBookmarksByFolderId method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('createBookmark'); + expect(UsersClient.prototype).toHaveProperty('getBookmarksByFolderId'); // Check method is callable - const method = usersClient.createBookmark; + const method = usersClient.getBookmarksByFolderId; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -454,6 +416,8 @@ describe('UsersClient Structure', () => { 'id', + 'folderId', + ]; for (const requiredParam of requiredParams) { @@ -467,8 +431,8 @@ describe('UsersClient Structure', () => { } }); - it('should have createBookmark method with return type annotation', () => { - const method = usersClient.createBookmark; + it('should have getBookmarksByFolderId method with return type annotation', () => { + const method = usersClient.getBookmarksByFolderId; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -477,12 +441,12 @@ describe('UsersClient Structure', () => { - it('should have blockDms method with correct signature', () => { + it('should have getMuting method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('blockDms'); + expect(UsersClient.prototype).toHaveProperty('getMuting'); // Check method is callable - const method = usersClient.blockDms; + const method = usersClient.getMuting; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -508,22 +472,40 @@ describe('UsersClient Structure', () => { } }); - it('should have blockDms method with return type annotation', () => { - const method = usersClient.blockDms; + it('should have getMuting method with return type annotation', () => { + const method = usersClient.getMuting; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getMuting method with pagination parameters', () => { + const method = usersClient.getMuting; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have unfollowList method with correct signature', () => { + it('should have muteUser method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('unfollowList'); + expect(UsersClient.prototype).toHaveProperty('muteUser'); // Check method is callable - const method = usersClient.unfollowList; + const method = usersClient.muteUser; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -536,8 +518,6 @@ describe('UsersClient Structure', () => { 'id', - 'listId', - ]; for (const requiredParam of requiredParams) { @@ -551,8 +531,8 @@ describe('UsersClient Structure', () => { } }); - it('should have unfollowList method with return type annotation', () => { - const method = usersClient.unfollowList; + it('should have muteUser method with return type annotation', () => { + const method = usersClient.muteUser; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -561,12 +541,12 @@ describe('UsersClient Structure', () => { - it('should have getMuting method with correct signature', () => { + it('should have getOwnedLists method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getMuting'); + expect(UsersClient.prototype).toHaveProperty('getOwnedLists'); // Check method is callable - const method = usersClient.getMuting; + const method = usersClient.getOwnedLists; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -592,16 +572,16 @@ describe('UsersClient Structure', () => { } }); - it('should have getMuting method with return type annotation', () => { - const method = usersClient.getMuting; + it('should have getOwnedLists method with return type annotation', () => { + const method = usersClient.getOwnedLists; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getMuting method with pagination parameters', () => { - const method = usersClient.getMuting; + it('should have getOwnedLists method with pagination parameters', () => { + const method = usersClient.getOwnedLists; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -620,12 +600,12 @@ describe('UsersClient Structure', () => { - it('should have muteUser method with correct signature', () => { + it('should have unpinList method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('muteUser'); + expect(UsersClient.prototype).toHaveProperty('unpinList'); // Check method is callable - const method = usersClient.muteUser; + const method = usersClient.unpinList; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -638,6 +618,8 @@ describe('UsersClient Structure', () => { 'id', + 'listId', + ]; for (const requiredParam of requiredParams) { @@ -651,8 +633,8 @@ describe('UsersClient Structure', () => { } }); - it('should have muteUser method with return type annotation', () => { - const method = usersClient.muteUser; + it('should have unpinList method with return type annotation', () => { + const method = usersClient.unpinList; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -661,12 +643,12 @@ describe('UsersClient Structure', () => { - it('should have getById method with correct signature', () => { + it('should have getByUsername method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getById'); + expect(UsersClient.prototype).toHaveProperty('getByUsername'); // Check method is callable - const method = usersClient.getById; + const method = usersClient.getByUsername; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -677,7 +659,7 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', + 'username', ]; @@ -692,8 +674,8 @@ describe('UsersClient Structure', () => { } }); - it('should have getById method with return type annotation', () => { - const method = usersClient.getById; + it('should have getByUsername method with return type annotation', () => { + const method = usersClient.getByUsername; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -702,12 +684,12 @@ describe('UsersClient Structure', () => { - it('should have getMe method with correct signature', () => { + it('should have getBlocking method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getMe'); + expect(UsersClient.prototype).toHaveProperty('getBlocking'); // Check method is callable - const method = usersClient.getMe; + const method = usersClient.getBlocking; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -718,6 +700,8 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'id', + ]; for (const requiredParam of requiredParams) { @@ -731,65 +715,40 @@ describe('UsersClient Structure', () => { } }); - it('should have getMe method with return type annotation', () => { - const method = usersClient.getMe; + it('should have getBlocking method with return type annotation', () => { + const method = usersClient.getBlocking; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - - - it('should have unrepostPost method with correct signature', () => { - // Check method exists - expect(UsersClient.prototype).toHaveProperty('unrepostPost'); - - // Check method is callable - const method = usersClient.unrepostPost; - expect(typeof method).toBe('function'); - - // Check method signature by examining parameter count + it('should have getBlocking method with pagination parameters', () => { + const method = usersClient.getBlocking; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - // Check required parameters exist (convert to camelCase for TypeScript) - const requiredParams = [ - - 'id', - - 'sourceTweetId', - - ]; - - for (const requiredParam of requiredParams) { - // Check if parameter exists (may be in camelCase or snake_case) - const paramExists = params.some(p => - p === requiredParam || - p.toLowerCase() === requiredParam.toLowerCase() || - p.replace(/_/g, '') === requiredParam.replace(/_/g, '') - ); - expect(paramExists).toBe(true); + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); } }); - - it('should have unrepostPost method with return type annotation', () => { - const method = usersClient.unrepostPost; - expect(typeof method).toBe('function'); - // TypeScript will enforce return types at compile time - // This test ensures the method exists and is callable - }); - - it('should have unmuteUser method with correct signature', () => { + it('should have getLikedPosts method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('unmuteUser'); + expect(UsersClient.prototype).toHaveProperty('getLikedPosts'); // Check method is callable - const method = usersClient.unmuteUser; + const method = usersClient.getLikedPosts; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -800,9 +759,7 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'sourceUserId', - - 'targetUserId', + 'id', ]; @@ -817,22 +774,40 @@ describe('UsersClient Structure', () => { } }); - it('should have unmuteUser method with return type annotation', () => { - const method = usersClient.unmuteUser; + it('should have getLikedPosts method with return type annotation', () => { + const method = usersClient.getLikedPosts; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getLikedPosts method with pagination parameters', () => { + const method = usersClient.getLikedPosts; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have search method with correct signature', () => { + it('should have unlikePost method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('search'); + expect(UsersClient.prototype).toHaveProperty('unlikePost'); // Check method is callable - const method = usersClient.search; + const method = usersClient.unlikePost; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -843,7 +818,9 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'query', + 'id', + + 'tweetId', ]; @@ -858,40 +835,22 @@ describe('UsersClient Structure', () => { } }); - it('should have search method with return type annotation', () => { - const method = usersClient.search; + it('should have unlikePost method with return type annotation', () => { + const method = usersClient.unlikePost; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have search method with pagination parameters', () => { - const method = usersClient.search; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have getPinnedLists method with correct signature', () => { + it('should have getFollowedLists method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getPinnedLists'); + expect(UsersClient.prototype).toHaveProperty('getFollowedLists'); // Check method is callable - const method = usersClient.getPinnedLists; + const method = usersClient.getFollowedLists; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -917,22 +876,40 @@ describe('UsersClient Structure', () => { } }); - it('should have getPinnedLists method with return type annotation', () => { - const method = usersClient.getPinnedLists; + it('should have getFollowedLists method with return type annotation', () => { + const method = usersClient.getFollowedLists; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getFollowedLists method with pagination parameters', () => { + const method = usersClient.getFollowedLists; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have pinList method with correct signature', () => { + it('should have followList method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('pinList'); + expect(UsersClient.prototype).toHaveProperty('followList'); // Check method is callable - const method = usersClient.pinList; + const method = usersClient.followList; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -958,8 +935,8 @@ describe('UsersClient Structure', () => { } }); - it('should have pinList method with return type annotation', () => { - const method = usersClient.pinList; + it('should have followList method with return type annotation', () => { + const method = usersClient.followList; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -968,12 +945,12 @@ describe('UsersClient Structure', () => { - it('should have getFollowedLists method with correct signature', () => { + it('should have getTimeline method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getFollowedLists'); + expect(UsersClient.prototype).toHaveProperty('getTimeline'); // Check method is callable - const method = usersClient.getFollowedLists; + const method = usersClient.getTimeline; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -999,16 +976,16 @@ describe('UsersClient Structure', () => { } }); - it('should have getFollowedLists method with return type annotation', () => { - const method = usersClient.getFollowedLists; + it('should have getTimeline method with return type annotation', () => { + const method = usersClient.getTimeline; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getFollowedLists method with pagination parameters', () => { - const method = usersClient.getFollowedLists; + it('should have getTimeline method with pagination parameters', () => { + const method = usersClient.getTimeline; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -1027,12 +1004,12 @@ describe('UsersClient Structure', () => { - it('should have followList method with correct signature', () => { + it('should have getPinnedLists method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('followList'); + expect(UsersClient.prototype).toHaveProperty('getPinnedLists'); // Check method is callable - const method = usersClient.followList; + const method = usersClient.getPinnedLists; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1058,8 +1035,8 @@ describe('UsersClient Structure', () => { } }); - it('should have followList method with return type annotation', () => { - const method = usersClient.followList; + it('should have getPinnedLists method with return type annotation', () => { + const method = usersClient.getPinnedLists; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -1068,12 +1045,12 @@ describe('UsersClient Structure', () => { - it('should have likePost method with correct signature', () => { + it('should have pinList method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('likePost'); + expect(UsersClient.prototype).toHaveProperty('pinList'); // Check method is callable - const method = usersClient.likePost; + const method = usersClient.pinList; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1099,8 +1076,8 @@ describe('UsersClient Structure', () => { } }); - it('should have likePost method with return type annotation', () => { - const method = usersClient.likePost; + it('should have pinList method with return type annotation', () => { + const method = usersClient.pinList; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -1109,12 +1086,12 @@ describe('UsersClient Structure', () => { - it('should have getLikedPosts method with correct signature', () => { + it('should have getRepostsOfMe method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getLikedPosts'); + expect(UsersClient.prototype).toHaveProperty('getRepostsOfMe'); // Check method is callable - const method = usersClient.getLikedPosts; + const method = usersClient.getRepostsOfMe; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1125,8 +1102,6 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', - ]; for (const requiredParam of requiredParams) { @@ -1140,16 +1115,16 @@ describe('UsersClient Structure', () => { } }); - it('should have getLikedPosts method with return type annotation', () => { - const method = usersClient.getLikedPosts; + it('should have getRepostsOfMe method with return type annotation', () => { + const method = usersClient.getRepostsOfMe; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getLikedPosts method with pagination parameters', () => { - const method = usersClient.getLikedPosts; + it('should have getRepostsOfMe method with pagination parameters', () => { + const method = usersClient.getRepostsOfMe; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -1168,12 +1143,12 @@ describe('UsersClient Structure', () => { - it('should have getByUsernames method with correct signature', () => { + it('should have getFollowing method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getByUsernames'); + expect(UsersClient.prototype).toHaveProperty('getFollowing'); // Check method is callable - const method = usersClient.getByUsernames; + const method = usersClient.getFollowing; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1184,7 +1159,7 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'usernames', + 'id', ]; @@ -1199,22 +1174,40 @@ describe('UsersClient Structure', () => { } }); - it('should have getByUsernames method with return type annotation', () => { - const method = usersClient.getByUsernames; + it('should have getFollowing method with return type annotation', () => { + const method = usersClient.getFollowing; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getFollowing method with pagination parameters', () => { + const method = usersClient.getFollowing; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have repostPost method with correct signature', () => { + it('should have followUser method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('repostPost'); + expect(UsersClient.prototype).toHaveProperty('followUser'); // Check method is callable - const method = usersClient.repostPost; + const method = usersClient.followUser; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1240,8 +1233,8 @@ describe('UsersClient Structure', () => { } }); - it('should have repostPost method with return type annotation', () => { - const method = usersClient.repostPost; + it('should have followUser method with return type annotation', () => { + const method = usersClient.followUser; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -1250,12 +1243,12 @@ describe('UsersClient Structure', () => { - it('should have unfollowUser method with correct signature', () => { + it('should have unblockDms method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('unfollowUser'); + expect(UsersClient.prototype).toHaveProperty('unblockDms'); // Check method is callable - const method = usersClient.unfollowUser; + const method = usersClient.unblockDms; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1266,9 +1259,7 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'sourceUserId', - - 'targetUserId', + 'id', ]; @@ -1283,8 +1274,8 @@ describe('UsersClient Structure', () => { } }); - it('should have unfollowUser method with return type annotation', () => { - const method = usersClient.unfollowUser; + it('should have unblockDms method with return type annotation', () => { + const method = usersClient.unblockDms; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -1293,12 +1284,12 @@ describe('UsersClient Structure', () => { - it('should have getFollowers method with correct signature', () => { + it('should have getMentions method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getFollowers'); + expect(UsersClient.prototype).toHaveProperty('getMentions'); // Check method is callable - const method = usersClient.getFollowers; + const method = usersClient.getMentions; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1324,16 +1315,16 @@ describe('UsersClient Structure', () => { } }); - it('should have getFollowers method with return type annotation', () => { - const method = usersClient.getFollowers; + it('should have getMentions method with return type annotation', () => { + const method = usersClient.getMentions; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getFollowers method with pagination parameters', () => { - const method = usersClient.getFollowers; + it('should have getMentions method with pagination parameters', () => { + const method = usersClient.getMentions; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -1352,12 +1343,12 @@ describe('UsersClient Structure', () => { - it('should have getByIds method with correct signature', () => { + it('should have getBookmarkFolders method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getByIds'); + expect(UsersClient.prototype).toHaveProperty('getBookmarkFolders'); // Check method is callable - const method = usersClient.getByIds; + const method = usersClient.getBookmarkFolders; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1368,7 +1359,7 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'ids', + 'id', ]; @@ -1383,22 +1374,40 @@ describe('UsersClient Structure', () => { } }); - it('should have getByIds method with return type annotation', () => { - const method = usersClient.getByIds; + it('should have getBookmarkFolders method with return type annotation', () => { + const method = usersClient.getBookmarkFolders; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); + it('should have getBookmarkFolders method with pagination parameters', () => { + const method = usersClient.getBookmarkFolders; + const methodString = method.toString(); + const paramsMatch = methodString.match(/\(([^)]*)\)/); + const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; + + // Should have pagination-related parameters (check for common pagination param names) + const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; + const hasPaginationParam = paginationKeywords.some(keyword => + params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) + ); + // Note: Some pagination methods may use options object instead of individual params + // This test is lenient to account for different pagination patterns + if (params.length > 0) { + expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + } + }); + - it('should have getBookmarksByFolderId method with correct signature', () => { + it('should have unrepostPost method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getBookmarksByFolderId'); + expect(UsersClient.prototype).toHaveProperty('unrepostPost'); // Check method is callable - const method = usersClient.getBookmarksByFolderId; + const method = usersClient.unrepostPost; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1411,7 +1420,7 @@ describe('UsersClient Structure', () => { 'id', - 'folderId', + 'sourceTweetId', ]; @@ -1426,8 +1435,8 @@ describe('UsersClient Structure', () => { } }); - it('should have getBookmarksByFolderId method with return type annotation', () => { - const method = usersClient.getBookmarksByFolderId; + it('should have unrepostPost method with return type annotation', () => { + const method = usersClient.unrepostPost; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -1436,12 +1445,12 @@ describe('UsersClient Structure', () => { - it('should have getBookmarkFolders method with correct signature', () => { + it('should have deleteBookmark method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getBookmarkFolders'); + expect(UsersClient.prototype).toHaveProperty('deleteBookmark'); // Check method is callable - const method = usersClient.getBookmarkFolders; + const method = usersClient.deleteBookmark; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1454,6 +1463,8 @@ describe('UsersClient Structure', () => { 'id', + 'tweetId', + ]; for (const requiredParam of requiredParams) { @@ -1467,40 +1478,63 @@ describe('UsersClient Structure', () => { } }); - it('should have getBookmarkFolders method with return type annotation', () => { - const method = usersClient.getBookmarkFolders; + it('should have deleteBookmark method with return type annotation', () => { + const method = usersClient.deleteBookmark; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getBookmarkFolders method with pagination parameters', () => { - const method = usersClient.getBookmarkFolders; + + + it('should have repostPost method with correct signature', () => { + // Check method exists + expect(UsersClient.prototype).toHaveProperty('repostPost'); + + // Check method is callable + const method = usersClient.repostPost; + expect(typeof method).toBe('function'); + + // Check method signature by examining parameter count const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); + // Check required parameters exist (convert to camelCase for TypeScript) + const requiredParams = [ + + 'id', + + ]; + + for (const requiredParam of requiredParams) { + // Check if parameter exists (may be in camelCase or snake_case) + const paramExists = params.some(p => + p === requiredParam || + p.toLowerCase() === requiredParam.toLowerCase() || + p.replace(/_/g, '') === requiredParam.replace(/_/g, '') + ); + expect(paramExists).toBe(true); } }); + + it('should have repostPost method with return type annotation', () => { + const method = usersClient.repostPost; + expect(typeof method).toBe('function'); + // TypeScript will enforce return types at compile time + // This test ensures the method exists and is callable + }); + - it('should have getFollowing method with correct signature', () => { + it('should have search method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getFollowing'); + expect(UsersClient.prototype).toHaveProperty('search'); // Check method is callable - const method = usersClient.getFollowing; + const method = usersClient.search; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1511,7 +1545,7 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', + 'query', ]; @@ -1526,16 +1560,16 @@ describe('UsersClient Structure', () => { } }); - it('should have getFollowing method with return type annotation', () => { - const method = usersClient.getFollowing; + it('should have search method with return type annotation', () => { + const method = usersClient.search; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getFollowing method with pagination parameters', () => { - const method = usersClient.getFollowing; + it('should have search method with pagination parameters', () => { + const method = usersClient.search; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -1554,12 +1588,12 @@ describe('UsersClient Structure', () => { - it('should have followUser method with correct signature', () => { + it('should have getById method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('followUser'); + expect(UsersClient.prototype).toHaveProperty('getById'); // Check method is callable - const method = usersClient.followUser; + const method = usersClient.getById; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1585,8 +1619,8 @@ describe('UsersClient Structure', () => { } }); - it('should have followUser method with return type annotation', () => { - const method = usersClient.followUser; + it('should have getById method with return type annotation', () => { + const method = usersClient.getById; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -1595,12 +1629,12 @@ describe('UsersClient Structure', () => { - it('should have getTimeline method with correct signature', () => { + it('should have getBookmarks method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getTimeline'); + expect(UsersClient.prototype).toHaveProperty('getBookmarks'); // Check method is callable - const method = usersClient.getTimeline; + const method = usersClient.getBookmarks; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1626,16 +1660,16 @@ describe('UsersClient Structure', () => { } }); - it('should have getTimeline method with return type annotation', () => { - const method = usersClient.getTimeline; + it('should have getBookmarks method with return type annotation', () => { + const method = usersClient.getBookmarks; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getTimeline method with pagination parameters', () => { - const method = usersClient.getTimeline; + it('should have getBookmarks method with pagination parameters', () => { + const method = usersClient.getBookmarks; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -1654,12 +1688,12 @@ describe('UsersClient Structure', () => { - it('should have unblockDms method with correct signature', () => { + it('should have createBookmark method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('unblockDms'); + expect(UsersClient.prototype).toHaveProperty('createBookmark'); // Check method is callable - const method = usersClient.unblockDms; + const method = usersClient.createBookmark; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1685,8 +1719,8 @@ describe('UsersClient Structure', () => { } }); - it('should have unblockDms method with return type annotation', () => { - const method = usersClient.unblockDms; + it('should have createBookmark method with return type annotation', () => { + const method = usersClient.createBookmark; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -1695,12 +1729,12 @@ describe('UsersClient Structure', () => { - it('should have getMentions method with correct signature', () => { + it('should have getFollowers method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getMentions'); + expect(UsersClient.prototype).toHaveProperty('getFollowers'); // Check method is callable - const method = usersClient.getMentions; + const method = usersClient.getFollowers; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1726,16 +1760,16 @@ describe('UsersClient Structure', () => { } }); - it('should have getMentions method with return type annotation', () => { - const method = usersClient.getMentions; + it('should have getFollowers method with return type annotation', () => { + const method = usersClient.getFollowers; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getMentions method with pagination parameters', () => { - const method = usersClient.getMentions; + it('should have getFollowers method with pagination parameters', () => { + const method = usersClient.getFollowers; const methodString = method.toString(); const paramsMatch = methodString.match(/\(([^)]*)\)/); const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; @@ -1754,12 +1788,12 @@ describe('UsersClient Structure', () => { - it('should have getListMemberships method with correct signature', () => { + it('should have getMe method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getListMemberships'); + expect(UsersClient.prototype).toHaveProperty('getMe'); // Check method is callable - const method = usersClient.getListMemberships; + const method = usersClient.getMe; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1770,8 +1804,6 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'id', - ]; for (const requiredParam of requiredParams) { @@ -1785,40 +1817,22 @@ describe('UsersClient Structure', () => { } }); - it('should have getListMemberships method with return type annotation', () => { - const method = usersClient.getListMemberships; + it('should have getMe method with return type annotation', () => { + const method = usersClient.getMe; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getListMemberships method with pagination parameters', () => { - const method = usersClient.getListMemberships; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - - it('should have getRepostsOfMe method with correct signature', () => { + it('should have unmuteUser method with correct signature', () => { // Check method exists - expect(UsersClient.prototype).toHaveProperty('getRepostsOfMe'); + expect(UsersClient.prototype).toHaveProperty('unmuteUser'); // Check method is callable - const method = usersClient.getRepostsOfMe; + const method = usersClient.unmuteUser; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -1829,6 +1843,10 @@ describe('UsersClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'sourceUserId', + + 'targetUserId', + ]; for (const requiredParam of requiredParams) { @@ -1842,113 +1860,95 @@ describe('UsersClient Structure', () => { } }); - it('should have getRepostsOfMe method with return type annotation', () => { - const method = usersClient.getRepostsOfMe; + it('should have unmuteUser method with return type annotation', () => { + const method = usersClient.unmuteUser; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable }); - it('should have getRepostsOfMe method with pagination parameters', () => { - const method = usersClient.getRepostsOfMe; - const methodString = method.toString(); - const paramsMatch = methodString.match(/\(([^)]*)\)/); - const params = paramsMatch ? paramsMatch[1].split(',').map(p => p.trim().split(':')[0].trim()).filter(p => p) : []; - - // Should have pagination-related parameters (check for common pagination param names) - const paginationKeywords = ['pagination', 'token', 'max', 'results', 'next', 'cursor', 'limit', 'page']; - const hasPaginationParam = paginationKeywords.some(keyword => - params.some(p => p.toLowerCase().includes(keyword.toLowerCase())) - ); - // Note: Some pagination methods may use options object instead of individual params - // This test is lenient to account for different pagination patterns - if (params.length > 0) { - expect(hasPaginationParam || params.some(p => p.includes('options'))).toBe(true); - } - }); - it('should have all expected methods', () => { const expectedMethods = [ - 'unlikePost', - - 'getOwnedLists', - - 'getBlocking', - - 'deleteBookmark', + 'getByUsernames', - 'getByUsername', + 'getListMemberships', - 'unpinList', + 'unfollowUser', - 'getPosts', + 'unfollowList', - 'getBookmarks', + 'getByIds', - 'createBookmark', + 'likePost', 'blockDms', - 'unfollowList', + 'getPosts', + + 'getBookmarksByFolderId', 'getMuting', 'muteUser', - 'getById', - - 'getMe', + 'getOwnedLists', - 'unrepostPost', + 'unpinList', - 'unmuteUser', + 'getByUsername', - 'search', + 'getBlocking', - 'getPinnedLists', + 'getLikedPosts', - 'pinList', + 'unlikePost', 'getFollowedLists', 'followList', - 'likePost', + 'getTimeline', - 'getLikedPosts', + 'getPinnedLists', - 'getByUsernames', + 'pinList', - 'repostPost', + 'getRepostsOfMe', - 'unfollowUser', + 'getFollowing', - 'getFollowers', + 'followUser', - 'getByIds', + 'unblockDms', - 'getBookmarksByFolderId', + 'getMentions', 'getBookmarkFolders', - 'getFollowing', + 'unrepostPost', - 'followUser', + 'deleteBookmark', - 'getTimeline', + 'repostPost', - 'unblockDms', + 'search', - 'getMentions', + 'getById', - 'getListMemberships', + 'getBookmarks', - 'getRepostsOfMe', + 'createBookmark', + + 'getFollowers', + + 'getMe', + + 'unmuteUser', ]; diff --git a/xdk/typescript/tests/webhooks/test_contracts.test.ts b/xdk/typescript/tests/webhooks/test_contracts.test.ts index e49a6e4f..fe9d6d0f 100644 --- a/xdk/typescript/tests/webhooks/test_contracts.test.ts +++ b/xdk/typescript/tests/webhooks/test_contracts.test.ts @@ -28,7 +28,7 @@ describe('WebhooksClient Contracts', () => { }); - it('should have correct request structure for createStreamLink', async () => { + it('should have correct request structure for get', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -58,17 +58,13 @@ describe('WebhooksClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (webhooksClient as any)['createStreamLink']; + const method = (webhooksClient as any)['get']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify the request was made @@ -80,7 +76,7 @@ describe('WebhooksClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/search/webhooks/{webhook_id}'; + const expectedPath = '/2/webhooks'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -93,7 +89,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should handle required parameters correctly for createStreamLink', async () => { + it('should handle required parameters correctly for get', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -111,17 +107,13 @@ describe('WebhooksClient Contracts', () => { } as Response); try { - const method = (webhooksClient as any)['createStreamLink']; + const method = (webhooksClient as any)['get']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -136,7 +128,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should validate response structure for createStreamLink', async () => { + it('should validate response structure for get', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -165,14 +157,10 @@ describe('WebhooksClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (webhooksClient as any)['createStreamLink']; + const method = (webhooksClient as any)['get']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -190,7 +178,7 @@ describe('WebhooksClient Contracts', () => { }); - it('should have correct request structure for deleteStreamLink', async () => { + it('should have correct request structure for create', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -220,17 +208,13 @@ describe('WebhooksClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (webhooksClient as any)['deleteStreamLink']; + const method = (webhooksClient as any)['create']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify the request was made @@ -242,7 +226,7 @@ describe('WebhooksClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/search/webhooks/{webhook_id}'; + const expectedPath = '/2/webhooks'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -255,7 +239,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should handle required parameters correctly for deleteStreamLink', async () => { + it('should handle required parameters correctly for create', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -273,17 +257,13 @@ describe('WebhooksClient Contracts', () => { } as Response); try { - const method = (webhooksClient as any)['deleteStreamLink']; + const method = (webhooksClient as any)['create']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; // Build options object (empty for required params, optional params go here) @@ -298,7 +278,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should validate response structure for deleteStreamLink', async () => { + it('should validate response structure for create', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -327,14 +307,10 @@ describe('WebhooksClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ - - 'test_value', - - ]; const options: any = {}; - const method = (webhooksClient as any)['deleteStreamLink']; + const method = (webhooksClient as any)['create']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -676,7 +652,7 @@ describe('WebhooksClient Contracts', () => { }); - it('should have correct request structure for getStreamLinks', async () => { + it('should have correct request structure for createStreamLink', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -706,13 +682,17 @@ describe('WebhooksClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (webhooksClient as any)['getStreamLinks']; + const method = (webhooksClient as any)['createStreamLink']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify the request was made @@ -724,7 +704,7 @@ describe('WebhooksClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/tweets/search/webhooks'; + const expectedPath = '/2/tweets/search/webhooks/{webhook_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -737,7 +717,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should handle required parameters correctly for getStreamLinks', async () => { + it('should handle required parameters correctly for createStreamLink', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -755,13 +735,17 @@ describe('WebhooksClient Contracts', () => { } as Response); try { - const method = (webhooksClient as any)['getStreamLinks']; + const method = (webhooksClient as any)['createStreamLink']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -776,7 +760,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should validate response structure for getStreamLinks', async () => { + it('should validate response structure for createStreamLink', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -805,10 +789,14 @@ describe('WebhooksClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (webhooksClient as any)['getStreamLinks']; + const method = (webhooksClient as any)['createStreamLink']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -826,7 +814,7 @@ describe('WebhooksClient Contracts', () => { }); - it('should have correct request structure for get', async () => { + it('should have correct request structure for deleteStreamLink', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -856,13 +844,17 @@ describe('WebhooksClient Contracts', () => { // Build required parameter arguments const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params test, optional params go here) const options: any = {}; // Call the method - const method = (webhooksClient as any)['get']; + const method = (webhooksClient as any)['deleteStreamLink']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify the request was made @@ -874,7 +866,7 @@ describe('WebhooksClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/webhooks'; + const expectedPath = '/2/tweets/search/webhooks/{webhook_id}'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -887,7 +879,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should handle required parameters correctly for get', async () => { + it('should handle required parameters correctly for deleteStreamLink', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -905,13 +897,17 @@ describe('WebhooksClient Contracts', () => { } as Response); try { - const method = (webhooksClient as any)['get']; + const method = (webhooksClient as any)['deleteStreamLink']; // Method has required parameters - verify it can be called with proper args // Build required parameter arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; // Build options object (empty for required params, optional params go here) @@ -926,7 +922,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should validate response structure for get', async () => { + it('should validate response structure for deleteStreamLink', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -955,10 +951,14 @@ describe('WebhooksClient Contracts', () => { // Build arguments (all required params are direct args in TypeScript) const requiredArgs: any[] = [ + + 'test_value', + + ]; const options: any = {}; - const method = (webhooksClient as any)['get']; + const method = (webhooksClient as any)['deleteStreamLink']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify response object has expected structure @@ -976,7 +976,7 @@ describe('WebhooksClient Contracts', () => { }); - it('should have correct request structure for create', async () => { + it('should have correct request structure for getStreamLinks', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1012,7 +1012,7 @@ describe('WebhooksClient Contracts', () => { const options: any = {}; // Call the method - const method = (webhooksClient as any)['create']; + const method = (webhooksClient as any)['getStreamLinks']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify the request was made @@ -1024,7 +1024,7 @@ describe('WebhooksClient Contracts', () => { const requestOptions = callArgs[1] as RequestInit; // Check URL structure - path parameters are replaced in the URL - const expectedPath = '/2/webhooks'; + const expectedPath = '/2/tweets/search/webhooks'; // Path parameters are replaced with actual values, so check for the base path structure const basePath = expectedPath.split('{')[0]; expect(url).toContain(basePath); @@ -1037,7 +1037,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should handle required parameters correctly for create', async () => { + it('should handle required parameters correctly for getStreamLinks', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1055,7 +1055,7 @@ describe('WebhooksClient Contracts', () => { } as Response); try { - const method = (webhooksClient as any)['create']; + const method = (webhooksClient as any)['getStreamLinks']; // Method has required parameters - verify it can be called with proper args @@ -1076,7 +1076,7 @@ describe('WebhooksClient Contracts', () => { } }); - it('should validate response structure for create', async () => { + it('should validate response structure for getStreamLinks', async () => { // Mock validateAuthentication to bypass auth checks (like Python mocks session) const originalValidateAuth = client.validateAuthentication; client.validateAuthentication = jest.fn(); @@ -1108,7 +1108,7 @@ describe('WebhooksClient Contracts', () => { ]; const options: any = {}; - const method = (webhooksClient as any)['create']; + const method = (webhooksClient as any)['getStreamLinks']; const result = await method.apply(webhooksClient, [...requiredArgs, options]); // Verify response object has expected structure diff --git a/xdk/typescript/tests/webhooks/test_structure.test.ts b/xdk/typescript/tests/webhooks/test_structure.test.ts index f707a493..39678d6d 100644 --- a/xdk/typescript/tests/webhooks/test_structure.test.ts +++ b/xdk/typescript/tests/webhooks/test_structure.test.ts @@ -30,12 +30,12 @@ describe('WebhooksClient Structure', () => { - it('should have createStreamLink method with correct signature', () => { + it('should have get method with correct signature', () => { // Check method exists - expect(WebhooksClient.prototype).toHaveProperty('createStreamLink'); + expect(WebhooksClient.prototype).toHaveProperty('get'); // Check method is callable - const method = webhooksClient.createStreamLink; + const method = webhooksClient.get; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -46,8 +46,6 @@ describe('WebhooksClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'webhookId', - ]; for (const requiredParam of requiredParams) { @@ -61,8 +59,8 @@ describe('WebhooksClient Structure', () => { } }); - it('should have createStreamLink method with return type annotation', () => { - const method = webhooksClient.createStreamLink; + it('should have get method with return type annotation', () => { + const method = webhooksClient.get; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -71,12 +69,12 @@ describe('WebhooksClient Structure', () => { - it('should have deleteStreamLink method with correct signature', () => { + it('should have create method with correct signature', () => { // Check method exists - expect(WebhooksClient.prototype).toHaveProperty('deleteStreamLink'); + expect(WebhooksClient.prototype).toHaveProperty('create'); // Check method is callable - const method = webhooksClient.deleteStreamLink; + const method = webhooksClient.create; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -87,8 +85,6 @@ describe('WebhooksClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ - 'webhookId', - ]; for (const requiredParam of requiredParams) { @@ -102,8 +98,8 @@ describe('WebhooksClient Structure', () => { } }); - it('should have deleteStreamLink method with return type annotation', () => { - const method = webhooksClient.deleteStreamLink; + it('should have create method with return type annotation', () => { + const method = webhooksClient.create; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -194,12 +190,12 @@ describe('WebhooksClient Structure', () => { - it('should have getStreamLinks method with correct signature', () => { + it('should have createStreamLink method with correct signature', () => { // Check method exists - expect(WebhooksClient.prototype).toHaveProperty('getStreamLinks'); + expect(WebhooksClient.prototype).toHaveProperty('createStreamLink'); // Check method is callable - const method = webhooksClient.getStreamLinks; + const method = webhooksClient.createStreamLink; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -210,6 +206,8 @@ describe('WebhooksClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'webhookId', + ]; for (const requiredParam of requiredParams) { @@ -223,8 +221,8 @@ describe('WebhooksClient Structure', () => { } }); - it('should have getStreamLinks method with return type annotation', () => { - const method = webhooksClient.getStreamLinks; + it('should have createStreamLink method with return type annotation', () => { + const method = webhooksClient.createStreamLink; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -233,12 +231,12 @@ describe('WebhooksClient Structure', () => { - it('should have get method with correct signature', () => { + it('should have deleteStreamLink method with correct signature', () => { // Check method exists - expect(WebhooksClient.prototype).toHaveProperty('get'); + expect(WebhooksClient.prototype).toHaveProperty('deleteStreamLink'); // Check method is callable - const method = webhooksClient.get; + const method = webhooksClient.deleteStreamLink; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -249,6 +247,8 @@ describe('WebhooksClient Structure', () => { // Check required parameters exist (convert to camelCase for TypeScript) const requiredParams = [ + 'webhookId', + ]; for (const requiredParam of requiredParams) { @@ -262,8 +262,8 @@ describe('WebhooksClient Structure', () => { } }); - it('should have get method with return type annotation', () => { - const method = webhooksClient.get; + it('should have deleteStreamLink method with return type annotation', () => { + const method = webhooksClient.deleteStreamLink; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -272,12 +272,12 @@ describe('WebhooksClient Structure', () => { - it('should have create method with correct signature', () => { + it('should have getStreamLinks method with correct signature', () => { // Check method exists - expect(WebhooksClient.prototype).toHaveProperty('create'); + expect(WebhooksClient.prototype).toHaveProperty('getStreamLinks'); // Check method is callable - const method = webhooksClient.create; + const method = webhooksClient.getStreamLinks; expect(typeof method).toBe('function'); // Check method signature by examining parameter count @@ -301,8 +301,8 @@ describe('WebhooksClient Structure', () => { } }); - it('should have create method with return type annotation', () => { - const method = webhooksClient.create; + it('should have getStreamLinks method with return type annotation', () => { + const method = webhooksClient.getStreamLinks; expect(typeof method).toBe('function'); // TypeScript will enforce return types at compile time // This test ensures the method exists and is callable @@ -315,19 +315,19 @@ describe('WebhooksClient Structure', () => { it('should have all expected methods', () => { const expectedMethods = [ - 'createStreamLink', + 'get', - 'deleteStreamLink', + 'create', 'validate', 'delete', - 'getStreamLinks', + 'createStreamLink', - 'get', + 'deleteStreamLink', - 'create', + 'getStreamLinks', ];