Giter Site home page Giter Site logo

gas-vault's Introduction

GAS-Vault

Library to use Google Vault with Google Apps Script

This library aim to let you use Google vault feature in Google Apps Script.

Install

You can use the library asis just by linking it. But as it's usage can touch sensitive data you may prefer to copy the source to your own repository in order to have full control of what is beneth.

Link the library

From the editor page of your Google Apps Script Project select the + in the Libraries section to add a new library. Pass the following script ID: 1yXuSYg04wH88jOi47oaPZahRjD3RN20tfkv7eQXrWvhnIi9c09i4q9up and select look up Select the last version available and let the default identifier to Vault

Activate the vault API

In order to use the library you need to activate Vault API in your Google Apps Script project. If you do not want to use a "classic" GCP Project but rather use the "Default" GCP Project, please refer to the following documentation: https://developers.google.com/apps-script/guides/admin/view-cloud-projects

Copy the library (alternative to link the library)

Open the script: https://script.google.com/home/projects/1yXuSYg04wH88jOi47oaPZahRjD3RN20tfkv7eQXrWvhnIi9c09i4q9up Make a copy of it on your own domain. Check that there is nothing in the code that may harm your domain (otherwise cut it off at your own risk).

  • Use it directly to make your development In this scenario omit the keyword Vault to invoke the library as shown in the rest of the document Example, replace:
    var matter = Vault.openMatterById("id");
    by
    var matter = openMatterById("id");

or

  • Create your own alternate library from it. Use the deploy button on the top right corner to create a new publication (as library). You can then use the script ID (from the script URL) as in the section Link the library

Usage

You can invoke the library by it's instantiation name (default being "Vault")
Library methods are available through autocompletion

Note: The library is not wrote in modern JS with Class in order to allow autocompletion in GAS that is otherwise not supported

var listing = Vault.getMatters(); // will return a list of matters object

Methods

Method Return type Description
createMatter(name, description) MATTER Create a new Matter in DRAFT state
listMatters(state) Array List all the matters corresponding to a given state (method do not list deleted matter if not explicitely requested)
openMatterById(matterId) MATTER Open a matter from it's ID
openExportById(matterId, exportId) EXPORT Open an export from the Matter Id and Export Id

Class

Matters

var matter = new Vault.Matter("name", "description");

var matter = new Vault.Matter();
matter.setName("name").setDescription("description");

Properties

Fields
id String
The matter ID, which is generated by the server. Leave blank when creating a matter.
name String
Matter name
description String
Matter description
state enum
Matter state
exports Array
Matter exports

TODO add matter permissions

Methods

Method Return type Description
setName(name) Matter
(for chaining)
Set the name (String) of a matter in view to create it
setDescription(description) Matter
(for chaining)
Set a description (String) of the matter in view to create it
openMatterById(matterId) Matter Open a matter from it's ID and return it
getName() name Gather the name (String) of a given matter
getDescription() description Gather the description (String) of a given matter
getState() STATE retrieve the state of the active matter
getInfos() Object retrieve raw informations regarding a matter
create() Matter
(for chaining)
Create a matter from the draft data
getId() MatterId Gather matterId(String)
close() RawMatter Close a Matter, will return a JSON representing the matter as in the "setStatus" method
addCollaborator(email, role) Collaborator Add a collaborator with a given role to the active matter
removeCollaborator(email) "removed" Removed a collaborator and return a confirmation String
--- --- ---
createUserExport(account, exportType, name, options) Export Create an export from a search of a user files
createExport(name, query, exportOptions) Export Create an export from a query like in the official documentation
getExports() [Export] Display the list of the actives exports from the matter
openExportById(exportId) Export Open an export and return it as an Object
listExports() [Export] Retrieve the list of the exports from the current Matter
--- --- ---
openHoldById(holdId) Hold Open an hold and return it as an Object
listHolds() [Hold] Retrieve the list of the holds from the current Matter

TODO Hold section

Enums
ROLE
Enums
ROLE_UNSPECIFIED No role assigned. (I still don't know what to do with this information)
COLLABORATOR A collaborator on the matter.
OWNER The owner of the matter.
STATE
Enums
DRAFT Matter yet to be created
STATE_UNSPECIFIED The matter has no specified state.
OPEN The matter is open.
CLOSED The matter is closed.
DELETED The matter is deleted.

Exports

var matter = Vault.openMatterById(matterId);
var vaultExport = matter.openExportById(exportId);

var vaultExport = new Vault.Export(matterId, exportId);

Properties

Fields
id String
The export ID, which is generated by the server. Leave blank when creating a matter.
matterId String
Matter ID that held the export
name String
name of the export
state enum
export state
files Array
exports files

Methods

Method Return type Description
getId() id Get the exportId (String)
setName(name) Export for chaining set the current export name
getStatus() EXPORT_STATUS get the active export status
getInfos() ExportInfos get the export raw informations
getFiles() [Files] List of the files contained in the export
remove() null Delete the current export
Enums
EXPORT_STATUS

https://developers.google.com/vault/reference/rest/v1/matters.exports#exportstatus

Enums
EXPORT_STATUS_UNSPECIFIED The status is unspecified.
COMPLETED The export completed.
FAILED The export failed.
IN_PROGRESS The export is in progress.
ExportType
Enums
MAIL emails
DRIVE Drive files
GROUP Not implemented yet
CHAT Not implemented yet
VOICE Not implemented yet
ExportFormat

Export format for messages

Enums
EXPORT_FORMAT_UNSPECIFIED No export format specified.
MBOX Export as MBOX. Only available for Gmail, Groups, Hangouts and Voice.
PST Export as PST. Only available for Gmail, Groups, Hangouts, Voice and Calendar.

terms https://support.google.com/vault/answer/2474474

Holds

[Not yes implemented] https://developers.google.com/vault/reference/rest/v1/matters.holds

var matter = Vault.openMatterById(matterId);
var hold = matter.openHoldById(holdId);

var hold = new Vault.Hold(matterId, holdId);

Properties

Methods

Method Return type Description
getId() id Get the holdId (String)
setName(name) Hold for chaining set the current hold name
getInfos() HoldInfos get the hold raw informations
getType() HoldType user or ou
removeUser(email) null remove user from hold
removeOu(orgUnitPath) null remove OU from hold
close()

gas-vault's People

Contributors

harold-ousset avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.