| 134 | } |
| 135 | |
| 136 | func getParams(opts *EditOptions) map[string]interface{} { |
| 137 | params := map[string]interface{}{} |
| 138 | |
| 139 | if opts.Body != nil { |
| 140 | params["body"] = opts.Body |
| 141 | } |
| 142 | |
| 143 | if opts.DiscussionCategory != nil { |
| 144 | params["discussion_category_name"] = *opts.DiscussionCategory |
| 145 | } |
| 146 | |
| 147 | if opts.Draft != nil { |
| 148 | params["draft"] = *opts.Draft |
| 149 | } |
| 150 | |
| 151 | if opts.Name != nil { |
| 152 | params["name"] = opts.Name |
| 153 | } |
| 154 | |
| 155 | if opts.Prerelease != nil { |
| 156 | params["prerelease"] = *opts.Prerelease |
| 157 | } |
| 158 | |
| 159 | if opts.TagName != "" { |
| 160 | params["tag_name"] = opts.TagName |
| 161 | } |
| 162 | |
| 163 | if opts.Target != "" { |
| 164 | params["target_commitish"] = opts.Target |
| 165 | } |
| 166 | |
| 167 | if opts.IsLatest != nil { |
| 168 | // valid values: true/false/legacy |
| 169 | params["make_latest"] = fmt.Sprintf("%v", *opts.IsLatest) |
| 170 | } |
| 171 | |
| 172 | return params |
| 173 | } |