Skip to content

Commit

Permalink
Replace "folder" with "path" in Share (PAN-8665)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenany committed Oct 10, 2024
1 parent 825765d commit b4fdca7
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 63 deletions.
5 changes: 4 additions & 1 deletion dev/run_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
# Need to run this script from `./examples/` folder

set -e
skip_items=("/util/", "share/cli.go")
skip_items=(
"/util/"
"share/cli.go"
)

# Root directory
root_directory=$(pwd)
Expand Down
39 changes: 4 additions & 35 deletions examples/audit/go.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M=
github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
Expand All @@ -16,48 +13,20 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.6.0 h1:vt9WIPdmQupZzlU9TreSap5YMlWvFBvggxNQSdCNRJY=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.6.0/go.mod h1:eTPRfLv6TCVK/Ey6lMIhh2TjyrkdCa4SPG2q6qRxRjc=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.7.0 h1:ChdZ+URmVYKpx4SNb86D8d9/HIZ8/Nwv1zrhzALTex4=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.7.0/go.mod h1:neO6CRODkaTM/Vt9L1guHNern4A3mS5tZ8RGFEr5pfA=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.8.0 h1:I263w98fzy0n41anaa8XqWI3ODQql3mhojozUJxE11I=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.8.0/go.mod h1:Vo3GWRYuNgPTdFyuvs213dhwCikfca9D3/MPqFpEVB8=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.9.0 h1:BLMTRs1xGraHQ+tRUbW4AWf41dHj3zV9G4sW7B2sF5s=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.9.0/go.mod h1:51UADzkgaNmN9DgEImwhJPnzczPl5GdfpQ14wcIA4qg=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.10.0 h1:LVwftUK8pATicfH7G69BUaMB2p3HZBWywewMvWTdlIw=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.10.0/go.mod h1:g51Cb7maqcrGRFMv/FFXOkBIcrK5wRQ6gEkCnFMSfLQ=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.11.0 h1:EIoGeBqhmrk0XRuuU1uF2Lm/vC74RAXfxgqv9W7Mh24=
github.com/pangeacyber/pangea-go/pangea-sdk/v3 v3.11.0/go.mod h1:g51Cb7maqcrGRFMv/FFXOkBIcrK5wRQ6gEkCnFMSfLQ=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2 changes: 1 addition & 1 deletion examples/share/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func main() {
}
defer f.Close()

