|
2 | 2 | //!
|
3 | 3 | //! See <https://docs.github.com/en/graphql> for more GitHub's GraphQL API.
|
4 | 4 |
|
5 |
| -// This schema can be downloaded from https://docs.github.com/en/graphql/overview/public-schema |
| 5 | +// This schema can be downloaded from https://docs.github.com/public/schema.docs.graphql |
6 | 6 | #[cynic::schema_for_derives(file = "src/github.graphql", module = "schema")]
|
7 | 7 | pub mod queries {
|
8 | 8 | use super::schema;
|
@@ -155,6 +155,113 @@ pub mod queries {
|
155 | 155 | pub struct Uri(pub String);
|
156 | 156 | }
|
157 | 157 |
|
| 158 | +#[cynic::schema_for_derives(file = "src/github.graphql", module = "schema")] |
| 159 | +pub mod docs_update_queries { |
| 160 | + use super::queries::{DateTime, PageInfo}; |
| 161 | + use super::schema; |
| 162 | + |
| 163 | + #[derive(cynic::FragmentArguments, Debug)] |
| 164 | + pub struct RecentCommitsArguments { |
| 165 | + pub branch: String, |
| 166 | + pub name: String, |
| 167 | + pub owner: String, |
| 168 | + pub after: Option<String>, |
| 169 | + } |
| 170 | + |
| 171 | + #[derive(cynic::QueryFragment, Debug)] |
| 172 | + #[cynic(graphql_type = "Query", argument_struct = "RecentCommitsArguments")] |
| 173 | + pub struct RecentCommits { |
| 174 | + #[arguments(name = &args.name, owner = &args.owner)] |
| 175 | + pub repository: Option<Repository>, |
| 176 | + } |
| 177 | + |
| 178 | + #[derive(cynic::QueryFragment, Debug)] |
| 179 | + #[cynic(argument_struct = "RecentCommitsArguments")] |
| 180 | + pub struct Repository { |
| 181 | + #[arguments(qualified_name = &args.branch)] |
| 182 | + #[cynic(rename = "ref")] |
| 183 | + pub ref_: Option<Ref>, |
| 184 | + } |
| 185 | + |
| 186 | + #[derive(cynic::QueryFragment, Debug)] |
| 187 | + pub struct Ref { |
| 188 | + pub target: Option<GitObject>, |
| 189 | + } |
| 190 | + |
| 191 | + #[derive(cynic::QueryFragment, Debug)] |
| 192 | + pub struct Commit { |
| 193 | + #[arguments(first = 100)] |
| 194 | + pub history: CommitHistoryConnection, |
| 195 | + } |
| 196 | + |
| 197 | + #[derive(cynic::QueryFragment, Debug)] |
| 198 | + pub struct CommitHistoryConnection { |
| 199 | + pub total_count: i32, |
| 200 | + pub page_info: PageInfo, |
| 201 | + pub nodes: Option<Vec<Option<Commit2>>>, |
| 202 | + } |
| 203 | + |
| 204 | + #[derive(cynic::QueryFragment, Debug)] |
| 205 | + #[cynic(graphql_type = "Commit")] |
| 206 | + pub struct Commit2 { |
| 207 | + pub oid: GitObjectID, |
| 208 | + #[arguments(first = 1)] |
| 209 | + pub parents: CommitConnection, |
| 210 | + pub committed_date: DateTime, |
| 211 | + pub message_headline: String, |
| 212 | + #[arguments(first = 1)] |
| 213 | + pub associated_pull_requests: Option<PullRequestConnection>, |
| 214 | + } |
| 215 | + |
| 216 | + #[derive(cynic::QueryFragment, Debug)] |
| 217 | + pub struct PullRequestConnection { |
| 218 | + pub nodes: Option<Vec<Option<PullRequest>>>, |
| 219 | + } |
| 220 | + |
| 221 | + #[derive(cynic::QueryFragment, Debug)] |
| 222 | + pub struct PullRequest { |
| 223 | + pub number: i32, |
| 224 | + pub title: String, |
| 225 | + } |
| 226 | + |
| 227 | + #[derive(cynic::QueryFragment, Debug)] |
| 228 | + pub struct CommitConnection { |
| 229 | + pub nodes: Option<Vec<Option<Commit3>>>, |
| 230 | + } |
| 231 | + |
| 232 | + #[derive(cynic::QueryFragment, Debug)] |
| 233 | + #[cynic(graphql_type = "Commit")] |
| 234 | + pub struct Commit3 { |
| 235 | + pub oid: GitObjectID, |
| 236 | + } |
| 237 | + |
| 238 | + #[derive(cynic::InlineFragments, Debug)] |
| 239 | + pub enum GitObject { |
| 240 | + Commit(Commit), |
| 241 | + // These three variants are here just to pacify cynic. I don't know |
| 242 | + // why it fails to compile without them. |
| 243 | + Tree(Tree), |
| 244 | + Tag(Tag), |
| 245 | + Blob(Blob), |
| 246 | + } |
| 247 | + |
| 248 | + #[derive(cynic::QueryFragment, Debug)] |
| 249 | + pub struct Tree { |
| 250 | + pub id: cynic::Id, |
| 251 | + } |
| 252 | + #[derive(cynic::QueryFragment, Debug)] |
| 253 | + pub struct Tag { |
| 254 | + pub id: cynic::Id, |
| 255 | + } |
| 256 | + #[derive(cynic::QueryFragment, Debug)] |
| 257 | + pub struct Blob { |
| 258 | + pub id: cynic::Id, |
| 259 | + } |
| 260 | + |
| 261 | + #[derive(cynic::Scalar, Debug, Clone)] |
| 262 | + pub struct GitObjectID(pub String); |
| 263 | +} |
| 264 | + |
158 | 265 | mod schema {
|
159 | 266 | cynic::use_schema!("src/github.graphql");
|
160 | 267 | }
|
0 commit comments