mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add create label gql mutation
This commit is contained in:
parent
fa97d01d0c
commit
b5a65cbc91
2 changed files with 27 additions and 0 deletions
16
android/Omnivore/app/src/main/graphql/CreateLabel.graphql
Normal file
16
android/Omnivore/app/src/main/graphql/CreateLabel.graphql
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
mutation CreateLabel($input: CreateLabelInput!) {
|
||||
createLabel(input: $input) {
|
||||
... on CreateLabelSuccess {
|
||||
label {
|
||||
id
|
||||
name
|
||||
color
|
||||
description
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
... on CreateLabelError {
|
||||
errorCodes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package app.omnivore.omnivore.networking
|
||||
|
||||
import app.omnivore.omnivore.graphql.generated.CreateLabelMutation
|
||||
import app.omnivore.omnivore.graphql.generated.SetLabelsMutation
|
||||
import app.omnivore.omnivore.graphql.generated.type.CreateLabelInput
|
||||
import app.omnivore.omnivore.graphql.generated.type.SetLabelsInput
|
||||
|
||||
suspend fun Networker.updateLabelsForSavedItem(input: SetLabelsInput): Boolean {
|
||||
|
|
@ -11,3 +13,12 @@ suspend fun Networker.updateLabelsForSavedItem(input: SetLabelsInput): Boolean {
|
|||
false
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun Networker.createNewLabel(input: CreateLabelInput): CreateLabelMutation.Label? {
|
||||
return try {
|
||||
val result = authenticatedApolloClient().mutation(CreateLabelMutation(input)).execute()
|
||||
return result.data?.createLabel?.onCreateLabelSuccess?.label
|
||||
} catch (e: java.lang.Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue