jfrog-client-go
jfrog-client-go copied to clipboard
Setting / deleting props API should be simplified
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.
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)
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