UNPKG

@abumalick/vcards-js

Version:

Create vCards to import contacts into Outlook, iOS, Mac OS, Android devices, and more.

268 lines (215 loc) 5.28 kB
// Type definitions for vcards-js 2.10 // Project: https://github.com/enesser/vCards-JS // Definitions by: Ben Allfree <https://github.com/benallfree> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // MIT License // Copyright (c) Microsoft Corporation. All rights reserved. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE export interface vCard { /** * Specifies a value that represents a persistent, globally unique identifier associated with the vCard */ uid: string; /** * Date of birth */ birthday: Date; /** * Anniversary */ anniversary: Date; /** * Cell phone number */ cellPhone: string; /** * Other cell phone number or pager */ pagerPhone: string; /** * The address for private electronic mail communication */ email: string; /** * The address for work-related electronic mail communication */ workEmail: string; /** * First name */ firstName: string; /** * Formatted name string associated with the vCard object (will automatically populate if not set) */ formattedName: string; /** * Gender. */ gender: 'M' | 'F'; /** * Home mailing address */ homeAddress: Address; /** * Home phone */ homePhone: string; /** * Home facsimile */ homeFax: string; /** * Last name */ lastName: string; /** * Logo */ logo: Photo; /** * Middle name */ middleName: string; /** * Prefix for individual's name */ namePrefix: string; /** * Suffix for individual's name */ nameSuffix: string; /** * Nickname of individual */ nickname: string; /** * Specifies supplemental information or a comment that is associated with the vCard */ note: string; /** * The name and optionally the unit(s) of the organization associated with the vCard object */ organization: string; /** * Whether or not this contact should be shown as a company */ isOrganization: boolean; /** * Individual's photo */ photo: Photo; /** * The role, occupation, or business category of the vCard object within an organization */ role: string; /** * Social URLs attached to the vCard object (ex: Facebook, Twitter, LinkedIn) */ socialUrls: SocialUrls; /** * A URL that can be used to get the latest version of this vCard */ source: string; /** * Specifies the job title, functional position or function of the individual within an organization */ title: string; /** * URL pointing to a website that represents the person in some way */ url: string; /** * URL pointing to a website that represents the person's work in some way */ workUrl: string; /** * Work mailing address */ workAddress: Address; /** * Work phone */ workPhone: string; /** * Work facsimile */ workFax: string; /** * vCard version */ version: string; /** * Get major version of the vCard format */ getMajorVersion: () => number; /** * Get formatted vCard * @return Formatted vCard in VCF format */ getFormattedString: () => string; } interface SocialUrls { facebook: string; linkedIn: string; twitter: string; flickr: string; } interface Photo { url: string; mediaType: string; base64: boolean; /** * Attach a photo from a URL * @param url URL where photo can be found * @param mediaType Media type of photo (JPEG, PNG, GIF) */ attachFromUrl: (url: string, mediaType: string) => void; /** * Embed a photo from a base-64 string * @param base64String - the base64 string * @param mediaType - the media type */ embedFromString: (base64String: string, mediaType: string) => void; } interface Address { /** * Represents the actual text that should be put on the mailing label when delivering a physical package */ label: string; /** * Street address */ street: string; /** * City */ city: string; /** * State or province */ stateProvince: string; /** * Postal code */ postalCode: string; /** * Country or region */ countryRegion: string; } declare function vCardFactory(): vCard; export = vCardFactory;