-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from levelhq/close-groups
Close groups
- Loading branch information
Showing
23 changed files
with
779 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module Mutation.CloseGroup exposing (Response(..), request) | ||
|
||
import GraphQL exposing (Document) | ||
import Group exposing (Group) | ||
import Json.Decode as Decode exposing (Decoder) | ||
import Json.Encode as Encode | ||
import Session exposing (Session) | ||
import Task exposing (Task) | ||
|
||
|
||
type Response | ||
= Success Group | ||
|
||
|
||
document : Document | ||
document = | ||
GraphQL.toDocument | ||
""" | ||
mutation CloseGroup( | ||
$spaceId: ID!, | ||
$groupId: ID! | ||
) { | ||
closeGroup( | ||
spaceId: $spaceId, | ||
groupId: $groupId | ||
) { | ||
group { | ||
...GroupFields | ||
} | ||
} | ||
} | ||
""" | ||
[ Group.fragment | ||
] | ||
|
||
|
||
variables : String -> String -> Maybe Encode.Value | ||
variables spaceId groupId = | ||
Just <| | ||
Encode.object | ||
[ ( "spaceId", Encode.string spaceId ) | ||
, ( "groupId", Encode.string groupId ) | ||
] | ||
|
||
|
||
decoder : Decoder Response | ||
decoder = | ||
Decode.map Success <| | ||
Decode.at [ "data", "closeGroup", "group" ] | ||
Group.decoder | ||
|
||
|
||
request : String -> String -> Session -> Task Session.Error ( Session, Response ) | ||
request spaceId groupId session = | ||
Session.request session <| | ||
GraphQL.request document (variables spaceId groupId) decoder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module Mutation.ReopenGroup exposing (Response(..), request) | ||
|
||
import GraphQL exposing (Document) | ||
import Group exposing (Group) | ||
import Json.Decode as Decode exposing (Decoder) | ||
import Json.Encode as Encode | ||
import Session exposing (Session) | ||
import Task exposing (Task) | ||
|
||
|
||
type Response | ||
= Success Group | ||
|
||
|
||
document : Document | ||
document = | ||
GraphQL.toDocument | ||
""" | ||
mutation ReopenGroup( | ||
$spaceId: ID!, | ||
$groupId: ID! | ||
) { | ||
reopenGroup( | ||
spaceId: $spaceId, | ||
groupId: $groupId | ||
) { | ||
group { | ||
...GroupFields | ||
} | ||
} | ||
} | ||
""" | ||
[ Group.fragment | ||
] | ||
|
||
|
||
variables : String -> String -> Maybe Encode.Value | ||
variables spaceId groupId = | ||
Just <| | ||
Encode.object | ||
[ ( "spaceId", Encode.string spaceId ) | ||
, ( "groupId", Encode.string groupId ) | ||
] | ||
|
||
|
||
decoder : Decoder Response | ||
decoder = | ||
Decode.map Success <| | ||
Decode.at [ "data", "reopenGroup", "group" ] | ||
Group.decoder | ||
|
||
|
||
request : String -> String -> Session -> Task Session.Error ( Session, Response ) | ||
request spaceId groupId session = | ||
Session.request session <| | ||
GraphQL.request document (variables spaceId groupId) decoder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.