@@ -54,6 +54,31 @@ extension ComAtprotoLexicon.Repository {
5454 /// The size of the blob.
5555 public let size : Int
5656
57+ public init ( type: String , reference: ComAtprotoLexicon . Repository . BlobReference , mimeType: String , size: Int ) {
58+ self . type = type
59+ self . reference = reference
60+ self . mimeType = mimeType
61+ self . size = size
62+ }
63+
64+ public init ( from decoder: any Decoder ) throws {
65+ let container = try decoder. container ( keyedBy: CodingKeys . self)
66+
67+ self . type = try ? container. decodeIfPresent ( String . self, forKey: . type)
68+ self . reference = try container. decode ( ComAtprotoLexicon . Repository. BlobReference. self, forKey: . reference)
69+ self . mimeType = try container. decode ( String . self, forKey: . mimeType)
70+ self . size = try container. decode ( Int . self, forKey: . size)
71+ }
72+
73+ public func encode( to encoder: any Encoder ) throws {
74+ var container = encoder. container ( keyedBy: CodingKeys . self)
75+
76+ try container. encodeIfPresent ( self . type, forKey: . type)
77+ try container. encode ( self . reference, forKey: . reference)
78+ try container. encode ( self . mimeType, forKey: . mimeType)
79+ try container. encode ( self . size, forKey: . size)
80+ }
81+
5782 enum CodingKeys : String , CodingKey {
5883 case type = " $type "
5984 case reference = " ref "
@@ -67,7 +92,21 @@ extension ComAtprotoLexicon.Repository {
6792
6893 /// The link of the blob reference.
6994 public let link : String
95+
96+ public init ( link: String ) {
97+ self . link = link
98+ }
7099
100+ public init ( from decoder: Decoder ) throws {
101+ let container = try decoder. container ( keyedBy: CodingKeys . self)
102+ self . link = try container. decode ( String . self, forKey: . link)
103+ }
104+
105+ public func encode( to encoder: any Encoder ) throws {
106+ var container = encoder. container ( keyedBy: CodingKeys . self)
107+ try container. encode ( self . link, forKey: . link)
108+ }
109+
71110 enum CodingKeys : String , CodingKey {
72111 case link = " $link "
73112 }
0 commit comments