Skip to content

Commit

Permalink
Refactor RecordAttachment to proper XML type and rename IDs to be con…
Browse files Browse the repository at this point in the history
…sistent
  • Loading branch information
fabiante committed Feb 2, 2024
1 parent d63bab9 commit 7e77fbc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 34 deletions.
16 changes: 0 additions & 16 deletions r_get_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,10 @@ package easclient
import (
"context"
"encoding/xml"
"time"

"github.com/google/uuid"
)

type RecordAttachment struct {
Body string `json:"body"`
Name string `json:"name"`
Size string `json:"size"`
Register string `json:"register"`
Author string `json:"author"`
Type string `json:"type"`
DocumentType string `json:"documentType"`
Id uuid.UUID `json:"id"`
FileId uuid.UUID `json:"fileId"`
MasterId uuid.UUID `json:"masterId"`
Version string `json:"version"`
ArchiveDateTime time.Time `json:"archiveDateTime"`
}

func (c *StoreClient) GetRecord(ctx context.Context, id uuid.UUID) (*Record, error) {
req, err := c.newRequestXML(ctx)
if err != nil {
Expand Down
38 changes: 20 additions & 18 deletions record.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ type RecordField struct {
}

type Record struct {
DocumentType string `xml:"documentType"`
MasterId uuid.UUID `xml:"masterId"`
ArchiveDateTime time.Time `xml:"archiveDateTime"`
ID uuid.UUID `xml:"id"`
Version string `xml:"version"`
ArchiverLogin string `xml:"archiverLogin"`
Archiver string `xml:"archiver"`
InitialArchiver string `xml:"initialArchiver"`
InitialArchiverLogin string `xml:"initialArchiverLogin"`
InitialArchiveDateTime time.Time `xml:"initialArchiveDateTime"`
Fields []*RecordField `xml:"field"`
Attachment struct {
Name string `xml:"name"`
Size int `xml:"size"`
Register string `xml:"register"`
Author string `xml:"author"`
ID string `xml:"id"`
} `xml:"attachment"`
DocumentType string `xml:"documentType"`
MasterId uuid.UUID `xml:"masterId"`
ArchiveDateTime time.Time `xml:"archiveDateTime"`
ID uuid.UUID `xml:"id"`
Version string `xml:"version"`
ArchiverLogin string `xml:"archiverLogin"`
Archiver string `xml:"archiver"`
InitialArchiver string `xml:"initialArchiver"`
InitialArchiverLogin string `xml:"initialArchiverLogin"`
InitialArchiveDateTime time.Time `xml:"initialArchiveDateTime"`
Fields []*RecordField `xml:"field"`
Attachments []*RecordAttachment `xml:"attachment"`
}

type RecordAttachment struct {
Name string `xml:"name"`
Size int `xml:"size"`
Register string `xml:"register"`
Author string `xml:"author"`
ID uuid.UUID `xml:"id"`
}

0 comments on commit 7e77fbc

Please sign in to comment.