You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Individual modules in the API](https://docs.rs/azure_devops_rust_api/latest/azure_devops_rust_api/#modules) are enabled via Rust [`features`](https://doc.rust-lang.org/cargo/reference/features.html).
47
+
### Personal Access Token (PAT)
62
48
63
-
See the `features` section of [Cargo.toml](Cargo.toml) for the full list of features.
49
+
Create a [PAT](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate)
50
+
with the minimum required scopes and a short expiry, then:
64
51
65
-
Example application `Cargo.toml` dependency spec showing how to specify desired features:
52
+
```rust
53
+
useazure_devops_rust_api::Credential;
66
54
67
-
```toml
68
-
[dependencies]
69
-
...
70
-
azure_devops_rust_api = { version = "0.35.0", features = ["git", "pipelines"] }
> **Note:** Treat PATs like passwords — grant only the minimum required scopes and set a short expiry.
74
60
75
-
See [examples](examples/) directory.
61
+
## Usage
76
62
77
-
Define environment variables:
63
+
All modules follow the same pattern:
78
64
79
-
```sh
80
-
export ADO_ORGANIZATION=<organization-name>
81
-
export ADO_PROJECT=<project-name>
82
-
```
65
+
1. Obtain a `Credential` (see [Authentication](#authentication) above).
66
+
2. Create a top-level client via `<module>::ClientBuilder::new(credential).build()`.
67
+
3. Obtain a sub-client for the resource you want (e.g. `repositories_client()`).
68
+
4. Call the operation method. Mandatory parameters are positional arguments; optional parameters
69
+
are set via builder methods. Finalize and send the request by `.await`ing the builder
70
+
(the builder implements `IntoFuture`).
83
71
84
-
To run the examples you need to provide authentication credentials either via:
72
+
### Example
85
73
86
-
- The `az` CLI, where you just need to have authenticated by running `az login` before running the examples.
87
-
- A [Personal Access Token (PAT)](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate), provided via the environment variable `ADO_TOKEN`
88
-
> Note: A personal access token contains your security credentials for Azure DevOps.
89
-
> A PAT identifies you, your accessible organizations, and scopes of access.
90
-
> As such, they're as critical as passwords, so you should treat them the same way.
91
-
> When creating a PAT only grant it the minimum required scopes, and set the expiry time to be short.
74
+
```rust
75
+
useanyhow::Result;
76
+
useazure_devops_rust_api::git;
77
+
useazure_devops_rust_api::Credential;
78
+
useazure_identity::AzureCliCredential;
79
+
usestd::env;
92
80
93
-
Run the example via `cargo run --example`. You will need to enable the features required
94
-
by the example. If you don't specify the necessary features you do get a helpful error
0 commit comments