Skip to main content

github_bot_sdk/client/
app.rs

1//! GitHub App metadata types.
2//!
3//! This module contains types representing GitHub App information returned
4//! from the GitHub API.
5
6use chrono::{DateTime, Utc};
7use serde::{Deserialize, Serialize};
8
9use crate::auth::User;
10
11/// GitHub App metadata.
12///
13/// Represents a GitHub App's configuration and metadata as returned by
14/// the GitHub API's `/app` endpoint.
15///
16/// # Examples
17///
18/// ```no_run
19/// # use github_bot_sdk::client::GitHubClient;
20/// # use github_bot_sdk::auth::AuthenticationProvider;
21/// # async fn example(client: &GitHubClient) -> Result<(), Box<dyn std::error::Error>> {
22/// let app = client.get_app().await?;
23/// println!("App: {} (ID: {})", app.name, app.id);
24/// println!("Owner: {}", app.owner.login);
25/// # Ok(())
26/// # }
27/// ```
28#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
29pub struct App {
30    /// Unique numeric identifier for the GitHub App
31    pub id: u64,
32
33    /// URL-friendly string identifier for the app
34    pub slug: String,
35
36    /// Display name of the GitHub App
37    pub name: String,
38
39    /// Owner of the GitHub App (user or organization)
40    pub owner: User,
41
42    /// Description of the app's purpose
43    pub description: Option<String>,
44
45    /// External URL for the app (e.g., homepage)
46    pub external_url: String,
47
48    /// GitHub URL for the app's page
49    pub html_url: String,
50
51    /// When the app was created
52    pub created_at: DateTime<Utc>,
53
54    /// When the app was last updated
55    pub updated_at: DateTime<Utc>,
56}
57
58#[cfg(test)]
59#[path = "app_tests.rs"]
60mod tests;