37 lines
951 B
Go
37 lines
951 B
Go
package mlflow
|
|
|
|
import "net/http"
|
|
|
|
type ListArtifactsRequest struct {
|
|
RunId string `json:"run_id,omitempty"`
|
|
Path string `json:"path,omitempty"`
|
|
PageToken string `json:"page_token,omitempty"`
|
|
}
|
|
|
|
func (l *ListArtifactsRequest) UrlEncode() string {
|
|
return UrlEncode(*l)
|
|
}
|
|
|
|
type FileInfo struct {
|
|
Path string `json:"path,omitempty"`
|
|
IsDir bool `json:"is_dir,omitempty"`
|
|
FileSize int64 `json:"file_size,omitempty"`
|
|
}
|
|
|
|
type ListArtifactsResponse struct {
|
|
RootUri string `json:"root_uri,omitempty"`
|
|
Files []FileInfo `json:"files,omitempty"`
|
|
NextPageToken string `json:"next_page_token,omitempty"`
|
|
}
|
|
|
|
func ListArtefacts(conf Config, req ListArtifactsRequest) (*ListArtifactsResponse, error) {
|
|
resp, err := http.Get(conf.ApiURI + "/api/2.0/mlflow/artifacts/list" + req.UrlEncode())
|
|
rv := ListArtifactsResponse{}
|
|
err = apiReadReply(resp, err, &rv)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &rv, nil
|
|
}
|