Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions crates/lineark-sdk/src/generated/client_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,23 @@ impl Client {
pub fn issue_labels<T>(&self) -> IssueLabelsQueryBuilder<'_, T> {
crate::generated::queries::issue_labels(self)
}
/// All initiatives in the workspace.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub fn initiatives<T>(&self) -> InitiativesQueryBuilder<'_, T> {
crate::generated::queries::initiatives(self)
}
/// One specific initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative<
T: DeserializeOwned + GraphQLFields<FullType = super::types::Initiative>,
>(
&self,
id: String,
) -> Result<T, LinearError> {
crate::generated::queries::initiative::<T>(self, id).await
}
/// All documents in the workspace.
///
/// Full type: [`Document`](super::types::Document)
Expand Down Expand Up @@ -182,6 +199,25 @@ impl Client {
) -> Result<serde_json::Value, LinearError> {
crate::generated::mutations::image_upload_from_url(self, url).await
}
/// Creates a new initiativeToProject join.
///
/// Full type: [`InitiativeToProject`](super::types::InitiativeToProject)
pub async fn initiative_to_project_create<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::InitiativeToProject>,
>(
&self,
input: InitiativeToProjectCreateInput,
) -> Result<T, LinearError> {
crate::generated::mutations::initiative_to_project_create::<T>(self, input).await
}
/// Deletes a initiativeToProject.
pub async fn initiative_to_project_delete(
&self,
id: String,
) -> Result<serde_json::Value, LinearError> {
crate::generated::mutations::initiative_to_project_delete(self, id).await
}
/// Creates a new comment.
///
/// Full type: [`Comment`](super::types::Comment)
Expand Down Expand Up @@ -403,6 +439,59 @@ impl Client {
) -> Result<serde_json::Value, LinearError> {
crate::generated::mutations::issue_relation_delete(self, id).await
}
/// Creates a new initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative_create<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::Initiative>,
>(
&self,
input: InitiativeCreateInput,
) -> Result<T, LinearError> {
crate::generated::mutations::initiative_create::<T>(self, input).await
}
/// Updates a initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative_update<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::Initiative>,
>(
&self,
input: InitiativeUpdateInput,
id: String,
) -> Result<T, LinearError> {
crate::generated::mutations::initiative_update::<T>(self, input, id).await
}
/// Archives a initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative_archive<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::Initiative>,
>(
&self,
id: String,
) -> Result<T, LinearError> {
crate::generated::mutations::initiative_archive::<T>(self, id).await
}
/// Unarchives a initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative_unarchive<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::Initiative>,
>(
&self,
id: String,
) -> Result<T, LinearError> {
crate::generated::mutations::initiative_unarchive::<T>(self, id).await
}
/// Deletes (trashes) an initiative.
pub async fn initiative_delete(&self, id: String) -> Result<serde_json::Value, LinearError> {
crate::generated::mutations::initiative_delete(self, id).await
}
/// Creates a new document.
///
/// Full type: [`Document`](super::types::Document)
Expand Down
127 changes: 127 additions & 0 deletions crates/lineark-sdk/src/generated/mutations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,44 @@ pub async fn image_upload_from_url(
.execute::<serde_json::Value>(&query, variables, "imageUploadFromUrl")
.await
}
/// Creates a new initiativeToProject join.
///
/// Full type: [`InitiativeToProject`](super::types::InitiativeToProject)
pub async fn initiative_to_project_create<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::InitiativeToProject>,
>(
client: &Client,
input: InitiativeToProjectCreateInput,
) -> Result<T, LinearError> {
let variables = serde_json::json!({ "input" : input });
let query = String::from(
"mutation InitiativeToProjectCreate($input: InitiativeToProjectCreateInput!) { initiativeToProjectCreate(input: $input) { success initiativeToProject { ",
) + &T::selection() + " } } }";
client
.execute_mutation::<T>(
&query,
variables,
"initiativeToProjectCreate",
"initiativeToProject",
)
.await
}
/// Deletes a initiativeToProject.
pub async fn initiative_to_project_delete(
client: &Client,
id: String,
) -> Result<serde_json::Value, LinearError> {
let variables = serde_json::json!({ "id" : id });
let response_parts: Vec<String> = vec!["success".to_string(), "entityId".to_string()];
let query = String::from(
"mutation InitiativeToProjectDelete($id: String!) { initiativeToProjectDelete(id: $id) { ",
) + &response_parts.join(" ")
+ " } }";
client
.execute::<serde_json::Value>(&query, variables, "initiativeToProjectDelete")
.await
}
/// Creates a new comment.
///
/// Full type: [`Comment`](super::types::Comment)
Expand Down Expand Up @@ -420,6 +458,95 @@ pub async fn issue_relation_delete(
.execute::<serde_json::Value>(&query, variables, "issueRelationDelete")
.await
}
/// Creates a new initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative_create<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::Initiative>,
>(
client: &Client,
input: InitiativeCreateInput,
) -> Result<T, LinearError> {
let variables = serde_json::json!({ "input" : input });
let query = String::from(
"mutation InitiativeCreate($input: InitiativeCreateInput!) { initiativeCreate(input: $input) { success initiative { ",
) + &T::selection() + " } } }";
client
.execute_mutation::<T>(&query, variables, "initiativeCreate", "initiative")
.await
}
/// Updates a initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative_update<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::Initiative>,
>(
client: &Client,
input: InitiativeUpdateInput,
id: String,
) -> Result<T, LinearError> {
let variables = serde_json::json!({ "input" : input, "id" : id });
let query = String::from(
"mutation InitiativeUpdate($input: InitiativeUpdateInput!, $id: String!) { initiativeUpdate(input: $input, id: $id) { success initiative { ",
) + &T::selection() + " } } }";
client
.execute_mutation::<T>(&query, variables, "initiativeUpdate", "initiative")
.await
}
/// Archives a initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative_archive<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::Initiative>,
>(
client: &Client,
id: String,
) -> Result<T, LinearError> {
let variables = serde_json::json!({ "id" : id });
let query = String::from(
"mutation InitiativeArchive($id: String!) { initiativeArchive(id: $id) { success entity { ",
) + &T::selection()
+ " } } }";
client
.execute_mutation::<T>(&query, variables, "initiativeArchive", "entity")
.await
}
/// Unarchives a initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative_unarchive<
T: serde::de::DeserializeOwned
+ crate::field_selection::GraphQLFields<FullType = super::types::Initiative>,
>(
client: &Client,
id: String,
) -> Result<T, LinearError> {
let variables = serde_json::json!({ "id" : id });
let query = String::from(
"mutation InitiativeUnarchive($id: String!) { initiativeUnarchive(id: $id) { success entity { ",
) + &T::selection() + " } } }";
client
.execute_mutation::<T>(&query, variables, "initiativeUnarchive", "entity")
.await
}
/// Deletes (trashes) an initiative.
pub async fn initiative_delete(
client: &Client,
id: String,
) -> Result<serde_json::Value, LinearError> {
let variables = serde_json::json!({ "id" : id });
let response_parts: Vec<String> = vec!["success".to_string(), "entityId".to_string()];
let query =
String::from("mutation InitiativeDelete($id: String!) { initiativeDelete(id: $id) { ")
+ &response_parts.join(" ")
+ " } }";
client
.execute::<serde_json::Value>(&query, variables, "initiativeDelete")
.await
}
/// Creates a new document.
///
/// Full type: [`Document`](super::types::Document)
Expand Down
129 changes: 129 additions & 0 deletions crates/lineark-sdk/src/generated/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,101 @@ impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::IssueLabel
.await
}
}
/// Query builder: All initiatives in the workspace.
///
/// Full type: [`Initiative`](super::types::Initiative)
///
/// Use setter methods to configure optional parameters, then call
/// [`.send()`](Self::send) to execute the query.
#[must_use]
pub struct InitiativesQueryBuilder<'a, T> {
client: &'a Client,
filter: Option<InitiativeFilter>,
before: Option<String>,
after: Option<String>,
first: Option<i64>,
last: Option<i64>,
include_archived: Option<bool>,
order_by: Option<PaginationOrderBy>,
sort: Option<InitiativeSortInput>,
_marker: std::marker::PhantomData<T>,
}
impl<'a, T: DeserializeOwned + GraphQLFields<FullType = super::types::Initiative>>
InitiativesQueryBuilder<'a, T>
{
pub fn filter(mut self, value: InitiativeFilter) -> Self {
self.filter = Some(value);
self
}
pub fn before(mut self, value: impl Into<String>) -> Self {
self.before = Some(value.into());
self
}
pub fn after(mut self, value: impl Into<String>) -> Self {
self.after = Some(value.into());
self
}
pub fn first(mut self, value: i64) -> Self {
self.first = Some(value);
self
}
pub fn last(mut self, value: i64) -> Self {
self.last = Some(value);
self
}
pub fn include_archived(mut self, value: bool) -> Self {
self.include_archived = Some(value);
self
}
pub fn order_by(mut self, value: PaginationOrderBy) -> Self {
self.order_by = Some(value);
self
}
pub fn sort(mut self, value: InitiativeSortInput) -> Self {
self.sort = Some(value);
self
}
pub async fn send(self) -> Result<Connection<T>, LinearError> {
let mut map = serde_json::Map::new();
if let Some(ref v) = self.filter {
map.insert("filter".to_string(), serde_json::json!(v));
}
if let Some(ref v) = self.before {
map.insert("before".to_string(), serde_json::json!(v));
}
if let Some(ref v) = self.after {
map.insert("after".to_string(), serde_json::json!(v));
}
if let Some(ref v) = self.first {
map.insert("first".to_string(), serde_json::json!(v));
}
if let Some(ref v) = self.last {
map.insert("last".to_string(), serde_json::json!(v));
}
if let Some(ref v) = self.include_archived {
map.insert("includeArchived".to_string(), serde_json::json!(v));
}
if let Some(ref v) = self.order_by {
map.insert("orderBy".to_string(), serde_json::json!(v));
}
if let Some(ref v) = self.sort {
map.insert("sort".to_string(), serde_json::json!(v));
}
let variables = serde_json::Value::Object(map);
let selection = T::selection();
let query = format!(
"query {}({}) {{ {}({}) {{ nodes {{ {} }} pageInfo {{ hasNextPage endCursor }} }} }}",
"Initiatives",
"$filter: InitiativeFilter, $before: String, $after: String, $first: Int, $last: Int, $includeArchived: Boolean, $orderBy: PaginationOrderBy, $sort: [InitiativeSortInput!]",
"initiatives",
"filter: $filter, before: $before, after: $after, first: $first, last: $last, includeArchived: $includeArchived, orderBy: $orderBy, sort: $sort",
selection
);
self.client
.execute_connection::<T>(&query, variables, "initiatives")
.await
}
}
/// Query builder: All documents in the workspace.
///
/// Full type: [`Document`](super::types::Document)
Expand Down Expand Up @@ -1258,6 +1353,40 @@ pub fn issue_labels<'a, T>(client: &'a Client) -> IssueLabelsQueryBuilder<'a, T>
_marker: std::marker::PhantomData,
}
}
/// All initiatives in the workspace.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub fn initiatives<'a, T>(client: &'a Client) -> InitiativesQueryBuilder<'a, T> {
InitiativesQueryBuilder {
client,
filter: None,
before: None,
after: None,
first: None,
last: None,
include_archived: None,
order_by: None,
sort: None,
_marker: std::marker::PhantomData,
}
}
/// One specific initiative.
///
/// Full type: [`Initiative`](super::types::Initiative)
pub async fn initiative<
T: DeserializeOwned + GraphQLFields<FullType = super::types::Initiative>,
>(
client: &Client,
id: String,
) -> Result<T, LinearError> {
let variables = serde_json::json!({ "id" : id });
let selection = T::selection();
let query = format!(
"query {}({}) {{ {}({}) {{ {} }} }}",
"Initiative", "$id: String!", "initiative", "id: $id", selection
);
client.execute::<T>(&query, variables, "initiative").await
}
/// All documents in the workspace.
///
/// Full type: [`Document`](super::types::Document)
Expand Down
Loading