| 194 | } |
| 195 | |
| 196 | func (p RequestPayload) appendInputItems(items []responses.ResponseInputItemUnionParam) (RequestPayload, error) { |
| 197 | if len(items) == 0 { |
| 198 | return p, nil |
| 199 | } |
| 200 | |
| 201 | existing, err := p.inputItems() |
| 202 | if err != nil { |
| 203 | return p, xerrors.Errorf("failed to get existing 'input' items: %w", err) |
| 204 | } |
| 205 | |
| 206 | allInput := make([]any, 0, len(existing)+len(items)) |
| 207 | allInput = append(allInput, existing...) |
| 208 | for _, item := range items { |
| 209 | allInput = append(allInput, item) |
| 210 | } |
| 211 | |
| 212 | return p.set(reqPathInput, allInput) |
| 213 | } |
| 214 | |
| 215 | func (p RequestPayload) inputItems() ([]any, error) { |
| 216 | input := gjson.GetBytes(p, reqPathInput) |