gotek

package module
v0.0.0-...-aa71bad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2016 License: MIT Imports: 5 Imported by: 0

README

DEPRECATED: Epitech Intranet move the authentication mecanism to Microsoft's OAuth2

Gotek

A Golang library for Epitech Intra Webservice

Installation

go get -u https://github.com/kokaz/gotek

Usage

Here is a little sample to log into the Epitech Intranet, get the dashboard and get your schedule

client := &gotek.Client{Login: "login_x", Password: "unix_password"}
dashboard, _ := client.SignIn()
schedule, _ := client.GetSchedule()

Check out the sample folder to get the whole code

Run the sample

You can use your own golang binary or you can use the Dockerfile provided in the repository

With Docker:

cd sample
docker build -t my-sample-app .
docker run -it --rm --name my-running-app my-sample-app

Manually:

go get github.com/kokaz/gotek/sample

LICENSE

The MIT License (MIT)

Copyright (c) 2014 Guillaume Fillon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Documentation

Index

Constants

View Source
const (
	API_ENDPOINT       = "https://intra.epitech.eu"
	SCHEDULE_ENDPOINT  = API_ENDPOINT + "/planning/load?format=json"
	DASHBOARD_ENDPOINT = API_ENDPOINT + "/?format=json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board struct {
	Projets []Project
	Modules []Module
}

type Client

type Client struct {
	Login    string
	Password string
}

func (*Client) GetDashboard

func (c *Client) GetDashboard() (*Dashboard, error)

func (*Client) GetSchedule

func (c *Client) GetSchedule() ([]Event, error)

func (*Client) SignIn

func (c *Client) SignIn() (*Dashboard, error)

type Current

type Current struct {
	ActiveLog   string `json:"active_log"`
	CreditsMin  string `json:"credits_min"`
	CreditsNorm string `json:"credits_norm"`
	CreditsObj  string `json:"credits_obj"`
}

type Dashboard

type Dashboard struct {
	IP      string
	Board   Board
	History []History
	Infos   Infos
	Current []Current
}

type Event

type Event struct {
	Scolaryear              string
	Codemodule              string
	Codeinstance            string
	Codeacti                string
	Codeevent               string
	Semester                int
	InstanceLocation        string `json:"instance_location"`
	Titlemodule             string `json:"titlemodule"`
	ActiTitle               string `json:"acti_title"`
	Start                   string
	End                     string
	TotalStudentsRegistered int    `json:"total_students_registered"`
	TypeTitle               string `json:"type_title"`
	NbHours                 string `json:"nb_hours"`
	RegisterStudent         bool   `json:"register_student"`
}

type History

type History struct {
	Title      string
	Content    string
	Date       string
	ID         string
	Visible    string
	IDActivite string `json:"id_activite"`
	Class      string
}

type Infos

type Infos struct {
	ID            string
	Login         string
	Title         string
	Email         string
	InternalEmail string `json:"internal_email"`
	Lastname      string
	Firstname     string
	Picture       string
	Promo         int
	Semester      int
	UID           int
	GID           int
	Location      string
}

type Module

type Module struct {
	Title           string
	TitleLink       string `json:"title_link"`
	TimelineStart   string `json:"timeline_start"`
	TimelineEnd     string `json:"timeline_end"`
	TimelineBarre   string `json:"timeline_barre"`
	DateInscription string `json:"date_inscription"`
}

type Project

type Project struct {
	Title           string
	TitleLink       string
	TimelineStart   string
	TimelineEnd     string
	TimelineBarre   string
	DateInscription string
	IDActivite      string
	SoutenanceName  string
	SoutenanceLink  string
	SoutenanceDate  string
	SoutenanceSalle string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL