• Stars
    star
    63
  • Rank 484,938 (Top 10 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Microsoft Graph Client Library for Go

msgraph.go

v1.0 beta
pkg.go.dev pkg.go.dev

(The online references at pkg.go.dev above are not shown due to huge size of packages - #23)

Introduction

Microsoft Graph client library for Go. Still in PoC or pre-alpha stage. Don't use in production.

The library code is auto-generated from the REST API specification available at https://graph.microsoft.com/v1.0/$metadata.

The code generator is written in pure Go, in contrast to the official code generator heavily relying on C# and non-portable .NET Framework.

v0.x.x releases

See GitHub releases for all release tags and release notes, and pkg.go.dev for all Go module versions available for your applications.

Until v1.0.0, all types of changes might be included in every release: bug fixes, new features, even incompatible API updates.

Usage

You can choose API version when importing msgraph package:

import msgraph "github.com/yaegashi/msgraph.go/v1.0"
import msgraph "github.com/yaegashi/msgraph.go/beta"

You could benefit from better IDE assisted coding experience because Graph API specs are completely translated to Go codes by msgraph.go.

Code examples in the repository:

Hacking

Run go generate ./gen to download the metadata and generate library code from it.

$ go generate ./gen
2020/08/02 19:46:20 Downloading https://graph.microsoft.com/v1.0/$metadata to metadata/v1.0.xml
2020/08/02 19:46:20 metadata/v1.0.xml already exists, skipping
2020/08/02 19:46:21 Downloading https://graph.microsoft.com/beta/$metadata to metadata/beta.xml
2020/08/02 19:46:21 metadata/beta.xml already exists, skipping
2020/08/02 19:46:21 Creating directory ../v1.0
2020/08/02 19:46:21 Removing ../v1.0/ModelAverage.go
2020/08/02 19:46:21 Removing ../v1.0/RequestSchema.go
2020/08/02 19:46:21 Removing ../v1.0/RequestAndroid.go.go
...
2020/08/02 19:47:06 Creating ../v1.0/extensions.go
2020/08/02 19:47:06 Creating ../v1.0/msgraph.go
2020/08/02 19:47:06 Creating ../v1.0/const.go
2020/08/02 19:47:06 Creating ../v1.0/EnumAction.gonEnum.go
...
2020/08/02 19:47:07 Formatting ../v1.0/ModelMedia.go
2020/08/02 19:47:07 Formatting ../v1.0/RequestWorkbookFunctionsN.go
2020/08/02 19:47:07 Formatting ../v1.0/EnumReject.go

(Currently code generation from the latest metadata is broken - #22)

Todo

  • Save indented metadata.xml
  • Support Action elements in metadata
  • Support Function elements in metadata
  • Support batch requests
  • Access to additional properties like @odata.type @odata.id
  • Split output into multiple files
  • Generate camel cases in golang manner (IpAddress -> IPAddress)
  • Provide easy way to generate pointers to literals
  • Provide easy way to generate pointers to constants
  • Provide easy way to add queries like $expand $select $filter
  • Every request method should take a ctx as the first arg for better control
  • Online API docs (the output is too big for pkg.go.dev to handle - #23)
  • Unit tests
  • CI
  • Persist OAuth2 tokens in file
  • Persist OAuth2 tokens in object storage like Azure Blob
  • OAuth2 device auth grant
  • OAuth2 client credentials grant
  • Use string for EnumType (pointed out in #6)
  • Reduce number of generated files (#11)
  • Provide easy way to add HTTP headers like Prefer: outlook.timezone="Tokyo Standard Time"
  • Support max number of pages to retrieve from a collection
  • Support Windows time zone names in DateTimeTimeZone (utilize wtz.go)

References

Applications

More Repositories

1

ansible-role-blockinfile

Ansible role which contains blockinfile module
Python
97
star
2

git-companion-scripts

Useful script collection for Git.
Shell
26
star
3

muslstack

Binary patch utility to set default thread stack size for musl libc
Go
22
star
4

ansible-role-rundeckres

Python
15
star
5

ansible-role-openvzmod

Ansible role with modules to manage OpenVZ containers
Python
14
star
6

terraform-provider-msgraph

Terraform Provider for Microsoft Graph
Go
14
star
7

cobra-cmder

Useful command builder for spf13/cobra
Go
11
star
8

icon-collection-mxlibrary

Azure Icon Collection mxlibrary for diagrams.net (formerly draw.io)
JavaScript
11
star
9

ozone-dispmanx

Chromium Ozone port to Raspberry Pi dispmanx
C++
8
star
10

ansible-snippets

Public repository for Ansible snippets and examples.
Shell
7
star
11

customazed

Customazed CLI - Azure VM Custom Script Helper
Go
7
star
12

contest.go

Go testing integration for programming contests
Go
5
star
13

azbill

Azure billing data exporter
Go
4
star
14

pswa

Simple web content/proxy server that embodies enterprise zero trust security
Go
4
star
15

wtz.go

Windows Time Zone Library for Go
Go
3
star
16

ninfod

ninfod cloned repository
C
3
star
17

dx2devops-backstage-containerapp

Enterprise Backstage DevOps on Azure Container Apps
Bicep
3
star
18

dx2devops-redmine

DevOps solution for Redmine or RedMica on Azure Web App for Containers
Bicep
2
star
19

dx2devops-nuget-server

DevOps solution for private NuGet server on Azure Container Apps
Bicep
2
star
20

rclonefunction

Bicep
1
star
21

p4p-docker

Perforce Helix Proxy Container
Dockerfile
1
star
22

wvd-terraform

Terraforming Windows Virtual Desktop Infrastructure on Azure
HCL
1
star
23

diligence.go

🤔精進.go
Go
1
star
24

p4d-docker

Shell
1
star
25

aadsync

Azure AD synchronization CLI
Go
1
star
26

jsonex.go

Go encoding/json alternative with a catch-all capability for unknown fields
Go
1
star