1use std::time::Duration;
2
3pub const GITHUB_API_URL: &str = "https://api.github.com";
4pub const GITHUB_GRAPHQL_URL: &str = "https://api.github.com/graphql";
5pub const USER_AGENT: &str = "github-rust/0.1.0";
6pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(30);
7pub const MAX_RETRIES: u32 = 3;
8
9pub const GRAPHQL_REPOSITORY_QUERY: &str = r#"
10query($owner: String!, $name: String!) {
11 repository(owner: $owner, name: $name) {
12 id
13 name
14 nameWithOwner
15 description
16 url
17 homepageUrl
18 createdAt
19 updatedAt
20 pushedAt
21 isPrivate
22 isFork
23 isArchived
24 stargazerCount
25 forkCount
26 watchers {
27 totalCount
28 }
29 issues {
30 totalCount
31 }
32 pullRequests {
33 totalCount
34 }
35 releases {
36 totalCount
37 }
38 primaryLanguage {
39 name
40 color
41 }
42 languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
43 edges {
44 size
45 node {
46 name
47 color
48 }
49 }
50 }
51 licenseInfo {
52 name
53 spdxId
54 }
55 defaultBranchRef {
56 name
57 }
58 repositoryTopics(first: 20) {
59 edges {
60 node {
61 topic {
62 name
63 }
64 }
65 }
66 }
67 }
68}
69"#;
70
71pub const GRAPHQL_SEARCH_REPOSITORIES_QUERY: &str = r#"
72query($queryString: String!, $first: Int!, $after: String) {
73 search(query: $queryString, type: REPOSITORY, first: $first, after: $after) {
74 repositoryCount
75 pageInfo {
76 hasNextPage
77 endCursor
78 }
79 edges {
80 node {
81 ... on Repository {
82 id
83 name
84 nameWithOwner
85 description
86 url
87 stargazerCount
88 forkCount
89 createdAt
90 updatedAt
91 pushedAt
92 primaryLanguage {
93 name
94 color
95 }
96 licenseInfo {
97 name
98 spdxId
99 }
100 repositoryTopics(first: 5) {
101 edges {
102 node {
103 topic {
104 name
105 }
106 }
107 }
108 }
109 }
110 }
111 }
112 }
113}
114"#;