atomiyama/studyplus_for_school_sync_go

View on GitHub
examples/learning_material/learning_material.go

Summary

Maintainability
A
0 mins
Test Coverage
package main

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)
}