Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

ishiyan/GraphQL.NetCore

Repository files navigation

GraphQL.NetCore

Using GraphQL in .Net Core app

Build Status

GraphiQL

http://facebook.github.io/graphql/October2016/

{
  account(accountId: 11) {
    accountId
    bamAccountId
    cppiConfiguration
    cppiPercentage
    managementStartDate
    lastAssetValueUpdate
    lastProcessedDate
  }
  floorHistory(accountId: 11) {
    cppiFloorHistoryId
    accountCppiConfigId
    cppiFloor
    cashFlow
    changeReason
    changeDateTime
  }
  balance(accountId: 11) {
    capital
    buffer
    bufferPercentage
    reserve
  }
  revenue(accountId: 11) {
    revenuePercentageCurrentYear
    revenuePercentageSinceStartAccount
    currentAssetValue
  }
  quarterlyRevenue(accountId: 11) {
    revenuePercentage
    quarterlyAssetValue
    quarterlyAssetValueDate
    latestAssetValue
    latestAssetValueDate
    reportDrop
    dropBracket
  }
}

Aliases

query
{
  a1: account(accountId: 1) {
    accountId
    bamAccountId
    cppiConfiguration
    cppiPercentage
    managementStartDate
    lastAssetValueUpdate
    lastProcessedDate
  }
  a2: account(accountId: 2) {
    accountId
    bamAccountId
    cppiConfiguration
    cppiPercentage
    managementStartDate
    lastAssetValueUpdate
    lastProcessedDate
  }
}

Fragments

query
{
  a1: account(accountId: 1) {
    ...comparisonFields
  }
  a2: account(accountId: 2) {
    ...comparisonFields
  }
}

fragment comparisonFields on Account {
    accountId
    cppiConfiguration
    cppiPercentage
}

Variables

query q1($accountId: Int!) # or with default value Int = 10
{
  account(accountId: $accountId) {
    accountId
    bamAccountId
    cppiConfiguration
    cppiPercentage
    managementStartDate
    lastAssetValueUpdate
    lastProcessedDate
  }
  floorHistory(accountId: $accountId) {    
    cppiFloorHistoryId
    accountCppiConfigId
    cppiFloor
    cashFlow
    changeReason
    changeDateTime
  }
  balance(accountId: $accountId) {
    capital
    buffer
    bufferPercentage
    reserve
  }
  revenue(accountId: $accountId) {
    revenuePercentageCurrentYear
    revenuePercentageSinceStartAccount
    currentAssetValue
  }
  quarterlyRevenue(accountId: $accountId) {
    revenuePercentage
    quarterlyAssetValue
    quarterlyAssetValueDate
    latestAssetValue
    latestAssetValueDate
    reportDrop
    dropBracket
  }
}
-----------------------
{
  "accountId": 1
}

Directives

query q1($accountId: Int!, $withHistory: Boolean!)
{
  account(accountId: $accountId) {
    accountId
    bamAccountId
    cppiConfiguration
    cppiPercentage
    managementStartDate
    lastAssetValueUpdate
    lastProcessedDate
  }
  # @include(if: Boolean!)
  # @skip(if: Boolean!)
  floorHistory(accountId: $accountId) @include(if: $withHistory) {    
    cppiFloorHistoryId
    accountCppiConfigId
    cppiFloor
    cashFlow
    changeReason
    changeDateTime
  }
  balance(accountId: $accountId) {
    capital
    buffer
    bufferPercentage
    reserve
  }
  revenue(accountId: $accountId) {
    revenuePercentageCurrentYear
    revenuePercentageSinceStartAccount
    currentAssetValue
  }
  quarterlyRevenue(accountId: $accountId) {
    revenuePercentage
    quarterlyAssetValue
    quarterlyAssetValueDate
    latestAssetValue
    latestAssetValueDate
    reportDrop
    dropBracket
  }
}
--------------------
{
  "accountId": 1,
  "withHistory": false
}

Mutation

mutation m1($accountId: Int!, $cashFlow: Float, $changeReason: FloorChangeReason!)
{
  addFloorChange(accountId: $accountId, cashFlow: $cashFlow, changeReason: $changeReason)
  {
    cppiFloorHistoryId
    accountCppiConfigId
    cashFlow
    cppiFloor
    changeReason
    changeDateTime
  }
}
------------------------
{
  "accountId": 1,
  "cashFlow": 987.65,
  "changeReason": "DEPOSIT"
}

Postman

raw, application/json

{"query": "{account(accountId: 1){accountId cppiConfiguration}}"}
{"query":"query\n{\n  account(accountId: 1) {\n    accountId\n    bamAccountId\n    cppiConfiguration\n    cppiPercentage\n    managementStartDate\n    lastAssetValueUpdate\n    lastProcessedDate\n  }\n  floorHistory(accountId: 1) {    \n    cppiFloorHistoryId\n    accountCppiConfigId\n    cppiFloor\n    cashFlow\n    changeReason\n    changeDateTime\n  }\n  balance(accountId: 1) {\n    capital\n    buffer\n    bufferPercentage\n    reserve\n  }\n  revenue(accountId: 1) {\n    revenuePercentageCurrentYear\n    revenuePercentageSinceStartAccount\n    currentAssetValue\n  }\n  quarterlyRevenue(accountId: 1) {\n    revenuePercentage\n    quarterlyAssetValue\n    quarterlyAssetValueDate\n    latestAssetValue\n    latestAssetValueDate\n    reportDrop\n    dropBracket\n  }\n}\n","variables":null}
{"query": "query q1($accountId: Int!)
{
  account(accountId: $accountId) {
    accountId
    bamAccountId
    cppiConfiguration
    cppiPercentage
    managementStartDate
    lastAssetValueUpdate
    lastProcessedDate
  }
  floorHistory(accountId: $accountId) {
    cppiFloorHistoryId
    accountCppiConfigId
    cppiFloor
    cashFlow
    changeReason
    changeDateTime
  }
  balance(accountId: $accountId) {
    capital
    buffer
    bufferPercentage
    reserve
  }
  revenue(accountId: $accountId) {
    revenuePercentageCurrentYear
    revenuePercentageSinceStartAccount
    currentAssetValue
  }
  quarterlyRevenue(accountId: $accountId) {
    revenuePercentage
    quarterlyAssetValue
    quarterlyAssetValueDate
    latestAssetValue
    latestAssetValueDate
    reportDrop
    dropBracket
  }
}", "variables":{'accountId': 1}
}

About

Using GraphQL in .Net Core app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published