MCPcopy Create free account
hub / github.com/dropbox/dbxcli / renderShareLinkUpdateOutput

Function renderShareLinkUpdateOutput

cmd/share_link_update.go:101–130  ·  view source on GitHub ↗
(cmd *cobra.Command, dbx sharedLinkClient, url string, opts shareLinkUpdateOptions, link sharing.IsSharedLinkMetadata)

Source from the content-addressed store, hash-verified

99}
100
101func renderShareLinkUpdateOutput(cmd *cobra.Command, dbx sharedLinkClient, url string, opts shareLinkUpdateOptions, link sharing.IsSharedLinkMetadata) error {
102 commandVerboseStatus(cmd, "Updated shared link %s", url)
103
104 if commandOutputFormat(cmd) != output.FormatJSON {
105 return nil
106 }
107
108 if link == nil {
109 arg := sharing.NewGetSharedLinkMetadataArg(url)
110 if opts.password.set {
111 arg.LinkPassword = opts.password.password
112 }
113 var err error
114 link, err = dbx.GetSharedLinkMetadataContext(currentContext(), arg)
115 if err != nil {
116 return withJSONErrorDetails(err, urlErrorDetails(url), operationErrorDetails("share_link_update"))
117 }
118 }
119
120 result, ok := shareLinkJSONMetadataFromDropbox(link)
121 if !ok {
122 return withJSONErrorDetails(errors.New("found unknown shared link type"), operationErrorDetails("share_link_update"), urlErrorDetails(url))
123 }
124
125 return renderJSONOperationOutput(
126 cmd,
127 newShareLinkUpdateInput(url, opts),
128 []jsonOperationResult{shareLinkJSONOperationResult(shareLinkJSONStatusUpdated, result)},
129 )
130}
131
132func newShareLinkUpdateInput(url string, opts shareLinkUpdateOptions) shareLinkUpdateInput {
133 input := shareLinkUpdateInput{

Callers 1

shareLinkUpdateFunction · 0.85

Calls 11

commandVerboseStatusFunction · 0.85
commandOutputFormatFunction · 0.85
currentContextFunction · 0.85
withJSONErrorDetailsFunction · 0.85
urlErrorDetailsFunction · 0.85
operationErrorDetailsFunction · 0.85
newShareLinkUpdateInputFunction · 0.85

Tested by

no test coverage detected