@dgcode/admin-directory
v0.1.26
Published
mocked class for google apps script's AdminDirectory API
Downloads
3
Readme
@dgcode/admin-directory
mocked class for google apps script's AdminDirectory API
Install
$ npm install @dgcode/admin-directory
Usage
This is a minimal JavaScript implementation of Google Apps Script's AdminDirectory
service. It is compatible with browsers and servers (even outside of Google Apps Script), includes TypeScript type definitions and tries to mimic the same classes as Google, with the caveats that only the following are implemented:
AdminDirectory.Channels
AdminDirectory.DomainAliases
AdminDirectory.Domains
AdminDirectory.Groups
AdminDirectory.Groups.Aliases
AdminDirectory.Members
AdminDirectory.Orgunits
AdminDirectory.Schemas
AdminDirectory.Users
AdminDirectory.Users.Aliases
AdminDirectory.Users.Photos
To get started:
import { AdminDirectory } from '@dgcode/admin-directory';
export function test() {
const { users } = AdminDirectory.Users.list();
console.log('First user: %s', users[0].name.givenName);
}
Such code can be compiled by the gscript bundler so that an Apps Script project eventually evaluates it with this end result internally:
function test() {
var users = AdminDirectory.Users.list().users;
Logger.log('First user: %s', users[0].name.givenName);
}
Roadmap
In its current state, this project mostly does nothing other than providing convenient TypeScript type definitions to develop Apps Script projects in an IDE (such as VSCode) in conjunction with gscript. In the future, this aims to evolve into a more complete toolkit:
- Implement all missing classes (
AdminDirectory.Asps
,AdminDirectory.Tokens
, ...): those currently throw an Error (err.code === "ENOIMPL"
) when accessed - Provide functional mock integration for all classes; currently all functions are callable but do not nothing and return
null
when they're supposed to return a result.
License
MIT