メインコンテンツまでスキップ

KyosoGraphQLClient

共創GraphQLクラス。インスタンス化して使用してください。

Example

利用例

const client = new KyosoGraphQLClient({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
baseUrl: 'https://api.kyoso.com',
apiKey: 'your-api-key',
})

Methods

execute()

execute<T>(requestContext): Promise<T>;

GraphQLリクエストを実行

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
requestContextKyosoGraphQLRequestContext共創GraphQLリクエストコンテキスト

Returns

Promise<T>

クエリの実行結果(data オブジェクトのみ。HTTPステータスや errors は含まれません)

Example

利用例

// 共創GraphQLクエリ
const kyosoGraphQLQuery = `
query ListShainJoho($input: ShainJohoSearchInput, $first: Int) {
listShainJoho(input: $input, first: $first) {
totalCount
edges {
node {
id
shainId
kojinJoho {
firstName
lastName
birthDate
}
}
}
}
`;
const response = await client.execute({
query: kyosoGraphQLQuery,
variables: { first: 10 },
})