-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTuneService.ts
94 lines (87 loc) · 2.25 KB
/
TuneService.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { clientErrorWrapper } from '../utils/errors.js';
import { Options } from '../client.js';
import {
TuneServiceCreateInput,
TuneServiceCreateOutput,
TuneServiceDeleteInput,
TuneServiceDeleteOutput,
TuneServiceListInput,
TuneServiceListOutput,
TuneServiceReadInput,
TuneServiceReadOutput,
TuneServiceRetrieveInput,
TuneServiceRetrieveOutput,
TuneServiceTypesInput,
TuneServiceTypesOutput,
} from '../schema.js';
import { BaseService } from './BaseService.js';
export class TuneService extends BaseService {
async create(
input: TuneServiceCreateInput,
opts?: Options,
): Promise<TuneServiceCreateOutput> {
return clientErrorWrapper(
this._client.POST('/v2/tunes', {
...opts,
params: { query: { version: '2023-11-22' } },
body: input,
}),
);
}
async read(
input: TuneServiceReadInput,
opts?: Options,
): Promise<TuneServiceReadOutput> {
return clientErrorWrapper(
this._client.GET('/v2/tunes/{id}/content/{type}', {
...opts,
params: { path: input, query: { version: '2023-12-15' } },
parseAs: 'blob',
}),
);
}
async retrieve(
input: TuneServiceRetrieveInput,
opts?: Options,
): Promise<TuneServiceRetrieveOutput> {
return clientErrorWrapper(
this._client.GET('/v2/tunes/{id}', {
...opts,
params: { path: input, query: { version: '2023-11-22' } },
}),
);
}
async delete(
input: TuneServiceDeleteInput,
opts?: Options,
): Promise<TuneServiceDeleteOutput> {
return clientErrorWrapper(
this._client.DELETE('/v2/tunes/{id}', {
...opts,
params: { path: input, query: { version: '2023-11-22' } },
}),
);
}
async list(
input: TuneServiceListInput,
opts?: Options,
): Promise<TuneServiceListOutput> {
return clientErrorWrapper(
this._client.GET('/v2/tunes', {
...opts,
params: { query: { ...input, version: '2023-11-22' } },
}),
);
}
async types(
input: TuneServiceTypesInput,
opts?: Options,
): Promise<TuneServiceTypesOutput> {
return clientErrorWrapper(
this._client.GET('/v2/tuning_types', {
...opts,
params: { query: { version: '2024-01-30' } },
}),
);
}
}