uploadResponse, err := client.Put(ctx, &share.PutRequest{Path: fmt.Sprintf("%s/%s", dest, filepath.Base(file))}, f)
uploadResponse, err := client.Put(ctx, &share.PutRequest{Folder: fmt.Sprintf("%s/%s", dest, filepath.Base(file))}, f)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion examples/share/folder_create_and_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func main() {

// Create a FolderCreateRequest and set the path of the folder to be created
input := &share.FolderCreateRequest{
Path: path,
Folder: path,
}

fmt.Printf("Let's create a folder: %s\n", path)
Expand Down
2 changes: 2 additions & 0 deletions examples/share/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ require (
require (
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.21.0 // indirect
)

Expand Down
10 changes: 10 additions & 0 deletions examples/share/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
Expand All @@ -7,6 +8,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/S
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
Expand All @@ -18,10 +21,17 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 2 additions & 2 deletions examples/share/item_life_cycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func main() {

// Create a folder
respCreate, err := client.FolderCreate(ctx, &share.FolderCreateRequest{
Path: folder,
Folder: folder,
})
if err != nil {
log.Fatalf("unexpected error: %v", err)
Expand All @@ -59,7 +59,7 @@ func main() {
fmt.Println("Uploading file with Path field...")
respPut, err := client.Put(ctx,
&share.PutRequest{
Path: path.Join(folder, "file_multipart_1"),
Folder: path.Join(folder, "file_multipart_1"),
TransferRequest: pangea.TransferRequest{
TransferMethod: pangea.TMmultipart,
},
Expand Down
23 changes: 9 additions & 14 deletions pangea-sdk/v3/service/share/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ type DeleteRequest struct {

ID string `json:"id,omitempty"` // The ID of the object to delete.
Force *bool `json:"force,omitempty"` // If true, delete a folder even if it's not empty. Deletes the contents of folder as well.
Path string `json:"path,omitempty"` // The path of the object to delete.
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
}

Expand Down Expand Up @@ -128,8 +127,7 @@ func (e *share) Buckets(ctx context.Context) (*pangea.PangeaResponse[BucketsResu

// @summary Delete
//
// @description Delete object by ID or path. If both are supplied, the path must
// match that of the object represented by the ID.
// @description Delete object by ID.
//
// @operationId store_post_v1_delete
//
Expand All @@ -150,7 +148,7 @@ type FolderCreateRequest struct {
Name string `json:"name,omitempty"` // The name of an object.
Metadata Metadata `json:"metadata,omitempty"` // A set of string-based key/value pairs used to provide additional data about an object.
ParentID string `json:"parent_id,omitempty"` // The ID of a stored object.
Path string `json:"path,omitempty"` // An case-sensitive path to an object. Contains a sequence of path segments delimited by the the / character. Any path ending in a / character refers to a folder.
Folder string `json:"folder,omitempty"` // The folder to place the folder in. Must match `parent_id` if also set.
Tags Tags `json:"tags,omitempty"` // A list of user-defined tags
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
}
Expand All @@ -173,7 +171,7 @@ type FolderCreateResult struct {
// "priority": "medium",
// },
// ParentID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
// Path: "/",
// Folder: "/",
// Tags: share.Tags{"irs_2023", "personal"},
// }
//
Expand All @@ -186,7 +184,6 @@ type GetRequest struct {
pangea.BaseRequest

ID string `json:"id,omitempty"` // The ID of the object to retrieve.
Path string `json:"path,omitempty"` // The path of the object to retrieve.
Password *string `json:"password,omitempty"` // If the file was protected with a password, the password to decrypt with.
TransferMethod pangea.TransferMethod `json:"transfer_method,omitempty"` // The requested transfer method for the file data.
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
Expand All @@ -199,16 +196,14 @@ type GetResult struct {

// @summary Get an object
//
// @description Get object. If both ID and path are supplied, the call will fail
// if the target object doesn't match both properties.
// @description Get object.
//
// @operationId store_post_v1_get
//
// @example
//
// input := &share.GetRequest{
// ID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
// Path: "/",
// }
//
// res, err := shareClient.Get(ctx, input)
Expand All @@ -230,7 +225,7 @@ type PutRequest struct {
Metadata Metadata `json:"metadata,omitempty"` // A set of string-based key/value pairs used to provide additional data about an object.
MimeType string `json:"mimetype,omitempty"` // The MIME type of the file, which will be verified by the server if provided. Uploads not matching the supplied MIME type will be rejected.
ParentID string `json:"parent_id,omitempty"` // The parent ID of the object (a folder). Leave blank to keep in the root folder.
Path string `json:"path,omitempty"` // An optional path where the file should be placed. It will auto-create directories if necessary.
Folder string `json:"folder,omitempty"` // The path to the parent folder. Leave blank for the root folder. Path must resolve to `parent_id` if also set.
Password string `json:"password,omitempty"` // An optional password to protect the file with. Downloading the file will require this password.
PasswordAlgorithm string `json:"password_algorithm,omitempty"` // An optional password algorithm to protect the file with. See symmetric vault password_algorithm.
SHA1 string `json:"sha1,omitempty"` // The hexadecimal-encoded SHA1 hash of the file data, which will be verified by the server if provided.
Expand Down Expand Up @@ -258,7 +253,7 @@ type PutResult struct {
// "priority": "medium",
// },
// ParentID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
// Path: "/",
// Folder: "/",
// Tags: share.Tags{"irs_2023", "personal"},
// }
//
Expand Down Expand Up @@ -303,7 +298,7 @@ type UpdateRequest struct {
pangea.BaseRequest

ID string `json:"id"` // An identifier for the file to update.
Path string `json:"path,omitempty"` // An alternative to ID for identifying the target file.
Folder string `json:"folder,omitempty"` // Set the parent (folder). Leave blank for the root folder. Path must resolve to `parent_id` if also set.
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
AddMetadata Metadata `json:"add_metadata,omitempty"` // A list of Metadata key/values to set in the object. If a provided key exists, the value will be replaced.
AddPassword string `json:"add_password,omitempty"` // Protect the file with the supplied password.
Expand Down Expand Up @@ -333,7 +328,7 @@ type UpdateResult struct {
//
// input := &share.UpdateRequest{
// ID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
// Path: "/",
// Folder: "/",
// RemoveMetadata: share.Metadata{
// "created_by": "jim",
// "priority": "medium",
Expand Down Expand Up @@ -720,7 +715,7 @@ func (e *share) ShareLinkDelete(ctx context.Context, input *ShareLinkDeleteReque
// "priority": "medium",
// },
// ParentID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
// Path: "/",
// Folder: "/",
// Tags: share.Tags{"irs_2023", "personal"},
// }
//
Expand Down
17 changes: 8 additions & 9 deletions pangea-sdk/v3/service/share/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func Test_Integration_Folder(t *testing.T) {
client := share.New(cfg)

input := &share.FolderCreateRequest{
Path: FOLDER_DELETE,
Folder: FOLDER_DELETE,
}

out, err := client.FolderCreate(ctx, input)
Expand Down Expand Up @@ -223,7 +223,7 @@ func Test_Integration_PutTransferMethodPostURL_PathAnd18MB(t *testing.T) {
path := "/sdk/tests/go/" + TIME + "_file_post_url"

input := &share.PutRequest{
Path: path,
Folder: path,
TransferRequest: pangea.TransferRequest{
TransferMethod: pangea.TMpostURL,
},
Expand Down Expand Up @@ -483,7 +483,7 @@ func Test_Integration_LifeCycle(t *testing.T) {

// Create a folder
respCreate, err := client.FolderCreate(ctx, &share.FolderCreateRequest{
Path: FOLDER_FILES,
Folder: FOLDER_FILES,
})
if err != nil {
t.Fatalf("unexpected error: %v", err)
Expand All @@ -502,7 +502,7 @@ func Test_Integration_LifeCycle(t *testing.T) {

respPut, err := client.Put(ctx,
&share.PutRequest{
Path: FOLDER_FILES + "/" + TIME + "_file_multipart_1",
Folder: FOLDER_FILES + "/" + TIME + "_file_multipart_1",
TransferRequest: pangea.TransferRequest{
TransferMethod: pangea.TMmultipart,
},
Expand All @@ -515,11 +515,10 @@ func Test_Integration_LifeCycle(t *testing.T) {

assert.NotNil(t, respPut)
assert.NotNil(t, respPut.Result)
assert.Equal(t, folderID, respPut.Result.Object.ParentID)
assert.Empty(t, respPut.Result.Object.Metadata)
assert.Empty(t, respPut.Result.Object.Tags)
assert.Empty(t, respPut.Result.Object.MD5)
assert.Empty(t, respPut.Result.Object.SHA512)
assert.NotEmpty(t, respPut.Result.Object.MD5)
assert.NotEmpty(t, respPut.Result.Object.SHA512)
assert.NotEmpty(t, respPut.Result.Object.SHA256)

// Upload a file with parent id and name
Expand Down Expand Up @@ -548,8 +547,8 @@ func Test_Integration_LifeCycle(t *testing.T) {
assert.Equal(t, folderID, respPut2.Result.Object.ParentID)
assert.Equal(t, share.Metadata(METADATA), respPut2.Result.Object.Metadata)
assert.Equal(t, share.Tags(TAGS), respPut2.Result.Object.Tags)
assert.Empty(t, respPut2.Result.Object.MD5)
assert.Empty(t, respPut2.Result.Object.SHA512)
assert.NotEmpty(t, respPut2.Result.Object.MD5)
assert.NotEmpty(t, respPut2.Result.Object.SHA512)
assert.NotEmpty(t, respPut2.Result.Object.SHA256)

// Update file with full metadata and tags
Expand Down

0 comments on commit b4fdca7

Please sign in to comment.