diff --git a/README.md b/README.md index 8a9796f..865d367 100644 --- a/README.md +++ b/README.md @@ -164,20 +164,6 @@ try { } ``` -### Searching for accounts - -This method fetches every account associated with a specific installation, returning the number of accounts and an array containing the account IDs and related timestamps. Use this API to map the relationship between user accounts and devices. - -```js -try { - const accounts = await incogniaApi.searchAccounts({ - installationId: 'installation_id' - }) -} catch (error) { - console.log(error.message) -} -``` - ## Typescript enabled Thanks to Typescript, all methods attributes and data response are typed, meaning any typescript-enabled editor can take advantage of intellisense and auto-complete: diff --git a/src/incogniaApi.ts b/src/incogniaApi.ts index a383e45..f3b8239 100644 --- a/src/incogniaApi.ts +++ b/src/incogniaApi.ts @@ -19,8 +19,6 @@ import { RegisterTransactionProps, RegisterWebLoginProps, RegisterWebSignupProps, - SearchAccountsBodyProps, - SearchAccountsResponse, SignupResponse, TransactionResponse, TransactionType, @@ -46,7 +44,6 @@ type ApiEndpoints = { SIGNUPS: string TRANSACTIONS: string FEEDBACKS: string - ACCOUNTS: string } const BASE_ENDPOINT = 'https://api.incognia.com/api' @@ -55,8 +52,7 @@ export const apiEndpoints: ApiEndpoints = { TOKEN: `${BASE_ENDPOINT}/v2/token`, SIGNUPS: `${BASE_ENDPOINT}/v2/onboarding/signups`, TRANSACTIONS: `${BASE_ENDPOINT}/v2/authentication/transactions`, - FEEDBACKS: `${BASE_ENDPOINT}/v2/feedbacks`, - ACCOUNTS: `${BASE_ENDPOINT}/v2/accounts/search` + FEEDBACKS: `${BASE_ENDPOINT}/v2/feedbacks` } export class IncogniaApi { @@ -170,23 +166,6 @@ export class IncogniaApi { }) } - // Search Accounts - async searchAccounts( - props: SearchAccountsBodyProps - ): Promise { - const { installationId } = props || {} - if (!installationId) { - throw new IncogniaError('No installationId provided') - } - const data = convertObjectToSnakeCase(props) - - return this.resourceRequest({ - url: apiEndpoints.ACCOUNTS, - method: Method.Post, - data - }) - } - async resourceRequest(options: AxiosRequestConfig) { await this.updateAccessToken() try { diff --git a/src/types.ts b/src/types.ts index eabd945..c466ab4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -472,18 +472,3 @@ export enum FeedbackEvent { SignupDeclined = 'signup_declined', Verified = 'verified' } - -export type SearchAccountsBodyProps = { - installationId: string -} - -export type SearchAccountsResponse = { - count: number - data: Array -} - -type AccountData = { - accountId: string - firstEventAt: string - lastEventAt: string -} diff --git a/test/incogniaApi.test.ts b/test/incogniaApi.test.ts index bc4c604..5e9597c 100644 --- a/test/incogniaApi.test.ts +++ b/test/incogniaApi.test.ts @@ -257,51 +257,6 @@ describe('API', () => { }) }) }) - - it('retrieves accounts', async () => { - const timestamp = '2022-06-02T22:25:30.885104Z' - - const apiResponse = { - count: 2, - data: [ - { - account_id: '1', - first_event_at: timestamp, - last_event_at: timestamp - }, - { - account_id: '2', - first_event_at: timestamp, - last_event_at: timestamp - } - ] - } - - const expectedResponse = { - count: 2, - data: [ - { - accountId: '1', - firstEventAt: timestamp, - lastEventAt: timestamp - }, - { - accountId: '2', - firstEventAt: timestamp, - lastEventAt: timestamp - } - ] - } - - nock(BASE_ENDPOINT_URL) - .post(`/v2/accounts/search`) - .reply(200, apiResponse) - - const accounts = await incogniaApi.searchAccounts({ - installationId: 'installation_id' - }) - expect(accounts).toEqual(expectedResponse) - }) }) describe('Access token managament', () => {