@hapl/api-queries 1.0.7 → 1.0.8--canary.237.5b55827.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,9 +15,6 @@ declare type ResultError = ErrorData['data']['error'];
15
15
  export declare type FindBuyerByIdUrlParams = {
16
16
  id: number;
17
17
  };
18
- export declare type FindBuyerByIdParams = {
19
- include?: Array<'sharing.fromExpert'>;
20
- };
21
18
  export declare type FindBuyerByIdHeaders = {
22
19
  'x-auth-hc': string;
23
20
  };
@@ -27,7 +24,6 @@ export declare type FindBuyerByIdConfig = {
27
24
  baseURL?: string;
28
25
  urlParams: FindBuyerByIdUrlParams;
29
26
  headers: FindBuyerByIdHeaders;
30
- params: FindBuyerByIdParams;
31
27
  };
32
- export declare function findBuyerByIdRequest({ baseURL, urlParams, headers, params }: FindBuyerByIdConfig): Promise<FindBuyerByIdData>;
28
+ export declare function findBuyerByIdRequest({ baseURL, urlParams, headers }: FindBuyerByIdConfig): Promise<FindBuyerByIdData>;
33
29
  export {};
@@ -38,7 +38,6 @@ export declare type FindBuyersParams = {
38
38
  type: 'createdAt';
39
39
  direction: 'asc' | 'desc';
40
40
  };
41
- include?: Array<'sharing.fromExpert'>;
42
41
  };
43
42
  export declare type FindBuyersData = AxiosResponse<ResultData>;
44
43
  export declare type FindBuyersError = AxiosError<ResultError>;
@@ -25,7 +25,6 @@ export * from './api/buyer/findBuyerStatuses';
25
25
  export * from './api/buyer/findBuyerUniquePhones';
26
26
  export * from './api/buyer/findBuyers';
27
27
  export * from './api/buyer/resetBuyerStatusTimer';
28
- export * from './api/buyer/shareBuyer';
29
28
  export * from './api/buyer/updateBuyer';
30
29
  export * from './api/call/createCallComment';
31
30
  export * from './api/call/findCallById';
