Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 2209x 2209x 3x 3x 2209x 3x 3x 2209x 3x 3x | import { MovableKind, MoveDestination, MovePlan } from "@/objects/Ownership";
import { Dictionary } from "@/types/ext";
import { AxiosRequestConfig } from "axios";
import { APIRouter } from "../ApiRouter";
/** Moving personal work into an organisation or project. Preview first: the
* plan lists what goes with it and what blocks it. */
export class OwnershipRouter extends APIRouter {
constructor(
host: string,
token: string | null = null,
default_config: AxiosRequestConfig | null = null,
headers: Dictionary<string> = {},
) {
super("ownership", host, token, default_config, headers);
}
preview = async (
kind: MovableKind,
resourceId: string,
to: MoveDestination,
): Promise<MovePlan> => {
const res = await this.api.post(this.endpoint("preview"), {
kind,
resource_id: resourceId,
...to,
});
return res.data as MovePlan;
};
/** Throws with the plan in `detail` when something blocks the move. */
move = async (
kind: MovableKind,
resourceId: string,
to: MoveDestination,
): Promise<MovePlan> => {
const res = await this.api.post(this.endpoint("move"), {
kind,
resource_id: resourceId,
...to,
});
return res.data as MovePlan;
};
/** An editable copy in the workspace the request is made in (svc-core
* `app/services/copying.py`): from a project's parent into the project,
* or a duplicate in place. */
copy = async (
kind: string,
resourceId: string,
): Promise<{ kind: string; id: string; name?: string | null; workspace: string }> => {
const res = await this.api.post(this.endpoint("copy"), {
kind,
resource_id: resourceId,
});
return res.data as { kind: string; id: string; name?: string | null; workspace: string };
};
}
|