Begin transferring scope document into documented functions
This commit is contained in:
parent
93ce378170
commit
7f7c34f9e0
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
go.work
|
83
src/configLoader.go
Normal file
83
src/configLoader.go
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
type MDWebDavUploaderConfig struct {
|
||||||
|
InstanceLink string `json:"instance"`
|
||||||
|
Mail string `json:"mail"`
|
||||||
|
WebDavAuthToken string `json:"token"`
|
||||||
|
InstitutionId int `json:"institution_id"`
|
||||||
|
Parser string `json:"parser"`
|
||||||
|
MetadataFolder string `json:"metadata_folder"`
|
||||||
|
MediaFolder string `json:"media_folder"`
|
||||||
|
PublishOnImport bool `json:"visible"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ParserListItem struct {
|
||||||
|
name string
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a uniform filepath for the configuration of this tool.
|
||||||
|
// To be compatible across operating systems, this will be a JSON
|
||||||
|
// file in the same directory as the current programm.
|
||||||
|
func getConfigFilepath() string {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loads configuration from the configuration file (located using
|
||||||
|
// getConfigFilepath()).
|
||||||
|
func loadFromFile() MDWebDavUploaderConfig {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a uniform filepath for the cache for the list of
|
||||||
|
// available parsers.
|
||||||
|
func getParserCacheFilepath() string {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stores a parser list to a cache file (located via
|
||||||
|
// getParserCacheFilepath()).
|
||||||
|
func storeParserList(parserList []ParserListItem) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a list of the available parsers.
|
||||||
|
func listParsers() []ParserListItem {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Checks if inputParser is in the list of available parsers.
|
||||||
|
// Returns the parser name or an error.
|
||||||
|
func validateParser(inputParser string) (string, error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checks if a directory is the entered directory can be used
|
||||||
|
// as an source directory for export data. As such, it does need
|
||||||
|
// to exist.
|
||||||
|
// Returns the directory name or an error.
|
||||||
|
func validateDir(dir string) (string, error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validates an input mail address.
|
||||||
|
// Returns the valid mail address or an eQueries therror.
|
||||||
|
func validateMail(mail string) (string, error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validates an entered instance URL.
|
||||||
|
// Returns the entered URL in a unified form (minus optional
|
||||||
|
// trailing slashes and the /musdb suffix) or an error.
|
||||||
|
func validateInstanceLink(instanceUrl string) (string, error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validates an institution ID.
|
||||||
|
// A valid institution ID returns a HTTP 200 response code when queried
|
||||||
|
// <instance_url> + "/institution/" + institution_id.
|
||||||
|
// Returns either the entered instance URL or an error.
|
||||||
|
func validateInstitutionId(institutionId int, instanceUrl string) (int, error) {
|
||||||
|
|
||||||
|
}
|
34
src/main.go
Normal file
34
src/main.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// Attempts to connect to WebDAV server, verifying that the authentication data
|
||||||
|
// works and that the server is one for uploads with museum-digital.
|
||||||
|
// A museum-digital WebDAV directory can be identified by the availability of the
|
||||||
|
// directories IMPORT_IMG and IMPORT_XML.
|
||||||
|
func verifyConnection(config MDWebDavUploaderConfig) bool {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generates the contents of the file import_config.txt necessary
|
||||||
|
// to let museum-digital know about the required import configuration.
|
||||||
|
func generateImportConfigFile() string {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Uploads metadata files to the configured instance of
|
||||||
|
// museum-digital / musdb.
|
||||||
|
func uploadMetadataFiles() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uploads media files to the configured instance of
|
||||||
|
// museum-digital / musdb.
|
||||||
|
func uploadMediaFiles() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println("hi")
|
||||||
|
}
|
15
src/setup.go
Normal file
15
src/setup.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// Fetches user information from the relevant musdb API:
|
||||||
|
// https://demo.museum-digital.org/musdb/swagger/#/user/userReadOwnData
|
||||||
|
func getUserInformation(instanceUrl string, username string, password string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uses musdb's API to generate an access token:
|
||||||
|
// https://demo.museum-digital.org/musdb/swagger/#/user/userGenerateWebdavAccessToken
|
||||||
|
// Returns either the token or an error.
|
||||||
|
func getWebDavAccessToken(instanceUrl string) (string, error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user