Skip to content

Commit

Permalink
Rename from projects to repos
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinez committed Aug 20, 2024
1 parent 7f30919 commit c69f6f2
Show file tree
Hide file tree
Showing 101 changed files with 929 additions and 937 deletions.
40 changes: 21 additions & 19 deletions http-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ import type { BaseUrl } from "./lib/fetcher.js";
import type {
Blob,
DiffResponse,
Project,
ProjectListQuery,
Remote,
Repo,
RepoListQuery,
Tree,
TreeStats,
} from "./lib/project.js";
} from "./lib/repo.js";
import type {
Author,
Config,
SeedingPolicy,
DefaultSeedingPolicy,
} from "./lib/shared.js";
import type { Comment, Embed, Reaction } from "./lib/project/comment.js";
import type { Comment, Embed, Reaction } from "./lib/repo/comment.js";
import type {
Commit,
CommitBlob,
Expand All @@ -25,8 +26,8 @@ import type {
DiffContent,
DiffFile,
HunkLine,
} from "./lib/project/commit.js";
import type { Issue, IssueState } from "./lib/project/issue.js";
} from "./lib/repo/commit.js";
import type { Issue, IssueState } from "./lib/repo/issue.js";
import type {
LifecycleState,
Merge,
Expand All @@ -35,13 +36,13 @@ import type {
Review,
Revision,
Verdict,
} from "./lib/project/patch.js";
} from "./lib/repo/patch.js";
import type { RequestOptions } from "./lib/fetcher.js";
import type { ZodSchema } from "zod";

import { z, array, literal, number, object, string, union } from "zod";

import * as project from "./lib/project.js";
import * as repo from "./lib/repo.js";
import { Fetcher } from "./lib/fetcher.js";
import {
nodeConfigSchema,
Expand All @@ -50,6 +51,7 @@ import {
} from "./lib/shared.js";

export type {
Author,
BaseUrl,
Blob,
ChangesetWithDiff,
Expand All @@ -73,15 +75,15 @@ export type {
Merge,
Patch,
PatchState,
Project,
ProjectListQuery,
Reaction,
Remote,
Repo,
RepoListQuery,
Review,
Revision,
SeedingPolicy,
TreeStats,
Tree,
TreeStats,
Verdict,
};

Expand Down Expand Up @@ -156,13 +158,13 @@ export class HttpdClient {
#fetcher: Fetcher;

public baseUrl: BaseUrl;
public project: project.Client;
public repo: repo.Client;

public constructor(baseUrl: BaseUrl) {
this.baseUrl = baseUrl;
this.#fetcher = new Fetcher(this.baseUrl);

this.project = new project.Client(this.#fetcher);
this.repo = new repo.Client(this.#fetcher);
}

public changePort(port: number): void {
Expand Down Expand Up @@ -214,13 +216,13 @@ export class HttpdClient {
}

public async getPolicyById(
id: string,
rid: string,
options?: RequestOptions,
): Promise<SeedingPolicy> {
return this.#fetcher.fetchOk(
{
method: "GET",
path: `node/policies/repos/${id}`,
path: `node/policies/repos/${rid}`,
options,
},
seedingPolicySchema,
Expand All @@ -239,27 +241,27 @@ export class HttpdClient {
}

public async getNodeIdentity(
id: string,
nid: string,
options?: RequestOptions,
): Promise<NodeIdentity> {
return this.#fetcher.fetchOk(
{
method: "GET",
path: `nodes/${id}`,
path: `nodes/${nid}`,
options,
},
nodeIdentitySchema,
);
}

public async getNodeInventory(
id: string,
nid: string,
options?: RequestOptions,
): Promise<string[]> {
return this.#fetcher.fetchOk(
{
method: "GET",
path: `nodes/${id}/inventory`,
path: `nodes/${nid}/inventory`,
options,
},
array(string()),
Expand Down
Loading

0 comments on commit c69f6f2

Please sign in to comment.