import { $Fetch } from 'ofetch'; import { Hookable, HookKeys } from 'hookable'; /** Decorator for methods that tells the GenHooks to ignore the decorated method and not generate hooks for it*/ declare function NoHook(target: any, context: ClassMethodDecoratorContext): void; /** * Decorator for classes that generates hooks for a given class before and after each method is called. */ declare function GenHooks(target: { new (...args: any[]): T; }): void; declare const timezones: readonly ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", "Africa/Asmara", "Africa/Asmera", "Africa/Bamako", "Africa/Bangui", "Africa/Banjul", "Africa/Bissau", "Africa/Blantyre", "Africa/Brazzaville", "Africa/Bujumbura", "Africa/Cairo", "Africa/Casablanca", "Africa/Ceuta", "Africa/Conakry", "Africa/Dakar", "Africa/Dar_es_Salaam", "Africa/Djibouti", "Africa/Douala", "Africa/El_Aaiun", "Africa/Freetown", "Africa/Gaborone", "Africa/Harare", "Africa/Johannesburg", "Africa/Juba", "Africa/Kampala", "Africa/Khartoum", "Africa/Kigali", "Africa/Kinshasa", "Africa/Lagos", "Africa/Libreville", "Africa/Lome", "Africa/Luanda", "Africa/Lubumbashi", "Africa/Lusaka", "Africa/Malabo", "Africa/Maputo", "Africa/Maseru", "Africa/Mbabane", "Africa/Mogadishu", "Africa/Monrovia", "Africa/Nairobi", "Africa/Ndjamena", "Africa/Niamey", "Africa/Nouakchott", "Africa/Ouagadougou", "Africa/Porto-Novo", "Africa/Sao_Tome", "Africa/Timbuktu", "Africa/Tripoli", "Africa/Tunis", "Africa/Windhoek", "America/Adak", "America/Anchorage", "America/Anguilla", "America/Antigua", "America/Araguaina", "America/Argentina/Buenos_Aires", "America/Argentina/Catamarca", "America/Argentina/ComodRivadavia", "America/Argentina/Cordoba", "America/Argentina/Jujuy", "America/Argentina/La_Rioja", "America/Argentina/Mendoza", "America/Argentina/Rio_Gallegos", "America/Argentina/Salta", "America/Argentina/San_Juan", "America/Argentina/San_Luis", "America/Argentina/Tucuman", "America/Argentina/Ushuaia", "America/Aruba", "America/Asuncion", "America/Atikokan", "America/Atka", "America/Bahia", "America/Bahia_Banderas", "America/Barbados", "America/Belem", "America/Belize", "America/Blanc-Sablon", "America/Boa_Vista", "America/Bogota", "America/Boise", "America/Buenos_Aires", "America/Cambridge_Bay", "America/Campo_Grande", "America/Cancun", "America/Caracas", "America/Catamarca", "America/Cayenne", "America/Cayman", "America/Chicago", "America/Chihuahua", "America/Ciudad_Juarez", "America/Coral_Harbour", "America/Cordoba", "America/Costa_Rica", "America/Creston", "America/Cuiaba", "America/Curacao", "America/Danmarkshavn", "America/Dawson", "America/Dawson_Creek", "America/Denver", "America/Detroit", "America/Dominica", "America/Edmonton", "America/Eirunepe", "America/El_Salvador", "America/Ensenada", "America/Fort_Nelson", "America/Fort_Wayne", "America/Fortaleza", "America/Glace_Bay", "America/Godthab", "America/Goose_Bay", "America/Grand_Turk", "America/Grenada", "America/Guadeloupe", "America/Guatemala", "America/Guayaquil", "America/Guyana", "America/Halifax", "America/Havana", "America/Hermosillo", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Indianapolis", "America/Inuvik", "America/Iqaluit", "America/Jamaica", "America/Jujuy", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Knox_IN", "America/Kralendijk", "America/La_Paz", "America/Lima", "America/Los_Angeles", "America/Louisville", "America/Lower_Princes", "America/Maceio", "America/Managua", "America/Manaus", "America/Marigot", "America/Martinique", "America/Matamoros", "America/Mazatlan", "America/Mendoza", "America/Menominee", "America/Merida", "America/Metlakatla", "America/Mexico_City", "America/Miquelon", "America/Moncton", "America/Monterrey", "America/Montevideo", "America/Montreal", "America/Montserrat", "America/Nassau", "America/New_York", "America/Nipigon", "America/Nome", "America/Noronha", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Nuuk", "America/Ojinaga", "America/Panama", "America/Pangnirtung", "America/Paramaribo", "America/Phoenix", "America/Port-au-Prince", "America/Port_of_Spain", "America/Porto_Acre", "America/Porto_Velho", "America/Puerto_Rico", "America/Punta_Arenas", "America/Rainy_River", "America/Rankin_Inlet", "America/Recife", "America/Regina", "America/Resolute", "America/Rio_Branco", "America/Rosario", "America/Santa_Isabel", "America/Santarem", "America/Santiago", "America/Santo_Domingo", "America/Sao_Paulo", "America/Scoresbysund", "America/Shiprock", "America/Sitka", "America/St_Barthelemy", "America/St_Johns", "America/St_Kitts", "America/St_Lucia", "America/St_Thomas", "America/St_Vincent", "America/Swift_Current", "America/Tegucigalpa", "America/Thule", "America/Thunder_Bay", "America/Tijuana", "America/Toronto", "America/Tortola", "America/Vancouver", "America/Virgin", "America/Whitehorse", "America/Winnipeg", "America/Yakutat", "America/Yellowknife", "Antarctica/Casey", "Antarctica/Davis", "Antarctica/DumontDUrville", "Antarctica/Macquarie", "Antarctica/Mawson", "Antarctica/McMurdo", "Antarctica/Palmer", "Antarctica/Rothera", "Antarctica/South_Pole", "Antarctica/Syowa", "Antarctica/Troll", "Antarctica/Vostok", "Arctic/Longyearbyen", "Asia/Aden", "Asia/Almaty", "Asia/Amman", "Asia/Anadyr", "Asia/Aqtau", "Asia/Aqtobe", "Asia/Ashgabat", "Asia/Ashkhabad", "Asia/Atyrau", "Asia/Baghdad", "Asia/Bahrain", "Asia/Baku", "Asia/Bangkok", "Asia/Barnaul", "Asia/Beirut", "Asia/Bishkek", "Asia/Brunei", "Asia/Calcutta", "Asia/Chita", "Asia/Choibalsan", "Asia/Chongqing", "Asia/Chungking", "Asia/Colombo", "Asia/Dacca", "Asia/Damascus", "Asia/Dhaka", "Asia/Dili", "Asia/Dubai", "Asia/Dushanbe", "Asia/Famagusta", "Asia/Gaza", "Asia/Harbin", "Asia/Hebron", "Asia/Ho_Chi_Minh", "Asia/Hong_Kong", "Asia/Hovd", "Asia/Irkutsk", "Asia/Istanbul", "Asia/Jakarta", "Asia/Jayapura", "Asia/Jerusalem", "Asia/Kabul", "Asia/Kamchatka", "Asia/Karachi", "Asia/Kashgar", "Asia/Kathmandu", "Asia/Katmandu", "Asia/Khandyga", "Asia/Kolkata", "Asia/Krasnoyarsk", "Asia/Kuala_Lumpur", "Asia/Kuching", "Asia/Kuwait", "Asia/Macao", "Asia/Macau", "Asia/Magadan", "Asia/Makassar", "Asia/Manila", "Asia/Muscat", "Asia/Nicosia", "Asia/Novokuznetsk", "Asia/Novosibirsk", "Asia/Omsk", "Asia/Oral", "Asia/Phnom_Penh", "Asia/Pontianak", "Asia/Pyongyang", "Asia/Qatar", "Asia/Qostanay", "Asia/Qyzylorda", "Asia/Rangoon", "Asia/Riyadh", "Asia/Saigon", "Asia/Sakhalin", "Asia/Samarkand", "Asia/Seoul", "Asia/Shanghai", "Asia/Singapore", "Asia/Srednekolymsk", "Asia/Taipei", "Asia/Tashkent", "Asia/Tbilisi", "Asia/Tehran", "Asia/Tel_Aviv", "Asia/Thimbu", "Asia/Thimphu", "Asia/Tokyo", "Asia/Tomsk", "Asia/Ujung_Pandang", "Asia/Ulaanbaatar", "Asia/Ulan_Bator", "Asia/Urumqi", "Asia/Ust-Nera", "Asia/Vientiane", "Asia/Vladivostok", "Asia/Yakutsk", "Asia/Yangon", "Asia/Yekaterinburg", "Asia/Yerevan", "Atlantic/Azores", "Atlantic/Bermuda", "Atlantic/Canary", "Atlantic/Cape_Verde", "Atlantic/Faeroe", "Atlantic/Faroe", "Atlantic/Jan_Mayen", "Atlantic/Madeira", "Atlantic/Reykjavik", "Atlantic/South_Georgia", "Atlantic/St_Helena", "Atlantic/Stanley", "Australia/ACT", "Australia/Adelaide", "Australia/Brisbane", "Australia/Broken_Hill", "Australia/Canberra", "Australia/Currie", "Australia/Darwin", "Australia/Eucla", "Australia/Hobart", "Australia/LHI", "Australia/Lindeman", "Australia/Lord_Howe", "Australia/Melbourne", "Australia/North", "Australia/NSW", "Australia/Perth", "Australia/Queensland", "Australia/South", "Australia/Sydney", "Australia/Tasmania", "Australia/Victoria", "Australia/West", "Australia/Yancowinna", "Brazil/Acre", "Brazil/DeNoronha", "Brazil/East", "Brazil/West", "Canada/Atlantic", "Canada/Central", "Canada/Eastern", "Canada/Mountain", "Canada/Newfoundland", "Canada/Pacific", "Canada/Saskatchewan", "Canada/Yukon", "CET", "Chile/Continental", "Chile/EasterIsland", "CST6CDT", "Cuba", "EET", "Egypt", "Eire", "EST", "EST5EDT", "Etc/GMT", "Etc/GMT+0", "Etc/GMT+1", "Etc/GMT+10", "Etc/GMT+11", "Etc/GMT+12", "Etc/GMT+2", "Etc/GMT+3", "Etc/GMT+4", "Etc/GMT+5", "Etc/GMT+6", "Etc/GMT+7", "Etc/GMT+8", "Etc/GMT+9", "Etc/GMT-0", "Etc/GMT-1", "Etc/GMT-10", "Etc/GMT-11", "Etc/GMT-12", "Etc/GMT-13", "Etc/GMT-14", "Etc/GMT-2", "Etc/GMT-3", "Etc/GMT-4", "Etc/GMT-5", "Etc/GMT-6", "Etc/GMT-7", "Etc/GMT-8", "Etc/GMT-9", "Etc/GMT0", "Etc/Greenwich", "Etc/UCT", "Etc/Universal", "Etc/UTC", "Etc/Zulu", "Europe/Amsterdam", "Europe/Andorra", "Europe/Astrakhan", "Europe/Athens", "Europe/Belfast", "Europe/Belgrade", "Europe/Berlin", "Europe/Bratislava", "Europe/Brussels", "Europe/Bucharest", "Europe/Budapest", "Europe/Busingen", "Europe/Chisinau", "Europe/Copenhagen", "Europe/Dublin", "Europe/Gibraltar", "Europe/Guernsey", "Europe/Helsinki", "Europe/Isle_of_Man", "Europe/Istanbul", "Europe/Jersey", "Europe/Kaliningrad", "Europe/Kiev", "Europe/Kirov", "Europe/Kyiv", "Europe/Lisbon", "Europe/Ljubljana", "Europe/London", "Europe/Luxembourg", "Europe/Madrid", "Europe/Malta", "Europe/Mariehamn", "Europe/Minsk", "Europe/Monaco", "Europe/Moscow", "Europe/Nicosia", "Europe/Oslo", "Europe/Paris", "Europe/Podgorica", "Europe/Prague", "Europe/Riga", "Europe/Rome", "Europe/Samara", "Europe/San_Marino", "Europe/Sarajevo", "Europe/Saratov", "Europe/Simferopol", "Europe/Skopje", "Europe/Sofia", "Europe/Stockholm", "Europe/Tallinn", "Europe/Tirane", "Europe/Tiraspol", "Europe/Ulyanovsk", "Europe/Uzhgorod", "Europe/Vaduz", "Europe/Vatican", "Europe/Vienna", "Europe/Vilnius", "Europe/Volgograd", "Europe/Warsaw", "Europe/Zagreb", "Europe/Zaporozhye", "Europe/Zurich", "Factory", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", "Greenwich", "Hongkong", "HST", "Iceland", "Indian/Antananarivo", "Indian/Chagos", "Indian/Christmas", "Indian/Cocos", "Indian/Comoro", "Indian/Kerguelen", "Indian/Mahe", "Indian/Maldives", "Indian/Mauritius", "Indian/Mayotte", "Indian/Reunion", "Iran", "Israel", "Jamaica", "Japan", "Kwajalein", "Libya", "MET", "Mexico/BajaNorte", "Mexico/BajaSur", "Mexico/General", "MST", "MST7MDT", "Navajo", "NZ", "NZ-CHAT", "Pacific/Apia", "Pacific/Auckland", "Pacific/Bougainville", "Pacific/Chatham", "Pacific/Chuuk", "Pacific/Easter", "Pacific/Efate", "Pacific/Enderbury", "Pacific/Fakaofo", "Pacific/Fiji", "Pacific/Funafuti", "Pacific/Galapagos", "Pacific/Gambier", "Pacific/Guadalcanal", "Pacific/Guam", "Pacific/Honolulu", "Pacific/Johnston", "Pacific/Kanton", "Pacific/Kiritimati", "Pacific/Kosrae", "Pacific/Kwajalein", "Pacific/Majuro", "Pacific/Marquesas", "Pacific/Midway", "Pacific/Nauru", "Pacific/Niue", "Pacific/Norfolk", "Pacific/Noumea", "Pacific/Pago_Pago", "Pacific/Palau", "Pacific/Pitcairn", "Pacific/Pohnpei", "Pacific/Ponape", "Pacific/Port_Moresby", "Pacific/Rarotonga", "Pacific/Saipan", "Pacific/Samoa", "Pacific/Tahiti", "Pacific/Tarawa", "Pacific/Tongatapu", "Pacific/Truk", "Pacific/Wake", "Pacific/Wallis", "Pacific/Yap", "Poland", "Portugal", "PRC", "PST8PDT", "ROC", "ROK", "Singapore", "Turkey", "UCT", "Universal", "US/Alaska", "US/Aleutian", "US/Arizona", "US/Central", "US/East-Indiana", "US/Eastern", "US/Hawaii", "US/Indiana-Starke", "US/Michigan", "US/Mountain", "US/Pacific", "US/Samoa", "UTC", "W-SU", "WET", "Zulu"]; /** Generic way to make types nullable */ type Nullable = T | null; /** Possible statuses for a signature request */ type SignatureRequestStatus = "draft" | "ongoing" | "done" | "deleted" | "expired" | "canceled" | "approval" | "rejected" | "declined"; /** Level of the signature, more info in the {@link https://developers.yousign.com/docs/choose-my-signature-level|docs} */ type SignatureLevel = "electronic_signature" | "advanced_electronic_signature" | "electronic_signature_with_qualified_certificate" | "qualified_electronic_signature" | "qualified_electronic_signature_mode_1"; /** All the possible timezones following the {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|tz database format}*/ type SignatureTimezone = (typeof timezones)[number]; /** * Delivery mode for the * @value none: You are on your own * @value email: signer will reveive an email to sign the document */ type DeliveryMode = "none" | "email"; /** *Settings on how often relevant users for a signature request shall be reminded *and the interval between the reminders */ type ReminderSettings = { interval_in_days: 1 | 2 | 7 | 14; max_occurrences: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; }; /** Short hand signer and status data of a signature request */ type SignerInner = { id: string; status: "initiated" | "declined" | "notified" | "verified" | "processing" | "consent_given" | "signed" | "aborted" | "error"; }; /** Status of the Approver related to a signature request*/ type ApproverInner = { id: string; status: "initiated" | "notified" | "approved" | "rejected"; }; /** Shorthand document info when used in overall Request info etc */ type DocumentInner = { id: string; nature: "attachment" | "signable_document"; }; type Sender = { id: string; email: string; }; type SignatureDeclineInfo = { signer_id: string; reason: string; decined_at: string; }; type AuditTrailLocale = "de" | "en" | "es" | "fr" | "it"; type CustomEmailNotificationSender = { type: "custom"; custom_name: string; }; type OrganizationEmailNotificationSender = { type: "organization"; }; type WorkspaceEmailNotificationSender = { type: "workspace"; }; /** Sets the field on the sender for the emails (seen in certificates) */ type EmailNotificationSender = CustomEmailNotificationSender | OrganizationEmailNotificationSender | WorkspaceEmailNotificationSender; /** Settings that need to be passed when creating a new signature request */ type CreateSignatureRequestOptions = { name: string; delivery_mode: DeliveryMode; ordered_signer?: boolean; timezone?: SignatureTimezone; expiration_date?: string; template_id?: string; external_id?: string; custom_experience_id?: string; workspace_id?: string; audit_trail_locale?: Nullable; /** @default false */ signers_allowed_to_decline?: boolean; email_notification?: Nullable<{ sender: Nullable; /** Max length 500 characters */ custom_note?: Nullable; }>; }; /** Info about a created signature */ type SignatureRequest = { id: string; status: SignatureRequestStatus; name: string; delivery_mode: DeliveryMode; created_at: string; ordered_signers: boolean; reminder_settings: Nullable; timezone: SignatureTimezone; expiration_date: string; source: "app" | "public_api" | "connector_hubspot_api" | "connector_salesforce_api" | "connector_google_api" | "connector_zapier_api"; signers: SignerInner[]; approvers: ApproverInner[]; documents: DocumentInner[]; sender: Nullable; external_id: Nullable; custom_experience_id: Nullable; signers_allowed_to_decline: boolean; audit_trail_locale: AuditTrailLocale; email_notification: { sender: EmailNotificationSender; /** @deprecated Probably... not displayed in documentation */ custom_note: Nullable; }; bulk_send_batch_id: Nullable; decline_information: Nullable; /**@deprecated Should always be null and soon to be removed*/ email_custom_note: Nullable; /**@deprecated Should always be null and soon to be removed*/ branding_id: Nullable; }; type URLFile = string | { type: "url"; url: string; encoding?: string; headers?: Record; mimeType?: string; fileName?: string; }; /** settings that need to be passed when adding a file to a signature request*/ type AddFileOptions = { file: File | Blob | URLFile; nature: "attachment" | "signable_document"; insert_after_id?: string; password?: string; initials?: Record; parse_anchors?: boolean; }; /** Response when a file got added to a signature request */ type AddFileResponse = { id: string; filename: string; nature: DocumentInner["nature"]; content_type: string; sha256: string; is_protected: boolean; is_signed: boolean; created_at: string; total_pages: Nullable; is_locked: boolean; initials: Nullable<{ alignment: "left" | "center" | "right"; y: number; }>; total_anchors: number; }; /** signature options that define where and on which document the siganture should be positioned */ type Signature = { document_id: string; type: "signature"; page: number; x: number; y: number; /** @default 37 */ height?: number; /** @default 85 */ width?: number; }; /** Mention options */ type Mention = { document_id: string; type: "mention"; page: number; x: number; y: number; height?: number; /** min 24, or multiple of 15 > 24 */ width?: Nullable; mention: string; }; /** Text input options */ type Text = { document_id: string; type: "text"; page: number; x: number; y: number; height?: number; width?: number; max_length: number; question: string; instruction: Nullable; optional: boolean; }; /** Checkbox Input options */ type Checkbox = { document_id: string; type: "checkbox"; page: number; x: number; y: number; /** min 8, max 30 */ size: number; optional: boolean; name?: Nullable; checked: boolean; }; /** Radio group input options */ type RadioGroup = { document_id: string; type: "radio_group"; page: number; optional: boolean; name?: Nullable; radios: { name?: Nullable; x: number; y: number; /** min 8, max 30 */ size: number; }[]; }; /** Options for all the possible anchors/inputs for a document when signing */ type FieldInput = Signature | Mention | Text | Checkbox | RadioGroup; /** Supported locales for signers */ type SignerLocale = "en" | "fr" | "de" | "it" | "nl" | "es" | "pl"; /** Information about who signed */ type SignerInfo = { first_name: string; last_name: string; email: string; phone_number: Nullable; locale: SignerLocale; }; /** Method with which the signature shoulld be authenticated */ type SignatureAuthMode = "otp_email" | "otp_sms" | "no_otp"; /** Redirect URLS in case of the different outcomes, more info on the {@link https://developers.yousign.com/docs/redirect-a-signer-at-the-end-of-the-signing-flow|docs} */ type RedirectUrls = { success: Nullable; error: Nullable; declined: Nullable; }; /** Custom text options to for reminders and requests */ type CustomText = { request_subject: Nullable; request_body: Nullable; reminder_subject: Nullable; reminder_body: Nullable; }; type AddSignerScratchOptions = { info: SignerInfo; fields?: FieldInput[]; insert_after_id?: Nullable; signature_level: SignatureLevel; signature_authentication_mode?: Nullable; redirect_urls?: Partial; custom_text?: Partial; delivery_mode?: Nullable; identification_attestation_id?: Nullable; }; /** Settings that need to get passed when adding a Signer to a signature request */ type AddSignerOptions = AddSignerScratchOptions; /** Font options for fields */ type Font = { family: "Inconsolata" | "Open Sans" | "Lato" | "Raleway" | "Merriweather" | "EB Garamond" | "Comic Neue"; color: string; /** min 8, max 22 */ size: number; variants: { itaic: boolean; bold: boolean; }; }; /** Signed signature value */ type SignerSignature = Required & { id: string; signature_id: string; }; /** Signed text value */ type SignerText = Required & { id: string; signer_id: string; font: Font; }; /** Signed Mention value */ type SignerMention = Required & { id: string; signer_id: string; font: Font; }; /** Signed Checkbox value */ type SignerCheckbox = Required & { id: string; signer_id: string; }; /** Signed Radio group value */ type SignerRadioGroup = Required & { id: string; signer_id: string; }; /** Signed input values */ type SignerFieldInput = SignerSignature | SignerText | SignerMention | SignerCheckbox | SignerRadioGroup; /** Response when a Signer got added to the SignatureRequest */ type AddSignerResponse = { id: string; info: SignerInfo; status: "initiated" | "declined" | "notified" | "verified" | "processing" | "consent_given" | "signed" | "aborted" | "error"; fields: SignerFieldInput[]; signature_level: SignatureLevel; signature_authentication_mode: SignatureAuthMode | "null"; signature_link: Nullable; signature_link_expiration_date: Nullable; signature_image_preview: Nullable; redirect_urls: RedirectUrls; custom_text: CustomText; delivery_mode: Nullable; identification_attestation_id: Nullable; }; /** Signature activation response, end of normal workflow */ type SignatureRequestActivateResponse = { id: string; status: "ongoing" | "approval"; name: string; delivery_mode: DeliveryMode; created_at: string; reminder_settings: Nullable; timezone: SignatureTimezone; expiration_date: string; signers: { id: string; status: "initiated" | "declined" | "notified" | "verified" | "processing" | "consent_given" | "signed" | "aborted" | "error"; /** @sensiblle */ signature_link: Nullable; signature_link_expiration_date: Nullable; }[]; approvers: { id: string; status: "initiated" | "notified" | "approved" | "rejected"; /** @sensible */ approval_link: Nullable; approval_link_expiration_date: Nullable; }[]; documents: DocumentInner[]; external_id: Nullable; branding_id: Nullable; custom_experience_id: Nullable; audit_trail_locale: AuditTrailLocale; }; /** Result of the query for signature requests */ type SignatureRequestQueryResult = { meta: { /** cursor to pass to the `after`fielld in the {@link SignatureRequestQuery} object */ next_cursor: Nullable; }; data: SignatureRequest[]; }; /** Query object to search for signature requests */ type SignatureRequestQuery = { /** * @default 100 * @min 1 * @max 100 */ limit: number; status: SignatureRequestStatus; /** * After cursor (pagination) */ after: string; external_id: string; source: string[]; /** * Search on name */ q: string; }; /** certificate sender info */ type SignedSender = { id: string; type: "User"; email: string; last_name: string; first_name: string; ip_address: string; phone_number: string; }; /** Certificate signer info */ type SignedSigner = { id: string; last_name: string; first_name: string; ip_address: string; phone_number: string; email_address: string; consent_given_at: string; signature_process_completed_at: string; }; /** Certificate signature info */ type SignedSignature = { hash: string; reason: string; certificate: { dn: string; oid: string; hash: string; content: string; generated_at: string; }; }; /** Certificate document info */ type SignedDocument = { id: string; name: string; mime_type: string; signatures: SignedSignature[]; initial_hash: string; initial_storage_id: string; }; /** Contents of the certificate of a fulfilled signature request */ type CertificateData = { version: number; signature_request: SignatureRequest; sender: SignedSender; signer: SignedSigner; documents: SignedDocument[]; organization: { id: string; name: string; }; authentication: { mode: string; message: string; validated_at: string; }; electronic_signature_level: { level: string; }; }; /** Metadata stored about a Document on YouSign */ type DocumentInfo = { id: string; filename: string; nature: "attachment" | "signable_document"; content_type: string; sha256: string; is_protected: boolean; is_signed: boolean; created_at: string; total_pages: number; is_locked: boolean; initials: { alignment: "left" | "center" | "right"; y: number; }; total_anchors: number; }; type CapitalizeFirstLetter = S extends `${infer First}${infer Rest}` ? `${Uppercase}${Rest}` : S; type MethodsOf = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K]; }; /**Generates all the onBefore hook type for a givven class/object type */ type MethodToBeforeEvent = { [K in keyof MethodsOf as `onBefore${CapitalizeFirstLetter}`]: (...args: Parameters) => void; }; /** Generates the onAfter hook type for a givven class/object type */ type MethodToAfterEvent = { [K in keyof MethodsOf as `onAfter${CapitalizeFirstLetter}`]: (data: Awaited>) => void; }; /** Generates the types for all the generated Hooks from a class/object type for all the methods/functions in it*/ type Hooks = MethodToBeforeEvent & MethodToAfterEvent & { onError: (error?: Error) => void; }; /** Options to be passed to the BaseClient or YouSignClient constructor */ type ClientOptions = { environment: "sandbox" | "production"; }; /** * @module * * Bindings to the Youfetch V3 api * * @example * ```ts * import { YouSignClient } from 'yousign-v3-client'; * * const yousign = new YouSignClient(process.env.YOUSIGN_API_KEY); * * //1. Create a signature request * const signatureRequest = await yousign.createSignatureRequest({ name: signatureName, delivery_mode: 'email' }); * //2. Add the files to the signature request * await yousign.addDocument(signatureRequest.value!.id, { * file, * nature: "signable_document", * parse_anchors: true, * }) * //3.Add signers to the signature request * await yousign.addSigner(signatureRequest.value!.id, { * signature_level: 'electronic_signature', * info: { * first_name, * last_name, * email * phone_number, * locale * }, * signature_authentication_mode: 'otp_sms', * fields: [ * { * type: 'signature', * document_id: file.id, * page: 1, * x: 0, * y: 0 * } * ] * }) * //4. Activate signature request * await yousign.activateSignature(signatureRequest.id); * ``` */ /** * BaseClient the YouSignClient is based off, this client includes only the base bindings * without any hooks or default config. This class should be used if you want to extend * the functionality of the client for your own project */ declare class BaseClient { readonly fetch: $Fetch; /** * Create a new YouSign adapter instance * @param apiKey YouSign API key */ constructor(apiKey: string, options: ClientOptions); /** * Create a new signature request * @param name Name of the signature request * @param delivery_mode If email is passed, signers will receive an email to sign the document * @param timezone * @returns the signature request or an error */ createSignatureRequest(options: CreateSignatureRequestOptions): Promise; /** * Adds a document to a signature request * @param signatureRequestId Signature request id where to add the document * @param options document options * @returns */ addDocument(signatureRequestId: string, options: AddFileOptions): Promise; /** * Adds a person that needs to sign the document to a signature request * @param signatureRequestId * @param options * @returns */ addSigner(signatureRequestId: string, options: AddSignerOptions): Promise; /** * Performs the signature request * @param signatureRequestId * @returns */ activateSignatureRequest(signatureRequestId: string): Promise; /** * Get all the signature requests that match the query * @param query * @returns */ getRequests(query?: Partial): Promise; /** * Gets the document from the request * @param signatureRequestId * @param documentId * @returns */ getDocument(signatureRequestId: string, documentId: string): Promise; /** * Get all the metadata stored about the file belonging to the signature request * @param signatureRequestId * @param documentId * @returns */ getDocumentData(signatureRequestId: string, documentId: string): Promise; /** * Get all the metadata of all the files relevant for the signature request * @param signatureRequestId * @returns */ getSignatureDocumentsData(signatureRequestId: string): Promise; /** * Gets the certificate data, useful to display it online, or to generate a certificate from it if needed * @param signatureRequestId * @param signerId * @returns */ getCertificateData(signatureRequestId: string, signerId: string): Promise; /** * Gets the certificate of the signer that matches the signerId * @param signatureRequestId * @param signerId */ getCertificate(signatureRequestId: string, signerId: string): Promise; /** * Gets the certificate for each signer of the signature request * @param signatureRequestId * @param mergeDocuments If true, the documents will be merged into one PDF file, else each document will be downloaded separately */ getCertificate(signatureRequestId: string, mergeDocuments?: boolean): Promise; } /** * YouSign adapter for the V3 REST API * @param token YouSign API key * @param options Options for the client * @default options.environment = 'sandbox' * * @example ```js * import { YouSignClient } from 'yousign-v3-client'; * * const yousign = new YouSignClient(process.env.YOUSIGN_API_KEY); * * //1. Create a signature request * const signatureRequest = await yousign.createSignatureRequest({ name: signatureName, delivery_mode: 'email' }); * //2. Add the files to the signature request * await yousign.addDocument(signatureRequest.value!.id, { * file, * nature: "signable_document", * parse_anchors: true, * }) * //3.Add signers to the signature request * await yousign.addSigner(signatureRequest.value!.id, { * signature_level: 'electronic_signature', * info: { * first_name, * last_name, * email * phone_number, * locale * }, * signature_authentication_mode: 'otp_sms', * fields: [ * { * type: 'signature', * document_id: file.id, * page: 1, * x: 0, * y: 0 * } * ] * }) * //4. Activate signature request * await yousign.activateSignature(signatureRequest.id); * ``` */ declare class YouSignClient extends BaseClient { readonly hooks: Hookable, HookKeys>>; constructor(token: string, options?: ClientOptions); } export { type AddFileOptions, type AddFileResponse, type AddSignerOptions, type AddSignerResponse, type ApproverInner, BaseClient, type CertificateData, type Checkbox, type ClientOptions, type CreateSignatureRequestOptions, type CustomText, type DeliveryMode, type DocumentInfo, type DocumentInner, type EmailNotificationSender, type FieldInput, type Font, GenHooks, type Hooks, type Mention, type MethodToAfterEvent, type MethodToBeforeEvent, NoHook, type Nullable, type RadioGroup, type RedirectUrls, type ReminderSettings, type Signature, type SignatureAuthMode, type SignatureLevel, type SignatureRequest, type SignatureRequestActivateResponse, type SignatureRequestQuery, type SignatureRequestQueryResult, type SignatureRequestStatus, type SignatureTimezone, type SignedDocument, type SignedSender, type SignedSignature, type SignedSigner, type SignerCheckbox, type SignerFieldInput, type SignerInfo, type SignerInner, type SignerLocale, type SignerMention, type SignerRadioGroup, type SignerSignature, type SignerText, type Text, YouSignClient };