Skip to main content

gitpoulpi_hosting/azure_devops/
mod.rs

1//! Azure DevOps (Services and Server) hosting client: repositories, pull
2//! requests and Boards work items (the "issues" half), over a personal
3//! access token.
4//!
5//! Slice S3 of the more-providers design. Every endpoint
6//! below was re-read on 2026-10-08 against the official 7.1 reference (the
7//! "verify-first" step); where the page disagreed with the plan, the page
8//! won (see the notes).
9//!
10//! # Endpoints (all `{org}` = `https://dev.azure.com/{org}` or the Server
11//! collection root; `api-version` 7.1 on Services, 7.0 on Server)
12//!
13//! * Repositories, org-wide list:
14//!   `GET {org}/_apis/git/repositories` --
15//!   <https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/list?view=azure-devops-rest-7.1>
16//! * Repository by **name or id**, project-scoped:
17//!   `GET {org}/{project}/_apis/git/repositories/{repo}` --
18//!   <https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/get-repository?view=azure-devops-rest-7.1>
19//! * Pull requests: `GET|POST {org}/{project}/_apis/git/repositories/{repoId}/pullrequests`
20//!   (`searchCriteria.status|creatorId|reviewerId|sourceRefName`, `$top`, `$skip`) --
21//!   <https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-requests/get-pull-requests?view=azure-devops-rest-7.1>,
22//!   <https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-requests/create?view=azure-devops-rest-7.1>
23//! * Work items: WIQL `POST {org}/{project}/_apis/wit/wiql?$top=` then batch
24//!   `GET {org}/{project}/_apis/wit/workitems?ids=&fields=` (200 ids max) and
25//!   `POST {org}/{project}/_apis/wit/workitems/${type}` as
26//!   `application/json-patch+json` --
27//!   <https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/wiql/query-by-wiql?view=azure-devops-rest-7.1>,
28//!   <https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/list?view=azure-devops-rest-7.1>,
29//!   <https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/create?view=azure-devops-rest-7.1>
30//! * Work item types: `GET {org}/{project}/_apis/wit/workitemtypes` --
31//!   <https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-item-types/list?view=azure-devops-rest-7.1>
32//!
33//! # Verification notes (doc vs plan)
34//!
35//! * **`repositoryId` on the pull-request endpoints is documented as an
36//!   id only** ("The repository ID of the pull request's target branch"),
37//!   so the repo *name* is not sent. The project-scoped *Get Repository*
38//!   documents "name or ID", so the client resolves name to id there first
39//!   (cached per client). The plan allowed either.
40//! * The create-PR sample answers **201** though the table lists 200; any
41//!   2xx is accepted. The response has no browser URL: it is built from
42//!   the spec (`.../_git/{repo}/pullrequest/{id}`).
43//! * `forkSource` exists on `GitPullRequest` (a `GitForkRef` whose
44//!   `repository` is the fork) but the create page documents no fork
45//!   flow: a pull request from a fork stays `Unsupported`.
46//! * Work item batch read: `_links.html` is only present with
47//!   `$expand=all|links`, and `fields` cannot be combined with `$expand`;
48//!   the browser URL is therefore built from the spec
49//!   (`{org}/{project}/_workitems/edit/{id}`). The create sample's
50//!   `_links.html` is the legacy `web/wi.aspx?pcguid=` form, not used.
51//!   `System.AssignedTo` is an identity object in 7.1 but a
52//!   `"Name <email>"` string in some samples: both are read.
53//! * Closed work items: the state *category* needs per-type
54//!   `workitemtypes/{type}/states`; the fallback names `Done`, `Closed`,
55//!   `Removed`, `Resolved` are used (plan D4).
56//!
57//! # Still unverified (no official REST page)
58//!
59//! * `GET {org}/_apis/connectionData` for the current user with a PAT is
60//!   only known from the extension SDK's `ConnectionData` type
61//!   (`authenticatedUser` is an Id). The client reads it leniently and
62//!   falls back to `GET {org}/_apis/projects?$top=1`, which only proves
63//!   access: "mine" and "review requested" then answer `Unsupported`.
64//! * Browser URLs other than the PR and work-item pages (`pullrequestcreate`,
65//!   `?version=GB{branch}`, `commit/{sha}`), and `refs/pull/{id}/...`
66//!   (never used: checkout fetches the source branch).
67//! * An invalid PAT is reported by Azure DevOps as **203 with an HTML
68//!   sign-in page**, not as 401; that is mapped to `Unauthorized`.
69//! * The work item *new* form URL: left `None`.
70
71mod client;
72#[cfg(test)]
73mod conversation_tests;
74mod map;
75mod remote;
76pub mod spec;
77#[cfg(test)]
78mod tests;
79
80pub use client::AzureDevopsClient;