Skip to content

Commit a6ae315

Browse files
author
Manuel Sanchez
committed
Add api translation
1 parent 00a381b commit a6ae315

File tree

4 files changed

+1965
-3804
lines changed

4 files changed

+1965
-3804
lines changed

alchemy/src/docker/api/api.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ export function createDockerApi() {
3737
const client = createClient<paths>({
3838
baseUrl: "http://localhost:10000",
3939
fetch(input) {
40-
// @ts-ignore: dispatcher may not be typed but we know it's there
41-
input.dispatcher = agent;
40+
if (typeof Bun !== "undefined") {
41+
// @ts-ignore: Bun specific
42+
input.unix = "/var/run/docker.sock";
43+
} else {
44+
// @ts-ignore: dispatcher may not be typed but we know it's there
45+
input.dispatcher = agent;
46+
}
47+
4248
return fetch(input.url, input);
4349
},
4450
});
@@ -124,13 +130,7 @@ export function createDockerApi() {
124130
}),
125131
create: (params: NetworkCreateParams) =>
126132
POST("/networks/create", {
127-
body: {
128-
name: params.name,
129-
driver: params.driver,
130-
labels: params.labels,
131-
enableIPv4: params.enableIPv4,
132-
enableIPv6: params.enableIPv6,
133-
},
133+
body: params,
134134
}),
135135
// TODO(manuel): Implement filters query param
136136
prune: () => POST("/networks/prune"),
@@ -250,7 +250,6 @@ interface ListImagesParams
250250
* process on the images list.
251251
*
252252
* Available filters:
253-
*
254253
* - `before`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`)
255254
* - `dangling=true`
256255
* - `label=key` or `label="key=value"` of an image label

0 commit comments

Comments
 (0)