Skip to content

Commit da1858b

Browse files
authored
fix: replace Promise<any> with SuccessResponse in line mutation functions (#835)
All six line mutation functions (update, enable, disable, archive, unarchive, deleteLine) returned Promise<any>, undermining type safety for consumers. Replaced with Promise<SuccessResponse> to match the existing pattern used in user.ts.
1 parent d935e95 commit da1858b

File tree

1 file changed

+13
-13
lines changed
  • packages/javascript-api/src/lib/services/line

1 file changed

+13
-13
lines changed

packages/javascript-api/src/lib/services/line/line.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Line } from '../../model/line.js';
22
import { Location } from '../../model/location.js';
33
import { extractId, IdOrObject } from '../../util/id-or-object.js';
4-
import { ApiBase } from '../api-base/api-base.js';
4+
import { ApiBase, SuccessResponse } from '../api-base/api-base.js';
55

66
type LineCreateParameters = Partial<Omit<Line, 'id'>> & Pick<Line, 'name'>;
77
type LineUpdateParameters = Pick<Line, 'id'> &
@@ -45,7 +45,7 @@ export function create(
4545
}) as Promise<Line>;
4646
}
4747

48-
export function update(line: LineUpdateParameters): Promise<any> {
48+
export function update(line: LineUpdateParameters): Promise<SuccessResponse> {
4949
if (!line || typeof line !== 'object') {
5050
throw new Error('Line is invalid or missing.');
5151
}
@@ -69,57 +69,57 @@ export function update(line: LineUpdateParameters): Promise<any> {
6969
return ApiBase.request(`v1/lines/${lineId}`, {
7070
body: data,
7171
method: 'POST',
72-
}) as Promise<any>;
72+
}) as Promise<SuccessResponse>;
7373
}
7474

75-
export function enable(line: IdOrObject<Line>): Promise<any> {
75+
export function enable(line: IdOrObject<Line>): Promise<SuccessResponse> {
7676
const lineId = extractId(line);
7777
if (!lineId || typeof lineId !== 'string') {
7878
throw new Error('Line ID invalid or missing.');
7979
}
8080
return ApiBase.request(`v1/lines/${lineId}/enable`, {
8181
method: 'POST',
82-
}) as Promise<any>;
82+
}) as Promise<SuccessResponse>;
8383
}
8484

85-
export function disable(line: IdOrObject<Line>): Promise<any> {
85+
export function disable(line: IdOrObject<Line>): Promise<SuccessResponse> {
8686
const lineId = extractId(line);
8787
if (!lineId || typeof lineId !== 'string') {
8888
throw new Error('Line ID invalid or missing.');
8989
}
9090
return ApiBase.request(`v1/lines/${lineId}/disable`, {
9191
method: 'POST',
92-
}) as Promise<any>;
92+
}) as Promise<SuccessResponse>;
9393
}
9494

95-
export function archive(line: IdOrObject<Line>): Promise<any> {
95+
export function archive(line: IdOrObject<Line>): Promise<SuccessResponse> {
9696
const lineId = extractId(line);
9797
if (!lineId || typeof lineId !== 'string') {
9898
throw new Error('Line ID invalid or missing.');
9999
}
100100
return ApiBase.request(`v1/lines/${lineId}/archive`, {
101101
method: 'POST',
102-
}) as Promise<any>;
102+
}) as Promise<SuccessResponse>;
103103
}
104104

105-
export function unarchive(line: IdOrObject<Line>): Promise<any> {
105+
export function unarchive(line: IdOrObject<Line>): Promise<SuccessResponse> {
106106
const lineId = extractId(line);
107107

108108
if (!lineId || typeof lineId !== 'string') {
109109
throw new Error('Line ID invalid or missing.');
110110
}
111111
return ApiBase.request(`v1/lines/${lineId}/unarchive`, {
112112
method: 'POST',
113-
}) as Promise<any>;
113+
}) as Promise<SuccessResponse>;
114114
}
115115

116-
export function deleteLine(line: IdOrObject<Line>): Promise<any> {
116+
export function deleteLine(line: IdOrObject<Line>): Promise<SuccessResponse> {
117117
const lineId = extractId(line);
118118

119119
if (!lineId || typeof lineId !== 'string') {
120120
throw new Error('Line ID invalid or missing.');
121121
}
122122
return ApiBase.request(`v1/lines/${lineId}`, {
123123
method: 'DELETE',
124-
}) as Promise<any>;
124+
}) as Promise<SuccessResponse>;
125125
}

0 commit comments

Comments
 (0)