Skip to content

Commit f455d22

Browse files
authored
Merge pull request #90 from trickest/update/library-endpoints
Update library endpoint usage
2 parents 264074b + 5bbc922 commit f455d22

File tree

14 files changed

+87
-87
lines changed

14 files changed

+87
-87
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ Current workflow categories are:
2626

2727
[<img src="./banner.png" />](https://trickest.io/auth/register)
2828

29-
# Store
29+
# Library
3030

31-
[Trickest Store](https://trickest.io/dashboard/store) is a collection of public tools, Trickest scripts, and Trickest workflows available on the platform. More info can be found at [Trickest workflows repository](https://github.com/trickest/workflows) <- (Coming soon!)
31+
[Trickest Library](https://trickest.io/dashboard/library) is a collection of public tools, Trickest scripts, and Trickest workflows available on the platform. More info can be found at [Trickest workflows repository](https://github.com/trickest/workflows) <- (Coming soon!)
3232

3333

3434
# Installation
@@ -118,7 +118,7 @@ trickest execute --workflow <workflow_or_tool_name> --space <space_name> --confi
118118
| Flag | Type | Default | Description |
119119
|------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------------|
120120
| --config | file | / | YAML file for run configuration |
121-
| --workflow | string | / | Workflow from the Store to be executed |
121+
| --workflow | string | / | Workflow from the Library to be executed |
122122
| --max | boolean | / | Use maximum number of machines for workflow execution |
123123
| --output | string | / | A comma-separated list of nodes whose outputs should be downloaded when the execution is finished |
124124
| --output-all | boolean | / | Download all outputs when the execution is finished |
@@ -191,30 +191,30 @@ trickest output --workflow <workflow_name> --space <space_name> [--nodes <comma_
191191
| --config | file | / | YAML file for run configuration |
192192
| --run | string | / | Download output data of a specific run |
193193
| --runs | integer | 1 | The number of executions to be downloaded sorted by newest |
194-
| --output-dir | string | / | Path to directory which should be used to store outputs |
194+
| --output-dir | string | / | Path to directory which should be used to library outputs |
195195
| --nodes | string | / | A comma separated list of nodes whose outputs should be downloaded |
196196
| --files | string | / | A comma-separated list of file names that should be downloaded from the selected node |
197197

198198
## Output Structure
199199

200200
When using the **output** command, trickest-cli will keep the local directory/file structure the same as on the platform. All your spaces and projects will become directories with the appropriate outputs.
201201

202-
## Store
202+
## Library
203203

204-
Use the **store** command to get more info about Trickest workflows and public tools available in the [Trickest Store](https://trickest.io/dashboard/store).
204+
Use the **library** command to get more info about Trickest workflows and public tools available in the [Trickest Library](https://trickest.io/dashboard/library).
205205

206206
#### List
207-
Use **store list** command to list all public tools & workflows available in the [store](https://trickest.io/dashboard/store), along with their descriptions.
207+
Use **library list** command to list all public tools & workflows available in the [library](https://trickest.io/dashboard/library), along with their descriptions.
208208

209209
```
210-
trickest store list
210+
trickest library list
211211
```
212212

213213
#### Search
214-
Use **store search** to search all Trickest tools & workflows available in the [store](https://trickest.io/dashboard/store), along with their descriptions.
214+
Use **library search** to search all Trickest tools & workflows available in the [library](https://trickest.io/dashboard/library), along with their descriptions.
215215

216216
```
217-
trickest store search subdomain takeover
217+
trickest library search subdomain takeover
218218
```
219219

220220
[<img src="./banner.png" />](https://trickest.io/auth/register)

cmd/create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func CreateWorkflow(name, description string, spaceID, projectID uuid.UUID, dele
169169
os.Exit(0)
170170
}
171171

172-
resp := request.Trickest.Post().Body(data).DoF("store/workflow/?vault=%s", util.GetVault())
172+
resp := request.Trickest.Post().Body(data).DoF("library/workflow/?vault=%s", util.GetVault())
173173
if resp == nil {
174174
fmt.Println("Error: Couldn't create workflow.")
175175
os.Exit(0)

cmd/delete/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func DeleteProject(id uuid.UUID) {
8787
}
8888

8989
func deleteWorkflow(id uuid.UUID) {
90-
resp := request.Trickest.Delete().DoF("store/workflow/%s/", id.String())
90+
resp := request.Trickest.Delete().DoF("workflow/%s/", id.String())
9191
if resp == nil {
9292
fmt.Println("Couldn't delete workflow with ID: " + id.String())
9393
os.Exit(0)

cmd/execute/execute.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ var ExecuteCmd = &cobra.Command{
7676
// Executing from a file
7777
version = readWorkflowYAMLandCreateVersion(workflowYAML, newWorkflowName, path)
7878
} else {
79-
// Executing an existing workflow or copying from store
79+
// Executing an existing workflow or copying from library
8080
version = prepareForExec(path)
8181
}
8282
if version == nil {
@@ -941,12 +941,12 @@ func prepareForExec(objectPath string) *types.WorkflowVersionDetailed {
941941
}
942942
}
943943
} else {
944-
// Executing from store
944+
// Executing from library
945945
wfName := pathSplit[len(pathSplit)-1]
946-
storeWorkflows := list.GetWorkflows(uuid.Nil, uuid.Nil, wfName, true)
947-
if storeWorkflows != nil && len(storeWorkflows) > 0 {
948-
// Executing from store
949-
for _, wf := range storeWorkflows {
946+
libraryWorkflows := list.GetWorkflows(uuid.Nil, uuid.Nil, wfName, true)
947+
if libraryWorkflows != nil && len(libraryWorkflows) > 0 {
948+
// Executing from library
949+
for _, wf := range libraryWorkflows {
950950
if strings.ToLower(wf.Name) == strings.ToLower(wfName) {
951951
if project == nil && createProject {
952952
projectName := util.ProjectName
@@ -965,14 +965,14 @@ func prepareForExec(objectPath string) *types.WorkflowVersionDetailed {
965965
copyDestination += "/" + project.Name
966966
}
967967
copyDestination += "/" + newWorkflowName
968-
fmt.Println("Copying " + wf.Name + " from the store to " + copyDestination)
968+
fmt.Println("Copying " + wf.Name + " from the library to " + copyDestination)
969969
projID := uuid.Nil
970970
if project != nil {
971971
projID = project.ID
972972
}
973973
newWorkflowID := copyWorkflow(space.ID, projID, wf.ID)
974974
if newWorkflowID == uuid.Nil {
975-
fmt.Println("Couldn't copy workflow from the store!")
975+
fmt.Println("Couldn't copy workflow from the library!")
976976
os.Exit(0)
977977
}
978978

@@ -1032,9 +1032,9 @@ func prepareForExec(objectPath string) *types.WorkflowVersionDetailed {
10321032
}
10331033
tools := list.GetTools(math.MaxInt, "", wfName)
10341034
if tools == nil || len(tools) == 0 {
1035-
fmt.Println("Couldn't find a workflow or tool named " + wfName + " in the store!")
1036-
fmt.Println("Use \"trickest store list\" to see all available workflows and tools, " +
1037-
"or search the store using \"trickest store search <name/description>\"")
1035+
fmt.Println("Couldn't find a workflow or tool named " + wfName + " in the library!")
1036+
fmt.Println("Use \"trickest library list\" to see all available workflows and tools, " +
1037+
"or search the library using \"trickest library search <name/description>\"")
10381038
os.Exit(0)
10391039
}
10401040
_, _, primitiveNodes = readConfig(configFile, nil, &tools[0])

cmd/execute/helpers.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
)
2828

2929
func getSplitter() *types.Splitter {
30-
resp := request.Trickest.Get().DoF("store/splitter/")
30+
resp := request.Trickest.Get().DoF("library/splitter/")
3131
if resp == nil {
3232
fmt.Println("Error: Couldn't get splitter.")
3333
}
@@ -61,7 +61,7 @@ func getScriptByName(name string) *types.Script {
6161
}
6262

6363
func getScripts(pageSize int, search string, name string) []types.Script {
64-
urlReq := "store/script/"
64+
urlReq := "library/script/"
6565
if pageSize > 0 {
6666
urlReq = urlReq + "?page_size=" + strconv.Itoa(pageSize)
6767
} else {
@@ -162,7 +162,7 @@ func createNewVersion(version *types.WorkflowVersionDetailed) *types.WorkflowVer
162162
os.Exit(0)
163163
}
164164

165-
resp := request.Trickest.Post().Body(data).DoF("store/workflow-version/")
165+
resp := request.Trickest.Post().Body(data).DoF("library/workflow-version/")
166166
if resp == nil {
167167
fmt.Println("Error: Couldn't create version!")
168168
os.Exit(0)
@@ -245,7 +245,7 @@ func uploadFile(filePath string) string {
245245
}
246246

247247
func GetLatestWorkflowVersion(workflowID uuid.UUID) *types.WorkflowVersionDetailed {
248-
resp := request.Trickest.Get().DoF("store/workflow-version/latest/?workflow=%s", workflowID)
248+
resp := request.Trickest.Get().DoF("library/workflow-version/latest/?workflow=%s", workflowID)
249249
if resp == nil {
250250
fmt.Println("Error: Couldn't get latest workflow version!")
251251
os.Exit(0)
@@ -280,7 +280,7 @@ func copyWorkflow(destinationSpaceID, destinationProjectID, workflowID uuid.UUID
280280
os.Exit(0)
281281
}
282282

283-
resp := request.Trickest.Post().Body(data).DoF("store/workflow/%s/copy/", workflowID)
283+
resp := request.Trickest.Post().Body(data).DoF("library/workflow/%s/copy/", workflowID)
284284
if resp == nil {
285285
fmt.Println("Error: Couldn't copy workflow!")
286286
os.Exit(0)
@@ -309,7 +309,7 @@ func updateWorkflow(workflow *types.Workflow, deleteProjectOnError bool) {
309309
os.Exit(0)
310310
}
311311

312-
resp := request.Trickest.Patch().Body(data).DoF("store/workflow/%s/", workflow.ID)
312+
resp := request.Trickest.Patch().Body(data).DoF("library/workflow/%s/", workflow.ID)
313313
if resp == nil {
314314
fmt.Println("Error: Couldn't update workflow!")
315315
os.Exit(0)
@@ -606,23 +606,23 @@ func getToolScriptOrSplitterFromYAMLNode(node types.WorkflowYAMLNode) (*types.To
606606
fmt.Println("Invalid node ID format: " + node.ID)
607607
os.Exit(0)
608608
}
609-
storeName := strings.TrimSuffix(node.ID, "-"+idSplit[len(idSplit)-1])
609+
libraryName := strings.TrimSuffix(node.ID, "-"+idSplit[len(idSplit)-1])
610610

611611
if node.Script == nil {
612-
tools := list.GetTools(1, "", storeName)
612+
tools := list.GetTools(1, "", libraryName)
613613
if tools == nil || len(tools) == 0 {
614614
splitter = getSplitter()
615615
if splitter == nil {
616-
fmt.Println("Couldn't find a tool named " + storeName + " in the store!")
617-
fmt.Println("Use \"trickest store list\" to see all available workflows and tools, " +
618-
"or search the store using \"trickest store search <name/description>\"")
616+
fmt.Println("Couldn't find a tool named " + libraryName + " in the library!")
617+
fmt.Println("Use \"trickest library list\" to see all available workflows and tools, " +
618+
"or search the library using \"trickest library search <name/description>\"")
619619
os.Exit(0)
620620
}
621621
} else {
622622
tool = &tools[0]
623623
}
624624
} else {
625-
script = getScriptByName(storeName)
625+
script = getScriptByName(libraryName)
626626
if script == nil {
627627
os.Exit(0)
628628
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
package store
1+
package library
22

33
import (
44
"github.com/spf13/cobra"
55
)
66

7-
// StoreCmd represents the store command
8-
var StoreCmd = &cobra.Command{
9-
Use: "store",
10-
Short: "Browse workflows and tools in the Trickest store",
7+
// LibraryCmd represents the library command
8+
var LibraryCmd = &cobra.Command{
9+
Use: "library",
10+
Short: "Browse workflows and tools in the Trickest library",
1111
Long: ``,
1212
Run: func(cmd *cobra.Command, args []string) {
1313
_ = cmd.Help()
1414
},
1515
}
1616

1717
func init() {
18-
StoreCmd.SetHelpFunc(func(command *cobra.Command, strings []string) {
18+
LibraryCmd.SetHelpFunc(func(command *cobra.Command, strings []string) {
1919
_ = command.Flags().MarkHidden("space")
2020
_ = command.Flags().MarkHidden("project")
2121
_ = command.Flags().MarkHidden("workflow")

cmd/library/libraryList.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package library
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
)
6+
7+
// libraryListCmd represents the libraryList command
8+
var libraryListCmd = &cobra.Command{
9+
Use: "list",
10+
Short: "List workflows and tools from the Trickest library",
11+
Long: ``,
12+
Run: func(cmd *cobra.Command, args []string) {
13+
_ = cmd.Help()
14+
},
15+
}
16+
17+
func init() {
18+
LibraryCmd.AddCommand(libraryListCmd)
19+
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package store
1+
package library
22

33
import (
44
"fmt"
@@ -11,23 +11,23 @@ import (
1111
"github.com/xlab/treeprint"
1212
)
1313

14-
// storeListToolsCmd represents the storeListTools command
15-
var storeListToolsCmd = &cobra.Command{
14+
// libraryListToolsCmd represents the libraryListTools command
15+
var libraryListToolsCmd = &cobra.Command{
1616
Use: "tools",
17-
Short: "List tools from the Trickest store",
17+
Short: "List tools from the Trickest library",
1818
Long: ``,
1919
Run: func(cmd *cobra.Command, args []string) {
2020
tools := list.GetTools(math.MaxInt, "", "")
2121
if len(tools) > 0 {
2222
printTools(tools)
2323
} else {
24-
fmt.Println("Couldn't find any tool in the store!")
24+
fmt.Println("Couldn't find any tool in the library!")
2525
}
2626
},
2727
}
2828

2929
func init() {
30-
storeListCmd.AddCommand(storeListToolsCmd)
30+
libraryListCmd.AddCommand(libraryListToolsCmd)
3131
}
3232

3333
func printTools(tools []types.Tool) {
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package store
1+
package library
22

33
import (
44
"fmt"
@@ -10,23 +10,23 @@ import (
1010
"github.com/xlab/treeprint"
1111
)
1212

13-
// storeListWorkflowsCmd represents the storeListWorkflows command
14-
var storeListWorkflowsCmd = &cobra.Command{
13+
// libraryListWorkflowsCmd represents the libraryListWorkflows command
14+
var libraryListWorkflowsCmd = &cobra.Command{
1515
Use: "workflows",
16-
Short: "List workflows from the Trickest store",
16+
Short: "List workflows from the Trickest library",
1717
Long: ``,
1818
Run: func(cmd *cobra.Command, args []string) {
1919
workflows := list.GetWorkflows(uuid.Nil, uuid.Nil, "", true)
2020
if len(workflows) > 0 {
2121
printWorkflows(workflows)
2222
} else {
23-
fmt.Println("Couldn't find any workflow in the store!")
23+
fmt.Println("Couldn't find any workflow in the library!")
2424
}
2525
},
2626
}
2727

2828
func init() {
29-
storeListCmd.AddCommand(storeListWorkflowsCmd)
29+
libraryListCmd.AddCommand(libraryListWorkflowsCmd)
3030
}
3131

3232
func printWorkflows(workflows []types.WorkflowListResponse) {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package store
1+
package library
22

33
import (
44
"fmt"
@@ -9,10 +9,10 @@ import (
99
"github.com/trickest/trickest-cli/cmd/list"
1010
)
1111

12-
// storeSearchCmd represents the storeSearch command
13-
var storeSearchCmd = &cobra.Command{
12+
// librarySearchCmd represents the librarySearch command
13+
var librarySearchCmd = &cobra.Command{
1414
Use: "search",
15-
Short: "Search for workflows and tools in the Trickest store",
15+
Short: "Search for workflows and tools in the Trickest library",
1616
Long: ``,
1717
Run: func(cmd *cobra.Command, args []string) {
1818
search := ""
@@ -24,16 +24,16 @@ var storeSearchCmd = &cobra.Command{
2424
if len(tools) > 0 {
2525
printTools(tools)
2626
} else {
27-
fmt.Println("Couldn't find any tool in the store that matches the search!")
27+
fmt.Println("Couldn't find any tool in the library that matches the search!")
2828
}
2929
if len(workflows) > 0 {
3030
printWorkflows(workflows)
3131
} else {
32-
fmt.Println("Couldn't find any workflow in the store that matches the search!")
32+
fmt.Println("Couldn't find any workflow in the library that matches the search!")
3333
}
3434
},
3535
}
3636

3737
func init() {
38-
StoreCmd.AddCommand(storeSearchCmd)
38+
LibraryCmd.AddCommand(librarySearchCmd)
3939
}

0 commit comments

Comments
 (0)