github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/protocol/media-type.go (about) 1 /* For license and copyright information please see the LEGAL file in the code repository */ 2 3 package protocol 4 5 type MediaTypes interface { 6 RegisterMediaType(mt MediaType) 7 GetMediaType(mt string) MediaType 8 GetMediaTypeByID(id MediaTypeID) MediaType 9 GetMediaTypeByFileExtension(ex string) MediaType 10 } 11 12 type MediaTypeID = ID 13 14 // MediaType or MimeType protocol is the shape of any coding media-type. 15 // It also implement our RFC details on https://github.com/GeniusesGroup/RFCs/blob/master/media-type.md 16 type MediaType interface { 17 // Below names are case-insensitive. 18 MediaType() string // must "maintype "/" [tree "."] subtype ["+" suffix]* [";" parameters]" 19 MainType() string // must 20 Tree() string // if any 21 SubType() string // must 22 Suffix() string // if any 23 Parameters() []string // if any 24 25 FileExtension() string // if any 26 27 Status() SoftwareStatus 28 ReferenceURI() string 29 IssueDate() Time 30 ExpiryDate() Time 31 ExpireInFavorOf() MediaType 32 33 Fields() []Field // In explicit mediatype like domain maintype not like "application/json" 34 35 UUIDHash // Hash of MediaType() 36 Details 37 Stringer 38 }