(cmd *cobra.Command, dbx sharedLinkClient, url string, opts shareLinkUpdateOptions, link sharing.IsSharedLinkMetadata)
| 99 | } |
| 100 | |
| 101 | func 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 | |
| 132 | func newShareLinkUpdateInput(url string, opts shareLinkUpdateOptions) shareLinkUpdateInput { |
| 133 | input := shareLinkUpdateInput{ |
no test coverage detected