|
1 | 1 | import type { Command, CommandContext } from "@/commands/types"; |
2 | | -import { printJson, requestDeveloperJson } from "@/commands/developerApi"; |
| 2 | +import { printJson, requestClientJson } from "@/client/clientApi"; |
3 | 3 |
|
4 | 4 | const USAGE = [ |
5 | 5 | "bee facts list [--limit N] [--cursor <cursor>] [--confirmed <true|false>]", |
@@ -66,7 +66,7 @@ async function handleList( |
66 | 66 |
|
67 | 67 | const suffix = params.toString(); |
68 | 68 | const path = suffix ? `/v1/facts?${suffix}` : "/v1/facts"; |
69 | | - const data = await requestDeveloperJson(context, path, { method: "GET" }); |
| 69 | + const data = await requestClientJson(context, path, { method: "GET" }); |
70 | 70 | printJson(data); |
71 | 71 | } |
72 | 72 |
|
@@ -137,7 +137,7 @@ async function handleGet( |
137 | 137 | context: CommandContext |
138 | 138 | ): Promise<void> { |
139 | 139 | const id = parseId(args); |
140 | | - const data = await requestDeveloperJson(context, `/v1/facts/${id}`, { |
| 140 | + const data = await requestClientJson(context, `/v1/facts/${id}`, { |
141 | 141 | method: "GET", |
142 | 142 | }); |
143 | 143 | printJson(data); |
@@ -167,7 +167,7 @@ async function handleCreate( |
167 | 167 | context: CommandContext |
168 | 168 | ): Promise<void> { |
169 | 169 | const options = parseCreateArgs(args); |
170 | | - const data = await requestDeveloperJson(context, "/v1/facts", { |
| 170 | + const data = await requestClientJson(context, "/v1/facts", { |
171 | 171 | method: "POST", |
172 | 172 | json: { text: options.text }, |
173 | 173 | }); |
@@ -228,7 +228,7 @@ async function handleUpdate( |
228 | 228 | body.confirmed = options.confirmed; |
229 | 229 | } |
230 | 230 |
|
231 | | - const data = await requestDeveloperJson(context, `/v1/facts/${options.id}`, { |
| 231 | + const data = await requestClientJson(context, `/v1/facts/${options.id}`, { |
232 | 232 | method: "PUT", |
233 | 233 | json: body, |
234 | 234 | }); |
@@ -311,7 +311,7 @@ async function handleDelete( |
311 | 311 | context: CommandContext |
312 | 312 | ): Promise<void> { |
313 | 313 | const id = parseId(args); |
314 | | - const data = await requestDeveloperJson(context, `/v1/facts/${id}`, { |
| 314 | + const data = await requestClientJson(context, `/v1/facts/${id}`, { |
315 | 315 | method: "DELETE", |
316 | 316 | }); |
317 | 317 | printJson(data); |
|
0 commit comments