@@ -27,9 +27,8 @@ export declare class Api {
27
27
  findBuyerStatuses: (urlParams: api.FindBuyerStatusesUrlParams, params: api.FindBuyerStatusesParams, headers: api.FindBuyerStatusesHeaders) => Promise<api.FindBuyerStatusesData>;
28
28
  findBuyerUniquePhones: (headers: api.FindBuyerUniquePhonesHeaders) => Promise<api.FindBuyerUniquePhonesData>;
29
29
  findBuyers: (params: api.FindBuyersParams, headers: api.FindBuyersHeaders) => Promise<api.FindBuyersData>;
30
- findBuyerById: (urlParams: api.FindBuyerByIdUrlParams, params: api.FindBuyerByIdParams, headers: api.FindBuyerByIdHeaders) => Promise<api.FindBuyerByIdData>;
30
+ findBuyerById: (urlParams: api.FindBuyerByIdUrlParams, headers: api.FindBuyerByIdHeaders) => Promise<api.FindBuyerByIdData>;
31
31
  resetBuyerStatusTimer: (urlParams: api.ResetBuyerStatusTimerUrlParams, headers: api.ResetBuyerStatusTimerHeaders) => Promise<api.ResetBuyerStatusTimerData>;
32
- shareBuyer: (urlParams: api.ShareBuyerUrlParams, body: api.ShareBuyerBody, headers: api.ShareBuyerHeaders) => Promise<api.ShareBuyerData>;
33
32
  updateBuyer: (urlParams: api.UpdateBuyerUrlParams, body: api.UpdateBuyerBody, headers: api.UpdateBuyerHeaders) => Promise<api.UpdateBuyerData>;
34
33
  createCallComment: (urlParams: api.CreateCallCommentUrlParams, body: api.CreateCallCommentBody, headers: api.CreateCallCommentHeaders) => Promise<api.CreateCallCommentData>;
35
34
  findCallById: (urlParams: api.FindCallByIdUrlParams, headers: api.FindCallByIdHeaders) => Promise<api.FindCallByIdData>;
@@ -1,5 +1,4 @@
1
1
  import { ServiceRequest } from './ServiceRequest';
2
- import { User } from './User';
3
2
  import { Call } from './Call';
4
3
  export declare enum BuyerStatus {
5
4
  Incoming = "incoming",
@@ -41,10 +40,6 @@ export declare type Buyer = {
41
40
  scheduledAt: string;
42
41
  status: BuyerRealtyShowStatus;
43
42
  };
44
- sharing?: {
45
- createdAt?: string;
46
- fromExpert?: Partial<User> & Required<Pick<User, 'id'>>;
47
- };
48
43
  source?: string;
49
44
  statusDeadlineAt?: string;
50
45
  updatedAt?: string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.7",
2
+ "version": "1.0.8--canary.237.5b55827.0",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,6 +1,4 @@
1
1
  import axios, { AxiosResponse, AxiosError, AxiosResponseTransformer } from 'axios';
2
- import qs from 'qs';
3
- import isNil from 'lodash/isNil';
4
2
  import { Buyer } from '../../types';
5
3
  import { DEFAULT_BASE_URL } from '../../../constants';
6
4
 
@@ -11,7 +9,6 @@ type ResultData = SuccessData['data'];
11
9
  type ResultError = ErrorData['data']['error'];
12
10
 
13
11
  export type FindBuyerByIdUrlParams = { id: number };
14
- export type FindBuyerByIdParams = { include?: Array<'sharing.fromExpert'> };
15
12
  export type FindBuyerByIdHeaders = { 'x-auth-hc': string };
16
13
  export type FindBuyerByIdData = AxiosResponse<ResultData>;
17
14
  export type FindBuyerByIdError = AxiosError<ResultError>;
@@ -20,16 +17,11 @@ export type FindBuyerByIdConfig = {
20
17
  baseURL?: string;
21
18
  urlParams: FindBuyerByIdUrlParams;
22
19
  headers: FindBuyerByIdHeaders;
23
- params: FindBuyerByIdParams;
24
20
  };
25
21
 
26
- export function findBuyerByIdRequest({ baseURL = DEFAULT_BASE_URL, urlParams, headers, params }: FindBuyerByIdConfig) {
27
- const includePostfix = !isNil(params.include)
28
- ? `?${qs.stringify({ include: params.include }, { arrayFormat: 'brackets' })}`
29
- : '';
30
-
22
+ export function findBuyerByIdRequest({ baseURL = DEFAULT_BASE_URL, urlParams, headers }: FindBuyerByIdConfig) {
31
23
  return axios
32
- .get(`/api/buyer/${urlParams.id}${includePostfix}`, {
24
+ .get(`/api/buyer/${urlParams.id}`, {
33
25
  baseURL,
34
26
  headers: { Accept: 'application/json', ...headers },
35
27
  transformResponse: [
@@ -39,7 +39,6 @@ export type FindBuyersParams = {
39
39
  type: 'createdAt';
40
40
  direction: 'asc' | 'desc';
41
41
  };
42
- include?: Array<'sharing.fromExpert'>;
43
42
  };
44
43
  export type FindBuyersData = AxiosResponse<ResultData>;
45
44
  export type FindBuyersError = AxiosError<ResultError>;
@@ -30,7 +30,6 @@ export * from './api/buyer/findBuyerStatuses';
30
30
  export * from './api/buyer/findBuyerUniquePhones';
31
31
  export * from './api/buyer/findBuyers';
32
32
  export * from './api/buyer/resetBuyerStatusTimer';
33
- export * from './api/buyer/shareBuyer';
34
33
  export * from './api/buyer/updateBuyer';
35
34
 
36
35
  export * from './api/call/createCallComment';
@@ -154,12 +154,8 @@ export class Api {
154
154
  return api.findBuyersRequest({ params, headers, baseURL: await this.baseURL });
155
155
  };
156
156
 
157
- findBuyerById = async (
158
- urlParams: api.FindBuyerByIdUrlParams,
159
- params: api.FindBuyerByIdParams,
160
- headers: api.FindBuyerByIdHeaders
161
- ) => {
162
- return api.findBuyerByIdRequest({ urlParams, params, headers, baseURL: await this.baseURL });
157
+ findBuyerById = async (urlParams: api.FindBuyerByIdUrlParams, headers: api.FindBuyerByIdHeaders) => {
158
+ return api.findBuyerByIdRequest({ urlParams, headers, baseURL: await this.baseURL });
163
159
  };
164
160
 
165
161
  resetBuyerStatusTimer = async (
@@ -169,10 +165,6 @@ export class Api {
169
165
  return api.resetBuyerStatusTimerRequest({ urlParams, headers, baseURL: await this.baseURL });
170
166
  };
171
167
 
172
- shareBuyer = async (urlParams: api.ShareBuyerUrlParams, body: api.ShareBuyerBody, headers: api.ShareBuyerHeaders) => {
173
- return api.shareBuyerRequest({ urlParams, body, headers, baseURL: await this.baseURL });
174
- };
175
-
176
168
  updateBuyer = async (
177
169
  urlParams: api.UpdateBuyerUrlParams,
178
170
  body: api.UpdateBuyerBody,
@@ -1,5 +1,4 @@
1
1
  import { ServiceRequest } from './ServiceRequest';
2
- import { User } from './User';
3
2
  import { Call } from './Call';
4
3
 
5
4
  export enum BuyerStatus {
@@ -46,10 +45,6 @@ export type Buyer = {
46
45
  scheduledAt: string;
47
46
  status: BuyerRealtyShowStatus;
48
47
  };
49
- sharing?: {
50
- createdAt?: string;
51
- fromExpert?: Partial<User> & Required<Pick<User, 'id'>>;
52
- };
53
48
  source?: string;
54
49
  statusDeadlineAt?: string;
55
50
  updatedAt?: string;
@@ -1,33 +0,0 @@
1
- import { AxiosResponse, AxiosError } from 'axios';
2
- declare type SuccessData = {
3
- success: true;
4
- data: null;
5
- };
6
- declare type ErrorData = {
7
- success: false;
8
- data: {
9
- error: string;
10
- };
11
- };
12
- declare type ResultData = SuccessData['data'];
13
- declare type ResultError = ErrorData['data']['error'];
14
- export declare type ShareBuyerUrlParams = {
15
- id: number;
16
- };
17
- export declare type ShareBuyerHeaders = {
18
- 'x-auth-hc': string;
19
- };
20
- export declare type ShareBuyerBody = {
21
- serviceRequestId: number;
22
- comment?: string;
23
- };
24
- export declare type ShareBuyerData = AxiosResponse<ResultData>;
25
- export declare type ShareBuyerError = AxiosError<ResultError>;
26
- export declare type ShareBuyerConfig = {
27
- baseURL?: string;
28
- urlParams: ShareBuyerUrlParams;
29
- headers: ShareBuyerHeaders;
30
- body: ShareBuyerBody;
31
- };
32
- export declare function shareBuyerRequest({ baseURL, urlParams, body, headers }: ShareBuyerConfig): Promise<ShareBuyerData>;
33
- export {};
@@ -1,36 +0,0 @@
1
- import axios, { AxiosResponse, AxiosError, AxiosResponseTransformer } from 'axios';
2
- import { DEFAULT_BASE_URL } from '../../../constants';
3
-
4
- type SuccessData = { success: true; data: null };
5
- type ErrorData = { success: false; data: { error: string } };
6
-
7
- type ResultData = SuccessData['data'];
8
- type ResultError = ErrorData['data']['error'];
9
-
10
- export type ShareBuyerUrlParams = { id: number };
11
- export type ShareBuyerHeaders = { 'x-auth-hc': string };
12
- export type ShareBuyerBody = { serviceRequestId: number; comment?: string };
13
- export type ShareBuyerData = AxiosResponse<ResultData>;
14
- export type ShareBuyerError = AxiosError<ResultError>;
15
- export type ShareBuyerConfig = {
16
- baseURL?: string;
17
- urlParams: ShareBuyerUrlParams;
18
- headers: ShareBuyerHeaders;
19
- body: ShareBuyerBody;
20
- };
21
-
22
- export function shareBuyerRequest({ baseURL = DEFAULT_BASE_URL, urlParams, body, headers }: ShareBuyerConfig) {
23
- return axios
24
- .put(`/api/buyer/${urlParams.id}/share`, body, {
25
- baseURL,
26
- headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
27
- transformResponse: [
28
- ...(axios.defaults.transformResponse as AxiosResponseTransformer[]),
29
- (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? null : data.data.error),
30
- ],
31
- })
32
- .then((res: ShareBuyerData) => res)
33
- .catch((err: ShareBuyerError) => {
34
- throw err;
35
- });
36
- }