forked from microsoft/cppgraphqlgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFolderConnectionObject.cpp
More file actions
77 lines (60 loc) · 3 KB
/
Copy pathFolderConnectionObject.cpp
File metadata and controls
77 lines (60 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// WARNING! Do not edit this file manually, your changes will be overwritten.
#include "TodayObjects.h"
#include "graphqlservice/introspection/Introspection.h"
#include <algorithm>
#include <functional>
#include <sstream>
#include <stdexcept>
#include <unordered_map>
using namespace std::literals;
namespace graphql::today {
namespace object {
FolderConnection::FolderConnection()
: service::Object({
"FolderConnection"
}, {
{ R"gql(edges)gql"sv, [this](service::ResolverParams&& params) { return resolveEdges(std::move(params)); } },
{ R"gql(pageInfo)gql"sv, [this](service::ResolverParams&& params) { return resolvePageInfo(std::move(params)); } },
{ R"gql(__typename)gql"sv, [this](service::ResolverParams&& params) { return resolve_typename(std::move(params)); } }
})
{
}
service::FieldResult<std::shared_ptr<PageInfo>> FolderConnection::getPageInfo(service::FieldParams&&) const
{
throw std::runtime_error(R"ex(FolderConnection::getPageInfo is not implemented)ex");
}
std::future<service::ResolverResult> FolderConnection::resolvePageInfo(service::ResolverParams&& params)
{
std::unique_lock resolverLock(_resolverMutex);
auto directives = std::move(params.fieldDirectives);
auto result = getPageInfo(service::FieldParams(service::SelectionSetParams{ params }, std::move(directives)));
resolverLock.unlock();
return service::ModifiedResult<PageInfo>::convert(std::move(result), std::move(params));
}
service::FieldResult<std::optional<std::vector<std::shared_ptr<FolderEdge>>>> FolderConnection::getEdges(service::FieldParams&&) const
{
throw std::runtime_error(R"ex(FolderConnection::getEdges is not implemented)ex");
}
std::future<service::ResolverResult> FolderConnection::resolveEdges(service::ResolverParams&& params)
{
std::unique_lock resolverLock(_resolverMutex);
auto directives = std::move(params.fieldDirectives);
auto result = getEdges(service::FieldParams(service::SelectionSetParams{ params }, std::move(directives)));
resolverLock.unlock();
return service::ModifiedResult<FolderEdge>::convert<service::TypeModifier::Nullable, service::TypeModifier::List, service::TypeModifier::Nullable>(std::move(result), std::move(params));
}
std::future<service::ResolverResult> FolderConnection::resolve_typename(service::ResolverParams&& params)
{
return service::ModifiedResult<response::StringType>::convert(response::StringType{ R"gql(FolderConnection)gql" }, std::move(params));
}
} // namespace object
void AddFolderConnectionDetails(std::shared_ptr<schema::ObjectType> typeFolderConnection, const std::shared_ptr<schema::Schema>& schema)
{
typeFolderConnection->AddFields({
schema::Field::Make(R"gql(pageInfo)gql"sv, R"md()md"sv, std::nullopt, schema->WrapType(introspection::TypeKind::NON_NULL, schema->LookupType("PageInfo"))),
schema::Field::Make(R"gql(edges)gql"sv, R"md()md"sv, std::nullopt, schema->WrapType(introspection::TypeKind::LIST, schema->LookupType("FolderEdge")))
});
}
} // namespace graphql::today