porting all github actions from bluesky-social/indigo to tangled CI

Support lexicons for video (#721)

authored by Jaz and committed by GitHub f1d2fda3 131b02d1

+1 -1
api/atproto/labeldefs.go
··· 34 34 35 35 // LabelDefs_LabelValueDefinition is a "labelValueDefinition" in the com.atproto.label.defs schema. 36 36 // 37 - // Declares a label value and its expected interpertations and behaviors. 37 + // Declares a label value and its expected interpretations and behaviors. 38 38 type LabelDefs_LabelValueDefinition struct { 39 39 // adultOnly: Does the user need to have adult content enabled in order to configure this label? 40 40 AdultOnly *bool `json:"adultOnly,omitempty" cborgen:"adultOnly,omitempty"`
+5 -1
api/atproto/servergetServiceAuth.go
··· 18 18 // ServerGetServiceAuth calls the XRPC method "com.atproto.server.getServiceAuth". 19 19 // 20 20 // aud: The DID of the service that the token will be used to authenticate with 21 - func ServerGetServiceAuth(ctx context.Context, c *xrpc.Client, aud string) (*ServerGetServiceAuth_Output, error) { 21 + // exp: The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. 22 + // lxm: Lexicon (XRPC) method to bind the requested token to 23 + func ServerGetServiceAuth(ctx context.Context, c *xrpc.Client, aud string, exp int64, lxm string) (*ServerGetServiceAuth_Output, error) { 22 24 var out ServerGetServiceAuth_Output 23 25 24 26 params := map[string]interface{}{ 25 27 "aud": aud, 28 + "exp": exp, 29 + "lxm": lxm, 26 30 } 27 31 if err := c.Do(ctx, xrpc.Query, "", "com.atproto.server.getServiceAuth", params, nil, &out); err != nil { 28 32 return nil, err
+5
api/bsky/actordefs.go
··· 112 112 // 113 113 // A word that the account owner has muted. 114 114 type ActorDefs_MutedWord struct { 115 + // actorTarget: Groups of users to apply the muted word to. If undefined, applies to all users. 116 + ActorTarget *string `json:"actorTarget,omitempty" cborgen:"actorTarget,omitempty"` 117 + // expiresAt: The date and time at which the muted word will expire and no longer be applied. 118 + ExpiresAt *string `json:"expiresAt,omitempty" cborgen:"expiresAt,omitempty"` 119 + Id *string `json:"id,omitempty" cborgen:"id,omitempty"` 115 120 // targets: The intended targets of the muted word. 116 121 Targets []*string `json:"targets" cborgen:"targets"` 117 122 // value: The muted word itself.
+448 -7
api/bsky/cbor_gen.go
··· 1806 1806 return err 1807 1807 } 1808 1808 1809 - // t.AspectRatio (bsky.EmbedImages_AspectRatio) (struct) 1809 + // t.AspectRatio (bsky.EmbedDefs_AspectRatio) (struct) 1810 1810 if t.AspectRatio != nil { 1811 1811 1812 1812 if len("aspectRatio") > 1000000 { ··· 1896 1896 } 1897 1897 1898 1898 } 1899 - // t.AspectRatio (bsky.EmbedImages_AspectRatio) (struct) 1899 + // t.AspectRatio (bsky.EmbedDefs_AspectRatio) (struct) 1900 1900 case "aspectRatio": 1901 1901 1902 1902 { ··· 1909 1909 if err := cr.UnreadByte(); err != nil { 1910 1910 return err 1911 1911 } 1912 - t.AspectRatio = new(EmbedImages_AspectRatio) 1912 + t.AspectRatio = new(EmbedDefs_AspectRatio) 1913 1913 if err := t.AspectRatio.UnmarshalCBOR(cr); err != nil { 1914 1914 return xerrors.Errorf("unmarshaling t.AspectRatio pointer: %w", err) 1915 1915 } ··· 5261 5261 5262 5262 return nil 5263 5263 } 5264 - func (t *EmbedImages_AspectRatio) MarshalCBOR(w io.Writer) error { 5264 + func (t *EmbedDefs_AspectRatio) MarshalCBOR(w io.Writer) error { 5265 5265 if t == nil { 5266 5266 _, err := w.Write(cbg.CborNull) 5267 5267 return err ··· 5320 5320 return nil 5321 5321 } 5322 5322 5323 - func (t *EmbedImages_AspectRatio) UnmarshalCBOR(r io.Reader) (err error) { 5324 - *t = EmbedImages_AspectRatio{} 5323 + func (t *EmbedDefs_AspectRatio) UnmarshalCBOR(r io.Reader) (err error) { 5324 + *t = EmbedDefs_AspectRatio{} 5325 5325 5326 5326 cr := cbg.NewCborReader(r) 5327 5327 ··· 5340 5340 } 5341 5341 5342 5342 if extra > cbg.MaxLength { 5343 - return fmt.Errorf("EmbedImages_AspectRatio: map struct too large (%d)", extra) 5343 + return fmt.Errorf("EmbedDefs_AspectRatio: map struct too large (%d)", extra) 5344 5344 } 5345 5345 5346 5346 var name string ··· 6916 6916 6917 6917 return nil 6918 6918 } 6919 + func (t *EmbedVideo) MarshalCBOR(w io.Writer) error { 6920 + if t == nil { 6921 + _, err := w.Write(cbg.CborNull) 6922 + return err 6923 + } 6924 + 6925 + cw := cbg.NewCborWriter(w) 6926 + fieldCount := 5 6927 + 6928 + if t.Alt == nil { 6929 + fieldCount-- 6930 + } 6931 + 6932 + if t.AspectRatio == nil { 6933 + fieldCount-- 6934 + } 6935 + 6936 + if t.Captions == nil { 6937 + fieldCount-- 6938 + } 6939 + 6940 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 6941 + return err 6942 + } 6943 + 6944 + // t.Alt (string) (string) 6945 + if t.Alt != nil { 6946 + 6947 + if len("alt") > 1000000 { 6948 + return xerrors.Errorf("Value in field \"alt\" was too long") 6949 + } 6950 + 6951 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("alt"))); err != nil { 6952 + return err 6953 + } 6954 + if _, err := cw.WriteString(string("alt")); err != nil { 6955 + return err 6956 + } 6957 + 6958 + if t.Alt == nil { 6959 + if _, err := cw.Write(cbg.CborNull); err != nil { 6960 + return err 6961 + } 6962 + } else { 6963 + if len(*t.Alt) > 1000000 { 6964 + return xerrors.Errorf("Value in field t.Alt was too long") 6965 + } 6966 + 6967 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Alt))); err != nil { 6968 + return err 6969 + } 6970 + if _, err := cw.WriteString(string(*t.Alt)); err != nil { 6971 + return err 6972 + } 6973 + } 6974 + } 6975 + 6976 + // t.LexiconTypeID (string) (string) 6977 + if len("$type") > 1000000 { 6978 + return xerrors.Errorf("Value in field \"$type\" was too long") 6979 + } 6980 + 6981 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 6982 + return err 6983 + } 6984 + if _, err := cw.WriteString(string("$type")); err != nil { 6985 + return err 6986 + } 6987 + 6988 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.bsky.embed.video"))); err != nil { 6989 + return err 6990 + } 6991 + if _, err := cw.WriteString(string("app.bsky.embed.video")); err != nil { 6992 + return err 6993 + } 6994 + 6995 + // t.Video (util.LexBlob) (struct) 6996 + if len("video") > 1000000 { 6997 + return xerrors.Errorf("Value in field \"video\" was too long") 6998 + } 6999 + 7000 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("video"))); err != nil { 7001 + return err 7002 + } 7003 + if _, err := cw.WriteString(string("video")); err != nil { 7004 + return err 7005 + } 7006 + 7007 + if err := t.Video.MarshalCBOR(cw); err != nil { 7008 + return err 7009 + } 7010 + 7011 + // t.Captions ([]*bsky.EmbedVideo_Caption) (slice) 7012 + if t.Captions != nil { 7013 + 7014 + if len("captions") > 1000000 { 7015 + return xerrors.Errorf("Value in field \"captions\" was too long") 7016 + } 7017 + 7018 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("captions"))); err != nil { 7019 + return err 7020 + } 7021 + if _, err := cw.WriteString(string("captions")); err != nil { 7022 + return err 7023 + } 7024 + 7025 + if len(t.Captions) > 8192 { 7026 + return xerrors.Errorf("Slice value in field t.Captions was too long") 7027 + } 7028 + 7029 + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Captions))); err != nil { 7030 + return err 7031 + } 7032 + for _, v := range t.Captions { 7033 + if err := v.MarshalCBOR(cw); err != nil { 7034 + return err 7035 + } 7036 + 7037 + } 7038 + } 7039 + 7040 + // t.AspectRatio (bsky.EmbedDefs_AspectRatio) (struct) 7041 + if t.AspectRatio != nil { 7042 + 7043 + if len("aspectRatio") > 1000000 { 7044 + return xerrors.Errorf("Value in field \"aspectRatio\" was too long") 7045 + } 7046 + 7047 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("aspectRatio"))); err != nil { 7048 + return err 7049 + } 7050 + if _, err := cw.WriteString(string("aspectRatio")); err != nil { 7051 + return err 7052 + } 7053 + 7054 + if err := t.AspectRatio.MarshalCBOR(cw); err != nil { 7055 + return err 7056 + } 7057 + } 7058 + return nil 7059 + } 7060 + 7061 + func (t *EmbedVideo) UnmarshalCBOR(r io.Reader) (err error) { 7062 + *t = EmbedVideo{} 7063 + 7064 + cr := cbg.NewCborReader(r) 7065 + 7066 + maj, extra, err := cr.ReadHeader() 7067 + if err != nil { 7068 + return err 7069 + } 7070 + defer func() { 7071 + if err == io.EOF { 7072 + err = io.ErrUnexpectedEOF 7073 + } 7074 + }() 7075 + 7076 + if maj != cbg.MajMap { 7077 + return fmt.Errorf("cbor input should be of type map") 7078 + } 7079 + 7080 + if extra > cbg.MaxLength { 7081 + return fmt.Errorf("EmbedVideo: map struct too large (%d)", extra) 7082 + } 7083 + 7084 + var name string 7085 + n := extra 7086 + 7087 + for i := uint64(0); i < n; i++ { 7088 + 7089 + { 7090 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7091 + if err != nil { 7092 + return err 7093 + } 7094 + 7095 + name = string(sval) 7096 + } 7097 + 7098 + switch name { 7099 + // t.Alt (string) (string) 7100 + case "alt": 7101 + 7102 + { 7103 + b, err := cr.ReadByte() 7104 + if err != nil { 7105 + return err 7106 + } 7107 + if b != cbg.CborNull[0] { 7108 + if err := cr.UnreadByte(); err != nil { 7109 + return err 7110 + } 7111 + 7112 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7113 + if err != nil { 7114 + return err 7115 + } 7116 + 7117 + t.Alt = (*string)(&sval) 7118 + } 7119 + } 7120 + // t.LexiconTypeID (string) (string) 7121 + case "$type": 7122 + 7123 + { 7124 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7125 + if err != nil { 7126 + return err 7127 + } 7128 + 7129 + t.LexiconTypeID = string(sval) 7130 + } 7131 + // t.Video (util.LexBlob) (struct) 7132 + case "video": 7133 + 7134 + { 7135 + 7136 + b, err := cr.ReadByte() 7137 + if err != nil { 7138 + return err 7139 + } 7140 + if b != cbg.CborNull[0] { 7141 + if err := cr.UnreadByte(); err != nil { 7142 + return err 7143 + } 7144 + t.Video = new(util.LexBlob) 7145 + if err := t.Video.UnmarshalCBOR(cr); err != nil { 7146 + return xerrors.Errorf("unmarshaling t.Video pointer: %w", err) 7147 + } 7148 + } 7149 + 7150 + } 7151 + // t.Captions ([]*bsky.EmbedVideo_Caption) (slice) 7152 + case "captions": 7153 + 7154 + maj, extra, err = cr.ReadHeader() 7155 + if err != nil { 7156 + return err 7157 + } 7158 + 7159 + if extra > 8192 { 7160 + return fmt.Errorf("t.Captions: array too large (%d)", extra) 7161 + } 7162 + 7163 + if maj != cbg.MajArray { 7164 + return fmt.Errorf("expected cbor array") 7165 + } 7166 + 7167 + if extra > 0 { 7168 + t.Captions = make([]*EmbedVideo_Caption, extra) 7169 + } 7170 + 7171 + for i := 0; i < int(extra); i++ { 7172 + { 7173 + var maj byte 7174 + var extra uint64 7175 + var err error 7176 + _ = maj 7177 + _ = extra 7178 + _ = err 7179 + 7180 + { 7181 + 7182 + b, err := cr.ReadByte() 7183 + if err != nil { 7184 + return err 7185 + } 7186 + if b != cbg.CborNull[0] { 7187 + if err := cr.UnreadByte(); err != nil { 7188 + return err 7189 + } 7190 + t.Captions[i] = new(EmbedVideo_Caption) 7191 + if err := t.Captions[i].UnmarshalCBOR(cr); err != nil { 7192 + return xerrors.Errorf("unmarshaling t.Captions[i] pointer: %w", err) 7193 + } 7194 + } 7195 + 7196 + } 7197 + 7198 + } 7199 + } 7200 + // t.AspectRatio (bsky.EmbedDefs_AspectRatio) (struct) 7201 + case "aspectRatio": 7202 + 7203 + { 7204 + 7205 + b, err := cr.ReadByte() 7206 + if err != nil { 7207 + return err 7208 + } 7209 + if b != cbg.CborNull[0] { 7210 + if err := cr.UnreadByte(); err != nil { 7211 + return err 7212 + } 7213 + t.AspectRatio = new(EmbedDefs_AspectRatio) 7214 + if err := t.AspectRatio.UnmarshalCBOR(cr); err != nil { 7215 + return xerrors.Errorf("unmarshaling t.AspectRatio pointer: %w", err) 7216 + } 7217 + } 7218 + 7219 + } 7220 + 7221 + default: 7222 + // Field doesn't exist on this type, so ignore it 7223 + cbg.ScanForLinks(r, func(cid.Cid) {}) 7224 + } 7225 + } 7226 + 7227 + return nil 7228 + } 7229 + func (t *EmbedVideo_Caption) MarshalCBOR(w io.Writer) error { 7230 + if t == nil { 7231 + _, err := w.Write(cbg.CborNull) 7232 + return err 7233 + } 7234 + 7235 + cw := cbg.NewCborWriter(w) 7236 + 7237 + if _, err := cw.Write([]byte{162}); err != nil { 7238 + return err 7239 + } 7240 + 7241 + // t.File (util.LexBlob) (struct) 7242 + if len("file") > 1000000 { 7243 + return xerrors.Errorf("Value in field \"file\" was too long") 7244 + } 7245 + 7246 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("file"))); err != nil { 7247 + return err 7248 + } 7249 + if _, err := cw.WriteString(string("file")); err != nil { 7250 + return err 7251 + } 7252 + 7253 + if err := t.File.MarshalCBOR(cw); err != nil { 7254 + return err 7255 + } 7256 + 7257 + // t.Lang (string) (string) 7258 + if len("lang") > 1000000 { 7259 + return xerrors.Errorf("Value in field \"lang\" was too long") 7260 + } 7261 + 7262 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("lang"))); err != nil { 7263 + return err 7264 + } 7265 + if _, err := cw.WriteString(string("lang")); err != nil { 7266 + return err 7267 + } 7268 + 7269 + if len(t.Lang) > 1000000 { 7270 + return xerrors.Errorf("Value in field t.Lang was too long") 7271 + } 7272 + 7273 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Lang))); err != nil { 7274 + return err 7275 + } 7276 + if _, err := cw.WriteString(string(t.Lang)); err != nil { 7277 + return err 7278 + } 7279 + return nil 7280 + } 7281 + 7282 + func (t *EmbedVideo_Caption) UnmarshalCBOR(r io.Reader) (err error) { 7283 + *t = EmbedVideo_Caption{} 7284 + 7285 + cr := cbg.NewCborReader(r) 7286 + 7287 + maj, extra, err := cr.ReadHeader() 7288 + if err != nil { 7289 + return err 7290 + } 7291 + defer func() { 7292 + if err == io.EOF { 7293 + err = io.ErrUnexpectedEOF 7294 + } 7295 + }() 7296 + 7297 + if maj != cbg.MajMap { 7298 + return fmt.Errorf("cbor input should be of type map") 7299 + } 7300 + 7301 + if extra > cbg.MaxLength { 7302 + return fmt.Errorf("EmbedVideo_Caption: map struct too large (%d)", extra) 7303 + } 7304 + 7305 + var name string 7306 + n := extra 7307 + 7308 + for i := uint64(0); i < n; i++ { 7309 + 7310 + { 7311 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7312 + if err != nil { 7313 + return err 7314 + } 7315 + 7316 + name = string(sval) 7317 + } 7318 + 7319 + switch name { 7320 + // t.File (util.LexBlob) (struct) 7321 + case "file": 7322 + 7323 + { 7324 + 7325 + b, err := cr.ReadByte() 7326 + if err != nil { 7327 + return err 7328 + } 7329 + if b != cbg.CborNull[0] { 7330 + if err := cr.UnreadByte(); err != nil { 7331 + return err 7332 + } 7333 + t.File = new(util.LexBlob) 7334 + if err := t.File.UnmarshalCBOR(cr); err != nil { 7335 + return xerrors.Errorf("unmarshaling t.File pointer: %w", err) 7336 + } 7337 + } 7338 + 7339 + } 7340 + // t.Lang (string) (string) 7341 + case "lang": 7342 + 7343 + { 7344 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 7345 + if err != nil { 7346 + return err 7347 + } 7348 + 7349 + t.Lang = string(sval) 7350 + } 7351 + 7352 + default: 7353 + // Field doesn't exist on this type, so ignore it 7354 + cbg.ScanForLinks(r, func(cid.Cid) {}) 7355 + } 7356 + } 7357 + 7358 + return nil 7359 + }
+13
api/bsky/embeddefs.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.embed.defs 6 + 7 + // EmbedDefs_AspectRatio is a "aspectRatio" in the app.bsky.embed.defs schema. 8 + // 9 + // width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. 10 + type EmbedDefs_AspectRatio struct { 11 + Height int64 `json:"height" cborgen:"height"` 12 + Width int64 `json:"width" cborgen:"width"` 13 + }
+5 -13
api/bsky/embedimages.go
··· 17 17 Images []*EmbedImages_Image `json:"images" cborgen:"images"` 18 18 } 19 19 20 - // EmbedImages_AspectRatio is a "aspectRatio" in the app.bsky.embed.images schema. 21 - // 22 - // width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. 23 - type EmbedImages_AspectRatio struct { 24 - Height int64 `json:"height" cborgen:"height"` 25 - Width int64 `json:"width" cborgen:"width"` 26 - } 27 - 28 20 // EmbedImages_Image is a "image" in the app.bsky.embed.images schema. 29 21 type EmbedImages_Image struct { 30 22 // alt: Alt text description of the image, for accessibility. 31 - Alt string `json:"alt" cborgen:"alt"` 32 - AspectRatio *EmbedImages_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"` 33 - Image *util.LexBlob `json:"image" cborgen:"image"` 23 + Alt string `json:"alt" cborgen:"alt"` 24 + AspectRatio *EmbedDefs_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"` 25 + Image *util.LexBlob `json:"image" cborgen:"image"` 34 26 } 35 27 36 28 // EmbedImages_View is a "view" in the app.bsky.embed.images schema. ··· 44 36 // EmbedImages_ViewImage is a "viewImage" in the app.bsky.embed.images schema. 45 37 type EmbedImages_ViewImage struct { 46 38 // alt: Alt text description of the image, for accessibility. 47 - Alt string `json:"alt" cborgen:"alt"` 48 - AspectRatio *EmbedImages_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"` 39 + Alt string `json:"alt" cborgen:"alt"` 40 + AspectRatio *EmbedDefs_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"` 49 41 // fullsize: Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. 50 42 Fullsize string `json:"fullsize" cborgen:"fullsize"` 51 43 // thumb: Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View.
+8
api/bsky/embedrecord.go
··· 68 68 69 69 type EmbedRecord_ViewRecord_Embeds_Elem struct { 70 70 EmbedImages_View *EmbedImages_View 71 + EmbedVideo_View *EmbedVideo_View 71 72 EmbedExternal_View *EmbedExternal_View 72 73 EmbedRecord_View *EmbedRecord_View 73 74 EmbedRecordWithMedia_View *EmbedRecordWithMedia_View ··· 77 78 if t.EmbedImages_View != nil { 78 79 t.EmbedImages_View.LexiconTypeID = "app.bsky.embed.images#view" 79 80 return json.Marshal(t.EmbedImages_View) 81 + } 82 + if t.EmbedVideo_View != nil { 83 + t.EmbedVideo_View.LexiconTypeID = "app.bsky.embed.video#view" 84 + return json.Marshal(t.EmbedVideo_View) 80 85 } 81 86 if t.EmbedExternal_View != nil { 82 87 t.EmbedExternal_View.LexiconTypeID = "app.bsky.embed.external#view" ··· 102 107 case "app.bsky.embed.images#view": 103 108 t.EmbedImages_View = new(EmbedImages_View) 104 109 return json.Unmarshal(b, t.EmbedImages_View) 110 + case "app.bsky.embed.video#view": 111 + t.EmbedVideo_View = new(EmbedVideo_View) 112 + return json.Unmarshal(b, t.EmbedVideo_View) 105 113 case "app.bsky.embed.external#view": 106 114 t.EmbedExternal_View = new(EmbedExternal_View) 107 115 return json.Unmarshal(b, t.EmbedExternal_View)
+22
api/bsky/embedrecordWithMedia.go
··· 26 26 27 27 type EmbedRecordWithMedia_Media struct { 28 28 EmbedImages *EmbedImages 29 + EmbedVideo *EmbedVideo 29 30 EmbedExternal *EmbedExternal 30 31 } 31 32 ··· 33 34 if t.EmbedImages != nil { 34 35 t.EmbedImages.LexiconTypeID = "app.bsky.embed.images" 35 36 return json.Marshal(t.EmbedImages) 37 + } 38 + if t.EmbedVideo != nil { 39 + t.EmbedVideo.LexiconTypeID = "app.bsky.embed.video" 40 + return json.Marshal(t.EmbedVideo) 36 41 } 37 42 if t.EmbedExternal != nil { 38 43 t.EmbedExternal.LexiconTypeID = "app.bsky.embed.external" ··· 50 55 case "app.bsky.embed.images": 51 56 t.EmbedImages = new(EmbedImages) 52 57 return json.Unmarshal(b, t.EmbedImages) 58 + case "app.bsky.embed.video": 59 + t.EmbedVideo = new(EmbedVideo) 60 + return json.Unmarshal(b, t.EmbedVideo) 53 61 case "app.bsky.embed.external": 54 62 t.EmbedExternal = new(EmbedExternal) 55 63 return json.Unmarshal(b, t.EmbedExternal) ··· 67 75 } 68 76 if t.EmbedImages != nil { 69 77 return t.EmbedImages.MarshalCBOR(w) 78 + } 79 + if t.EmbedVideo != nil { 80 + return t.EmbedVideo.MarshalCBOR(w) 70 81 } 71 82 if t.EmbedExternal != nil { 72 83 return t.EmbedExternal.MarshalCBOR(w) ··· 83 94 case "app.bsky.embed.images": 84 95 t.EmbedImages = new(EmbedImages) 85 96 return t.EmbedImages.UnmarshalCBOR(bytes.NewReader(b)) 97 + case "app.bsky.embed.video": 98 + t.EmbedVideo = new(EmbedVideo) 99 + return t.EmbedVideo.UnmarshalCBOR(bytes.NewReader(b)) 86 100 case "app.bsky.embed.external": 87 101 t.EmbedExternal = new(EmbedExternal) 88 102 return t.EmbedExternal.UnmarshalCBOR(bytes.NewReader(b)) ··· 103 117 104 118 type EmbedRecordWithMedia_View_Media struct { 105 119 EmbedImages_View *EmbedImages_View 120 + EmbedVideo_View *EmbedVideo_View 106 121 EmbedExternal_View *EmbedExternal_View 107 122 } 108 123 ··· 111 126 t.EmbedImages_View.LexiconTypeID = "app.bsky.embed.images#view" 112 127 return json.Marshal(t.EmbedImages_View) 113 128 } 129 + if t.EmbedVideo_View != nil { 130 + t.EmbedVideo_View.LexiconTypeID = "app.bsky.embed.video#view" 131 + return json.Marshal(t.EmbedVideo_View) 132 + } 114 133 if t.EmbedExternal_View != nil { 115 134 t.EmbedExternal_View.LexiconTypeID = "app.bsky.embed.external#view" 116 135 return json.Marshal(t.EmbedExternal_View) ··· 127 146 case "app.bsky.embed.images#view": 128 147 t.EmbedImages_View = new(EmbedImages_View) 129 148 return json.Unmarshal(b, t.EmbedImages_View) 149 + case "app.bsky.embed.video#view": 150 + t.EmbedVideo_View = new(EmbedVideo_View) 151 + return json.Unmarshal(b, t.EmbedVideo_View) 130 152 case "app.bsky.embed.external#view": 131 153 t.EmbedExternal_View = new(EmbedExternal_View) 132 154 return json.Unmarshal(b, t.EmbedExternal_View)
+40
api/bsky/embedvideo.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.embed.video 6 + 7 + import ( 8 + "github.com/bluesky-social/indigo/lex/util" 9 + ) 10 + 11 + func init() { 12 + util.RegisterType("app.bsky.embed.video#main", &EmbedVideo{}) 13 + } // EmbedVideo is a "main" in the app.bsky.embed.video schema. 14 + // RECORDTYPE: EmbedVideo 15 + type EmbedVideo struct { 16 + LexiconTypeID string `json:"$type,const=app.bsky.embed.video" cborgen:"$type,const=app.bsky.embed.video"` 17 + // alt: Alt text description of the video, for accessibility. 18 + Alt *string `json:"alt,omitempty" cborgen:"alt,omitempty"` 19 + AspectRatio *EmbedDefs_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"` 20 + Captions []*EmbedVideo_Caption `json:"captions,omitempty" cborgen:"captions,omitempty"` 21 + Video *util.LexBlob `json:"video" cborgen:"video"` 22 + } 23 + 24 + // EmbedVideo_Caption is a "caption" in the app.bsky.embed.video schema. 25 + type EmbedVideo_Caption struct { 26 + File *util.LexBlob `json:"file" cborgen:"file"` 27 + Lang string `json:"lang" cborgen:"lang"` 28 + } 29 + 30 + // EmbedVideo_View is a "view" in the app.bsky.embed.video schema. 31 + // 32 + // RECORDTYPE: EmbedVideo_View 33 + type EmbedVideo_View struct { 34 + LexiconTypeID string `json:"$type,const=app.bsky.embed.video#view" cborgen:"$type,const=app.bsky.embed.video#view"` 35 + Alt *string `json:"alt,omitempty" cborgen:"alt,omitempty"` 36 + AspectRatio *EmbedDefs_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"` 37 + Cid string `json:"cid" cborgen:"cid"` 38 + Playlist string `json:"playlist" cborgen:"playlist"` 39 + Thumbnail *string `json:"thumbnail,omitempty" cborgen:"thumbnail,omitempty"` 40 + }
+9 -1
api/bsky/feeddefs.go
··· 92 92 // FeedDefs_Interaction is a "interaction" in the app.bsky.feed.defs schema. 93 93 type FeedDefs_Interaction struct { 94 94 Event *string `json:"event,omitempty" cborgen:"event,omitempty"` 95 - // feedContext: Context on a feed item that was orginally supplied by the feed generator on getFeedSkeleton. 95 + // feedContext: Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. 96 96 FeedContext *string `json:"feedContext,omitempty" cborgen:"feedContext,omitempty"` 97 97 Item *string `json:"item,omitempty" cborgen:"item,omitempty"` 98 98 } ··· 127 127 128 128 type FeedDefs_PostView_Embed struct { 129 129 EmbedImages_View *EmbedImages_View 130 + EmbedVideo_View *EmbedVideo_View 130 131 EmbedExternal_View *EmbedExternal_View 131 132 EmbedRecord_View *EmbedRecord_View 132 133 EmbedRecordWithMedia_View *EmbedRecordWithMedia_View ··· 137 138 t.EmbedImages_View.LexiconTypeID = "app.bsky.embed.images#view" 138 139 return json.Marshal(t.EmbedImages_View) 139 140 } 141 + if t.EmbedVideo_View != nil { 142 + t.EmbedVideo_View.LexiconTypeID = "app.bsky.embed.video#view" 143 + return json.Marshal(t.EmbedVideo_View) 144 + } 140 145 if t.EmbedExternal_View != nil { 141 146 t.EmbedExternal_View.LexiconTypeID = "app.bsky.embed.external#view" 142 147 return json.Marshal(t.EmbedExternal_View) ··· 161 166 case "app.bsky.embed.images#view": 162 167 t.EmbedImages_View = new(EmbedImages_View) 163 168 return json.Unmarshal(b, t.EmbedImages_View) 169 + case "app.bsky.embed.video#view": 170 + t.EmbedVideo_View = new(EmbedVideo_View) 171 + return json.Unmarshal(b, t.EmbedVideo_View) 164 172 case "app.bsky.embed.external#view": 165 173 t.EmbedExternal_View = new(EmbedExternal_View) 166 174 return json.Unmarshal(b, t.EmbedExternal_View)
+14
api/bsky/feedpost.go
··· 41 41 42 42 type FeedPost_Embed struct { 43 43 EmbedImages *EmbedImages 44 + EmbedVideo *EmbedVideo 44 45 EmbedExternal *EmbedExternal 45 46 EmbedRecord *EmbedRecord 46 47 EmbedRecordWithMedia *EmbedRecordWithMedia ··· 50 51 if t.EmbedImages != nil { 51 52 t.EmbedImages.LexiconTypeID = "app.bsky.embed.images" 52 53 return json.Marshal(t.EmbedImages) 54 + } 55 + if t.EmbedVideo != nil { 56 + t.EmbedVideo.LexiconTypeID = "app.bsky.embed.video" 57 + return json.Marshal(t.EmbedVideo) 53 58 } 54 59 if t.EmbedExternal != nil { 55 60 t.EmbedExternal.LexiconTypeID = "app.bsky.embed.external" ··· 75 80 case "app.bsky.embed.images": 76 81 t.EmbedImages = new(EmbedImages) 77 82 return json.Unmarshal(b, t.EmbedImages) 83 + case "app.bsky.embed.video": 84 + t.EmbedVideo = new(EmbedVideo) 85 + return json.Unmarshal(b, t.EmbedVideo) 78 86 case "app.bsky.embed.external": 79 87 t.EmbedExternal = new(EmbedExternal) 80 88 return json.Unmarshal(b, t.EmbedExternal) ··· 98 106 } 99 107 if t.EmbedImages != nil { 100 108 return t.EmbedImages.MarshalCBOR(w) 109 + } 110 + if t.EmbedVideo != nil { 111 + return t.EmbedVideo.MarshalCBOR(w) 101 112 } 102 113 if t.EmbedExternal != nil { 103 114 return t.EmbedExternal.MarshalCBOR(w) ··· 120 131 case "app.bsky.embed.images": 121 132 t.EmbedImages = new(EmbedImages) 122 133 return t.EmbedImages.UnmarshalCBOR(bytes.NewReader(b)) 134 + case "app.bsky.embed.video": 135 + t.EmbedVideo = new(EmbedVideo) 136 + return t.EmbedVideo.UnmarshalCBOR(bytes.NewReader(b)) 123 137 case "app.bsky.embed.external": 124 138 t.EmbedExternal = new(EmbedExternal) 125 139 return t.EmbedExternal.UnmarshalCBOR(bytes.NewReader(b))
+22
api/bsky/videodefs.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.video.defs 6 + 7 + import ( 8 + "github.com/bluesky-social/indigo/lex/util" 9 + ) 10 + 11 + // VideoDefs_JobStatus is a "jobStatus" in the app.bsky.video.defs schema. 12 + type VideoDefs_JobStatus struct { 13 + Blob *util.LexBlob `json:"blob,omitempty" cborgen:"blob,omitempty"` 14 + Did string `json:"did" cborgen:"did"` 15 + Error *string `json:"error,omitempty" cborgen:"error,omitempty"` 16 + JobId string `json:"jobId" cborgen:"jobId"` 17 + Message *string `json:"message,omitempty" cborgen:"message,omitempty"` 18 + // progress: Progress within the current processing state. 19 + Progress *int64 `json:"progress,omitempty" cborgen:"progress,omitempty"` 20 + // state: The state of the video processing job. All values not listed as a known value indicate that the job is in process. 21 + State string `json:"state" cborgen:"state"` 22 + }
+30
api/bsky/videogetJobStatus.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.video.getJobStatus 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/xrpc" 11 + ) 12 + 13 + // VideoGetJobStatus_Output is the output of a app.bsky.video.getJobStatus call. 14 + type VideoGetJobStatus_Output struct { 15 + JobStatus *VideoDefs_JobStatus `json:"jobStatus" cborgen:"jobStatus"` 16 + } 17 + 18 + // VideoGetJobStatus calls the XRPC method "app.bsky.video.getJobStatus". 19 + func VideoGetJobStatus(ctx context.Context, c *xrpc.Client, jobId string) (*VideoGetJobStatus_Output, error) { 20 + var out VideoGetJobStatus_Output 21 + 22 + params := map[string]interface{}{ 23 + "jobId": jobId, 24 + } 25 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.video.getJobStatus", params, nil, &out); err != nil { 26 + return nil, err 27 + } 28 + 29 + return &out, nil 30 + }
+30
api/bsky/videogetUploadLimits.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.video.getUploadLimits 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/xrpc" 11 + ) 12 + 13 + // VideoGetUploadLimits_Output is the output of a app.bsky.video.getUploadLimits call. 14 + type VideoGetUploadLimits_Output struct { 15 + CanUpload bool `json:"canUpload" cborgen:"canUpload"` 16 + Error *string `json:"error,omitempty" cborgen:"error,omitempty"` 17 + Message *string `json:"message,omitempty" cborgen:"message,omitempty"` 18 + RemainingDailyBytes *int64 `json:"remainingDailyBytes,omitempty" cborgen:"remainingDailyBytes,omitempty"` 19 + RemainingDailyVideos *int64 `json:"remainingDailyVideos,omitempty" cborgen:"remainingDailyVideos,omitempty"` 20 + } 21 + 22 + // VideoGetUploadLimits calls the XRPC method "app.bsky.video.getUploadLimits". 23 + func VideoGetUploadLimits(ctx context.Context, c *xrpc.Client) (*VideoGetUploadLimits_Output, error) { 24 + var out VideoGetUploadLimits_Output 25 + if err := c.Do(ctx, xrpc.Query, "", "app.bsky.video.getUploadLimits", nil, nil, &out); err != nil { 26 + return nil, err 27 + } 28 + 29 + return &out, nil 30 + }
+27
api/bsky/videouploadVideo.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package bsky 4 + 5 + // schema: app.bsky.video.uploadVideo 6 + 7 + import ( 8 + "context" 9 + "io" 10 + 11 + "github.com/bluesky-social/indigo/xrpc" 12 + ) 13 + 14 + // VideoUploadVideo_Output is the output of a app.bsky.video.uploadVideo call. 15 + type VideoUploadVideo_Output struct { 16 + JobStatus *VideoDefs_JobStatus `json:"jobStatus" cborgen:"jobStatus"` 17 + } 18 + 19 + // VideoUploadVideo calls the XRPC method "app.bsky.video.uploadVideo". 20 + func VideoUploadVideo(ctx context.Context, c *xrpc.Client, input io.Reader) (*VideoUploadVideo_Output, error) { 21 + var out VideoUploadVideo_Output 22 + if err := c.Do(ctx, xrpc.Procedure, "video/mp4", "app.bsky.video.uploadVideo", nil, input, &out); err != nil { 23 + return nil, err 24 + } 25 + 26 + return &out, nil 27 + }
+2 -1
gen/main.go
··· 58 58 bsky.GraphListitem{}, 59 59 bsky.FeedGenerator{}, 60 60 bsky.GraphListblock{}, 61 - bsky.EmbedImages_AspectRatio{}, 61 + bsky.EmbedDefs_AspectRatio{}, 62 62 bsky.FeedThreadgate{}, 63 63 bsky.FeedThreadgate_ListRule{}, 64 64 bsky.FeedThreadgate_MentionRule{}, ··· 67 67 bsky.GraphStarterpack{}, 68 68 bsky.LabelerService{}, 69 69 bsky.LabelerDefs_LabelerPolicies{}, 70 + bsky.EmbedVideo{}, bsky.EmbedVideo_Caption{}, 70 71 /*bsky.EmbedImages_View{}, 71 72 bsky.EmbedRecord_View{}, bsky.EmbedRecordWithMedia_View{}, 72 73 bsky.EmbedExternal_View{}, bsky.EmbedImages_ViewImage{},
+20 -7
lex/gen.go
··· 21 21 EncodingJSON = "application/json" 22 22 EncodingJSONL = "application/jsonl" 23 23 EncodingCAR = "application/vnd.ipld.car" 24 + EncodingMP4 = "video/mp4" 24 25 EncodingANY = "*/*" 25 26 ) 26 27 ··· 173 174 174 175 if ts.Input != nil { 175 176 if ts.Input.Schema == nil { 176 - if ts.Input.Encoding != "application/cbor" && ts.Input.Encoding != "*/*" && ts.Input.Encoding != "application/vnd.ipld.car" { 177 + if ts.Input.Encoding != EncodingCBOR && 178 + ts.Input.Encoding != EncodingANY && 179 + ts.Input.Encoding != EncodingCAR && 180 + ts.Input.Encoding != EncodingMP4 { 177 181 panic(fmt.Sprintf("strange input type def in %s", s.ID)) 178 182 } 179 183 } else { ··· 183 187 184 188 if ts.Output != nil { 185 189 if ts.Output.Schema == nil { 186 - if ts.Output.Encoding != "application/cbor" && ts.Output.Encoding != "application/vnd.ipld.car" && ts.Output.Encoding != "*/*" && ts.Output.Encoding != "application/jsonl" { 190 + if ts.Output.Encoding != EncodingCBOR && 191 + ts.Output.Encoding != EncodingCAR && 192 + ts.Output.Encoding != EncodingANY && 193 + ts.Output.Encoding != EncodingJSONL && 194 + ts.Output.Encoding != EncodingMP4 { 187 195 panic(fmt.Sprintf("strange output type def in %s", s.ID)) 188 196 } 189 197 } else { ··· 479 487 inpvar = "input" 480 488 inpenc = s.Input.Encoding 481 489 switch s.Input.Encoding { 482 - case EncodingCBOR, EncodingCAR, EncodingANY: 490 + case EncodingCBOR, EncodingCAR, EncodingANY, EncodingMP4: 483 491 params = fmt.Sprintf("%s, input io.Reader", params) 484 492 case EncodingJSON: 485 493 params = fmt.Sprintf("%s, input *%s_Input", params, fname) ··· 507 515 out := "error" 508 516 if s.Output != nil { 509 517 switch s.Output.Encoding { 510 - case EncodingCBOR, EncodingCAR, EncodingANY, EncodingJSONL: 518 + case EncodingCBOR, EncodingCAR, EncodingANY, EncodingJSONL, EncodingMP4: 511 519 out = "([]byte, error)" 512 520 case EncodingJSON: 513 521 outname := fname + "_Output" ··· 540 548 outRet := "nil" 541 549 if s.Output != nil { 542 550 switch s.Output.Encoding { 543 - case EncodingCBOR, EncodingCAR, EncodingANY, EncodingJSONL: 551 + case EncodingCBOR, EncodingCAR, EncodingANY, EncodingJSONL, EncodingMP4: 544 552 pf("buf := new(bytes.Buffer)\n") 545 553 outvar = "buf" 546 554 errRet = "nil, err" ··· 983 991 pf("contentType := c.Request().Header.Get(\"Content-Type\")\n") 984 992 paramtypes = append(paramtypes, "r io.Reader", "contentType string") 985 993 params = append(params, "body", "contentType") 986 - 994 + case EncodingMP4: 995 + pf("body := c.Request().Body\n") 996 + paramtypes = append(paramtypes, "r io.Reader") 997 + params = append(params, "body") 987 998 default: 988 999 return fmt.Errorf("unrecognized input encoding: %q", s.Input.Encoding) 989 1000 } ··· 1004 1015 } 1005 1016 pf("var out *%s.%s\n", impname, outname) 1006 1017 returndef = fmt.Sprintf("(*%s.%s, error)", impname, outname) 1007 - case EncodingCBOR, EncodingCAR, EncodingANY, EncodingJSONL: 1018 + case EncodingCBOR, EncodingCAR, EncodingANY, EncodingJSONL, EncodingMP4: 1008 1019 assign = "out, handleErr" 1009 1020 pf("var out io.Reader\n") 1010 1021 returndef = "(io.Reader, error)" ··· 1029 1040 pf("return c.Stream(200, \"application/vnd.ipld.car\", out)\n}\n\n") 1030 1041 case EncodingJSONL: 1031 1042 pf("return c.Stream(200, \"application/jsonl\", out)\n}\n\n") 1043 + case EncodingMP4: 1044 + pf("return c.Stream(200, \"video/mp4\", out)\n}\n\n") 1032 1045 default: 1033 1046 return fmt.Errorf("unrecognized output encoding (RPC output handler return): %q", s.Output.Encoding) 1034 1047 }