Skip to content

Commit

Permalink
refactor(api): aligning our API with spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Arqu committed Apr 6, 2021
1 parent 3c59dbc commit 9f2e5bb
Show file tree
Hide file tree
Showing 32 changed files with 893 additions and 1,108 deletions.
135 changes: 68 additions & 67 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,101 +215,102 @@ func NewServerRoutes(s Server) *mux.Router {
m.Use(refStringMiddleware)
m.Use(token.OAuthTokenMiddleware)

dsh := NewDatasetHandlers(s.Instance, cfg.API.ReadOnly)
sqlh := NewSQLHandlers(s.Instance, cfg.API.ReadOnly)
tfh := NewTransformHandlers(s.Instance)
rch := NewRegistryClientHandlers(s.Instance, cfg.API.ReadOnly)
renderh := NewRenderHandlers(s.Instance)
remClientH := NewRemoteClientHandlers(s.Instance, cfg.API.ReadOnly)

var routeParams refRouteParams

// misc endpoints
m.Handle(lib.AEHome.String(), s.NoLogMiddleware(s.HomeHandler))
m.Handle(lib.AEHealth.String(), s.NoLogMiddleware(HealthCheckHandler))
m.Handle(lib.AEIPFS.String(), s.Middleware(s.HandleIPFSPath))
if !cfg.API.DisableWebui {
m.Handle(lib.AEWebUI.String(), s.Middleware(WebuiHandler))
}

m.Handle(lib.AEGetProfile.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "profile.getprofile"))).Methods(http.MethodPost)
m.Handle(lib.AESetProfile.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "profile.setprofile"))).Methods(http.MethodPost)
m.Handle(lib.AESetProfilePhoto.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "profile.setprofilePhoto"))).Methods(http.MethodPost)
m.Handle(lib.AESetPosterPhoto.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "profile.setposterphoto"))).Methods(http.MethodPost)

