Skip to main content

ephemeris_forge_forgejo/api/model/
access.rs

1use facet::Facet;
2
3/// A direct collaborator with the permission Forgejo reports for them.
4#[derive(Clone, Debug, Default, Eq, PartialEq)]
5pub struct Collaborator {
6    /// The user's login.
7    pub login: String,
8    /// The user's permission on the repository.
9    pub permission: String,
10}
11
12/// The wire shape of a user in the collaborator listing.
13#[derive(Facet)]
14pub(crate) struct CollaboratorUser {
15    pub(crate) login: String,
16}
17
18/// The wire shape of the permission lookup for one collaborator.
19#[derive(Facet)]
20pub(crate) struct CollaboratorPermission {
21    pub(crate) permission: String,
22}
23
24/// A repository team assignment returned by Forgejo.
25#[derive(Clone, Debug, Default, Facet)]
26pub struct Team {
27    /// The team's numeric identifier.
28    pub id: Option<i64>,
29    /// The team's name.
30    pub name: Option<String>,
31    /// The team's organization-wide permission.
32    pub permission: Option<String>,
33    /// Whether the team is granted every repository in the organization,
34    /// including ones created later.
35    pub includes_all_repositories: Option<bool>,
36    /// The organization the team belongs to.
37    pub organization: Option<TeamOrganization>,
38}
39
40/// The organization a team belongs to.
41#[derive(Clone, Debug, Default, Facet)]
42pub struct TeamOrganization {
43    /// The organization's name.
44    pub username: Option<String>,
45}
46
47/// The wire shape of the authenticated user.
48#[derive(Facet)]
49pub(crate) struct CurrentUser {
50    pub(crate) login: String,
51}