Coder Social home page Coder Social logo

michael-sewell / go-google-email-audit-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ngs-archives/go-google-email-audit-api

0.0 0.0 0.0 26 KB

Go Client Library for G Suite Email Audit API

Home Page: https://godoc.org/github.com/ngs/go-google-email-audit-api/emailaudit

License: BSD 3-Clause "New" or "Revised" License

Go 100.00%

go-google-email-audit-api's Introduction

go-google-email-audit-api

Build Status GoDoc Go Report Card Coverage Status

Go Client Library for Google Email Audit API

go get -u github.com/ngs/go-google-email-audit-api/emailaudit

Email Monitor API

import (
	// ...
	"github.com/ngs/go-google-email-audit-api/emailaudit"
)

func main() {
	// ...
	srv, err := emailaudit.New(client) // client = http.Client
	if err != nil {
		log.Fatalf("Unable to retrieve Email Audit API Client %v", err)
	}
	endDate := time.Date(2116, time.October, 31, 23, 59, 59, 0, time.UTC)

	// Create or update Email Monitor
	monitor, err := srv.MailMonitor.Update("example.com",
		"ngs", "kyohei", endDate,
		emailaudit.MailMonitorLevels{
			IncomingEmail: emailaudit.FullMessageLevel,
			OutgoingEmail: emailaudit.FullMessageLevel,
			Draft:         emailaudit.FullMessageLevel,
			Chat:          emailaudit.FullMessageLevel,
		},
	)
	if err != nil {
		log.Fatalf("Unable to update email monitor. %v", err)
	}

	// List Email Monitors
	monitors, err := srv.MailMonitor.List("example.com", "ngs")
	if err != nil {
		log.Fatalf("Unable to list email monitor. %v", err)
	}
	for _, m := range monitors {
		fmt.Printf("%v %v@%v chat:%v draft:%v incoming:%v outgoing:%v\n",
			m.Updated, m.DestUserName, m.DomainName,
			m.MonitorLevels.Chat, m.MonitorLevels.Draft,
			m.MonitorLevels.IncomingEmail, m.MonitorLevels.OutgoingEmail)
	}

	// Disable Email Monitor
	err = srv.MailMonitor.Disable("example.com", "ngs", "kyohei")
	if err != nil {
		log.Fatalf("Unable to disable email monitor. %v", err)
	}
}

Mailbox Download

Not yet implemented

Author

Atsushi Nagase

License

See LICENSE

go-google-email-audit-api's People

Contributors

ngs 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.