mschartgen

package module
v0.0.0-...-a3064b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

mschartgen

Generate an org chart from the microsoft graph api

This project uses https://github.com/dabeng/OrgChart for generating the org chart.

Usage

Export Bearer Access Token

You can get this without having to create an app in Azure.

Browse to https://developer.microsoft.com/en-us/graph/graph-explorer and login.

You can then copy the Access Token for usage with this program, export in your shell env:

export MSGRAPH_BEARER_TOKEN=thisisquitelong
Get UID

Get the UID of your CEO or the person you'd like to generate the chart down from.

You can get this in delve by navigating to the person and getting the id from the URL, e.g.

https://eur.delve.office.com/?u=2a6e0631-9431-4aed-b250-87b5d03a9fde (the value of u)

Run

go run cmd/mschartgen/mschartgen.go 2a6e0621-9441-4aed-b750-87c5d03a9fde

License

Copyright 2021, Chris Fordham

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(organisationName string, rootMemberId string)

func Serve

func Serve(dir string, port int)

Types

type Child

type Child struct {
	Name     string
	Title    string
	Children []Child
}

type DirectReports

type DirectReports struct {
	Data []Person `json:"value"`
}

type Member

type Member struct {
	Id            string
	Name          string
	Title         string
	DirectReports []Member
}

type OrgChart

type OrgChart struct {
	Data []Child
}

phase 3: these types are for post-processing to orgchart js

type OrgMetaData

type OrgMetaData struct {
	DisplayName string `json:"displayName"`
}

type Organisation

type Organisation struct {
	Name string
	Head Member
}

phase 2: these types are the native data structures

type Organization

type Organization struct {
	Data []OrgMetaData `json:"value"`
}

phase 1: these types are binded to the msgraph api (data fetch stage)

type People

type People struct {
	Persons []Person `json:"value"`
}

TODO: currently unused

type Person

type Person struct {
	Id            string `json:"id"`
	Name          string `json:"displayName"`
	Title         string `json:"jobTitle"`
	DirectReports []Person
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL