JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Fixed imports!

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨ef0e853

⁨giterated-models/src/user/operations.rs⁩ - ⁨925⁩ bytes
Raw
1 use serde::{Deserialize, Serialize};
2
3 use crate::{
4 error::{OperationError, UserError},
5 instance::Instance,
6 object::Object,
7 object_backend::ObjectBackend,
8 operation::GiteratedOperation,
9 repository::Repository,
10 };
11
12 use super::User;
13
14 #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
15 pub struct UserRepositoriesRequest {
16 pub instance: Instance,
17 pub user: User,
18 }
19
20 impl GiteratedOperation<User> for UserRepositoriesRequest {
21 type Success = Vec<Repository>;
22 type Failure = UserError;
23 }
24
25 impl<B: ObjectBackend + std::fmt::Debug> Object<'_, User, B> {
26 pub async fn repositories(
27 &mut self,
28 instance: &Instance,
29 ) -> Result<Vec<Repository>, OperationError<UserError>> {
30 self.request::<UserRepositoriesRequest>(UserRepositoriesRequest {
31 instance: instance.clone(),
32 user: self.inner.clone(),
33 })
34 .await
35 }
36 }
37