m.Handle(lib.AEPeers.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.list"))).Methods(http.MethodPost)
m.Handle(lib.AEPeer.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.info"))).Methods(http.MethodPost)
m.Handle(lib.AEConnect.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.connect"))).Methods(http.MethodPost)
m.Handle(lib.AEDisconnect.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.disconnect"))).Methods(http.MethodPost)
m.Handle(lib.AEConnections.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.connections"))).Methods(http.MethodPost)
m.Handle(lib.AEConnectedQriProfiles.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.connectedqriprofiles"))).Methods(http.MethodPost)
// aggregate endpoints
m.Handle(lib.AEList.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "collection.list"))).Methods(http.MethodPost)
m.Handle(lib.AEPeerList.String(), s.Middleware(dsh.PeerListHandler(lib.AEPeerList.String())))
m.Handle(lib.AESQL.String(), s.Middleware(sqlh.QueryHandler))
m.Handle(lib.AEDiff.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.diff"))).Methods(http.MethodPost, http.MethodGet)
m.Handle(lib.AEChanges.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.changereport"))).Methods(http.MethodPost, http.MethodGet)

if cfg.Remote != nil && cfg.Remote.Enabled {
log.Info("running in `remote` mode")
// access endpoints

remh := NewRemoteHandlers(s.Instance)
m.Handle(lib.AERemoteDSync.String(), s.Middleware(remh.DsyncHandler))
m.Handle(lib.AERemoteLogSync.String(), s.Middleware(remh.LogsyncHandler))
m.Handle(lib.AERemoteRefs.String(), s.Middleware(remh.RefsHandler))
}
// automation endpoints
m.Handle(lib.AEApply.String(), s.Middleware(tfh.ApplyHandler(lib.AEApply.NoTrailingSlash())))

dsh := NewDatasetHandlers(s.Instance, cfg.API.ReadOnly)
m.Handle(lib.AEList.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.list"))).Methods(http.MethodPost, http.MethodGet)
m.Handle(lib.AEListRaw.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.listrawrefs"))).Methods(http.MethodPost, http.MethodGet)
m.Handle(lib.AEPeerList.String(), s.Middleware(dsh.PeerListHandler(lib.AEPeerList.String())))
routeParams = newrefRouteParams(lib.AESave, false, false, http.MethodPost, http.MethodPut)
handleRefRoute(m, routeParams, s.Middleware(dsh.SaveHandler(lib.AESave.String())))
// dataset endpoints
m.Handle(lib.AEComponentStatus.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.componentstatus"))).Methods(http.MethodPost)
routeParams = newrefRouteParams(lib.AEGet, false, true, http.MethodGet, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(dsh.GetHandler(lib.AEGet.String())))
m.Handle(lib.AERename.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.rename"))).Methods(http.MethodPost, http.MethodPut)
routeParams = newrefRouteParams(lib.AESave, false, false, http.MethodPost, http.MethodPut)
handleRefRoute(m, routeParams, s.Middleware(dsh.SaveHandler(lib.AESave.String())))
routeParams = newrefRouteParams(lib.AEPull, false, false, http.MethodPost, http.MethodPut)
handleRefRoute(m, routeParams, s.Middleware(dsh.PullHandler(lib.AEPull.NoTrailingSlash())))
routeParams = newrefRouteParams(lib.AEPush, false, false, http.MethodGet, http.MethodPost, http.MethodDelete)
handleRefRoute(m, routeParams, s.Middleware(remClientH.PushHandler))
routeParams = newrefRouteParams(lib.AERender, false, false, http.MethodGet, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(renderh.RenderHandler))
routeParams = newrefRouteParams(lib.AERemove, false, false, http.MethodPost, http.MethodDelete)
handleRefRoute(m, routeParams, s.Middleware(dsh.RemoveHandler(lib.AERemove.String())))
m.Handle(lib.AERename.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.rename"))).Methods(http.MethodPost, http.MethodPut)
routeParams = newrefRouteParams(lib.AEValidate, false, false, http.MethodGet, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.validate")))
m.Handle(lib.AEDiff.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.diff"))).Methods(http.MethodPost, http.MethodGet)
m.Handle(lib.AEChanges.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.changereport"))).Methods(http.MethodPost, http.MethodGet)
m.Handle(lib.AEValidate.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.validate"))).Methods(http.MethodPost)
m.Handle(lib.AEUnpack.String(), s.Middleware(dsh.UnpackHandler(lib.AEUnpack.NoTrailingSlash())))
routeParams = newrefRouteParams(lib.AEManifest, false, false, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.manifest")))
m.Handle(lib.AEManifest.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.manifest"))).Methods(http.MethodPost)
m.Handle(lib.AEManifestMissing.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.manifestmissing"))).Methods(http.MethodPost)
routeParams = newrefRouteParams(lib.AEDAGInfo, false, false, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.daginfo")))
m.Handle(lib.AEDAGInfo.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "dataset.daginfo"))).Methods(http.MethodPost)

remClientH := NewRemoteClientHandlers(s.Instance, cfg.API.ReadOnly)
routeParams = newrefRouteParams(lib.AEPush, false, false, http.MethodGet, http.MethodPost, http.MethodDelete)
handleRefRoute(m, routeParams, s.Middleware(remClientH.PushHandler))
routeParams = newrefRouteParams(lib.AEPull, false, false, http.MethodPost, http.MethodPut)
handleRefRoute(m, routeParams, s.Middleware(dsh.PullHandler(lib.AEPull.NoTrailingSlash())))
// peer endpoints
m.Handle(lib.AEPeers.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.list"))).Methods(http.MethodPost)
m.Handle(lib.AEPeer.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.info"))).Methods(http.MethodPost)
m.Handle(lib.AEConnect.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.connect"))).Methods(http.MethodPost)
m.Handle(lib.AEDisconnect.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.disconnect"))).Methods(http.MethodPost)
m.Handle(lib.AEConnections.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.connections"))).Methods(http.MethodPost)
m.Handle(lib.AEConnectedQriProfiles.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "peer.connectedqriprofiles"))).Methods(http.MethodPost)

// profile endpoints
m.Handle(lib.AEGetProfile.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "profile.getprofile"))).Methods(http.MethodPost)
m.Handle(lib.AESetProfile.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "profile.setprofile"))).Methods(http.MethodPost)
m.Handle(lib.AESetProfilePhoto.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "profile.setprofilePhoto"))).Methods(http.MethodPost)
m.Handle(lib.AESetPosterPhoto.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "profile.setposterphoto"))).Methods(http.MethodPost)

// remote endpoints
m.Handle(lib.AEFeeds.String(), s.Middleware(remClientH.FeedsHandler))
routeParams = newrefRouteParams(lib.AEPreview, false, false, http.MethodGet, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(remClientH.DatasetPreviewHandler))
m.Handle(lib.AERegistryNew.String(), s.Middleware(rch.CreateProfileHandler))
m.Handle(lib.AERegistryProve.String(), s.Middleware(rch.ProveProfileKeyHandler))
m.Handle(lib.AESearch.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "search.search"))).Methods(http.MethodPost)

routeParams = newrefRouteParams(lib.AEStatus, false, false, http.MethodGet, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.status")))
routeParams = newrefRouteParams(lib.AEWhatChanged, false, false, http.MethodGet, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.whatchanged")))
routeParams = newrefRouteParams(lib.AEInit, true, false, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.init")))
m.Handle(lib.AECanInitDatasetWorkDir.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.caninitdatasetworkdir")))
// working directory endpoints
m.Handle(lib.AEStatus.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.status"))).Methods(http.MethodPost)
m.Handle(lib.AECanInitDatasetWorkDir.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.caninitdatasetworkdir"))).Methods(http.MethodPost)
m.Handle(lib.AEInit.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.init"))).Methods(http.MethodPost)
m.Handle(lib.AECheckout.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.checkout"))).Methods(http.MethodPost)
m.Handle(lib.AEEnsureRef.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.ensureref"))).Methods(http.MethodPost)
m.Handle(lib.AERestore.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.restore"))).Methods(http.MethodPost)
m.Handle(lib.AEFSIWrite.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.write"))).Methods(http.MethodPost)
m.Handle(lib.AEFSICreateLink.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.createlink"))).Methods(http.MethodPost)
m.Handle(lib.AEFSIUnlink.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "fsi.unlink"))).Methods(http.MethodPost)

renderh := NewRenderHandlers(s.Instance)
routeParams = newrefRouteParams(lib.AERender, false, false, http.MethodGet, http.MethodPost)
handleRefRoute(m, routeParams, s.Middleware(renderh.RenderHandler))

m.Handle(lib.AEHistory.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "log.history"))).Methods(http.MethodPost)
m.Handle(lib.AEEntries.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "log.entries"))).Methods(http.MethodPost)
m.Handle(lib.AERawLogbook.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "log.rawlogbook"))).Methods(http.MethodPost)
m.Handle(lib.AELogbookSummary.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "log.logbooksummary"))).Methods(http.MethodPost)

rch := NewRegistryClientHandlers(s.Instance, cfg.API.ReadOnly)
m.Handle(lib.AERegistryNew.String(), s.Middleware(rch.CreateProfileHandler))
m.Handle(lib.AERegistryProve.String(), s.Middleware(rch.ProveProfileKeyHandler))

m.Handle(lib.AESearch.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "search.search"))).Methods(http.MethodPost)

sqlh := NewSQLHandlers(s.Instance, cfg.API.ReadOnly)
m.Handle(lib.AESQL.String(), s.Middleware(sqlh.QueryHandler))

tfh := NewTransformHandlers(s.Instance)
m.Handle(lib.AEApply.String(), s.Middleware(tfh.ApplyHandler(lib.AEApply.NoTrailingSlash())))
// sync/protocol endpoints
if cfg.Remote != nil && cfg.Remote.Enabled {
log.Info("running in `remote` mode")

if !cfg.API.DisableWebui {
m.Handle(lib.AEWebUI.String(), s.Middleware(WebuiHandler))
remh := NewRemoteHandlers(s.Instance)
m.Handle(lib.AERemoteDSync.String(), s.Middleware(remh.DsyncHandler))
m.Handle(lib.AERemoteLogSync.String(), s.Middleware(remh.LogsyncHandler))
m.Handle(lib.AERemoteRefs.String(), s.Middleware(remh.RefsHandler))
}

// TODO(aqru): clear up these endpoints up to spec
m.Handle(lib.AELog.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "log.history"))).Methods(http.MethodPost)
m.Handle(lib.AEEntries.String(), s.Middleware(lib.NewHTTPRequestHandler(s.Instance, "log.log"))).Methods(http.MethodPost)

return m
}
97 changes: 0 additions & 97 deletions api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,103 +173,6 @@ func TestHealthCheck(t *testing.T) {
runHandlerTestCases(t, "health check", HealthCheckHandler, healthCheckCases, true)
}

func TestServerReadOnlyRoutes(t *testing.T) {
if err := confirmQriNotRunning(); err != nil {
t.Skip(err.Error())
}

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

prevXformVer := APIVersion
APIVersion = "test_version"
defer func() {
APIVersion = prevXformVer
}()

// bump up log level to keep test output clean
golog.SetLogLevel("qriapi", "error")
defer golog.SetLogLevel("qriapi", "info")

// to keep hashes consistent, artificially specify the timestamp by overriding
// the dsfs.Timestamp func
prev := dsfs.Timestamp
defer func() { dsfs.Timestamp = prev }()
dsfs.Timestamp = func() time.Time { return time.Date(2001, 01, 01, 01, 01, 01, 01, time.UTC) }

client := &http.Client{}

r, err := test.NewTestRepo()
if err != nil {
t.Fatalf("error allocating test repo: %s", err.Error())
}

// Cannot use TestRunner because we need to set cfg.API.ReadOnly.
// TODO(dlong): Add a testRunner call trace that does this correctly.
cfg := testcfg.DefaultConfigForTesting()
cfg.API.ReadOnly = true
defer func() {
cfg.API.ReadOnly = false
}()

node, err := p2p.NewQriNode(r, cfg.P2P, event.NilBus, nil)
if err != nil {
t.Fatal(err.Error())
}
// TODO (b5) - hack until tests have better instance-generation primitives
inst := lib.NewInstanceFromConfigAndNode(ctx, cfg, node)
s := New(inst)

server := httptest.NewServer(NewServerRoutes(s))

cases := []struct {
method string
endpoint string
resStatus int
}{
// forbidden endpoints
{"GET", "/ipfs/", 403},
{"GET", "/ipns/", 404},
{"POST", "/save", 403},
{"PUT", "/save", 403},
{"POST", "/remove", 403},
{"DELETE", "/remove", 403},
{"POST", "/rename", 403},
{"PUT", "/rename", 403},
{"POST", "/registry/profile/new", 403},
{"POST", "/registry/profile/prove", 403},

// active endpoints:
{"GET", "/health", 200},
{"GET", "/list/peer", 200},
// Cannot test connect endpoint until we have peers in this test suite
// {"GET", "/connect/QmZePf5LeXow3RW5U1AgEiNbW46YnRGhZ7HPvm1UmPFPwt", 200},
// Cannot test endpoint until we have peers in this test suite
// {"GET", "/peer", 200},
{"GET", "/get/peer/movies", 200},
}

for i, c := range cases {

req, err := http.NewRequest(c.method, server.URL+c.endpoint, nil)
if err != nil {
t.Errorf("case %d error creating request: %s", i, err.Error())
continue
}

res, err := client.Do(req)
if err != nil {
t.Errorf("case %d error performing request: %s", i, err.Error())
continue
}

if res.StatusCode != c.resStatus {
t.Errorf("case %d: %s - %s status code mismatch. expected: %d, got: %d", i, c.method, c.endpoint, c.resStatus, res.StatusCode)
continue
}
}
}

type handlerMimeMultipartTestCase struct {
method string
endpoint string
Expand Down
2 changes: 1 addition & 1 deletion api/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (h *DatasetHandlers) PeerListHandler(routePrefix string) http.HandlerFunc {
p.Peername = ref.Username
}

res, err := h.List(r.Context(), &p)
res, err := h.inst.Collection().List(r.Context(), &p)
if err != nil {
log.Infof("error listing peer's datasets: %s", err.Error())
util.WriteErrResponse(w, http.StatusInternalServerError, err)
Expand Down
14 changes: 2 additions & 12 deletions api/fsi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ func TestFSIHandlers(t *testing.T) {
}
runHandlerTestCases(t, "init", initHandler, initCases, true)

whatChangedHandler := func(w http.ResponseWriter, r *http.Request) {
lib.NewHTTPRequestHandler(inst, "fsi.whatchanged").ServeHTTP(w, r)
}
whatChangedCases := []handlerTestCase{
// TODO (b5) - can't ask for an FSI-linked status b/c the responses change with
// temp directory names
{"GET", "/me/movies", nil, map[string]string{"peername": "me", "name": "movies"}},
}
runHandlerTestCases(t, "whatchanged", whatChangedHandler, whatChangedCases, true)

checkoutHandler := func(w http.ResponseWriter, r *http.Request) {
muxVarsToQueryParamMiddleware(lib.NewHTTPRequestHandler(inst, "fsi.checkout")).ServeHTTP(w, r)
}
Expand Down Expand Up @@ -199,7 +189,7 @@ func TestNoHistory(t *testing.T) {

// History with no history
p := lib.HistoryParams{Ref: "peer/test_ds"}
gotStatusCode, gotBodyString = JSONAPICallWithBody("POST", lib.AEHistory.String(), p, historyHandler, nil)
gotStatusCode, gotBodyString = JSONAPICallWithBody("POST", lib.AELog.String(), p, historyHandler, nil)
if gotStatusCode != 422 {
t.Errorf("expected status code 422, got %d", gotStatusCode)
}
Expand All @@ -209,7 +199,7 @@ func TestNoHistory(t *testing.T) {

p.EnsureFSIExists = true
// History with no history, still returns ErrNoHistory since this route ignores fsi param
gotStatusCode, gotBodyString = JSONAPICallWithBody("POST", lib.AEHistory.String(), p, historyHandler, nil)
gotStatusCode, gotBodyString = JSONAPICallWithBody("POST", lib.AELog.String(), p, historyHandler, nil)
if gotStatusCode != 422 {
t.Errorf("expected status code 422, got %d", gotStatusCode)
}
Expand Down
2 changes: 1 addition & 1 deletion api/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestHTTPClient(t *testing.T) {
}

res := []dsref.VersionInfo{}
err = httpClient.CallMethod(ctx, lib.AEList, http.MethodGet, nil, &res)
err = httpClient.CallMethod(ctx, lib.AEList, http.MethodPost, nil, &res)
if err != nil {
t.Fatal(err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion api/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (h *RemoteClientHandlers) listPublicHandler(w http.ResponseWriter, r *http.
args.OrderBy = "created"
args.Public = true

res, err := h.inst.Dataset().List(r.Context(), &args)
res, err := h.inst.Collection().List(r.Context(), &args)
if err != nil {
log.Infof("error listing datasets: %s", err.Error())
util.WriteErrResponse(w, http.StatusInternalServerError, err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (o *ApplyOptions) Run() error {
Wait: true,
}

res, err := inst.Transform().Apply(ctx, &params)
res, err := inst.Automation().Apply(ctx, &params)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (o *DiffOptions) Run() (err error) {
}

ctx := context.TODO()
res, err := o.inst.Dataset().Diff(ctx, p)
res, err := o.inst.Diff().Diff(ctx, p)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (o *ListOptions) Run() (err error) {
p := &lib.ListParams{
UseDscache: o.UseDscache,
}
text, err := o.inst.Dataset().ListRawRefs(ctx, p)
text, err := o.inst.Collection().ListRawRefs(ctx, p)
if err != nil {
return err
}
Expand All @@ -119,7 +119,7 @@ func (o *ListOptions) Run() (err error) {
EnsureFSIExists: true,
UseDscache: o.UseDscache,
}
infos, err := o.inst.Dataset().List(ctx, p)
infos, err := o.inst.Collection().List(ctx, p)
if err != nil {
if errors.Is(err, lib.ErrListWarning) {
printWarning(o.ErrOut, fmt.Sprintf("%s\n", err))
Expand Down
Loading

0 comments on commit 9f2e5bb

Please sign in to comment.