An API Client package for Studyplus for School SYNC API

Studyplus for School SYNC API Client

This project is currently alpha, possibility having breaking changes.

Maintainability github action workflow

studyplus_for_school_sync_go is a API client for Studyplus for School SYNC

Getting Started

Authorization

It is a NOT required implementation, most users can use golang.org/x/oauth2 for Oauth2 authorization process.

import (
	"fmt"
	"os"

	. "github.com/atomiyama/studyplus_for_school_sync_go/auth"
	"golang.org/x/oauth2"
)

type DBTokenStore struct {
	// some fields. 
}

func (s *DBTokenStore) Get() (*oauth2.Token, error) {
	// fetch persited token from DB.
}

func (s *DBTokenStore) Save(t *oauth2.Token) error {
	// Persist token.
}

func main() {
	var endpoint oauth2.Endpoint
	EndpointFromEnv(&endpoint, EnvDevelopment)
	cnf := &oauth2.Config{
		ClientID:     os.Getenv("CLIENT_ID"),
		ClientSecret: os.Getenv("CLIENT_SECRET"),
		RedirectURL:  os.Getenv("REDIRECT_URL"),
		Scopes:       []string{"learning_material_supplier"},
		Endpoint:     endpoint,
	}
	src := &DBTokenStore{}
	authorization := NewAuthorization(cnf, src)
	url := authorization.AuthCodeURL("state")

	var code string // get auth code.

	ctx := context.Background()
	authorization.AuthorizeFromCode(ctx, code)

	ctx = context.Background()
	client, err := authorization.Client(ctx)
	if err != nil {
		log.Fatal(err)
	}
	// Request API via client.
}

Creating LearningMaterial

import (
	"fmt"
	"log"
	"net/http"

	. "github.com/atomiyama/studyplus_for_school_sync_go/fssync"
)

func main() {
	client := &http.Client{} // It should have injected Authorization Header when requesting.
	service, err := NewService(client, BaseURLDevelopment)
	if err != nil {
		log.Fatal(err)
	}
	lm := &LearningMaterial{
		Name:     "SAMPLE_NAME",
		ImageUrl: "https://exmaple.com/image.jpeg",
	}
	lm, err = service.LearningMaterial.Create(lm).Do()
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("New LearningMaterial: %+v\n", lm)
}

Creating Partner

TBD

Creating Student

TBD

Creating StudyRecord

TBD

Similar Resources

Server and client implementation of the grpc go libraries to perform unary, client streaming, server streaming and full duplex RPCs from gRPC go introduction

Description This is an implementation of a gRPC client and server that provides route guidance from gRPC Basics: Go tutorial. It demonstrates how to u

Nov 24, 2021

Comunicación de envios de archivos entres cliente-servidor, client-client.

Client - Server - Client Estes es un proyecto simple de comunicacion de envios de archivos del cliente al servidor y viceversamente, y de cliente a cl

Jul 16, 2022

FTP client package for Go

goftp A FTP client package for Go Install go get -u github.com/jlaffaye/ftp Documentation https://pkg.go.dev/github.com/jlaffaye/ftp?tab=doc Example

Jan 7, 2023

A STOMP Client package for go developers, supporting all STOMP specification levels.

stompngo - A STOMP 1.0, 1.1 and 1.2 Client Package Features Full support of STOMP protocols: Protocol Level 1.0 Protocol Level 1.1 Protocol Level 1.2

Oct 19, 2022

Full-featured BitTorrent client package and utilities

torrent This repository implements BitTorrent-related packages and command-line utilities in Go. The emphasis is on use as a library from other projec

Jan 2, 2023

a simple ntp client package for go

ntp The ntp package is an implementation of a Simple NTP (SNTP) client based on RFC5905. It allows you to connect to a remote NTP server and request i

Dec 30, 2022

A minimal analytics package to start collecting traffic data without client dependencies.

go-web-analytics A minimal analytics package to start collecting traffic data without client dependencies. Logging incoming requests import "github.co

Nov 23, 2021

Fetch-npm-package - A small utility that can be used to fetch a given version of a NPM package

Use fetch-npm-package package version output-dir E.g. fetch-npm-package is

May 21, 2022
Cross platform local network clipboard sync.

clipSync Synchronize clipboard content across multiple devices. Features Rapidly synchronize clipboard content to all devices in same local network. S

Jan 3, 2022
server-to-server sync application, written in go/golang.

svcpy: server to server copy a basic server-to-server copy application. on a single binary, it can be a server or a client. example usage: on the serv

Nov 4, 2021
Secure Time Sync Daemon

stsd - Secure Time Sync Daemon ============================== Set system date based on HTTP 'date' headers over TLS. Inspired by Whonix's sdwdate, an

Dec 15, 2021
easyRpc - Sync && Async Call supported

easyRpc - Sync && Async Call supported

Feb 16, 2022
Godaddy-domains-client-go - Godaddy domains api Client golang - Write automaticly from swagger codegen

Go API client for swagger Overview This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you c

Jan 9, 2022
Tailscale-client-go - A client implementation for the Tailscale HTTP API

tailscale-client-go A client implementation for the Tailscale HTTP API Example p

Sep 8, 2022
Tscert - Minimal package for just the HTTPS cert fetching part of the Tailscale client API

tscert This is a stripped down version of the tailscale.com/client/tailscale Go

Nov 27, 2022
Prisma Client Go is an auto-generated and fully type-safe database client

Prisma Client Go Typesafe database access for Go Quickstart • Website • Docs • API reference • Blog • Slack • Twitter Prisma Client Go is an auto-gene

Jan 9, 2023
The Dual-Stack Dynamic DNS client, the world's first dynamic DNS client built for IPv6.

dsddns DsDDNS is the Dual-Stack Dynamic DNS client. A dynamic DNS client keeps your DNS records in sync with the IP addresses associated with your hom

Sep 27, 2022
Go Substrate RPC Client (GSRPC)Go Substrate RPC Client (GSRPC)

Go Substrate RPC Client (GSRPC) Substrate RPC client in Go. It provides APIs and types around Polkadot and any Substrate-based chain RPC calls. This c

Nov 11, 2021