github.com/altipla-consulting/ravendb-go-client@v0.1.3/delete_attachment_command_data.go (about) 1 package ravendb 2 3 type DeleteAttachmentCommandData struct { 4 *CommandData 5 } 6 7 // NewDeleteAttachmentCommandData creates CommandData for Delete Attachment command 8 func NewDeleteAttachmentCommandData(documentID string, name string, changeVector *string) (*DeleteAttachmentCommandData, error) { 9 if stringIsBlank(documentID) { 10 return nil, newIllegalArgumentError("DocumentId cannot be null or empty") 11 } 12 if stringIsBlank(name) { 13 return nil, newIllegalArgumentError("Name cannot be null or empty") 14 } 15 16 res := &DeleteAttachmentCommandData{ 17 &CommandData{ 18 Type: CommandDelete, 19 ID: documentID, 20 Name: name, 21 ChangeVector: changeVector, 22 }, 23 } 24 return res, nil 25 } 26 27 func (d *DeleteAttachmentCommandData) serialize(conventions *DocumentConventions) (interface{}, error) { 28 res := d.baseJSON() 29 res["Type"] = "AttachmentDELETE" 30 res["Name"] = d.Name 31 return res, nil 32 }