Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(shared-drives): use correct endpoints for delete and get #56

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions commands/shared-drive/delete/mod.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { sharedDrives } from "../../../api/shared-drives.ts";
import { fields } from "../../../flags.ts";
import { asserts } from "../../../lib/asserts.ts";
import { dataTable } from "../../../lib/data-table.ts";
import { loading } from "../../../lib/loading.ts";
import { pickJson } from "../../../lib/pick-json.ts";
import { input } from "../../../prompts/input.ts";
import { args, command, flags, z } from "../../../zcli.ts";
import { dataTable } from "../../../lib/data-table.ts";
import { fields } from "../../../flags.ts";
import { pickJson } from "../../../lib/pick-json.ts";
import { templates } from "../../../api/templates.ts";
import { defaultFields } from "../mod.ts";

/**
Expand All @@ -15,13 +15,13 @@ import { defaultFields } from "../mod.ts";
const subCommands: ReturnType<typeof command>[] = [];

export const del = command("delete", {
short: "Delete a template",
short: "Delete a shared drive",
long: `
Delete a template from a team.
Delete a shared drive from a team.
`,
commands: subCommands,
args: args().tuple([
z.string().describe("The ID of the template to delete"),
z.string().describe("The ID of the shared drive to delete"),
]).optional(),
flags: flags({
fields,
Expand All @@ -40,11 +40,11 @@ export const del = command("delete", {
id = await input("ID:", {
filter: (v) => !!v.sequence.match(/[a-zA-Z0-9_-]/),
});
asserts(id, "A template ID is required");
asserts(id, "A shared drive ID is required");
}

const response = await loading(
templates.delete({ id }),
sharedDrives.delete({ id }),
);

asserts(response.ok, response);
Expand Down
18 changes: 9 additions & 9 deletions commands/shared-drive/get/mod.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { sharedDrives } from "../../../api/shared-drives.ts";
import { fields } from "../../../flags.ts";
import { asserts } from "../../../lib/asserts.ts";
import { dataTable } from "../../../lib/data-table.ts";
import { loading } from "../../../lib/loading.ts";
import { pickJson } from "../../../lib/pick-json.ts";
import { input } from "../../../prompts/input.ts";
import { args, command, flags, z } from "../../../zcli.ts";
import { dataTable } from "../../../lib/data-table.ts";
import { fields } from "../../../flags.ts";
import { pickJson } from "../../../lib/pick-json.ts";
import { templates } from "../../../api/templates.ts";
import { defaultFields } from "../mod.ts";

/**
Expand All @@ -15,13 +15,13 @@ import { defaultFields } from "../mod.ts";
const subCommands: ReturnType<typeof command>[] = [];

export const get = command("get", {
short: "Get a template",
short: "Get a shared drive",
long: `
Get a template from a team.
Get a shared drive from a team.
`,
commands: subCommands,
args: args().tuple([
z.string().describe("The ID of the template to get"),
z.string().describe("The ID of the shared drive to get"),
]).optional(),
flags: flags({
fields,
Expand All @@ -40,11 +40,11 @@ export const get = command("get", {
id = await input("ID:", {
filter: (v) => !!v.sequence.match(/[a-zA-Z0-9_-]/),
});
asserts(id, "A template ID is required");
asserts(id, "A shared drive ID is required");
}

const response = await loading(
templates.get({ id }),
sharedDrives.get({ id }),
);

asserts(response.ok, response);
Expand Down
Loading