有没有一种方法可以使用ASP.NET创建Google Gsuite帐户ID

时间:2019-07-08 11:29:57

标签: c# asp.net google-api

是否可以使用ASP.NET C#中的Google API创建Google Gsuite帐户ID

1 个答案:

答案 0 :(得分:1)

几乎所有GSuite操作都可以通过Web API获得,这意味着您可以直接进行适当的调用,例如使用HttpClient。在这种情况下,您需要的API是Directory API in the Admin SDK。 SDK说明了如何使用API​​来manage users,包括creating new users

Google还提供了多种语言的客户端库,包括.NETDirectory API受支持

您必须从Getting Started指南开始,首先学习如何连接到Google并向各种API发送请求。所有API的模式都相似-您为所需的API创建一个import { fromEvent, combineLatest, of, concat, merge, } from 'rxjs'; import { filter, tap, map, concatMap, } from 'rxjs/operators'; console.log( 'Press arrow keys to change factory' ); console.log( 'Press [0-9] to change topping' ); console.log( 'Press [a-z] to import donuts' ); const donuts = []; const allEvents$ = concat( of( 'ArrowUp', '1' ), fromEvent( document, 'keydown' ).pipe( map( event => event.key ) ) ); const factoryLocations = { ArrowUp: 'N', ArrowLeft: 'W', ArrowDown: 'S', ArrowRight: 'E', }; const factoryEvent$ = allEvents$.pipe( filter( val => factoryLocations[ val ] ), map( val => factoryLocations[ val ] ), tap( x => console.log( `%c Change Factory ${ x }`, 'color: #e57373' ) ) ); const toppingEvent$ = allEvents$.pipe( filter( val => Number.isInteger( Number( val ) ) ), tap( x => console.log( `%c Change Topping ${ x }`, 'color: #f06292' ) ) ); const importDonutEvent$ = allEvents$.pipe( filter( val => !Number.isInteger( Number( val ) ) && !factoryLocations[ val ] ), tap( x => console.log( `%c Importing Donut ${ x }`, 'color: #f06292' ) ) ); const settingEvents$ = combineLatest( factoryEvent$, toppingEvent$ ); const processEvent$ = settingEvents$.pipe( concatMap( ( [ factory, topping ] ) => merge( importDonutEvent$ ).pipe( map( type => ( { factory, topping, type } ) ), ) ) ); processEvent$.pipe( concatMap( ( { factory, topping, type } ) => makeDonut( factory, topping, type ) ), ).subscribe( donut => { console.log( `%c DONE ${ donut }`, 'color: #4db6ac' ); donuts.push( donut ); console.log( donuts ); } ); function makeDonut ( factory, topping, type ) { const time = Math.random() * 3000; const donut = factory + topping + type; console.log( `%c MAKING ${ donut }`, 'color: #7986cb' ); return new Promise( resolve => setTimeout( () => resolve( donut ), time ) ); } 实例。资源和操作在Service类下显示为属性和方法。

相关问题