Ejemplo n.º 1
0
func SetProfile(project, version, name, contentPath string) bool {
	if project == "" || version == "" || name == "" || contentPath == "" {
		log.Fatal("Illegal param!")
	}

	content := file.ReadFile(contentPath)
	if content == nil {
		log.Fatal("Read file at", contentPath, "failed.")
	}

	uri := "/api/setProfile?project=" + project + "&version=" + version + "&name=" + name
	responseContent := postURL(uri, content)

	return CheckResponse(uri, responseContent)
}
Ejemplo n.º 2
0
func UploadFile(localPath, project, fileName, relativePath, fileType string) bool {
	if localPath == "" || project == "" || fileName == "" || relativePath == "" || (fileType != "raw" && fileType != "flat") {
		log.Fatal("Illegal param!")
	}

	content := file.ReadFile(localPath)
	if content == nil {
		log.Fatal("Read file at", localPath, "failed.")
	}

	uri := "/api/uploadFile?project=" + project + "&relativePath=" + relativePath + "&fileName=" + fileName + "&fileType=" + fileType
	responseContent := postURL(uri, content)

	return CheckResponse(uri, responseContent)
}