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
type Reaction = enum Reaction | |
{ | |
| Undefined = 0 Undefined = 0, | |
| Cool = 1 Cool = 1, | |
| LoveIt = 2 LoveIt = 2, | |
| Boring = 3 Boring = 3, | |
| Gripping = 4 Gripping = 4, | |
| Sad = 5 Sad = 5, | |
| Inspiring = 6 Inspiring = 6 |
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
type Root (serviceProvider : IServiceProvider, | |
user : Lazy<Result<GraphQLUser, ErrorMessage>>, | |
facebookService : Lazy<Result<IFacebookService, ErrorMessage>>, | |
securityOptions : IOptions<SecurityOptions>) = | |
let securityOptions = securityOptions.Value | |
member val RequestId = System.Guid.NewGuid () with get |
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
// static var Query = Define.Object<Root>(...) | |
let Query = | |
Define.Object<Root> | |
(name = "Query", | |
fields = [ Define.AsyncField ( | |
name = "grupoj", | |
type = ListOf GrupoType, | |
resolver = asyncGetRecenzoj) ]) |
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
// static var Mutation = Define.Object<Root>(...) | |
let Mutation = | |
Define.Object<Root> ( | |
... | |
fields = [ Define.AsyncField ( | |
... | |
inputs = [ Define.Input ("command", SetCommentInputType) ], | |
...) ]) |
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
let InputRegistriCultureType = | |
Define.InputObject<RegistriCulture> | |
(name = "InputCulture", | |
fields = | |
[ Define.Input ("kind" , String , description = "A kind of book culture: native or translated") | |
Define.Input ("culture", CultureInfoType, description = "A culture code of a book") ]) | |
// C# | |
// Define.Input (name: "kind", type: String, defaultValue: null, description: "A kind of book culture: native or translated") |
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
let asyncGetGrupo (ctx : ResolveFieldContext) _ = asyncResult { | |
let container = ctx.Root.BibliotekoDatabase.GrupojContainer | |
let! grupoId = ctx.ArgId | |
return! asyncGetGrupo container grupoId |> AsyncResult.mapError ErrorMappings.mapGrupoError | |
} | |
public Task<Grupo> GetGrupoAsync(ResolveFieldContext: ctx, Root: _) | |
{ | |
var cointainer = ctx.Root.BibliotekoDatabase.GrupojContainer; |
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
mutation grupo ($id: GrupoID!, $addAdminCommand: AddAdminCommand!, $description: String, $imageURL: GrupoImageURL!, $name: GrupoName!, $removeAdminCommand: RemoveAdminCommand!) { | |
grupo_addAdmin (id: $id, addAdminCommand: $addAdminCommand) | |
grupo_delete (id: $id) | |
grupo_join (id: $id) | |
grupo_leave (id: $id) | |
grupo_patch (id: $id) { | |
description (description: $description) | |
imageURL (imageURL: $imageURL) | |
name (name: $name) |
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
mutation grupo ($id: GrupoID! | |
$addAdminCommand: AddAdminCommand! | |
$name: GrupoName! | |
$description: String | |
$imageURL: GrupoImageURL! | |
$removeAdminCommand: RemoveAdminCommand!) { | |
grupo (id: $id) { | |
addAdmin (addAdminCommand: $addAdminCommand) // in parallel / параллельно |
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
mutation grupo ($id: GrupoID! | |
$name: GrupoName! | |
$description: String | |
$imageURL: GrupoImageURL!) { | |
grupo (id: $id) { | |
// Intercept AST and handle its processing / Перехватываем AST и обрабаываем сами | |
patch { | |
description (description: $description) // return null or error for field / возвращаем null или ошибку по полю |
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
mutation grupo ($id: GrupoID!, $patchOperations: [JsonPatchOperation!]) { | |
grupo (id: $id) { | |
patch (operations: $patchOperations) | |
} | |
} | |
let JSONPatchOperationInputType<'t when 't : not struct> = | |
let name = sprintf "Input%s_JSON_PatchOperation" (typeof<'t>.Name.Replace ("ViewModel", System.String.Empty)) | |
Define.InputObject<Operation<'t>> |
OlderNewer