// Hiboty JavaScript istemcisinin tip tanımları (hiboty.js ile birlikte kullanılır). Alanlar OpenAPI belgesiyle aynıdır. export declare const SDK_SURUMU: string; export type Kanal = "telegram" | "whatsapp"; export type Izin = "opted_in" | "opted_out" | "unknown"; export type SohbetDurumu = "open" | "handoff" | "closed"; export type OzelAlanlar = Record; export interface Bot { id: string; name: string; channel: Kanal; status: string; telegram_username: string | null; whatsapp_phone: string | null; created_at: string } export interface Kisi { id: string; bot_id: string; channel: Kanal; external_id: string; name: string | null; username: string | null; phone: string | null; consent: Izin; acquisition_source: string | null; attributes: OzelAlanlar; last_seen_at: string | null; created_at: string } export interface KisiAyrinti { id: string; bot_id: string; channel: Kanal; external_id: string; name: string | null; username: string | null; phone: string | null; consent: Izin; tags: string[]; notes: string; attributes: OzelAlanlar; last_seen_at: string | null } export interface IzinDurumu { id: string; consent: Izin; source: string | null; history: { from: string | null; to: string; source: string; created_at: string }[] } export interface Sohbet { id: string; bot_id: string; status: SohbetDurumu; unread_count: number; last_message_preview: string | null; last_message_at: string | null; contact: { id: string; external_id: string; name: string | null; channel: Kanal; consent: Izin } } export interface Mesaj { id: string; direction: "in" | "out"; sender: string; body: string; status: string; external_id: string | null; created_at: string } export interface Sayfa { data: T[]; next_cursor: string | null } export type MesajGonder = { bot_id: string; to: string } & ({ message: string; template?: never } | { template: { name: string; language: string; params?: string[] }; message?: never }); export interface KisiGuncelle { name?: string | null; notes?: string | null; tags?: string[]; add_tags?: string[]; remove_tags?: string[]; attributes?: Record } export interface Kampanya { id: string; bot_id: string; name: string; status: string; body: string; template_name: string | null; topic: string | null; audience_count: number; sent_count: number; failed_count: number; scheduled_at: string | null; started_at: string | null; completed_at: string | null; created_at: string } export interface KampanyaSegmenti { include_tags?: string[]; exclude_tags?: string[]; match?: "any" | "all"; last_seen?: { within_days: number } | { older_than_days: number }; order?: "placed" | "none"; source?: string[]; fields?: { key: string; type: "text" | "number" | "date" | "choice"; op: "exists" | "empty" | "eq" | "neq" | "gt" | "lt" | "contains"; value?: string | number }[]; } export interface KampanyaOlustur { bot_id: string; name: string; body?: string; body_b?: string; media_url?: string; template?: { name: string; language: string; params?: string[]; params_b?: string[] }; topic?: string; scheduled_at?: string; segment?: KampanyaSegmenti } export type KampanyaDurumu = "draft" | "pending_approval" | "approved" | "sending" | "completed" | "failed" | "cancelled"; /** Yeniden denemede çift işlemi önler: aynı anahtar ve gövdeyle 24 saat içinde ilk yanıt döner. */ export interface IdempotencySecenegi { idempotencyKey?: string } export interface MiniApp { id: string; bot_id: string; name: string; slug: string; template: string; status: string; url: string; created_at: string } export interface MiniAppGonderimi { id: string; kind: "form" | "order"; status: string; contact_id: string | null; user_name: string | null; data: Record; source: string | null; created_at: string } export interface Otomasyon { id: string; bot_id: string; name: string; trigger: string; active: boolean; run_count: number; created_at: string; updated_at: string } export interface WebhookKaydi { id: string; url: string; description: string; events: WebhookOlayi[]; active: boolean; failure_count: number; last_status: number | null; last_delivery_at: string | null; created_at: string } // scripts/sdk-uret.ts üretir; elle düzenlemeyin. export type OtomasyonDetayi = { id?: string; bot_id?: string; name?: string; trigger?: "yeni_kisi" | "anahtar_kelime" | "etiket_eklendi" | "sessiz" | "miniapp_gonderim"; trigger_config?: Record; steps?: Record[]; active?: boolean; run_count?: number; created_at?: string; updated_at?: string }; export type OtomasyonCalistirmasi = { id?: string; contact_id?: string; status?: "running" | "waiting" | "completed" | "failed" | "stopped"; step_index?: number; error?: string | null; log?: { step?: number; type?: string; result?: string; at?: string }[]; next_run_at?: string; created_at?: string; updated_at?: string }; export type MiniAppDetayi = { id?: string; bot_id?: string; name?: string; slug?: string; template?: "katalog" | "form" | "baglanti"; status?: "draft" | "published" | "unpublished"; url?: string; menu_button?: boolean; draft?: Record; published_version?: { id?: string; version?: number; config?: Record; created_at?: string } | null; created_at?: string; updated_at?: string }; export type MiniAppSurumu = { id?: string; version?: number; config?: Record; is_published?: boolean; created_at?: string; config_sha256?: string | null; status?: "published" | "pending" | "rejected" }; export type MiniAppOnizlemesi = { url?: string; expires_at?: string; valid?: boolean; errors?: string[]; config?: Record }; export type Siparis = { id?: string; mini_app_id?: string; mini_app_name?: string; status?: "yeni" | "hazirlaniyor" | "tamamlandi" | "iptal"; contact_id?: string | null; user_name?: string | null; data?: Record; source?: string | null; payment?: { status?: "pending" | "paid" | "refunded"; method?: "telegram_stars" | "telegram_card"; currency?: string; amount?: number | null; amount_stars?: number | null } | null; status_updated_at?: string | null; created_at?: string }; export type OzelMiniAppTalebi = { id?: string; status?: "yeni" | "incelemede" | "teklif" | "kabul" | "odendi" | "uretimde" | "onizleme" | "onizleme_onay" | "teslim" | "iptal" | "reddedildi"; title?: string; description?: string; examples?: string; budget?: string; takes_payment?: boolean; handles_personal_data?: boolean; quote_amount_cents?: number | null; monthly_amount_cents?: number | null; delivery_days?: number | null; quote_note?: string | null; payment_url?: string | null; preview_url?: string | null; delivery_url?: string | null; created_at?: string; updated_at?: string }; export type KisiEtiketi = { key?: string; name?: string; variants?: string[]; contact_count?: number; automation_count?: number }; export type KisiOzelAlani = { id?: string; key?: string; label?: string; type?: "metin" | "sayi" | "tarih" | "secim"; options?: string[]; ai_writable?: boolean }; export type KisiIceAktarmaSonucu = { added?: number; updated?: number; skipped?: number; invalid_field_values?: number; errors?: ({ row?: number; code?: "missing_channel_id" | "invalid_telegram_id" | "invalid_whatsapp_phone" })[] }; export type SohbetAyrintisi = { id?: string; status?: "open" | "handoff" | "closed"; unread_count?: number; last_message_preview?: string | null; last_message_at?: string | null; handoff_at?: string | null; closed_at?: string | null; snoozed_until?: string | null; flood_until?: string | null; created_at?: string; bot?: { id?: string; name?: string; channel?: string }; contact?: { id?: string; external_id?: string; name?: string | null; username?: string | null; channel?: string; consent?: string }; assigned_user?: { id?: string; name?: string } | null }; export type SohbetNotu = { id?: string; conversation_id?: string; user_id?: string | null; author_name?: string | null; body?: string; mentions?: string[]; created_at?: string }; export type HazirYanit = { id?: string; shortcut?: string; body?: string; created_at?: string; updated_at?: string }; export type KampanyaVaryantSonucu = { variant?: "a" | "b"; audience?: number; sent?: number; failed?: number; replied?: number }; export type KampanyaSonuclari = { campaign_id?: string; status?: string; audience_count?: number; sent_count?: number; failed_count?: number; replied_count?: number; variants?: KampanyaVaryantSonucu[]; remaining_variants?: KampanyaVaryantSonucu[]; ab_stage?: "test" | "waiting" | "winner" | null; ab_test_percent?: number | null; ab_wait_hours?: number | null; ab_decide_at?: string | null; ab_winner?: "a" | "b" | null; ab_decision?: { reason?: string; metric?: string; a?: { sent?: number; replied?: number; read?: number | null }; b?: { sent?: number; replied?: number; read?: number | null } } | null; ab_decided_at?: string | null }; export type KampanyaKitleSayisi = { audience_count?: number }; export type KampanyaEnIyiSaat = { suggestion?: { weekday?: number; hour?: number; interactions?: number } | null; reason?: "veri_az" | "kisi_az" | "uygun_saat_yok" | "unavailable" | null; interactions?: number; contacts?: number; next_at?: string | null; timezone?: string }; export type RaporGenelBakis = { days?: number; usage?: { messages?: { used?: number; limit?: number }; ai_replies?: { used?: number; limit?: number; effective_limit?: number | null; own_key?: boolean }; ai_tokens?: number }; contacts?: { total?: number; opted_in?: number }; conversations?: { total?: number; handoff?: number }; bots?: { name?: string; incoming?: number; ai?: number; agent?: number }[]; hourly?: number[]; daily?: { date?: string; ai?: number; agent?: number }[]; campaigns?: { total?: number; completed?: number; delivered?: number } }; export type RaporTeslim = { days?: number; succeeded?: number; failed?: number; success_rate?: number | null; recovered?: number; sources?: { sender?: string; succeeded?: number; failed?: number }[]; reasons?: { reason?: string; count?: number }[]; samples?: { error?: string; count?: number }[] }; export type RaporTemsilci = { days?: number; handoffs?: number; resolved?: number; first_reply_median_seconds?: number | null; resolution_average_seconds?: number | null; sla_target_minutes?: number; sla_compliance?: number | null; waiting?: number; oldest_waiting_seconds?: number | null; agents?: ({ user_id?: string; name?: string; open?: number; replies?: number; first_reply_median_seconds?: number | null })[] }; export type RaporCsat = { days?: number; enabled?: boolean; responses?: number; average?: number | null; satisfied_rate?: number | null; distribution?: number[]; agents?: ({ user_id?: string; name?: string; responses?: number; average?: number | null; satisfied_rate?: number | null })[] }; export type RaporAiKalite = { days?: number; ai_replies?: number; rated?: number; liked?: number; disliked?: number; like_rate?: number | null; coverage?: number | null; attributed_replies?: number; unsourced_replies?: number; unsourced_rate?: number | null }; export type RaporKohort = { new_contacts?: number; first_week_return_rate?: number | null; cohorts?: ({ week?: string; size?: number; rates?: (number | null)[] })[] }; export type RaporGelir = { from?: string; to?: string; range_clamped?: boolean; campaigns?: ({ id?: string; name?: string; bot_name?: string; channel?: string; summary?: { orders?: number; cancelled?: number; refunded?: number; gross?: { amounts?: Record; stars?: number }; net?: { amounts?: Record; stars?: number }; unpriced_items?: number }; cost?: { amount?: number | null; currency?: string | null; mixed?: Record | null }; manual_cost?: { amount?: number | null; currency?: string | null }; roi?: { value?: number | null; reason?: string | null } })[]; links?: ({ id?: string; name?: string; bot_name?: string; channel?: string; summary?: { orders?: number; cancelled?: number; refunded?: number; gross?: { amounts?: Record; stars?: number }; net?: { amounts?: Record; stars?: number }; unpriced_items?: number }; cost?: { amount?: number | null; currency?: string | null; mixed?: Record | null }; manual_cost?: { amount?: number | null; currency?: string | null }; roi?: { value?: number | null; reason?: string | null }; code?: string; new_contacts?: number; cost_per_contact?: { value?: number | null; currency?: string | null; reason?: string | null } })[]; ads?: ({ id?: string; name?: string; source_type?: string; source_url?: string | null; new_contacts?: number; summary?: { orders?: number; cancelled?: number; refunded?: number; gross?: { amounts?: Record; stars?: number }; net?: { amounts?: Record; stars?: number }; unpriced_items?: number }; cost?: { amount?: number | null; currency?: string | null; mixed?: Record | null }; roi?: { value?: number | null; reason?: string | null }; cost_per_contact?: { value?: number | null; currency?: string | null; reason?: string | null } })[]; totals?: { campaigns?: { orders?: number; cancelled?: number; refunded?: number; gross?: { amounts?: Record; stars?: number }; net?: { amounts?: Record; stars?: number }; unpriced_items?: number }; links?: { orders?: number; cancelled?: number; refunded?: number; gross?: { amounts?: Record; stars?: number }; net?: { amounts?: Record; stars?: number }; unpriced_items?: number }; store?: { orders?: number; cancelled?: number; refunded?: number; gross?: { amounts?: Record; stars?: number }; net?: { amounts?: Record; stars?: number }; unpriced_items?: number }; ads?: { orders?: number; cancelled?: number; refunded?: number; gross?: { amounts?: Record; stars?: number }; net?: { amounts?: Record; stars?: number }; unpriced_items?: number } }; conversions?: { campaigns?: { target?: string; total?: number; converted?: { currency?: string; amount?: number; equivalent?: number }[]; unconverted?: Record; stars?: number }; links?: { target?: string; total?: number; converted?: { currency?: string; amount?: number; equivalent?: number }[]; unconverted?: Record; stars?: number }; store?: { target?: string; total?: number; converted?: { currency?: string; amount?: number; equivalent?: number }[]; unconverted?: Record; stars?: number }; ads?: { target?: string; total?: number; converted?: { currency?: string; amount?: number; equivalent?: number }[]; unconverted?: Record; stars?: number } }; exchange_rate?: { usd_try?: number; date?: string } | null; out_of_scope?: { miniapp_orders?: number; orders_without_contact?: number; store_orders?: number | null; store_unmatched?: number | null }; truncated?: boolean }; export type RaporKullanim = { plan?: string; limits?: { bots?: number; seats?: number; workspaces?: number; monthly_messages?: number; monthly_ai_replies?: number; campaigns?: boolean; api?: boolean; miniapps?: boolean }; messages?: { used?: number; limit?: number; extra_credits?: number }; ai_replies?: { used?: number; limit?: number; extra_credits?: number }; ai_tokens?: { input?: number; output?: number; total?: number }; breakdown?: RaporKullanimKirilimi }; export type RaporKullanimKirilimi = { group_by?: "bot" | "channel"; rows?: ({ key?: string; bot_id?: string | null; name?: string | null; channel?: "telegram" | "whatsapp" | null; messages_out?: number; ai_replies?: number; media?: number; meta_estimate_usd?: number | null })[]; totals?: { messages_out?: number; ai_replies?: number; media?: number; meta_estimate_usd?: number | null } }; export type RaporMaliyet = { kind?: "campaign" | "link"; id?: string; amount?: number | null; currency?: string | null }; export type ApiUyarisi = { code?: string; message?: string }; export type Topluluk = { id?: string; bot_id?: string; bot_name?: string; bot_username?: string | null; chat_id?: string; type?: string; title?: string; username?: string | null; bot_status?: string; member_count?: number; last_activity_at?: string | null; created_at?: string }; export type ToplulukAyrintisi = { id?: string; bot_id?: string; bot_name?: string; bot_username?: string | null; chat_id?: string; type?: string; title?: string; username?: string | null; bot_status?: string; member_count?: number; last_activity_at?: string | null; created_at?: string; bot_permissions?: Record; welcome_enabled?: boolean; welcome_message?: string; welcome_delete_after_sec?: number; ai_enabled?: boolean; ai_hourly_limit?: number; join_request_mode?: "manual" | "approve" | "verify"; join_request_message?: string; join_request_button?: string; join_approved_message?: string; rules?: { block_links?: boolean; block_forwards?: boolean; banned_words?: string[]; flood_count?: number; flood_seconds?: number; action?: "delete" | "warn" | "mute"; exempt_admins?: boolean }; forum_topics?: { id?: number; name?: string }[]; updated_at?: string }; export type ToplulukGuncelleme = { community?: ToplulukAyrintisi; warnings?: ApiUyarisi[] }; export type DavetBaglantisi = { id?: string; community_id?: string; name?: string; invite_link?: string; member_limit?: number | null; expires_at?: string | null; join_request?: boolean; joins?: number; leaves?: number; status?: "active" | "revoked" | "expired" | "full"; revoked_at?: string | null; created_at?: string }; export type PlanliGonderi = { id?: string; community_id?: string; batch_id?: string | null; topic_id?: number | null; text?: string; image_url?: string | null; button_text?: string | null; button_url?: string | null; silent?: boolean; pin?: boolean; repeat?: "none" | "daily" | "weekly"; status?: "pending_approval" | "rejected" | "scheduled" | "sending" | "sent" | "failed" | "uncertain" | "canceled"; scheduled_at?: string; retry_at?: string | null; attempts?: number; message_id?: string | null; simulated?: boolean; error?: string | null; reject_reason?: string | null; created_by?: string | null; reviewed_at?: string | null; sent_at?: string | null; clicks?: number | null; created_at?: string; updated_at?: string }; export type PlanliGonderiAyrintisi = { id?: string; community_id?: string; batch_id?: string | null; topic_id?: number | null; text?: string; image_url?: string | null; button_text?: string | null; button_url?: string | null; silent?: boolean; pin?: boolean; repeat?: "none" | "daily" | "weekly"; status?: "pending_approval" | "rejected" | "scheduled" | "sending" | "sent" | "failed" | "uncertain" | "canceled"; scheduled_at?: string; retry_at?: string | null; attempts?: number; message_id?: string | null; simulated?: boolean; error?: string | null; reject_reason?: string | null; created_by?: string | null; reviewed_at?: string | null; sent_at?: string | null; clicks?: number | null; created_at?: string; updated_at?: string; batch_status?: "pending_approval" | "rejected" | "scheduled" | "sending" | "sent" | "partial" | "failed" | "uncertain" | "canceled" | null; targets?: ({ id?: string; community_id?: string; status?: "pending_approval" | "rejected" | "scheduled" | "sending" | "sent" | "failed" | "uncertain" | "canceled" })[] }; export type PlanliGonderiSonucu = { batch_id?: string | null; posts?: PlanliGonderi[]; warnings?: ApiUyarisi[]; whatsapp_campaign?: { id?: string; status?: string; audience_count?: number } | null }; export type GonderiTakvimi = { month?: string; timezone?: string; days?: ({ date?: string; in_month?: boolean; posts?: ({ id?: string; batch_id?: string | null; status?: "pending_approval" | "rejected" | "scheduled" | "sending" | "sent" | "partial" | "failed" | "uncertain" | "canceled"; scheduled_at?: string; repeat?: "none" | "daily" | "weekly"; text?: string; targets?: ({ id?: string; community_id?: string; community_title?: string; status?: "pending_approval" | "rejected" | "scheduled" | "sending" | "sent" | "failed" | "uncertain" | "canceled" })[] })[] })[] }; export type OrganizasyonAyari = { id?: string; name?: string; slug?: string; plan?: string; brand?: { name?: string | null; logo_url?: string | null; color?: string | null }; timezone?: string; campaign_frequency_hours?: number; quiet_hours_start?: number | null; quiet_hours_end?: number | null; campaign_four_eyes?: boolean; business_hours?: { days?: number[]; start?: string; end?: string; message?: string } | null; csat?: { question?: string; thank_you?: string } | null; sla_target_minutes?: number; sla_escalation?: boolean; test_mode?: boolean; data_retention_days?: number | null; suspended?: boolean; suspended_at?: string | null; created_at?: string; legal_hold?: boolean; legal_hold_at?: string | null }; export type IcerikPolitikasiAyari = { enabled?: boolean; blocked_phrases?: string[]; warned_phrases?: string[]; allowed_domains?: string[]; blocked_domains?: string[]; max_links?: number | null; max_caps_percent?: number | null }; export type AiAyari = { provider?: string; model?: string; monthly_limit?: number; anthropic_key_set?: boolean; openrouter_key_set?: boolean; openai_key_set?: boolean }; export type MagazaBaglantisi = { platform?: "woocommerce" | "shopify"; store_url?: string; notify_statuses?: string[]; language?: "tr" | "en"; notify_opted_out?: boolean; wa_template?: { name?: string; language?: string } | null; credentials_set?: boolean; webhook_secret_set?: boolean; last_error?: string | null; last_event_at?: string | null }; export type MedyaOgesi = { id?: string; url?: string; path?: string; name?: string | null; mime?: string; size?: number; created_at?: string }; export type MedyaKullanimi = { id?: string; in_use?: boolean; usages?: ({ place?: "campaign" | "scheduled_post" | "brand_logo" | "mini_app" | "automation" | "message"; count?: number })[] }; export type DenetimKaydi = { id?: string; action?: string; action_name?: string; category?: string; user_id?: string | null; target?: string | null; summary?: string; created_at?: string }; export type AbonelikOzeti = { plan?: string; limits?: { bots?: number; monthly_messages?: number; ai_replies?: number; seats?: number; workspaces?: number; campaigns?: boolean; api?: boolean; mini_apps?: boolean; storage_mb?: number }; usage?: { messages?: number; ai_replies?: number; bots?: number; seats?: number; storage_bytes?: number }; subscription?: { status?: string; plan?: string; period?: string; current_period_end?: string | null; canceled_at?: string | null } | null; ai_extra_credits?: number; price?: { currency?: "USD"; monthly_amount_cents?: number; yearly_amount_cents?: number }; manage_url?: string }; export type WebhookOlayi = "message.received" | "message.sent" | "conversation.handoff" | "contact.created" | "contact.consent_changed" | "campaign.completed" | "post.published" | "miniapp.submission" | "miniapp.order_updated"; export type EkipUyesi = { id?: string; user_id?: string; name?: string; email?: string; role?: "owner" | "admin" | "member"; bot_ids?: string[] | null; created_at?: string }; export type EkipDaveti = { id?: string; email?: string; role?: "admin" | "member"; expires_at?: string; created_at?: string }; export type WebhookTeslimi = { id?: string; event?: string; status?: "pending" | "delivered" | "failed"; attempts?: number; response_status?: number | null; error?: string | null; delivered_at?: string | null; created_at?: string }; export type ApiAnahtari = { id?: string; name?: string; prefix?: string; scopes?: string[]; access_level?: string; last_used_at?: string | null; revoked_at?: string | null; created_at?: string }; export type BagliUygulama = { id?: string; name?: string; scopes?: string[]; last_used_at?: string | null; created_at?: string }; export type ApiIstegi = { id?: string; method?: string; path?: string; status?: number; duration_ms?: number; credential?: { type?: "api_key" | "oauth"; id?: string | null; name?: string | null }; created_at?: string }; export type ApiIstekOzeti = { period_days?: number; total?: number; errors?: number; error_rate?: number; p95_ms?: number | null; requests?: ApiIstegi[] }; export type CrmBaglantisi = { platform?: "hubspot" | "pipedrive"; name?: string; status?: "aktif" | "hata"; token_set?: boolean; company_domain?: string | null; field_mapping?: { tag_field?: string | null; email_field?: string | null; order_as_deal?: boolean; deal_stage?: string | null; note_language?: "tr" | "en" }; last_sync_at?: string | null; last_error?: string | null; last_error_message?: string | null; last_error_at?: string | null; pending_jobs?: number; failed_jobs?: number; created_at?: string; updated_at?: string }; export type TelegramKomutMenusu = { bot_id?: string; commands?: { command?: string; description?: string }[] }; export type BotOdemeAyari = { bot_id?: string; card_payments_enabled?: boolean; provider_token_set?: boolean; test_mode?: boolean | null; refund_note?: string }; export type UrunBeslemeSonucu = { saved?: boolean; format?: "xml" | "csv" | "json"; mapping?: { id?: string; ad?: string; aciklama?: string; fiyat?: string; gorsel?: string; stok?: string }; total?: number; imported?: number; warnings?: ({ code?: "kesildi" | "stok_yok" | "eksik" | "tekrar" | "kirpildi" | "cikarilacak"; count?: number; message?: string })[]; products?: { id?: string; name?: string; price?: string; image_url?: string }[]; feed?: { url?: string | null; auto_refresh?: boolean; ai_knowledge?: boolean; synced_at?: string | null; checked_at?: string | null; error?: string | null } }; export type YayinOnayi = { id?: string; type?: "bot" | "miniapp"; target_id?: string; target_name?: string; version?: number; action?: "yapilandirma" | "geri_alma" | "arac_ekle" | "arac_guncelle" | "arac_durum" | "arac_sil" | "kaynak_ekle" | "kaynak_guncelle" | "kaynak_sil" | "yayin"; summary?: string[]; requested_by?: string | null; requested_at?: string; own_request?: boolean; api_key_request?: boolean }; export type YayinOnayiSonucu = { status?: "approved" | "rejected"; signing_secret?: string | null; tools_need_secret?: string[] }; export type TopluBotIslemi = { action?: "pause" | "resume" | "update"; summary?: { total?: number; succeeded?: number; unchanged?: number; pending_approval?: number; skipped?: number }; results?: ({ bot_id?: string; name?: string | null; status?: "succeeded" | "unchanged" | "pending_approval" | "skipped"; reason?: "not_found" | "forbidden_role" | "plan_limit" | "not_connected" | "error" | null; version?: number | null })[] }; export type FiloDegerlendirmeBaslatma = { dry_run?: boolean; responses_needed?: number; quota_left?: number | null; quota_enough?: boolean; key_set?: boolean; in_progress?: boolean; queued?: number; run_ids?: string[]; bots?: ({ bot_id?: string; name?: string; cases?: number; skipped_reason?: "no_cases" | "plan_limit" | null })[] }; export type FiloDegerlendirmeOzeti = { in_progress?: boolean; queued?: number; overview?: { bots?: number; evaluated?: number; average_pass_rate?: number | null; improved?: number; worsened?: number }; bots?: ({ bot_id?: string; name?: string; channel?: string; cases?: number; status?: "queued" | "running" | "completed" | "aborted" | null; last_run?: { id?: string; finished_at?: string; summary?: { total?: number; passed?: number; failed?: number; errored?: number; not_run?: number }; pass_rate?: number | null } | null; previous_pass_rate?: number | null; change?: number | null })[] }; export type RaporMaliyetIceAktarma = { imported?: number; updated?: number; errors?: ({ line?: number; error?: "tur" | "hedef" | "tutar" | "birim" | "donem" | "hedef_yok" | "tekrar" })[]; total?: number }; export type OrgBotSablonu = { id?: string; name?: string; description?: string; channel?: "telegram" | "whatsapp"; knowledge_count?: number; tool_count?: number; created_by?: string | null; created_at?: string; updated_at?: string }; export type OrgBotSablonuAyrinti = { id?: string; name?: string; description?: string; channel?: "telegram" | "whatsapp"; knowledge_count?: number; tool_count?: number; created_by?: string | null; created_at?: string; updated_at?: string; file?: Record }; export type OrgBotSablonuKaydi = { template?: OrgBotSablonu; urls?: ({ kind?: "tool" | "knowledge"; name?: string; url?: string; has_query?: boolean })[] }; export type OrgSablondanBot = { bot_id?: string; name?: string; knowledge_count?: number; tools?: { name?: string; signing_secret?: string }[] }; export type BuyumeKampanyasi = { id?: string; name?: string; goal_contacts?: number; starts_on?: string; ends_on?: string; budget?: { amount?: number; currency?: string } | null; status?: "scheduled" | "active" | "ended"; created_at?: string; updated_at?: string; acquisition_links?: number; invite_links?: number; new_contacts?: number; progress_percent?: number }; export type BuyumeKampanyaRaporu = { campaign?: BuyumeKampanyasi; range?: { from?: string; to?: string } | null; days_left?: number; progress?: { new_contacts?: number; goal_contacts?: number; percent?: number; remaining?: number }; funnel?: { clicks?: number | null; starts?: number; new_contacts?: number; activated_contacts?: number; orders?: number; paid_orders?: number; joins?: number; leaves?: number }; rates?: { contacts_per_start?: number | null; activation?: number | null; paid_per_order?: number | null; member_retention?: number | null }; revenue?: { orders?: number; cancelled?: number; refunded?: number; gross?: { amounts?: Record; stars?: number }; net?: { amounts?: Record; stars?: number }; unpriced_items?: number }; spend?: { amount?: number | null; currency?: string | null; mixed?: Record | null }; cost?: { amount?: number | null; currency?: string | null; mixed?: Record | null }; cost_source?: "spend" | "budget" | null; budget_usage_percent?: number | null; cost_per_contact?: { value?: number | null; currency?: string | null; reason?: "maliyet_yok" | "kisi_yok" | null }; roi?: { value?: number | null; reason?: "maliyet_yok" | "maliyet_sifir" | "para_birimi" | null }; acquisition_links?: ({ id?: string; kind?: "acquisition_link"; name?: string; code?: string; bot_id?: string; bot_name?: string; url?: string | null; clicks?: number | null; starts?: number; new_contacts?: number; activated_contacts?: number; paid_orders?: number; revenue?: { orders?: number; cancelled?: number; refunded?: number; gross?: { amounts?: Record; stars?: number }; net?: { amounts?: Record; stars?: number }; unpriced_items?: number }; cost?: { amount?: number | null; currency?: string | null; mixed?: Record | null }; cost_per_contact?: { value?: number | null; currency?: string | null; reason?: "maliyet_yok" | "kisi_yok" | null }; roi?: { value?: number | null; reason?: "maliyet_yok" | "maliyet_sifir" | "para_birimi" | null } })[]; invite_links?: ({ id?: string; kind?: "invite_link"; name?: string; community_id?: string; community_name?: string; invite_link?: string; joins?: number; leaves?: number; net_members?: number; revoked?: boolean; expires_at?: string | null })[]; truncated?: boolean }; export type BuyumeKampanyaKaynagi = { id?: string; kind?: "acquisition_link" | "invite_link"; name?: string; code?: string | null; url?: string | null }; export type WhatsAppHesabi = { id?: string; waba_id?: string; business_id?: string | null; name?: string | null; display_name?: string; currency?: string | null; timezone_id?: string | null; embedded?: boolean; status?: "bagli" | "uyari" | "hata" | "bagli_degil"; access_token_set?: boolean; app_secret_set?: boolean; last_synced_at?: string | null; last_error?: string | null; phone_numbers?: ({ bot_id?: string; bot_name?: string; bot_status?: string; display_phone?: string | null; phone_number_id?: string | null; quality?: "GREEN" | "YELLOW" | "RED" | "UNKNOWN" | null; messaging_limit?: string | null; delivery_score?: number | null; last_webhook_at?: string | null; last_error?: string | null })[]; created_at?: string; updated_at?: string }; export type WhatsAppHesapSablonu = { id?: string; name?: string; language?: string; category?: string | null; status?: string | null; body?: string; rejected_reason?: string | null }; export type Baglanti = { id?: string; kind?: "telegram_bot" | "whatsapp_number" | "whatsapp_account" | "store" | "crm" | "ai_tool" | "webhook" | "oauth_app" | "product_feed"; name?: string; detail?: string | null; status?: "bagli" | "uyari" | "hata" | "kapali" | "bagli_degil"; bot_id?: string | null; bot_name?: string | null; last_event_at?: string | null; last_error?: string | null; panel_path?: string }; // export interface SayfaGirdisi { id: string; limit?: number; cursor?: string } export interface Silindi { id: string; deleted: boolean } /** Jeton ve sırlar bu görünümde yoktur; yalnız connected bilgisi döner. */ export interface BotAyrinti { id: string; name: string; channel: Kanal; status: string; connected: boolean; persona: string; welcome_message: string; handoff_keyword: string; ai_enabled: boolean; voice_transcription: boolean; image_understanding: boolean; ai_tools: boolean; telegram_username: string | null; whatsapp_phone: string | null; whatsapp_phone_number_id: string | null; whatsapp_business_account_id: string | null; whatsapp_embedded: boolean; whatsapp_app_secret_set: boolean; webhook_url: string | null; webhook_verified_at: string | null; last_webhook_at: string | null; last_error: string | null; created_at: string; updated_at: string } export interface BotGuncelle { name?: string; persona?: string; welcome_message?: string; handoff_keyword?: string; ai_enabled?: boolean; voice_transcription?: boolean; image_understanding?: boolean; ai_tools?: boolean } export interface BotOlustur extends BotGuncelle { name: string; channel: Kanal; template?: "eticaret" | "restoran" | "randevu" | "egitim" | "destek"; language?: "tr" | "en"; faqs?: { question: string; answer: string }[] } export type BotBagla = { token: string } | { phone_number_id: string; business_account_id: string; access_token: string; app_secret?: string; webhook_verify_token?: string }; export interface BotSablonu { code: string; sector: string; name: string; description: string; persona: string; welcome_message: string; handoff_keyword: string; faqs: { question: string; answer: string }[] } export interface BilgiKaynagi { id: string; bot_id: string; type: "text" | "faq" | "url"; title: string; length: number; url: string | null; status: string; freshness: "taze" | "eskidi" | "hata" | "gozden_gecir"; last_error: string | null; fetched_at: string | null; created_at: string } export interface BilgiKaynagiAyrinti extends BilgiKaynagi { content: string; question: string | null; answer: string | null } export interface BilgiKaynagiOlustur { type: "text" | "faq" | "url" | "file"; title: string; content?: string; question?: string; answer?: string; url?: string; file_name?: string; file_base64?: string } export interface OzelAracAlani { name: string; type: "string" | "number" | "boolean" | "enum"; required?: boolean; description?: string; options?: string[] } export interface OzelArac { id: string; name: string; description: string; fields: OzelAracAlani[]; url: string | null; host: string; secret_header_name: string | null; enabled: boolean; last_called_at: string | null; last_status: number | null } export interface OzelAracOlustur { name: string; description: string; url: string; fields?: OzelAracAlani[]; secret_header_name?: string; secret_header_value?: string; enabled?: boolean } export interface AlanFarki { field: string; before: string | boolean; after: string | boolean } export interface BotSurumu { id: string; version: number; created_at: string; source: "panel" | "api" | "geri_alma"; restored_from_version: number | null; readable: boolean; changes: AlanFarki[]; truncated: boolean } export interface TelegramVitrinDili { name: string; short_description: string; description: string } export interface BotVitrini { channel: Kanal; tr?: TelegramVitrinDili; en?: TelegramVitrinDili; about?: string; description?: string; vertical?: string; website?: string | null } export type BotVitrinGuncelle = { tr: TelegramVitrinDili; en: TelegramVitrinDili } | { about: string; vertical: string; description?: string; website?: string }; export interface DegerlendirmeVakasi { id: string; question: string; must_include: string[]; must_not_include: string[]; expect_handoff: boolean } export interface DegerlendirmeOzeti { total: number; passed: number; failed: number; errored: number; not_run: number } export interface DegerlendirmeCalistirma { id: string; kind: "cases" | "security"; status: string; started_at: string; finished_at: string | null; model: string | null; summary: DegerlendirmeOzeti } export interface EdinmeBaglantisi { id: string; name: string; code: string; prefill_text: string; url: string | null; starts: number; new_contacts: number; orders: number; last_start_at: string | null; created_at: string } export interface WhatsAppSablonu { id: string; name: string; language: string; category: string | null; status: string | null; body: string; rejected_reason: string | null } export interface WhatsAppSablonuOlustur { name: string; category: "MARKETING" | "UTILITY"; language: string; body: string; header?: string; examples?: string[]; footer?: string; buttons?: Record[] } export interface AiGeriBildirim { id: string; conversation_id: string; question: string | null; reply: string; note: string | null; created_at: string | null } export declare class HibotyHatasi extends Error { readonly status: number; readonly code: string; readonly retryAfter: number | null; readonly body: unknown; } export declare class Hiboty { constructor(secenekler: { apiKey: string; baseUrl?: string; fetch?: typeof fetch; lang?: "tr" | "en" }); lang?: "tr" | "en"; rateLimit: { limit: number; remaining: number; reset: number } | null; sendMessage(govde: MesajGonder, secenek?: IdempotencySecenegi): Promise<{ id: string; status: "sent"; bot_id: string; to: string; template?: string }>; listMessages(p: { conversation_id: string; limit?: number; cursor?: string }): Promise>; listBots(p?: { limit?: number; cursor?: string }): Promise>; createBot(govde: BotOlustur, secenek?: IdempotencySecenegi): Promise<{ data: BotAyrinti }>; listBotTemplates(p?: { sector?: string; language?: "tr" | "en" }): Promise<{ data: BotSablonu[] }>; createBotDraft(govde: { description?: string; website?: string }): Promise<{ data: { persona: string; welcome_message: string; faqs: { question: string; answer: string }[]; website_error: string | null } }>; importBot(govde: { file: string | Record }, secenek?: IdempotencySecenegi): Promise<{ data: { bot_id: string; name: string; knowledge_count: number; tools: { name: string; signing_secret: string }[] } }>; previewBotImport(govde: { file: string | Record }): Promise<{ data: Record }>; getBot(id: string): Promise<{ data: BotAyrinti }>; updateBot(id: string, govde: BotGuncelle): Promise<{ data: BotAyrinti }>; deleteBot(id: string): Promise<{ data: Silindi }>; connectBot(id: string, govde: BotBagla, secenek?: IdempotencySecenegi): Promise<{ data: BotAyrinti & { warning: string | null } }>; disconnectBot(id: string): Promise<{ data: BotAyrinti }>; pauseBot(id: string): Promise<{ data: BotAyrinti }>; resumeBot(id: string): Promise<{ data: BotAyrinti }>; getBotReadiness(id: string): Promise<{ data: { ready: boolean; items: { key: string; status: string; group: string; count: [number, number] | null }[] } }>; exportBot(id: string): Promise<{ data: { file_name: string; file: Record; knowledge_count: number; tool_count: number } }>; testBotReply(id: string, govde: { messages: { role: "user" | "assistant"; content: string }[] }): Promise<{ data: { reply: string } }>; listKnowledgeSources(p: SayfaGirdisi): Promise>; createKnowledgeSource(id: string, govde: BilgiKaynagiOlustur, secenek?: IdempotencySecenegi): Promise<{ data: BilgiKaynagiAyrinti }>; getKnowledgeSource(id: string, source_id: string): Promise<{ data: BilgiKaynagiAyrinti }>; updateKnowledgeSource(id: string, source_id: string, govde: { title: string; content?: string; question?: string; answer?: string }): Promise<{ data: BilgiKaynagiAyrinti }>; deleteKnowledgeSource(id: string, source_id: string): Promise<{ data: Silindi }>; refreshKnowledgeSource(id: string, source_id: string): Promise<{ data: BilgiKaynagiAyrinti & { changed: boolean } }>; listBotTools(p: SayfaGirdisi): Promise>; createBotTool(id: string, govde: OzelAracOlustur, secenek?: IdempotencySecenegi): Promise<{ data: OzelArac & { signing_secret: string } }>; updateBotTool(id: string, tool_id: string, govde: Partial & { remove_secret_header?: boolean }): Promise<{ data: OzelArac }>; deleteBotTool(id: string, tool_id: string): Promise<{ data: Silindi }>; testBotTool(id: string, tool_id: string, govde: { input: Record }): Promise<{ data: { success: boolean; uncertain: boolean; status: number | null; duration_ms: number; body: string; truncated: boolean; model_text: string } }>; listBotVersions(p: SayfaGirdisi): Promise>; getBotVersion(id: string, version_id: string): Promise<{ data: { version: number; changes: AlanFarki[]; restore: { available: boolean; changes: AlanFarki[]; skipped_fields: string[]; restore_token: string | null; reason: string | null } | null } }>; restoreBotVersion(id: string, version_id: string, govde: { restore_token: string }): Promise<{ data: { new_version: number; restored_version: number } }>; getBotProfile(id: string): Promise<{ data: BotVitrini }>; updateBotProfile(id: string, govde: BotVitrinGuncelle): Promise<{ data: { changed: number } }>; suggestBotProfile(id: string): Promise<{ data: BotVitrini }>; listBotEvalCases(p: SayfaGirdisi): Promise>; createBotEvalCase(id: string, govde: Omit, secenek?: IdempotencySecenegi): Promise<{ data: DegerlendirmeVakasi }>; updateBotEvalCase(id: string, case_id: string, govde: Omit): Promise<{ data: DegerlendirmeVakasi }>; deleteBotEvalCase(id: string, case_id: string): Promise<{ data: Silindi }>; listBotEvalRuns(p: SayfaGirdisi): Promise>; runBotEval(id: string, govde: { kind: "cases" | "security" }, secenek?: IdempotencySecenegi): Promise<{ data: { id: string; summary: DegerlendirmeOzeti } }>; getBotEvalRun(id: string, run_id: string): Promise<{ data: DegerlendirmeCalistirma & { comparison: { improved: number; worsened: number; added: number; removed: number } | null; results: Record[] } }>; listAcquisitionLinks(p: SayfaGirdisi): Promise>; createAcquisitionLink(id: string, govde: { name: string; code?: string; prefill_text?: string }, secenek?: IdempotencySecenegi): Promise<{ data: { id: string; name: string; code: string; prefill_text: string; url: string | null } }>; deleteAcquisitionLink(id: string, link_id: string): Promise<{ data: Silindi }>; listWhatsAppTemplates(p: SayfaGirdisi): Promise>; createWhatsAppTemplate(id: string, govde: WhatsAppSablonuOlustur, secenek?: IdempotencySecenegi): Promise<{ data: { id: string; name: string; status: string } }>; deleteWhatsAppTemplate(id: string, name: string): Promise<{ data: { name: string; deleted: boolean } }>; listAiFeedback(p: SayfaGirdisi): Promise>; resolveAiFeedback(id: string, message_id: string, govde: { action: "add_faq" | "dismiss"; question?: string; answer?: string }): Promise<{ data: { id: string; resolved: boolean; knowledge_source_id: string | null } }>; listContacts(p?: { bot_id?: string; limit?: number; cursor?: string }): Promise>; getContact(id: string): Promise<{ data: KisiAyrinti }>; updateContact(id: string, govde: KisiGuncelle): Promise<{ data: KisiAyrinti }>; getContactConsent(id: string): Promise<{ data: IzinDurumu }>; updateContactConsent(id: string, govde: { consent: "opted_in" | "opted_out"; tags?: string[] }): Promise<{ data: { id: string; consent: Izin; tags?: string[] } }>; listConversations(p?: { bot_id?: string; status?: SohbetDurumu; limit?: number; cursor?: string }): Promise>; updateConversationStatus(id: string, status: SohbetDurumu): Promise<{ data: { id: string; status: SohbetDurumu; previous_status: SohbetDurumu; assigned_user_id: string | null; closed_at: string | null } }>; listCampaigns(p?: { bot_id?: string; status?: KampanyaDurumu; limit?: number; cursor?: string }): Promise>; createCampaign(govde: KampanyaOlustur, secenek?: IdempotencySecenegi): Promise<{ data: Kampanya }>; getCampaign(id: string): Promise<{ data: Kampanya & { results: { variant: string; audience: number; sent: number; failed: number; replied: number }[] } }>; cancelCampaign(id: string): Promise<{ data: Kampanya }>; listMiniApps(p?: { bot_id?: string; limit?: number; cursor?: string }): Promise>; listMiniAppSubmissions(p: { id: string; kind?: "form" | "order"; limit?: number; cursor?: string }): Promise>; updateOrder(id: string, govde: { status: "yeni" | "hazirlaniyor" | "tamamlandi" | "iptal"; notify?: boolean }): Promise<{ data: { id: string; status: string; notification?: { sent: false; error: string } } }>; listAutomations(p?: { bot_id?: string; limit?: number; cursor?: string }): Promise>; updateAutomation(id: string, govde: { active: boolean }): Promise<{ data: Otomasyon }>; listTemplates(p: { bot_id: string }): Promise<{ data: { name: string; language: string; category: string | null; parameter_count: number }[] }>; listWebhooks(): Promise<{ data: WebhookKaydi[] }>; createWebhook(govde: { url: string; events: WebhookOlayi[]; description?: string }): Promise<{ data: WebhookKaydi & { secret: string } }>; deleteWebhook(id: string): Promise<{ data: { id: string; deleted: boolean } }>; enableWebhook(id: string): Promise<{ data: WebhookKaydi }>; getUsage(): Promise<{ data: { plan: string; messages: { used: number; limit: number }; ai_replies: { used: number; limit: number } } }>; // scripts/sdk-uret.ts üretir; elle düzenlemeyin. createAutomation(govde: { bot_id: string; name: string; trigger: "yeni_kisi" | "anahtar_kelime" | "etiket_eklendi" | "sessiz" | "miniapp_gonderim"; trigger_config?: Record; steps?: Record[] }, secenek?: IdempotencySecenegi): Promise<{ data: OtomasyonDetayi }>; getAutomation(id: string): Promise<{ data: OtomasyonDetayi }>; saveAutomation(id: string, govde: { name: string; trigger_config: Record; steps: Record[] }): Promise<{ data: OtomasyonDetayi }>; deleteAutomation(id: string): Promise<{ data: { id: string; deleted: boolean } }>; listAutomationRuns(p: { id: string; limit?: number; cursor?: string }): Promise>; createMiniApp(govde: { bot_id: string; name: string; template: "katalog" | "form" | "baglanti"; form_preset?: "iletisim" | "randevu" | "anket" | "basvuru" | "bos" }, secenek?: IdempotencySecenegi): Promise<{ data: MiniAppDetayi }>; getMiniApp(id: string): Promise<{ data: MiniAppDetayi }>; updateMiniAppDraft(id: string, govde: { name?: string; config?: Record }): Promise<{ data: MiniAppDetayi }>; deleteMiniApp(id: string): Promise<{ data: { id: string; deleted: boolean } }>; publishMiniApp(id: string, secenek?: IdempotencySecenegi): Promise<{ data: MiniAppDetayi }>; unpublishMiniApp(id: string, secenek?: IdempotencySecenegi): Promise<{ data: MiniAppDetayi }>; rollbackMiniApp(id: string, govde: { version_id: string }, secenek?: IdempotencySecenegi): Promise<{ data: MiniAppDetayi }>; setMiniAppMenuButton(id: string, govde: { enabled: boolean }, secenek?: IdempotencySecenegi): Promise<{ data: MiniAppDetayi }>; listMiniAppVersions(p: { id: string; limit?: number; cursor?: string }): Promise>; getMiniAppPreview(id: string): Promise<{ data: MiniAppOnizlemesi }>; listOrders(p?: { status?: "yeni" | "hazirlaniyor" | "tamamlandi" | "iptal"; app_id?: string; limit?: number; cursor?: string }): Promise>; getOrder(id: string): Promise<{ data: Siparis }>; listCustomMiniAppRequests(p?: { limit?: number; cursor?: string }): Promise>; createCustomMiniAppRequest(govde: { title: string; description: string; examples?: string; budget?: string; takes_payment?: boolean; handles_personal_data?: boolean }, secenek?: IdempotencySecenegi): Promise<{ data: OzelMiniAppTalebi }>; getCustomMiniAppRequest(id: string): Promise<{ data: OzelMiniAppTalebi }>; acceptCustomMiniAppQuote(id: string, secenek?: IdempotencySecenegi): Promise<{ data: OzelMiniAppTalebi }>; approveCustomMiniAppPreview(id: string, secenek?: IdempotencySecenegi): Promise<{ data: OzelMiniAppTalebi }>; cancelCustomMiniAppRequest(id: string, secenek?: IdempotencySecenegi): Promise<{ data: OzelMiniAppTalebi }>; createContact(govde: { bot_id: string; external_id?: string; name?: string; username?: string; phone?: string; tags?: string[]; notes?: string; attributes?: OzelAlanlar }, secenek?: IdempotencySecenegi): Promise<{ data: KisiAyrinti }>; deleteContact(id: string): Promise<{ data: { id?: string; deleted?: boolean } }>; importContacts(govde: { bot_id: string; csv: string }, secenek?: IdempotencySecenegi): Promise<{ data: KisiIceAktarmaSonucu }>; exportContacts(p?: { consent?: "opted_in" | "opted_out" | "unknown"; tag?: string; q?: string; bot_id?: string; limit?: number; cursor?: string }): Promise<{ data: { csv?: string; row_count?: number; next_cursor?: string | null } }>; bulkContacts(govde: { operation: "tag_add" | "tag_remove" | "opt_out" | "delete"; ids: string[]; tag?: string }, secenek?: IdempotencySecenegi): Promise<{ data: { operation?: string; affected?: number } }>; clearContactMemory(id: string, secenek?: IdempotencySecenegi): Promise<{ data: { id?: string; memory_cleared?: boolean } }>; revokeContactLinks(id: string, secenek?: IdempotencySecenegi): Promise<{ data: { id?: string; links_revoked?: boolean } }>; linkContactProfile(id: string, govde: { other_contact_id: string }, secenek?: IdempotencySecenegi): Promise<{ data: { id?: string; other_contact_id?: string; profile_id?: string } }>; unlinkContactProfile(id: string): Promise<{ data: { id?: string; unlinked?: boolean } }>; listContactTags(p?: { limit?: number; cursor?: string }): Promise>; renameContactTag(govde: { tag: string; new_name: string }, secenek?: IdempotencySecenegi): Promise<{ data: { affected_contacts?: number } }>; mergeContactTags(govde: { tags: string[]; target: string }, secenek?: IdempotencySecenegi): Promise<{ data: { affected_contacts?: number } }>; deleteContactTags(govde: { tags: string[] }, secenek?: IdempotencySecenegi): Promise<{ data: { affected_contacts?: number } }>; listContactFields(p?: { limit?: number; cursor?: string }): Promise>; createContactField(govde: { key: string; label: string; type: "metin" | "sayi" | "tarih" | "secim"; options?: string[] }, secenek?: IdempotencySecenegi): Promise<{ data: KisiOzelAlani }>; updateContactField(id: string, govde: { label?: string; options?: string[]; ai_writable?: boolean }): Promise<{ data: { id?: string; key?: string; label?: string; type?: "metin" | "sayi" | "tarih" | "secim"; options?: string[]; ai_writable?: boolean; cleared_contacts?: number } }>; deleteContactField(id: string): Promise<{ data: { id?: string; deleted?: boolean; cleared_contacts?: number } }>; getConversation(id: string): Promise<{ data: SohbetAyrintisi }>; assignConversation(id: string, govde: { user_id: string | null }, secenek?: IdempotencySecenegi): Promise<{ data: SohbetAyrintisi }>; markConversationRead(id: string, secenek?: IdempotencySecenegi): Promise<{ data: SohbetAyrintisi }>; snoozeConversation(id: string, govde: { option: "1s" | "3s" | "yarin" | "pazartesi" | "custom" | null; until?: string }, secenek?: IdempotencySecenegi): Promise<{ data: SohbetAyrintisi }>; clearConversationFlood(id: string, secenek?: IdempotencySecenegi): Promise<{ data: SohbetAyrintisi }>; replyToConversation(id: string, govde: { body: string; image_url?: string }, secenek?: IdempotencySecenegi): Promise<{ data: { id?: string; conversation_id?: string; status?: "sent" } }>; listConversationNotes(p: { id: string; limit?: number; cursor?: string }): Promise>; createConversationNote(id: string, govde: { body: string }, secenek?: IdempotencySecenegi): Promise<{ data: SohbetNotu }>; deleteConversationNote(id: string, note_id: string): Promise<{ data: { id: string; deleted: boolean } }>; bulkConversations(govde: { operation: "close" | "assign" | "read"; ids: string[]; user_id?: string | null }, secenek?: IdempotencySecenegi): Promise<{ data: { operation?: "close" | "assign" | "read"; requested?: number; affected?: number; skipped?: number } }>; retryMessage(id: string, secenek?: IdempotencySecenegi): Promise<{ data: { id?: string; retried?: boolean } }>; rateAiReply(id: string, govde: { value: "up" | "down" | null; note?: string }, secenek?: IdempotencySecenegi): Promise<{ data: { id?: string; value?: "up" | "down" | null; note?: string | null; rated_at?: string | null } }>; listSavedReplies(p?: { limit?: number; cursor?: string }): Promise>; createSavedReply(govde: { shortcut: string; body: string }, secenek?: IdempotencySecenegi): Promise<{ data: HazirYanit }>; getSavedReply(id: string): Promise<{ data: HazirYanit }>; updateSavedReply(id: string, govde: { shortcut?: string; body?: string }): Promise<{ data: HazirYanit }>; deleteSavedReply(id: string): Promise<{ data: { id: string; deleted: boolean } }>; updateCampaign(id: string, govde: { name?: string; body?: string; body_b?: string | null; media_url?: string | null; template?: { name: string; language: string; params?: string[]; params_b?: string[] }; topic?: string | null; scheduled_at?: string | null; segment?: Record }): Promise<{ data: Kampanya }>; deleteCampaign(id: string): Promise<{ data: { id: string; deleted: boolean } }>; getCampaignResults(id: string): Promise<{ data: KampanyaSonuclari }>; countCampaignAudience(govde: { bot_id: string; segment?: Record; topic?: string }): Promise<{ data: KampanyaKitleSayisi }>; getCampaignBestTime(p: { bot_id: string }): Promise<{ data: KampanyaEnIyiSaat }>; getReportOverview(p?: { days?: 7 | 30 | 90 }): Promise<{ data: RaporGenelBakis }>; getDeliveryTelemetry(p?: { days?: 7 | 30 | 90 }): Promise<{ data: RaporTeslim }>; getAgentReport(p?: { days?: 7 | 30 | 90 }): Promise<{ data: RaporTemsilci }>; getCsatReport(p?: { days?: 7 | 30 | 90 }): Promise<{ data: RaporCsat }>; getAiQualityReport(p?: { days?: 7 | 30 | 90 }): Promise<{ data: RaporAiKalite }>; getCohortReport(): Promise<{ data: RaporKohort }>; getRevenueReport(p?: { from?: string; to?: string }): Promise<{ data: RaporGelir }>; getUsageReport(p?: { group_by?: "bot" | "channel" }): Promise<{ data: RaporKullanim }>; setReportCost(kind: string, id: string, govde: { amount: number | null; currency?: "TRY" | "USD" | "EUR" }): Promise<{ data: RaporMaliyet }>; listCommunities(p?: { bot_id?: string; limit?: number; cursor?: string }): Promise>; getCommunity(id: string): Promise<{ data: ToplulukAyrintisi }>; updateCommunity(id: string, govde: { welcome_enabled?: boolean; welcome_message?: string; welcome_delete_after_sec?: 0 | 60 | 300 | 1800 | 3600; ai_enabled?: boolean; ai_hourly_limit?: number; join_request_mode?: "manual" | "approve" | "verify"; join_request_message?: string; join_request_button?: string; join_approved_message?: string; rules?: { block_links?: boolean; block_forwards?: boolean; banned_words?: string[]; flood_count?: number; flood_seconds?: number; action?: "delete" | "warn" | "mute"; exempt_admins?: boolean } }): Promise<{ data: ToplulukGuncelleme }>; removeCommunity(id: string): Promise<{ data: { id: string; deleted: boolean } }>; refreshBotWebhook(id: string): Promise<{ data: { id?: string; webhook_refreshed?: boolean } }>; refreshCommunityMembers(id: string, secenek?: IdempotencySecenegi): Promise<{ data: { id?: string; member_count?: number } }>; listCommunityInviteLinks(p: { id: string; limit?: number; cursor?: string }): Promise>; createCommunityInviteLink(id: string, govde: { name: string; member_limit?: number | null; expires_in_days?: number | null; join_request?: boolean }, secenek?: IdempotencySecenegi): Promise<{ data: DavetBaglantisi }>; revokeCommunityInviteLink(id: string, link_id: string): Promise<{ data: DavetBaglantisi }>; listScheduledPosts(p?: { community_id?: string; status?: "pending_approval" | "rejected" | "scheduled" | "sending" | "sent" | "failed" | "uncertain" | "canceled"; from?: string; to?: string; limit?: number; cursor?: string }): Promise>; createScheduledPost(govde: { community_ids: string[]; text: string; publish_now?: boolean; topic_ids?: Record; image_url?: string | null; button_text?: string | null; button_url?: string | null; silent?: boolean; pin?: boolean; repeat?: "none" | "daily" | "weekly"; scheduled_at?: string; whatsapp?: { bot_id: string; template_name: string; template_language: string; template_params?: string[]; topic?: string } }, secenek?: IdempotencySecenegi): Promise<{ data: PlanliGonderiSonucu }>; getPostCalendar(p?: { month?: string }): Promise<{ data: GonderiTakvimi }>; getScheduledPost(id: string): Promise<{ data: PlanliGonderiAyrintisi }>; updateScheduledPost(id: string, govde: { text?: string; topic_ids?: Record; image_url?: string | null; button_text?: string | null; button_url?: string | null; silent?: boolean; pin?: boolean; repeat?: "none" | "daily" | "weekly"; scheduled_at?: string }): Promise<{ data: PlanliGonderiSonucu }>; cancelScheduledPost(id: string): Promise<{ data: { id?: string; canceled?: boolean; canceled_targets?: number; sent_targets?: number } }>; publishScheduledPost(id: string, secenek?: IdempotencySecenegi): Promise<{ data: PlanliGonderiSonucu }>; approveScheduledPost(id: string, secenek?: IdempotencySecenegi): Promise<{ data: PlanliGonderiSonucu }>; rejectScheduledPost(id: string, govde: { reason?: string }, secenek?: IdempotencySecenegi): Promise<{ data: PlanliGonderiSonucu }>; resendUncertainPost(id: string, secenek?: IdempotencySecenegi): Promise<{ data: PlanliGonderiSonucu }>; getOrganization(): Promise<{ data: OrganizasyonAyari }>; updateOrganization(govde: { name?: string; brand?: { name?: string | null; logo_url?: string | null; color?: string | null }; timezone?: string; campaign_frequency_hours?: 0 | 12 | 24 | 48 | 72 | 168; quiet_hours_start?: number | null; quiet_hours_end?: number | null; business_hours?: { days: number[]; start: string; end: string; message: string } | null; csat?: { question: string; thank_you: string } | null; sla_target_minutes?: 5 | 15 | 30 | 60 | 120 | 240 | 480 | 1440; sla_escalation?: boolean; test_mode?: boolean; data_retention_days?: 90 | 180 | 365 | 730 | null }): Promise<{ data: OrganizasyonAyari }>; getContentPolicy(): Promise<{ data: IcerikPolitikasiAyari }>; updateContentPolicy(govde: { enabled: boolean; blocked_phrases?: string[]; warned_phrases?: string[]; allowed_domains?: string[]; blocked_domains?: string[]; max_links?: number | null; max_caps_percent?: number | null }): Promise<{ data: IcerikPolitikasiAyari }>; getAiSettings(): Promise<{ data: AiAyari }>; updateAiSettings(govde: { provider?: "anthropic" | "openrouter" | "openai"; model?: string; monthly_limit?: number; api_key?: string; remove_key?: boolean }): Promise<{ data: AiAyari }>; listStores(p?: { limit?: number; cursor?: string }): Promise>; saveStore(platform: string, govde: { store_url: string; key?: string; secret?: string; token?: string; webhook_secret?: string; notify_statuses?: string[]; language?: "tr" | "en"; notify_opted_out?: boolean; wa_template?: { name: string; language: string } | null }): Promise<{ data: MagazaBaglantisi }>; deleteStore(platform: string): Promise<{ data: { platform?: "woocommerce" | "shopify"; deleted?: boolean } }>; testStore(platform: string): Promise<{ data: { connected?: boolean; error?: string | null } }>; listMedia(p?: { q?: string; limit?: number; cursor?: string }): Promise>; uploadMedia(govde: { file_name: string; file_base64: string }, secenek?: IdempotencySecenegi): Promise<{ data: MedyaOgesi }>; getMediaUsage(id: string): Promise<{ data: MedyaKullanimi }>; deleteMedia(id: string): Promise<{ data: { id: string; deleted: boolean } }>; listAuditLogs(p?: { category?: "auth" | "account" | "org" | "team" | "bot" | "conversation" | "contact" | "campaign" | "automation" | "knowledge" | "community" | "post" | "miniapp" | "upload" | "apikey" | "webhook" | "plan" | "billing" | "affiliate" | "store"; user_id?: string; from?: string; to?: string; limit?: number; cursor?: string }): Promise>; getBilling(): Promise<{ data: AbonelikOzeti }>; listTeamMembers(p?: { limit?: number; cursor?: string }): Promise>; updateTeamMember(id: string, govde: { role?: "admin" | "member"; bot_ids?: string[] | null }): Promise<{ data: EkipUyesi }>; removeTeamMember(id: string): Promise<{ data: { id?: string; deleted?: boolean; unassigned_conversations?: number } }>; listTeamInvitations(p?: { limit?: number; cursor?: string }): Promise>; createTeamInvitation(govde: { email: string; role: "admin" | "member" }, secenek?: IdempotencySecenegi): Promise<{ data: { id?: string; email?: string; role?: "admin" | "member"; expires_at?: string; created_at?: string; email_sent?: boolean } }>; cancelTeamInvitation(id: string): Promise<{ data: { id: string; deleted: boolean } }>; getWebhook(id: string): Promise<{ data: WebhookKaydi }>; updateWebhook(id: string, govde: { url?: string; description?: string; events?: WebhookOlayi[]; active?: boolean }): Promise<{ data: WebhookKaydi }>; listWebhookDeliveries(p: { id: string; limit?: number; cursor?: string }): Promise>; testWebhook(id: string): Promise<{ data: { delivered?: boolean; status?: number | null } }>; listApiKeys(p?: { limit?: number; cursor?: string }): Promise>; revokeApiKey(id: string): Promise<{ data: { id: string; deleted: boolean } }>; listConnectedApps(p?: { limit?: number; cursor?: string }): Promise>; revokeConnectedApp(id: string): Promise<{ data: { id: string; deleted: boolean } }>; getApiRequestLog(p?: { days?: number; limit?: number }): Promise<{ data: ApiIstekOzeti }>; listCrmConnections(): Promise<{ data: CrmBaglantisi[] }>; saveCrmConnection(govde: { platform: "hubspot" | "pipedrive"; token?: string; company_domain?: string; field_mapping?: { tag_field?: string | null; email_field?: string | null; order_as_deal?: boolean; deal_stage?: string | null; note_language?: "tr" | "en" } }): Promise<{ data: CrmBaglantisi }>; deleteCrmConnection(p: { platform: "hubspot" | "pipedrive" }): Promise<{ data: { platform?: "hubspot" | "pipedrive"; deleted?: boolean } }>; testCrmConnection(govde: { platform: "hubspot" | "pipedrive" }): Promise<{ data: { connected?: boolean; error?: string | null; error_message?: string | null; connection?: CrmBaglantisi } }>; setBotCommands(id: string, govde: { commands?: { command: string; description: string }[] }): Promise<{ data: TelegramKomutMenusu }>; getBotPaymentSettings(id: string): Promise<{ data: BotOdemeAyari }>; updateBotPaymentSettings(id: string, govde: { provider_token: string | null }): Promise<{ data: BotOdemeAyari }>; importMiniAppFeed(id: string, govde: { url?: string; content?: string; format?: "xml" | "csv" | "json"; dry_run?: boolean; auto_refresh?: boolean; ai_knowledge?: boolean }, secenek?: IdempotencySecenegi): Promise<{ data: UrunBeslemeSonucu }>; listPublishApprovals(p?: { bot_id?: string; miniapp_id?: string; limit?: number; cursor?: string }): Promise>; approveBotVersion(id: string, version_id: string): Promise<{ data: YayinOnayiSonucu }>; rejectBotVersion(id: string, version_id: string): Promise<{ data: YayinOnayiSonucu }>; approveMiniAppVersion(id: string, version_id: string): Promise<{ data: MiniAppDetayi }>; rejectMiniAppVersion(id: string, version_id: string): Promise<{ data: MiniAppDetayi }>; bulkBotAction(govde: { action: "pause" | "resume" | "update"; bot_ids: string[]; settings?: { ai_enabled?: boolean; handoff_keyword?: string; voice_transcription?: boolean } }, secenek?: IdempotencySecenegi): Promise<{ data: TopluBotIslemi }>; runAllBotEvaluations(govde: { bot_ids?: string[]; dry_run?: boolean; max_responses?: number }, secenek?: IdempotencySecenegi): Promise<{ data: FiloDegerlendirmeBaslatma }>; getFleetEvaluation(): Promise<{ data: FiloDegerlendirmeOzeti }>; importReportCosts(govde: { csv?: string; rows?: ({ kind: "campaign" | "link" | "ad"; ref: string; amount: number; currency: "TRY" | "USD" | "EUR"; period_start: string; period_end: string })[] }): Promise<{ data: RaporMaliyetIceAktarma }>; listOrgBotTemplates(): Promise<{ data: OrgBotSablonu[] }>; createOrgBotTemplate(govde: { bot_id: string; name: string; description?: string }, secenek?: IdempotencySecenegi): Promise<{ data: OrgBotSablonuKaydi }>; getOrgBotTemplate(id: string): Promise<{ data: OrgBotSablonuAyrinti }>; updateOrgBotTemplate(id: string, govde: { name: string; description?: string }): Promise<{ data: OrgBotSablonu }>; deleteOrgBotTemplate(id: string): Promise<{ data: { id: string; deleted: boolean } }>; createBotFromOrgTemplate(id: string, govde: { name?: string; channel?: "telegram" | "whatsapp" }, secenek?: IdempotencySecenegi): Promise<{ data: OrgSablondanBot }>; listGrowthCampaigns(p?: { limit?: number; cursor?: string }): Promise>; createGrowthCampaign(govde: { name: string; goal_contacts: number; starts_on: string; ends_on: string; budget_amount?: number | null; budget_currency?: "TRY" | "USD" | "EUR" }, secenek?: IdempotencySecenegi): Promise<{ data: BuyumeKampanyasi }>; getGrowthCampaign(id: string): Promise<{ data: BuyumeKampanyasi }>; updateGrowthCampaign(id: string, govde: { name?: string; goal_contacts?: number; starts_on?: string; ends_on?: string; budget_amount?: number | null; budget_currency?: "TRY" | "USD" | "EUR" }): Promise<{ data: BuyumeKampanyasi }>; deleteGrowthCampaign(id: string): Promise<{ data: { id: string; deleted: boolean } }>; getGrowthCampaignReport(id: string): Promise<{ data: BuyumeKampanyaRaporu }>; addGrowthCampaignSource(id: string, govde: { kind: "acquisition_link" | "invite_link"; source_id?: string; bot_id?: string; community_id?: string; name?: string; code?: string; member_limit?: number | null; expires_in_days?: number | null; join_request?: boolean }, secenek?: IdempotencySecenegi): Promise<{ data: BuyumeKampanyaKaynagi }>; removeGrowthCampaignSource(id: string, source_id: string): Promise<{ data: { id: string; deleted: boolean } }>; listWhatsAppAccounts(p?: { limit?: number; cursor?: string }): Promise>; getWhatsAppAccount(id: string): Promise<{ data: WhatsAppHesabi }>; listWhatsAppAccountTemplates(p: { id: string; limit?: number; cursor?: string }): Promise>; listConnections(p?: { kind?: "telegram_bot" | "whatsapp_number" | "whatsapp_account" | "store" | "crm" | "ai_tool" | "webhook" | "oauth_app" | "product_feed"; status?: "bagli" | "uyari" | "hata" | "kapali" | "bagli_degil"; limit?: number; cursor?: string }): Promise>; paginate(metot: "listAutomationRuns", p: { id: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listMiniAppVersions", p: { id: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listOrders", p?: { status?: "yeni" | "hazirlaniyor" | "tamamlandi" | "iptal"; app_id?: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listCustomMiniAppRequests", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listContactTags", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listContactFields", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listConversationNotes", p: { id: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listSavedReplies", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listCommunities", p?: { bot_id?: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listCommunityInviteLinks", p: { id: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listScheduledPosts", p?: { community_id?: string; status?: "pending_approval" | "rejected" | "scheduled" | "sending" | "sent" | "failed" | "uncertain" | "canceled"; from?: string; to?: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listStores", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listMedia", p?: { q?: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listAuditLogs", p?: { category?: "auth" | "account" | "org" | "team" | "bot" | "conversation" | "contact" | "campaign" | "automation" | "knowledge" | "community" | "post" | "miniapp" | "upload" | "apikey" | "webhook" | "plan" | "billing" | "affiliate" | "store"; user_id?: string; from?: string; to?: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listTeamMembers", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listTeamInvitations", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listWebhookDeliveries", p: { id: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listApiKeys", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listConnectedApps", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listPublishApprovals", p?: { bot_id?: string; miniapp_id?: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listGrowthCampaigns", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listWhatsAppAccounts", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listWhatsAppAccountTemplates", p: { id: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listConnections", p?: { kind?: "telegram_bot" | "whatsapp_number" | "whatsapp_account" | "store" | "crm" | "ai_tool" | "webhook" | "oauth_app" | "product_feed"; status?: "bagli" | "uyari" | "hata" | "kapali" | "bagli_degil"; limit?: number; cursor?: string }): AsyncGenerator; // getOpenApi(): Promise>; health(p?: { cron?: "1" }): Promise<{ status: "ok" | "degraded"; db: "ok" | "error"; cron?: "ok" | "stale"; cron_age_s?: number | null; latency_ms?: number; time: string }>; paginate(metot: "listBots", p?: { limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listContacts", p?: { bot_id?: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listMessages", p: { conversation_id: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listMiniAppSubmissions", p: { id: string; kind?: "form" | "order"; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listConversations", p?: { bot_id?: string; status?: SohbetDurumu; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listCampaigns", p?: { bot_id?: string; status?: KampanyaDurumu; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listMiniApps", p?: { bot_id?: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listAutomations", p?: { bot_id?: string; limit?: number; cursor?: string }): AsyncGenerator; paginate(metot: "listKnowledgeSources", p: SayfaGirdisi): AsyncGenerator; paginate(metot: "listBotTools", p: SayfaGirdisi): AsyncGenerator; paginate(metot: "listBotVersions", p: SayfaGirdisi): AsyncGenerator; paginate(metot: "listBotEvalCases", p: SayfaGirdisi): AsyncGenerator; paginate(metot: "listBotEvalRuns", p: SayfaGirdisi): AsyncGenerator; paginate(metot: "listAcquisitionLinks", p: SayfaGirdisi): AsyncGenerator; paginate(metot: "listWhatsAppTemplates", p: SayfaGirdisi): AsyncGenerator; paginate(metot: "listAiFeedback", p: SayfaGirdisi): AsyncGenerator; }