use autoschematic_core::connector::ConnectorOp;
use serde::{Deserialize, Serialize};
use autoschematic_core::util::RON;
use super::resource::{GitHubRepository, BranchProtection, Collaborator};
#[derive(Debug, Serialize, Deserialize)]
pub enum GitHubConnectorOp {
CreateRepository(GitHubRepository),
UpdateRepository(GitHubRepository, GitHubRepository), DeleteRepository,
CreateBranchProtection(BranchProtection),
UpdateBranchProtection(BranchProtection, BranchProtection), DeleteBranchProtection,
AddCollaborator(Collaborator),
UpdateCollaboratorPermission(Collaborator, Collaborator), RemoveCollaborator,
}
impl ConnectorOp for GitHubConnectorOp {
fn to_string(&self) -> Result<String, anyhow::Error> {
Ok(RON.to_string(self)?)
}
fn from_str(s: &str) -> Result<Self, anyhow::Error>
where
Self: Sized,
{
Ok(RON.from_str(s)?)
}
}