From 474ff5890649dd1246dbd92565f455d2c848e71d Mon Sep 17 00:00:00 2001 From: Josef Hornych Date: Mon, 18 Jun 2018 12:37:48 +0200 Subject: [PATCH 1/5] 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" +} From 11e09dbbd3d90df695feffb7cad4db37d21c249d Mon Sep 17 00:00:00 2001 From: Josef Hornych Date: Mon, 18 Jun 2018 12:44:39 +0200 Subject: [PATCH 2/5] deleted package.json, which was an artifact from node-modules --- types/intercom-client/package.json | 48 ------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 types/intercom-client/package.json diff --git a/types/intercom-client/package.json b/types/intercom-client/package.json deleted file mode 100644 index 99ab47808b..0000000000 --- a/types/intercom-client/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "_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" -} From 1b0c321c143f7553f942abf7d0b00c7df31f762f Mon Sep 17 00:00:00 2001 From: Josef Hornych Date: Mon, 18 Jun 2018 14:02:34 +0200 Subject: [PATCH 3/5] Fixed linter errors --- types/intercom-client/Scroll.d.ts | 3 ++ types/intercom-client/User.d.ts | 85 +++++++++++++++++++++++++++++++ types/intercom-client/index.d.ts | 35 ++++++++++++- 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 types/intercom-client/Scroll.d.ts create mode 100644 types/intercom-client/User.d.ts 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..d67fd963d2 --- /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 +} + +export 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..f5699464b6 100644 --- a/types/intercom-client/index.d.ts +++ b/types/intercom-client/index.d.ts @@ -1,7 +1,11 @@ // Type definitions for intercom-client 2.9 // Project: https://github.com/intercom/intercom-node -// Definitions by: Jinesh Shah +// Definitions by: Jinesh Shah , Josef Hornych // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { List as UserList, User, UserIdentifier } from './User'; +import { Scroll } from './Scroll'; export interface IdentityVerificationOptions { secretKey: string; @@ -11,3 +15,32 @@ export interface IdentityVerificationOptions { export const IdentityVerification: { userHash(opts: IdentityVerificationOptions): string; }; + +export class Client { + constructor(auth: { token: string } | { appId: string, appApiKey: string }); + constructor(username: string, password: string); + + users: Users; +} + +export interface Company { + readonly "id": string; +} + +export 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}>; +} From 199cb191f9fd390bff8e1a21d29380c4a51adf6e Mon Sep 17 00:00:00 2001 From: Josef Hornych Date: Mon, 18 Jun 2018 15:25:14 +0200 Subject: [PATCH 4/5] remove files not present in previous version (LICENSE, README.md) --- types/intercom-client/LICENSE | 21 --------------------- types/intercom-client/README.md | 16 ---------------- 2 files changed, 37 deletions(-) delete mode 100644 types/intercom-client/LICENSE delete mode 100644 types/intercom-client/README.md diff --git a/types/intercom-client/LICENSE b/types/intercom-client/LICENSE deleted file mode 100644 index 21071075c2..0000000000 --- a/types/intercom-client/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - 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 deleted file mode 100644 index 481eebf5e4..0000000000 --- a/types/intercom-client/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# 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 . From b25e9ab4b215d439d2a1480c2c2f20fd17ea63c9 Mon Sep 17 00:00:00 2001 From: Josef Hornych Date: Mon, 18 Jun 2018 15:44:34 +0200 Subject: [PATCH 5/5] Fix linter errors --- types/intercom-client/User.d.ts | 6 ++--- types/intercom-client/index.d.ts | 39 -------------------------------- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/types/intercom-client/User.d.ts b/types/intercom-client/User.d.ts index d67fd963d2..880b8b5681 100644 --- a/types/intercom-client/User.d.ts +++ b/types/intercom-client/User.d.ts @@ -9,9 +9,9 @@ export interface Avatar { export interface SocialProfile { "name": "Twitter", - readonly "id": string, - "username": "th1sland", - "url": "http://twitter.com/th1sland" + readonly "id": string | null, + "username": string | null, + "url": string | null } export interface Segment { diff --git a/types/intercom-client/index.d.ts b/types/intercom-client/index.d.ts index 427089bc66..4d9e572da0 100644 --- a/types/intercom-client/index.d.ts +++ b/types/intercom-client/index.d.ts @@ -3,13 +3,9 @@ // Definitions by: Jinesh Shah , Josef Hornych // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 - import { List as UserList, User, UserIdentifier } from './User'; import { Scroll } from './Scroll'; -import {List as UserList, User, UserIdentifier} from './User'; -import {Scroll} from './Scroll'; - export interface IdentityVerificationOptions { secretKey: string; identifier: string; @@ -19,40 +15,6 @@ export const IdentityVerification: { userHash(opts: IdentityVerificationOptions): string; }; -<<<<<<< HEAD - -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}> -} -======= export class Client { constructor(auth: { token: string } | { appId: string, appApiKey: string }); constructor(username: string, password: string); @@ -81,4 +43,3 @@ export class Users { requestPermanentDeletion(): Promise<{id: number}>; } ->>>>>>> tmp