jfrog-client-go icon indicating copy to clipboard operation
jfrog-client-go copied to clipboard

Setting / deleting props API should be simplified

Open eyalbe4 opened this issue 5 years ago • 2 comments

It looks like the SetProps and DeleteProps props APIs require using the SearchFiles API. The SetProps and DeleteProps API expect to receive to result of the SearchFiles. This is both inconsistent with the other APIs (which are all independent) and also cumbersome to use. In addition, the README is incorrect, because it notes that propsParams includes a Pattern property, while it doesn't, right now, although it should.

eyalbe4 avatar Jul 15 '20 13:07 eyalbe4

The requested API:

propsParams := services.NewPropsParams()
propsParams.Pattern = "repo/*/*.zip"

// Filter the files by properties. Warning - this would be a breaking change. We have to consider it wisely.
propsParams.Props = "unwantedKey=unwantedValue"

// The properties to add (new field)
propsParams.AddedProps = "keyToAdd=valueToAdd"

rtManager.SetProps(propsParams)

The new function signature should accept varargs of PropsParams:

func (ps *PropsService) SetProps(propsParams ...PropsParams) (int, error)

yahavi avatar Jan 21 '21 11:01 yahavi

running in to the same problem, I need to set a property on one file and know the repo / path from steps before. requiring a second API request to search for a file that is already know is unnecessary and makes the process slower and more CPU / Network intensive then it needs to be.

a simple

func SetItemProps(relativePath string, props string) (int, error)

analog to GetItemProps is needed in my opinion

Links2004 avatar Aug 05 '24 14:08 Links2004