• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

microsoftgraph/graphql-demo: [ARCHIVED] GraphQL for Microsoft Graph

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

microsoftgraph/graphql-demo

开源软件地址(OpenSource Url):

https://github.com/microsoftgraph/graphql-demo

开源编程语言(OpenSource Language):

JavaScript 83.0%

开源软件介绍(OpenSource Introduction):

[ARCHIVED] GraphQL for Microsoft Graph (DEMO)

Note: This repo is archived and no longer actively maintained. Security vulnerabilities may exist in the project, or its dependencies. If you plan to reuse or run any code from this repo, be sure to perform appropriate security checks on the code or dependencies first.

Call to action

We are looking for feedback from developers interested in integrating with Microsoft Graph via GraphQL. To share your thoughts and scenarios, please leave a comment on UserVoice.

About

This is a demo that enables basic, read-only querying of the Microsoft Graph API using GraphQL query syntax. GraphQL enables clients to request exactly the resources and properties that they need instead of making REST requests for each resource and consolidating the responses. To create a GraphQL service, this demo translates the Microsoft Graph OData $metadata document to a GraphQL schema and generates the necessary resolvers. Please note we are providing this demo code for evaluation as-is.

Animation of sample request

Live demo

Try the Microsoft Graph GraphQL Demo here

Installation

  1. Clone the repo
  2. Install dependencies (npm install)
  3. Generate schema description and resolver code using npm run build
  4. Navigate to the App Registration Portal, set up a new web app
  5. Configure App Id and redirect URIs in the AppConfiguration of build/index.html
  6. Run npm start and go to localhost:1337

Sample requests

Fetch recent emails

{
  me {
    displayName
    officeLocation
    skills
    messages {
      subject
      isRead
      from {
        emailAddress {
          address
        }
      }
    }
  }
}

Fetch groups and members

{
  groups {
    displayName
    description
    members {
      id
    }
  }
}

Fetch files from OneDrive

{
  me {
    drives {
      quota {
        used
        remaining
      }
      root {
        children {
          name
          size
          lastModifiedDateTime
          webUrl
        }
      }
    }
  }
}

How it works

  • src/setup.js reads in a well-formed $metadata CSDL, parses it and builds up a GraphQL schema
  • src/setup.js code generates resolvers that naively issues requests to the Graph service when the previous (parent) resolver doesn't have the data at hand

Limitations/to-dos

  • Translate OData inheritance relationships
  • Enable passing arguments (id for indexing into collections)
  • Support pagination
  • Implement mutations
  • Enable passing arguments for sort, filter
  • Add heuristics for $expand to reduce number of service calls made

Code of conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Copyright

Copyright (c) 2017 Microsoft Corporation.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
david3107/graphql-security-labs: GraphQL security workshop labs发布时间:2022-06-13
下一篇:
ember-graphql/ember-apollo-client: 发布时间:2022-06-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap