Git Product home page Git Product logo

iserv2go's Introduction

iserv2go

License Go Version Lines Release Stars Contributors

An unofficial Go library and CLI for IServ.

Disclaimer 1: I am not affiliated with the IServ GmbH in any way.

Disclaimer 2: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

Disclaimer 3: Use it at YOUR OWN RISK!

Use as CLI

iserv2go [options] command [arguments...]

List of options

Option Description
-enable-email enables the email functionality
-enable-files enables the files functionality
-enable-web enables other functions (notifications, exercises, etc)
-info shows program info
-interactive starts interactive console where you can type commands instead of passing them as arguments
-save-sessions saves login cookies on the hard drive for subsequent logins

List of commands

Command Arguments Description
email.list_mailboxes none get a list of mailboxes
email.read_mailbox mailbox path get last 50 messages from mailbox
email.send_mail recipient address, subject, body send email
files.cat filename print contents of file
files.download iserv path, local path download file from IServ
files.ls directory list of files in directory
files.upload local path, iserv path upload file to IServ
web.get_badges none get badges (for modules on the nav bar left)
web.get_current_exercises none list of current exercises
web.get_notifications none get unread notifications
web.get_past_exercises none list of past exercises
web.get_upcoming_events none list of upcoming events

Use as Library

Install

# in your project directory
go get github.com/alexcoder04/iserv2go/iserv

Example usage

package main

import (
    "fmt"

    "github.com/alexcoder04/iserv2go/iserv"
    "github.com/alexcoder04/iserv2go/iserv/types"
)

func main(){
    // create new client instance
    client := iserv.Client{}

    // login your client
    err := client.Login(&types.ClientConfig{
        IServHost: os.Getenv("ISERV_HOST"),
        Username:  os.Getenv("ISERV_USERNAME"),
        Password:  os.Getenv("ISERV_PASSWORD"),

        EnableModules: map[string]bool{
            "email": true,
            "files": false,
            "web":   false,
        },
        SaveSessions: true,
    })
    if err != nil {
        fmt.Println("failed to login")
        return
    }

    // don't forget to logout
    defer client.Logout()

    // get 10 last mails in INBOX
    messages, err := client.Email.ReadMailbox("INBOX", 10)
    if err != nil {
        return
    }
    // print them
    for _, m := range messages {
        fmt.Printf(" = '%s' from %s\n", m.Envelope.Subject, m.Envelope.Sender[0].Address())
    }
}

Project Structure

The iserv folder contains the Go Library, the subfolders email, files, web are modules, which can be (de-)activated separately. They contain each user.go files, which include all the functions meant to be used by end-user.

Contributing

Contributions are always welcome, there are a lot of things that wait to be implemented, see the issues. I am also looking for co-maintainers and someone to test the project extensively :)

Credits

Contributors

Libraries

iserv2go's People

Contributors

alexcoder04 avatar dependabot[bot] avatar redstonerayy avatar redstonerayyy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

iserv2go's Issues

TODOs

  • send emails via smtp
  • calendar module via caldav
  • exercises integration in web module
  • submit solutions for exercises
  • news integration in web module
  • texts integration
  • get full name from username
  • sending emails: proper encoding
  • iserv script for cli
  • save sessions
  • IServ time format parsing and encoding
  • auto-enable modules that are used

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.