From 474ff5890649dd1246dbd92565f455d2c848e71d Mon Sep 17 00:00:00 2001 From: Josef Hornych Date: Mon, 18 Jun 2018 12:37:48 +0200 Subject: [PATCH] Added Client class and definitions of functions for Client.users --- types/intercom-client/LICENSE | 21 ++++++++ types/intercom-client/README.md | 16 ++++++ types/intercom-client/Scroll.d.ts | 3 ++ types/intercom-client/User.d.ts | 85 ++++++++++++++++++++++++++++++ types/intercom-client/index.d.ts | 36 +++++++++++++ types/intercom-client/package.json | 48 +++++++++++++++++ 6 files changed, 209 insertions(+) create mode 100644 types/intercom-client/LICENSE create mode 100644 types/intercom-client/README.md create mode 100644 types/intercom-client/Scroll.d.ts create mode 100644 types/intercom-client/User.d.ts create mode 100644 types/intercom-client/package.json diff --git a/types/intercom-client/LICENSE b/types/intercom-client/LICENSE new file mode 100644 index 0000000000..21071075c2 --- /dev/null +++ b/types/intercom-client/LICENSE @@ -0,0 +1,21 @@ + 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 diff --git a/types/intercom-client/README.md b/types/intercom-client/README.md new file mode 100644 index 0000000000..481eebf5e4 --- /dev/null +++ b/types/intercom-client/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/intercom-client` + +# Summary +This package contains type definitions for intercom-client (https://github.com/intercom/intercom-node). + +# Details +Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/intercom-client + +Additional Details + * Last updated: Thu, 03 May 2018 15:33:57 GMT + * Dependencies: none + * Global values: none + +# Credits +These definitions were written by Jinesh Shah , Josef Hornych . diff --git a/types/intercom-client/Scroll.d.ts b/types/intercom-client/Scroll.d.ts new file mode 100644 index 0000000000..2704a4cfbe --- /dev/null +++ b/types/intercom-client/Scroll.d.ts @@ -0,0 +1,3 @@ +export declare class Scroll { + +} \ No newline at end of file diff --git a/types/intercom-client/User.d.ts b/types/intercom-client/User.d.ts new file mode 100644 index 0000000000..a6ff10875a --- /dev/null +++ b/types/intercom-client/User.d.ts @@ -0,0 +1,85 @@ +import {Company} from "intercom-client"; + +export type UserIdentifier = { "id": string } | { "user_id": string } | { "email": string } + +export interface Avatar { + "type": "avatar", + "image_url": string | null +} + +export interface SocialProfile { + "name": "Twitter", + readonly "id": string, + "username": "th1sland", + "url": "http://twitter.com/th1sland" +} + +export interface Segment { + readonly "id": string +} + +export interface Tag { + readonly "id": string +} + +interface LocationData { + "type": "location_data", + "city_name": string | null, + "continent_code": string | null, + "country_code": string | null, + "country_name": string | null, + "latitude": number | null, + "longitude": number | null, + "postal_code": string | null, + "region_name": string | null, + "timezone": string | null +} + +export interface User { + "type": "user" | "contact", + readonly "id": string, + "user_id": string | null, + "email": string | null, + "app_id"?: string, + "phone": string | null, + "name": string | null, + readonly "updated_at": number, + "last_seen_ip": string | null, + "unsubscribed_from_emails": boolean, + "last_request_at": number | null, + "signed_up_at": number | null, + readonly "created_at": number, + "session_count": number, + "user_agent_data": string | null, + "pseudonym": string | null, + "anonymous": boolean, + "custom_attributes": { + [key: string]: any + }, + "avatar": Avatar, + "location_data": LocationData | {}, + "social_profiles": { + "type": "social_profile.list", + "social_profiles": SocialProfile[] + }, + "companies": { + "type": "company.list", + "companies": Company[] + }, + "segments": { + "type": "segment.list", + "segments": Segment[] + + }, + "tags": { + "type": "tag.list", + "tags": Tag[] + } +} + +export interface List { + "type": "user.list", + "total_count": number, + "users": User[], + "pages": { "next"?: string, "page": number, "per_page": number, "total_pages": number } +} \ No newline at end of file diff --git a/types/intercom-client/index.d.ts b/types/intercom-client/index.d.ts index b68dc87e71..67b1e10476 100644 --- a/types/intercom-client/index.d.ts +++ b/types/intercom-client/index.d.ts @@ -3,6 +3,9 @@ // Definitions by: Jinesh Shah // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import {List as UserList, User, UserIdentifier} from './User'; +import {Scroll} from './Scroll'; + export interface IdentityVerificationOptions { secretKey: string; identifier: string; @@ -11,3 +14,36 @@ export interface IdentityVerificationOptions { export const IdentityVerification: { userHash(opts: IdentityVerificationOptions): string; }; + + +export declare class Client { + constructor(auth: { token: string }); + constructor(username: string, password: string); + constructor(auth: { appId: string, appApiKey: string }); + + users: Users; +} + + +interface Company { + readonly "id": string +} + + +declare class Users { + create(user: Partial): Promise + + update(user: UserIdentifier & Partial ): Promise + + find(identifier: UserIdentifier): Promise + + list(): Promise + + listBy(params: {tag_id: string, segment_id: string}): Promise + + scroll: Scroll + + archive(): Promise + + requestPermanentDeletion(): Promise<{id: number}> +} \ No newline at end of file diff --git a/types/intercom-client/package.json b/types/intercom-client/package.json new file mode 100644 index 0000000000..99ab47808b --- /dev/null +++ b/types/intercom-client/package.json @@ -0,0 +1,48 @@ +{ + "_from": "@types/intercom-client", + "_id": "@types/intercom-client@2.9.0", + "_inBundle": false, + "_integrity": "sha512-BijYT7XATNJ4TOwj3OULC8FRt2OgGJ18wxV/M5Hjl4Ql7kXa/Mr0s0fgcuegn6SsmEqOg/CYCPEeUILzKXHR/g==", + "_location": "/@types/intercom-client", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "@types/intercom-client", + "name": "@types/intercom-client", + "escapedName": "@types%2fintercom-client", + "scope": "@types", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#DEV:/", + "#USER" + ], + "_resolved": "https://registry.npmjs.org/@types/intercom-client/-/intercom-client-2.9.0.tgz", + "_shasum": "7713308ace441835e687662bbf08d41393144295", + "_spec": "@types/intercom-client", + "_where": "C:\\Users\\Pepin\\Documents\\projects\\cqrs", + "bundleDependencies": false, + "contributors": [ + { + "name": "Jinesh Shah", + "url": "https://github.com/jineshshah36" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "TypeScript definitions for intercom-client", + "license": "MIT", + "main": "", + "name": "@types/intercom-client", + "repository": { + "type": "git", + "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "typeScriptVersion": "2.0", + "typesPublisherContentHash": "c27ac6cbc719f43db3d968722e9976bfc2d2d1380f77dae007bf5d360ed1aa84", + "version": "2.9.0" +}