MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / getPull

Function getPull

packages/wl-sdk/src/dolthub/pulls.ts:152–186  ·  view source on GitHub ↗
(opts: GetPullOptions)

Source from the content-addressed store, hash-verified

150
151/** Fetch pull detail, normalizing the dual field-name shapes. */
152export async function getPull(opts: GetPullOptions): Promise<PullDetail> {
153 const path = `${pullsPath(opts.owner, opts.db)}/${encodeURIComponent(opts.pullId)}`;
154 const res = await doltFetch({
155 method: 'GET',
156 path,
157 auth: opts.auth,
158 fetch: opts.fetch,
159 hooks: opts.hooks,
160 });
161 const url = buildDoltUrl(path);
162 expectOk(res, url, `Get pull ${opts.pullId}`);
163 const parsed = PullDetailRaw.safeParse(res.json ?? {});
164 if (!parsed.success) {
165 throw new WlDoltHubError(
166 `Get pull ${opts.pullId} returned an unexpected shape: ${parsed.error.message}`,
167 res.status,
168 res.json ?? res.text,
169 url
170 );
171 }
172 const raw = parsed.data;
173 return {
174 pull_id: raw.pull_id,
175 title: raw.title,
176 description: raw.description ?? null,
177 state: raw.state,
178 from_branch_name: raw.from_branch_name ?? raw.from_branch ?? null,
179 to_branch_name: raw.to_branch_name ?? raw.to_branch ?? null,
180 from_branch_owner_name: raw.from_branch_owner_name ?? raw.from_branch_owner ?? null,
181 from_branch_repo_name: raw.from_branch_repo_name ?? raw.from_branch_database ?? null,
182 creator_name: raw.creator_name ?? raw.author ?? null,
183 created_at: raw.created_at ?? null,
184 updated_at: raw.updated_at ?? null,
185 };
186}
187
188/**
189 * Open a pull request. `fromOwner` / `fromDb` default to `owner` /

Callers 6

listMyBranchesFunction · 0.90
closeOpenPullForBranchFunction · 0.90
unpublishFunction · 0.90
findPullForBranchInStateFunction · 0.90
pulls.test.tsFile · 0.90
listMyPullsViaSdkFunction · 0.90

Calls 4

doltFetchFunction · 0.90
buildDoltUrlFunction · 0.90
expectOkFunction · 0.90
pullsPathFunction · 0.85

Tested by

no test coverage detected