Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

lexicons/ci: introduce pipeline query xrpc lexicons

Using `sh.tangled.ci.*` instead of `sh.tangled.pipeline.*` following
lexicon style guidelines. Since we need both 'pipeline' and 'workflow'
objects, we use different group namespace 'ci'.

I would prefer `ci.temp.*` to be more explicit, but that's not possible
with current lexgen's behavior. It sets filename using last two words
which allows duplicates.

Signed-off-by: Seongmin Lee <git@boltless.me>

author
Seongmin Lee
date (Jun 20, 2026, 7:50 PM +0900) commit 9772ea71 parent 3554ecbe change-id tounqkxz
+2622 -1
+2019
api/tangled/cbor_gen.go
··· 662 662 663 663 return nil 664 664 } 665 + func (t *CiDefs_Pipeline) MarshalCBOR(w io.Writer) error { 666 + if t == nil { 667 + _, err := w.Write(cbg.CborNull) 668 + return err 669 + } 670 + 671 + cw := cbg.NewCborWriter(w) 672 + fieldCount := 6 673 + 674 + if t.CreatedAt == nil { 675 + fieldCount-- 676 + } 677 + 678 + if t.Repo == nil { 679 + fieldCount-- 680 + } 681 + 682 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 683 + return err 684 + } 685 + 686 + // t.Id (string) (string) 687 + if len("id") > 1000000 { 688 + return xerrors.Errorf("Value in field \"id\" was too long") 689 + } 690 + 691 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("id"))); err != nil { 692 + return err 693 + } 694 + if _, err := cw.WriteString(string("id")); err != nil { 695 + return err 696 + } 697 + 698 + if len(t.Id) > 1000000 { 699 + return xerrors.Errorf("Value in field t.Id was too long") 700 + } 701 + 702 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Id))); err != nil { 703 + return err 704 + } 705 + if _, err := cw.WriteString(string(t.Id)); err != nil { 706 + return err 707 + } 708 + 709 + // t.Repo (string) (string) 710 + if t.Repo != nil { 711 + 712 + if len("repo") > 1000000 { 713 + return xerrors.Errorf("Value in field \"repo\" was too long") 714 + } 715 + 716 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil { 717 + return err 718 + } 719 + if _, err := cw.WriteString(string("repo")); err != nil { 720 + return err 721 + } 722 + 723 + if t.Repo == nil { 724 + if _, err := cw.Write(cbg.CborNull); err != nil { 725 + return err 726 + } 727 + } else { 728 + if len(*t.Repo) > 1000000 { 729 + return xerrors.Errorf("Value in field t.Repo was too long") 730 + } 731 + 732 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil { 733 + return err 734 + } 735 + if _, err := cw.WriteString(string(*t.Repo)); err != nil { 736 + return err 737 + } 738 + } 739 + } 740 + 741 + // t.Commit (string) (string) 742 + if len("commit") > 1000000 { 743 + return xerrors.Errorf("Value in field \"commit\" was too long") 744 + } 745 + 746 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commit"))); err != nil { 747 + return err 748 + } 749 + if _, err := cw.WriteString(string("commit")); err != nil { 750 + return err 751 + } 752 + 753 + if len(t.Commit) > 1000000 { 754 + return xerrors.Errorf("Value in field t.Commit was too long") 755 + } 756 + 757 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Commit))); err != nil { 758 + return err 759 + } 760 + if _, err := cw.WriteString(string(t.Commit)); err != nil { 761 + return err 762 + } 763 + 764 + // t.Trigger (tangled.CiDefs_Pipeline_Trigger) (struct) 765 + if len("trigger") > 1000000 { 766 + return xerrors.Errorf("Value in field \"trigger\" was too long") 767 + } 768 + 769 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("trigger"))); err != nil { 770 + return err 771 + } 772 + if _, err := cw.WriteString(string("trigger")); err != nil { 773 + return err 774 + } 775 + 776 + if err := t.Trigger.MarshalCBOR(cw); err != nil { 777 + return err 778 + } 779 + 780 + // t.CreatedAt (string) (string) 781 + if t.CreatedAt != nil { 782 + 783 + if len("createdAt") > 1000000 { 784 + return xerrors.Errorf("Value in field \"createdAt\" was too long") 785 + } 786 + 787 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { 788 + return err 789 + } 790 + if _, err := cw.WriteString(string("createdAt")); err != nil { 791 + return err 792 + } 793 + 794 + if t.CreatedAt == nil { 795 + if _, err := cw.Write(cbg.CborNull); err != nil { 796 + return err 797 + } 798 + } else { 799 + if len(*t.CreatedAt) > 1000000 { 800 + return xerrors.Errorf("Value in field t.CreatedAt was too long") 801 + } 802 + 803 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedAt))); err != nil { 804 + return err 805 + } 806 + if _, err := cw.WriteString(string(*t.CreatedAt)); err != nil { 807 + return err 808 + } 809 + } 810 + } 811 + 812 + // t.Workflows ([]*tangled.CiDefs_Workflow) (slice) 813 + if len("workflows") > 1000000 { 814 + return xerrors.Errorf("Value in field \"workflows\" was too long") 815 + } 816 + 817 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflows"))); err != nil { 818 + return err 819 + } 820 + if _, err := cw.WriteString(string("workflows")); err != nil { 821 + return err 822 + } 823 + 824 + if len(t.Workflows) > 8192 { 825 + return xerrors.Errorf("Slice value in field t.Workflows was too long") 826 + } 827 + 828 + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Workflows))); err != nil { 829 + return err 830 + } 831 + for _, v := range t.Workflows { 832 + if err := v.MarshalCBOR(cw); err != nil { 833 + return err 834 + } 835 + 836 + } 837 + return nil 838 + } 839 + 840 + func (t *CiDefs_Pipeline) UnmarshalCBOR(r io.Reader) (err error) { 841 + *t = CiDefs_Pipeline{} 842 + 843 + cr := cbg.NewCborReader(r) 844 + 845 + maj, extra, err := cr.ReadHeader() 846 + if err != nil { 847 + return err 848 + } 849 + defer func() { 850 + if err == io.EOF { 851 + err = io.ErrUnexpectedEOF 852 + } 853 + }() 854 + 855 + if maj != cbg.MajMap { 856 + return fmt.Errorf("cbor input should be of type map") 857 + } 858 + 859 + if extra > cbg.MaxLength { 860 + return fmt.Errorf("CiDefs_Pipeline: map struct too large (%d)", extra) 861 + } 862 + 863 + n := extra 864 + 865 + nameBuf := make([]byte, 9) 866 + for i := uint64(0); i < n; i++ { 867 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 868 + if err != nil { 869 + return err 870 + } 871 + 872 + if !ok { 873 + // Field doesn't exist on this type, so ignore it 874 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 875 + return err 876 + } 877 + continue 878 + } 879 + 880 + switch string(nameBuf[:nameLen]) { 881 + // t.Id (string) (string) 882 + case "id": 883 + 884 + { 885 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 886 + if err != nil { 887 + return err 888 + } 889 + 890 + t.Id = string(sval) 891 + } 892 + // t.Repo (string) (string) 893 + case "repo": 894 + 895 + { 896 + b, err := cr.ReadByte() 897 + if err != nil { 898 + return err 899 + } 900 + if b != cbg.CborNull[0] { 901 + if err := cr.UnreadByte(); err != nil { 902 + return err 903 + } 904 + 905 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 906 + if err != nil { 907 + return err 908 + } 909 + 910 + t.Repo = (*string)(&sval) 911 + } 912 + } 913 + // t.Commit (string) (string) 914 + case "commit": 915 + 916 + { 917 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 918 + if err != nil { 919 + return err 920 + } 921 + 922 + t.Commit = string(sval) 923 + } 924 + // t.Trigger (tangled.CiDefs_Pipeline_Trigger) (struct) 925 + case "trigger": 926 + 927 + { 928 + 929 + b, err := cr.ReadByte() 930 + if err != nil { 931 + return err 932 + } 933 + if b != cbg.CborNull[0] { 934 + if err := cr.UnreadByte(); err != nil { 935 + return err 936 + } 937 + t.Trigger = new(CiDefs_Pipeline_Trigger) 938 + if err := t.Trigger.UnmarshalCBOR(cr); err != nil { 939 + return xerrors.Errorf("unmarshaling t.Trigger pointer: %w", err) 940 + } 941 + } 942 + 943 + } 944 + // t.CreatedAt (string) (string) 945 + case "createdAt": 946 + 947 + { 948 + b, err := cr.ReadByte() 949 + if err != nil { 950 + return err 951 + } 952 + if b != cbg.CborNull[0] { 953 + if err := cr.UnreadByte(); err != nil { 954 + return err 955 + } 956 + 957 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 958 + if err != nil { 959 + return err 960 + } 961 + 962 + t.CreatedAt = (*string)(&sval) 963 + } 964 + } 965 + // t.Workflows ([]*tangled.CiDefs_Workflow) (slice) 966 + case "workflows": 967 + 968 + maj, extra, err = cr.ReadHeader() 969 + if err != nil { 970 + return err 971 + } 972 + 973 + if extra > 8192 { 974 + return fmt.Errorf("t.Workflows: array too large (%d)", extra) 975 + } 976 + 977 + if maj != cbg.MajArray { 978 + return fmt.Errorf("expected cbor array") 979 + } 980 + 981 + if extra > 0 { 982 + t.Workflows = make([]*CiDefs_Workflow, extra) 983 + } 984 + 985 + for i := 0; i < int(extra); i++ { 986 + { 987 + var maj byte 988 + var extra uint64 989 + var err error 990 + _ = maj 991 + _ = extra 992 + _ = err 993 + 994 + { 995 + 996 + b, err := cr.ReadByte() 997 + if err != nil { 998 + return err 999 + } 1000 + if b != cbg.CborNull[0] { 1001 + if err := cr.UnreadByte(); err != nil { 1002 + return err 1003 + } 1004 + t.Workflows[i] = new(CiDefs_Workflow) 1005 + if err := t.Workflows[i].UnmarshalCBOR(cr); err != nil { 1006 + return xerrors.Errorf("unmarshaling t.Workflows[i] pointer: %w", err) 1007 + } 1008 + } 1009 + 1010 + } 1011 + 1012 + } 1013 + } 1014 + 1015 + default: 1016 + // Field doesn't exist on this type, so ignore it 1017 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 1018 + return err 1019 + } 1020 + } 1021 + } 1022 + 1023 + return nil 1024 + } 1025 + func (t *CiDefs_Pipeline_Trigger) MarshalCBOR(w io.Writer) error { 1026 + if t == nil { 1027 + _, err := w.Write(cbg.CborNull) 1028 + return err 1029 + } 1030 + 1031 + cw := cbg.NewCborWriter(w) 1032 + 1033 + if _, err := cw.Write([]byte{163}); err != nil { 1034 + return err 1035 + } 1036 + 1037 + // t.CiTrigger_Push (tangled.CiTrigger_Push) (struct) 1038 + if len("CiTrigger_Push") > 1000000 { 1039 + return xerrors.Errorf("Value in field \"CiTrigger_Push\" was too long") 1040 + } 1041 + 1042 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CiTrigger_Push"))); err != nil { 1043 + return err 1044 + } 1045 + if _, err := cw.WriteString(string("CiTrigger_Push")); err != nil { 1046 + return err 1047 + } 1048 + 1049 + if err := t.CiTrigger_Push.MarshalCBOR(cw); err != nil { 1050 + return err 1051 + } 1052 + 1053 + // t.CiTrigger_Manual (tangled.CiTrigger_Manual) (struct) 1054 + if len("CiTrigger_Manual") > 1000000 { 1055 + return xerrors.Errorf("Value in field \"CiTrigger_Manual\" was too long") 1056 + } 1057 + 1058 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CiTrigger_Manual"))); err != nil { 1059 + return err 1060 + } 1061 + if _, err := cw.WriteString(string("CiTrigger_Manual")); err != nil { 1062 + return err 1063 + } 1064 + 1065 + if err := t.CiTrigger_Manual.MarshalCBOR(cw); err != nil { 1066 + return err 1067 + } 1068 + 1069 + // t.CiTrigger_PullRequest (tangled.CiTrigger_PullRequest) (struct) 1070 + if len("CiTrigger_PullRequest") > 1000000 { 1071 + return xerrors.Errorf("Value in field \"CiTrigger_PullRequest\" was too long") 1072 + } 1073 + 1074 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CiTrigger_PullRequest"))); err != nil { 1075 + return err 1076 + } 1077 + if _, err := cw.WriteString(string("CiTrigger_PullRequest")); err != nil { 1078 + return err 1079 + } 1080 + 1081 + if err := t.CiTrigger_PullRequest.MarshalCBOR(cw); err != nil { 1082 + return err 1083 + } 1084 + return nil 1085 + } 1086 + 1087 + func (t *CiDefs_Pipeline_Trigger) UnmarshalCBOR(r io.Reader) (err error) { 1088 + *t = CiDefs_Pipeline_Trigger{} 1089 + 1090 + cr := cbg.NewCborReader(r) 1091 + 1092 + maj, extra, err := cr.ReadHeader() 1093 + if err != nil { 1094 + return err 1095 + } 1096 + defer func() { 1097 + if err == io.EOF { 1098 + err = io.ErrUnexpectedEOF 1099 + } 1100 + }() 1101 + 1102 + if maj != cbg.MajMap { 1103 + return fmt.Errorf("cbor input should be of type map") 1104 + } 1105 + 1106 + if extra > cbg.MaxLength { 1107 + return fmt.Errorf("CiDefs_Pipeline_Trigger: map struct too large (%d)", extra) 1108 + } 1109 + 1110 + n := extra 1111 + 1112 + nameBuf := make([]byte, 21) 1113 + for i := uint64(0); i < n; i++ { 1114 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 1115 + if err != nil { 1116 + return err 1117 + } 1118 + 1119 + if !ok { 1120 + // Field doesn't exist on this type, so ignore it 1121 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 1122 + return err 1123 + } 1124 + continue 1125 + } 1126 + 1127 + switch string(nameBuf[:nameLen]) { 1128 + // t.CiTrigger_Push (tangled.CiTrigger_Push) (struct) 1129 + case "CiTrigger_Push": 1130 + 1131 + { 1132 + 1133 + b, err := cr.ReadByte() 1134 + if err != nil { 1135 + return err 1136 + } 1137 + if b != cbg.CborNull[0] { 1138 + if err := cr.UnreadByte(); err != nil { 1139 + return err 1140 + } 1141 + t.CiTrigger_Push = new(CiTrigger_Push) 1142 + if err := t.CiTrigger_Push.UnmarshalCBOR(cr); err != nil { 1143 + return xerrors.Errorf("unmarshaling t.CiTrigger_Push pointer: %w", err) 1144 + } 1145 + } 1146 + 1147 + } 1148 + // t.CiTrigger_Manual (tangled.CiTrigger_Manual) (struct) 1149 + case "CiTrigger_Manual": 1150 + 1151 + { 1152 + 1153 + b, err := cr.ReadByte() 1154 + if err != nil { 1155 + return err 1156 + } 1157 + if b != cbg.CborNull[0] { 1158 + if err := cr.UnreadByte(); err != nil { 1159 + return err 1160 + } 1161 + t.CiTrigger_Manual = new(CiTrigger_Manual) 1162 + if err := t.CiTrigger_Manual.UnmarshalCBOR(cr); err != nil { 1163 + return xerrors.Errorf("unmarshaling t.CiTrigger_Manual pointer: %w", err) 1164 + } 1165 + } 1166 + 1167 + } 1168 + // t.CiTrigger_PullRequest (tangled.CiTrigger_PullRequest) (struct) 1169 + case "CiTrigger_PullRequest": 1170 + 1171 + { 1172 + 1173 + b, err := cr.ReadByte() 1174 + if err != nil { 1175 + return err 1176 + } 1177 + if b != cbg.CborNull[0] { 1178 + if err := cr.UnreadByte(); err != nil { 1179 + return err 1180 + } 1181 + t.CiTrigger_PullRequest = new(CiTrigger_PullRequest) 1182 + if err := t.CiTrigger_PullRequest.UnmarshalCBOR(cr); err != nil { 1183 + return xerrors.Errorf("unmarshaling t.CiTrigger_PullRequest pointer: %w", err) 1184 + } 1185 + } 1186 + 1187 + } 1188 + 1189 + default: 1190 + // Field doesn't exist on this type, so ignore it 1191 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 1192 + return err 1193 + } 1194 + } 1195 + } 1196 + 1197 + return nil 1198 + } 1199 + func (t *CiDefs_Workflow) MarshalCBOR(w io.Writer) error { 1200 + if t == nil { 1201 + _, err := w.Write(cbg.CborNull) 1202 + return err 1203 + } 1204 + 1205 + cw := cbg.NewCborWriter(w) 1206 + fieldCount := 5 1207 + 1208 + if t.FinishedAt == nil { 1209 + fieldCount-- 1210 + } 1211 + 1212 + if t.StartedAt == nil { 1213 + fieldCount-- 1214 + } 1215 + 1216 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 1217 + return err 1218 + } 1219 + 1220 + // t.Id (int64) (int64) 1221 + if len("id") > 1000000 { 1222 + return xerrors.Errorf("Value in field \"id\" was too long") 1223 + } 1224 + 1225 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("id"))); err != nil { 1226 + return err 1227 + } 1228 + if _, err := cw.WriteString(string("id")); err != nil { 1229 + return err 1230 + } 1231 + 1232 + if t.Id >= 0 { 1233 + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Id)); err != nil { 1234 + return err 1235 + } 1236 + } else { 1237 + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Id-1)); err != nil { 1238 + return err 1239 + } 1240 + } 1241 + 1242 + // t.Name (string) (string) 1243 + if len("name") > 1000000 { 1244 + return xerrors.Errorf("Value in field \"name\" was too long") 1245 + } 1246 + 1247 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil { 1248 + return err 1249 + } 1250 + if _, err := cw.WriteString(string("name")); err != nil { 1251 + return err 1252 + } 1253 + 1254 + if len(t.Name) > 1000000 { 1255 + return xerrors.Errorf("Value in field t.Name was too long") 1256 + } 1257 + 1258 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil { 1259 + return err 1260 + } 1261 + if _, err := cw.WriteString(string(t.Name)); err != nil { 1262 + return err 1263 + } 1264 + 1265 + // t.Status (string) (string) 1266 + if len("status") > 1000000 { 1267 + return xerrors.Errorf("Value in field \"status\" was too long") 1268 + } 1269 + 1270 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { 1271 + return err 1272 + } 1273 + if _, err := cw.WriteString(string("status")); err != nil { 1274 + return err 1275 + } 1276 + 1277 + if len(t.Status) > 1000000 { 1278 + return xerrors.Errorf("Value in field t.Status was too long") 1279 + } 1280 + 1281 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Status))); err != nil { 1282 + return err 1283 + } 1284 + if _, err := cw.WriteString(string(t.Status)); err != nil { 1285 + return err 1286 + } 1287 + 1288 + // t.StartedAt (string) (string) 1289 + if t.StartedAt != nil { 1290 + 1291 + if len("startedAt") > 1000000 { 1292 + return xerrors.Errorf("Value in field \"startedAt\" was too long") 1293 + } 1294 + 1295 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("startedAt"))); err != nil { 1296 + return err 1297 + } 1298 + if _, err := cw.WriteString(string("startedAt")); err != nil { 1299 + return err 1300 + } 1301 + 1302 + if t.StartedAt == nil { 1303 + if _, err := cw.Write(cbg.CborNull); err != nil { 1304 + return err 1305 + } 1306 + } else { 1307 + if len(*t.StartedAt) > 1000000 { 1308 + return xerrors.Errorf("Value in field t.StartedAt was too long") 1309 + } 1310 + 1311 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.StartedAt))); err != nil { 1312 + return err 1313 + } 1314 + if _, err := cw.WriteString(string(*t.StartedAt)); err != nil { 1315 + return err 1316 + } 1317 + } 1318 + } 1319 + 1320 + // t.FinishedAt (string) (string) 1321 + if t.FinishedAt != nil { 1322 + 1323 + if len("finishedAt") > 1000000 { 1324 + return xerrors.Errorf("Value in field \"finishedAt\" was too long") 1325 + } 1326 + 1327 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("finishedAt"))); err != nil { 1328 + return err 1329 + } 1330 + if _, err := cw.WriteString(string("finishedAt")); err != nil { 1331 + return err 1332 + } 1333 + 1334 + if t.FinishedAt == nil { 1335 + if _, err := cw.Write(cbg.CborNull); err != nil { 1336 + return err 1337 + } 1338 + } else { 1339 + if len(*t.FinishedAt) > 1000000 { 1340 + return xerrors.Errorf("Value in field t.FinishedAt was too long") 1341 + } 1342 + 1343 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.FinishedAt))); err != nil { 1344 + return err 1345 + } 1346 + if _, err := cw.WriteString(string(*t.FinishedAt)); err != nil { 1347 + return err 1348 + } 1349 + } 1350 + } 1351 + return nil 1352 + } 1353 + 1354 + func (t *CiDefs_Workflow) UnmarshalCBOR(r io.Reader) (err error) { 1355 + *t = CiDefs_Workflow{} 1356 + 1357 + cr := cbg.NewCborReader(r) 1358 + 1359 + maj, extra, err := cr.ReadHeader() 1360 + if err != nil { 1361 + return err 1362 + } 1363 + defer func() { 1364 + if err == io.EOF { 1365 + err = io.ErrUnexpectedEOF 1366 + } 1367 + }() 1368 + 1369 + if maj != cbg.MajMap { 1370 + return fmt.Errorf("cbor input should be of type map") 1371 + } 1372 + 1373 + if extra > cbg.MaxLength { 1374 + return fmt.Errorf("CiDefs_Workflow: map struct too large (%d)", extra) 1375 + } 1376 + 1377 + n := extra 1378 + 1379 + nameBuf := make([]byte, 10) 1380 + for i := uint64(0); i < n; i++ { 1381 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 1382 + if err != nil { 1383 + return err 1384 + } 1385 + 1386 + if !ok { 1387 + // Field doesn't exist on this type, so ignore it 1388 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 1389 + return err 1390 + } 1391 + continue 1392 + } 1393 + 1394 + switch string(nameBuf[:nameLen]) { 1395 + // t.Id (int64) (int64) 1396 + case "id": 1397 + { 1398 + maj, extra, err := cr.ReadHeader() 1399 + if err != nil { 1400 + return err 1401 + } 1402 + var extraI int64 1403 + switch maj { 1404 + case cbg.MajUnsignedInt: 1405 + extraI = int64(extra) 1406 + if extraI < 0 { 1407 + return fmt.Errorf("int64 positive overflow") 1408 + } 1409 + case cbg.MajNegativeInt: 1410 + extraI = int64(extra) 1411 + if extraI < 0 { 1412 + return fmt.Errorf("int64 negative overflow") 1413 + } 1414 + extraI = -1 - extraI 1415 + default: 1416 + return fmt.Errorf("wrong type for int64 field: %d", maj) 1417 + } 1418 + 1419 + t.Id = int64(extraI) 1420 + } 1421 + // t.Name (string) (string) 1422 + case "name": 1423 + 1424 + { 1425 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1426 + if err != nil { 1427 + return err 1428 + } 1429 + 1430 + t.Name = string(sval) 1431 + } 1432 + // t.Status (string) (string) 1433 + case "status": 1434 + 1435 + { 1436 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1437 + if err != nil { 1438 + return err 1439 + } 1440 + 1441 + t.Status = string(sval) 1442 + } 1443 + // t.StartedAt (string) (string) 1444 + case "startedAt": 1445 + 1446 + { 1447 + b, err := cr.ReadByte() 1448 + if err != nil { 1449 + return err 1450 + } 1451 + if b != cbg.CborNull[0] { 1452 + if err := cr.UnreadByte(); err != nil { 1453 + return err 1454 + } 1455 + 1456 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1457 + if err != nil { 1458 + return err 1459 + } 1460 + 1461 + t.StartedAt = (*string)(&sval) 1462 + } 1463 + } 1464 + // t.FinishedAt (string) (string) 1465 + case "finishedAt": 1466 + 1467 + { 1468 + b, err := cr.ReadByte() 1469 + if err != nil { 1470 + return err 1471 + } 1472 + if b != cbg.CborNull[0] { 1473 + if err := cr.UnreadByte(); err != nil { 1474 + return err 1475 + } 1476 + 1477 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1478 + if err != nil { 1479 + return err 1480 + } 1481 + 1482 + t.FinishedAt = (*string)(&sval) 1483 + } 1484 + } 1485 + 1486 + default: 1487 + // Field doesn't exist on this type, so ignore it 1488 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 1489 + return err 1490 + } 1491 + } 1492 + } 1493 + 1494 + return nil 1495 + } 1496 + func (t *CiPipelineSubscribeLogs_Control) MarshalCBOR(w io.Writer) error { 1497 + if t == nil { 1498 + _, err := w.Write(cbg.CborNull) 1499 + return err 1500 + } 1501 + 1502 + cw := cbg.NewCborWriter(w) 1503 + fieldCount := 7 1504 + 1505 + if t.Command == nil { 1506 + fieldCount-- 1507 + } 1508 + 1509 + if t.Kind == nil { 1510 + fieldCount-- 1511 + } 1512 + 1513 + if t.Status == nil { 1514 + fieldCount-- 1515 + } 1516 + 1517 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 1518 + return err 1519 + } 1520 + 1521 + // t.Kind (string) (string) 1522 + if t.Kind != nil { 1523 + 1524 + if len("kind") > 1000000 { 1525 + return xerrors.Errorf("Value in field \"kind\" was too long") 1526 + } 1527 + 1528 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("kind"))); err != nil { 1529 + return err 1530 + } 1531 + if _, err := cw.WriteString(string("kind")); err != nil { 1532 + return err 1533 + } 1534 + 1535 + if t.Kind == nil { 1536 + if _, err := cw.Write(cbg.CborNull); err != nil { 1537 + return err 1538 + } 1539 + } else { 1540 + if len(*t.Kind) > 1000000 { 1541 + return xerrors.Errorf("Value in field t.Kind was too long") 1542 + } 1543 + 1544 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Kind))); err != nil { 1545 + return err 1546 + } 1547 + if _, err := cw.WriteString(string(*t.Kind)); err != nil { 1548 + return err 1549 + } 1550 + } 1551 + } 1552 + 1553 + // t.Step (int64) (int64) 1554 + if len("step") > 1000000 { 1555 + return xerrors.Errorf("Value in field \"step\" was too long") 1556 + } 1557 + 1558 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("step"))); err != nil { 1559 + return err 1560 + } 1561 + if _, err := cw.WriteString(string("step")); err != nil { 1562 + return err 1563 + } 1564 + 1565 + if t.Step >= 0 { 1566 + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Step)); err != nil { 1567 + return err 1568 + } 1569 + } else { 1570 + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Step-1)); err != nil { 1571 + return err 1572 + } 1573 + } 1574 + 1575 + // t.Time (string) (string) 1576 + if len("time") > 1000000 { 1577 + return xerrors.Errorf("Value in field \"time\" was too long") 1578 + } 1579 + 1580 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("time"))); err != nil { 1581 + return err 1582 + } 1583 + if _, err := cw.WriteString(string("time")); err != nil { 1584 + return err 1585 + } 1586 + 1587 + if len(t.Time) > 1000000 { 1588 + return xerrors.Errorf("Value in field t.Time was too long") 1589 + } 1590 + 1591 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Time))); err != nil { 1592 + return err 1593 + } 1594 + if _, err := cw.WriteString(string(t.Time)); err != nil { 1595 + return err 1596 + } 1597 + 1598 + // t.Status (string) (string) 1599 + if t.Status != nil { 1600 + 1601 + if len("status") > 1000000 { 1602 + return xerrors.Errorf("Value in field \"status\" was too long") 1603 + } 1604 + 1605 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { 1606 + return err 1607 + } 1608 + if _, err := cw.WriteString(string("status")); err != nil { 1609 + return err 1610 + } 1611 + 1612 + if t.Status == nil { 1613 + if _, err := cw.Write(cbg.CborNull); err != nil { 1614 + return err 1615 + } 1616 + } else { 1617 + if len(*t.Status) > 1000000 { 1618 + return xerrors.Errorf("Value in field t.Status was too long") 1619 + } 1620 + 1621 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Status))); err != nil { 1622 + return err 1623 + } 1624 + if _, err := cw.WriteString(string(*t.Status)); err != nil { 1625 + return err 1626 + } 1627 + } 1628 + } 1629 + 1630 + // t.Command (string) (string) 1631 + if t.Command != nil { 1632 + 1633 + if len("command") > 1000000 { 1634 + return xerrors.Errorf("Value in field \"command\" was too long") 1635 + } 1636 + 1637 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("command"))); err != nil { 1638 + return err 1639 + } 1640 + if _, err := cw.WriteString(string("command")); err != nil { 1641 + return err 1642 + } 1643 + 1644 + if t.Command == nil { 1645 + if _, err := cw.Write(cbg.CborNull); err != nil { 1646 + return err 1647 + } 1648 + } else { 1649 + if len(*t.Command) > 1000000 { 1650 + return xerrors.Errorf("Value in field t.Command was too long") 1651 + } 1652 + 1653 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Command))); err != nil { 1654 + return err 1655 + } 1656 + if _, err := cw.WriteString(string(*t.Command)); err != nil { 1657 + return err 1658 + } 1659 + } 1660 + } 1661 + 1662 + // t.Content (string) (string) 1663 + if len("content") > 1000000 { 1664 + return xerrors.Errorf("Value in field \"content\" was too long") 1665 + } 1666 + 1667 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("content"))); err != nil { 1668 + return err 1669 + } 1670 + if _, err := cw.WriteString(string("content")); err != nil { 1671 + return err 1672 + } 1673 + 1674 + if len(t.Content) > 1000000 { 1675 + return xerrors.Errorf("Value in field t.Content was too long") 1676 + } 1677 + 1678 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Content))); err != nil { 1679 + return err 1680 + } 1681 + if _, err := cw.WriteString(string(t.Content)); err != nil { 1682 + return err 1683 + } 1684 + 1685 + // t.Workflow (string) (string) 1686 + if len("workflow") > 1000000 { 1687 + return xerrors.Errorf("Value in field \"workflow\" was too long") 1688 + } 1689 + 1690 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflow"))); err != nil { 1691 + return err 1692 + } 1693 + if _, err := cw.WriteString(string("workflow")); err != nil { 1694 + return err 1695 + } 1696 + 1697 + if len(t.Workflow) > 1000000 { 1698 + return xerrors.Errorf("Value in field t.Workflow was too long") 1699 + } 1700 + 1701 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Workflow))); err != nil { 1702 + return err 1703 + } 1704 + if _, err := cw.WriteString(string(t.Workflow)); err != nil { 1705 + return err 1706 + } 1707 + return nil 1708 + } 1709 + 1710 + func (t *CiPipelineSubscribeLogs_Control) UnmarshalCBOR(r io.Reader) (err error) { 1711 + *t = CiPipelineSubscribeLogs_Control{} 1712 + 1713 + cr := cbg.NewCborReader(r) 1714 + 1715 + maj, extra, err := cr.ReadHeader() 1716 + if err != nil { 1717 + return err 1718 + } 1719 + defer func() { 1720 + if err == io.EOF { 1721 + err = io.ErrUnexpectedEOF 1722 + } 1723 + }() 1724 + 1725 + if maj != cbg.MajMap { 1726 + return fmt.Errorf("cbor input should be of type map") 1727 + } 1728 + 1729 + if extra > cbg.MaxLength { 1730 + return fmt.Errorf("CiPipelineSubscribeLogs_Control: map struct too large (%d)", extra) 1731 + } 1732 + 1733 + n := extra 1734 + 1735 + nameBuf := make([]byte, 8) 1736 + for i := uint64(0); i < n; i++ { 1737 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 1738 + if err != nil { 1739 + return err 1740 + } 1741 + 1742 + if !ok { 1743 + // Field doesn't exist on this type, so ignore it 1744 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 1745 + return err 1746 + } 1747 + continue 1748 + } 1749 + 1750 + switch string(nameBuf[:nameLen]) { 1751 + // t.Kind (string) (string) 1752 + case "kind": 1753 + 1754 + { 1755 + b, err := cr.ReadByte() 1756 + if err != nil { 1757 + return err 1758 + } 1759 + if b != cbg.CborNull[0] { 1760 + if err := cr.UnreadByte(); err != nil { 1761 + return err 1762 + } 1763 + 1764 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1765 + if err != nil { 1766 + return err 1767 + } 1768 + 1769 + t.Kind = (*string)(&sval) 1770 + } 1771 + } 1772 + // t.Step (int64) (int64) 1773 + case "step": 1774 + { 1775 + maj, extra, err := cr.ReadHeader() 1776 + if err != nil { 1777 + return err 1778 + } 1779 + var extraI int64 1780 + switch maj { 1781 + case cbg.MajUnsignedInt: 1782 + extraI = int64(extra) 1783 + if extraI < 0 { 1784 + return fmt.Errorf("int64 positive overflow") 1785 + } 1786 + case cbg.MajNegativeInt: 1787 + extraI = int64(extra) 1788 + if extraI < 0 { 1789 + return fmt.Errorf("int64 negative overflow") 1790 + } 1791 + extraI = -1 - extraI 1792 + default: 1793 + return fmt.Errorf("wrong type for int64 field: %d", maj) 1794 + } 1795 + 1796 + t.Step = int64(extraI) 1797 + } 1798 + // t.Time (string) (string) 1799 + case "time": 1800 + 1801 + { 1802 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1803 + if err != nil { 1804 + return err 1805 + } 1806 + 1807 + t.Time = string(sval) 1808 + } 1809 + // t.Status (string) (string) 1810 + case "status": 1811 + 1812 + { 1813 + b, err := cr.ReadByte() 1814 + if err != nil { 1815 + return err 1816 + } 1817 + if b != cbg.CborNull[0] { 1818 + if err := cr.UnreadByte(); err != nil { 1819 + return err 1820 + } 1821 + 1822 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1823 + if err != nil { 1824 + return err 1825 + } 1826 + 1827 + t.Status = (*string)(&sval) 1828 + } 1829 + } 1830 + // t.Command (string) (string) 1831 + case "command": 1832 + 1833 + { 1834 + b, err := cr.ReadByte() 1835 + if err != nil { 1836 + return err 1837 + } 1838 + if b != cbg.CborNull[0] { 1839 + if err := cr.UnreadByte(); err != nil { 1840 + return err 1841 + } 1842 + 1843 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1844 + if err != nil { 1845 + return err 1846 + } 1847 + 1848 + t.Command = (*string)(&sval) 1849 + } 1850 + } 1851 + // t.Content (string) (string) 1852 + case "content": 1853 + 1854 + { 1855 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1856 + if err != nil { 1857 + return err 1858 + } 1859 + 1860 + t.Content = string(sval) 1861 + } 1862 + // t.Workflow (string) (string) 1863 + case "workflow": 1864 + 1865 + { 1866 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1867 + if err != nil { 1868 + return err 1869 + } 1870 + 1871 + t.Workflow = string(sval) 1872 + } 1873 + 1874 + default: 1875 + // Field doesn't exist on this type, so ignore it 1876 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 1877 + return err 1878 + } 1879 + } 1880 + } 1881 + 1882 + return nil 1883 + } 1884 + func (t *CiPipelineSubscribeLogs_Data) MarshalCBOR(w io.Writer) error { 1885 + if t == nil { 1886 + _, err := w.Write(cbg.CborNull) 1887 + return err 1888 + } 1889 + 1890 + cw := cbg.NewCborWriter(w) 1891 + 1892 + if _, err := cw.Write([]byte{165}); err != nil { 1893 + return err 1894 + } 1895 + 1896 + // t.Step (int64) (int64) 1897 + if len("step") > 1000000 { 1898 + return xerrors.Errorf("Value in field \"step\" was too long") 1899 + } 1900 + 1901 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("step"))); err != nil { 1902 + return err 1903 + } 1904 + if _, err := cw.WriteString(string("step")); err != nil { 1905 + return err 1906 + } 1907 + 1908 + if t.Step >= 0 { 1909 + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Step)); err != nil { 1910 + return err 1911 + } 1912 + } else { 1913 + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Step-1)); err != nil { 1914 + return err 1915 + } 1916 + } 1917 + 1918 + // t.Time (string) (string) 1919 + if len("time") > 1000000 { 1920 + return xerrors.Errorf("Value in field \"time\" was too long") 1921 + } 1922 + 1923 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("time"))); err != nil { 1924 + return err 1925 + } 1926 + if _, err := cw.WriteString(string("time")); err != nil { 1927 + return err 1928 + } 1929 + 1930 + if len(t.Time) > 1000000 { 1931 + return xerrors.Errorf("Value in field t.Time was too long") 1932 + } 1933 + 1934 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Time))); err != nil { 1935 + return err 1936 + } 1937 + if _, err := cw.WriteString(string(t.Time)); err != nil { 1938 + return err 1939 + } 1940 + 1941 + // t.Stream (string) (string) 1942 + if len("stream") > 1000000 { 1943 + return xerrors.Errorf("Value in field \"stream\" was too long") 1944 + } 1945 + 1946 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("stream"))); err != nil { 1947 + return err 1948 + } 1949 + if _, err := cw.WriteString(string("stream")); err != nil { 1950 + return err 1951 + } 1952 + 1953 + if len(t.Stream) > 1000000 { 1954 + return xerrors.Errorf("Value in field t.Stream was too long") 1955 + } 1956 + 1957 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Stream))); err != nil { 1958 + return err 1959 + } 1960 + if _, err := cw.WriteString(string(t.Stream)); err != nil { 1961 + return err 1962 + } 1963 + 1964 + // t.Content (string) (string) 1965 + if len("content") > 1000000 { 1966 + return xerrors.Errorf("Value in field \"content\" was too long") 1967 + } 1968 + 1969 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("content"))); err != nil { 1970 + return err 1971 + } 1972 + if _, err := cw.WriteString(string("content")); err != nil { 1973 + return err 1974 + } 1975 + 1976 + if len(t.Content) > 1000000 { 1977 + return xerrors.Errorf("Value in field t.Content was too long") 1978 + } 1979 + 1980 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Content))); err != nil { 1981 + return err 1982 + } 1983 + if _, err := cw.WriteString(string(t.Content)); err != nil { 1984 + return err 1985 + } 1986 + 1987 + // t.Workflow (string) (string) 1988 + if len("workflow") > 1000000 { 1989 + return xerrors.Errorf("Value in field \"workflow\" was too long") 1990 + } 1991 + 1992 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflow"))); err != nil { 1993 + return err 1994 + } 1995 + if _, err := cw.WriteString(string("workflow")); err != nil { 1996 + return err 1997 + } 1998 + 1999 + if len(t.Workflow) > 1000000 { 2000 + return xerrors.Errorf("Value in field t.Workflow was too long") 2001 + } 2002 + 2003 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Workflow))); err != nil { 2004 + return err 2005 + } 2006 + if _, err := cw.WriteString(string(t.Workflow)); err != nil { 2007 + return err 2008 + } 2009 + return nil 2010 + } 2011 + 2012 + func (t *CiPipelineSubscribeLogs_Data) UnmarshalCBOR(r io.Reader) (err error) { 2013 + *t = CiPipelineSubscribeLogs_Data{} 2014 + 2015 + cr := cbg.NewCborReader(r) 2016 + 2017 + maj, extra, err := cr.ReadHeader() 2018 + if err != nil { 2019 + return err 2020 + } 2021 + defer func() { 2022 + if err == io.EOF { 2023 + err = io.ErrUnexpectedEOF 2024 + } 2025 + }() 2026 + 2027 + if maj != cbg.MajMap { 2028 + return fmt.Errorf("cbor input should be of type map") 2029 + } 2030 + 2031 + if extra > cbg.MaxLength { 2032 + return fmt.Errorf("CiPipelineSubscribeLogs_Data: map struct too large (%d)", extra) 2033 + } 2034 + 2035 + n := extra 2036 + 2037 + nameBuf := make([]byte, 8) 2038 + for i := uint64(0); i < n; i++ { 2039 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 2040 + if err != nil { 2041 + return err 2042 + } 2043 + 2044 + if !ok { 2045 + // Field doesn't exist on this type, so ignore it 2046 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 2047 + return err 2048 + } 2049 + continue 2050 + } 2051 + 2052 + switch string(nameBuf[:nameLen]) { 2053 + // t.Step (int64) (int64) 2054 + case "step": 2055 + { 2056 + maj, extra, err := cr.ReadHeader() 2057 + if err != nil { 2058 + return err 2059 + } 2060 + var extraI int64 2061 + switch maj { 2062 + case cbg.MajUnsignedInt: 2063 + extraI = int64(extra) 2064 + if extraI < 0 { 2065 + return fmt.Errorf("int64 positive overflow") 2066 + } 2067 + case cbg.MajNegativeInt: 2068 + extraI = int64(extra) 2069 + if extraI < 0 { 2070 + return fmt.Errorf("int64 negative overflow") 2071 + } 2072 + extraI = -1 - extraI 2073 + default: 2074 + return fmt.Errorf("wrong type for int64 field: %d", maj) 2075 + } 2076 + 2077 + t.Step = int64(extraI) 2078 + } 2079 + // t.Time (string) (string) 2080 + case "time": 2081 + 2082 + { 2083 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2084 + if err != nil { 2085 + return err 2086 + } 2087 + 2088 + t.Time = string(sval) 2089 + } 2090 + // t.Stream (string) (string) 2091 + case "stream": 2092 + 2093 + { 2094 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2095 + if err != nil { 2096 + return err 2097 + } 2098 + 2099 + t.Stream = string(sval) 2100 + } 2101 + // t.Content (string) (string) 2102 + case "content": 2103 + 2104 + { 2105 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2106 + if err != nil { 2107 + return err 2108 + } 2109 + 2110 + t.Content = string(sval) 2111 + } 2112 + // t.Workflow (string) (string) 2113 + case "workflow": 2114 + 2115 + { 2116 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2117 + if err != nil { 2118 + return err 2119 + } 2120 + 2121 + t.Workflow = string(sval) 2122 + } 2123 + 2124 + default: 2125 + // Field doesn't exist on this type, so ignore it 2126 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 2127 + return err 2128 + } 2129 + } 2130 + } 2131 + 2132 + return nil 2133 + } 2134 + func (t *CiTrigger_Manual) MarshalCBOR(w io.Writer) error { 2135 + if t == nil { 2136 + _, err := w.Write(cbg.CborNull) 2137 + return err 2138 + } 2139 + 2140 + cw := cbg.NewCborWriter(w) 2141 + 2142 + if _, err := cw.Write([]byte{161}); err != nil { 2143 + return err 2144 + } 2145 + 2146 + // t.LexiconTypeID (string) (string) 2147 + if len("$type") > 1000000 { 2148 + return xerrors.Errorf("Value in field \"$type\" was too long") 2149 + } 2150 + 2151 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2152 + return err 2153 + } 2154 + if _, err := cw.WriteString(string("$type")); err != nil { 2155 + return err 2156 + } 2157 + 2158 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.trigger#manual"))); err != nil { 2159 + return err 2160 + } 2161 + if _, err := cw.WriteString(string("sh.tangled.ci.trigger#manual")); err != nil { 2162 + return err 2163 + } 2164 + return nil 2165 + } 2166 + 2167 + func (t *CiTrigger_Manual) UnmarshalCBOR(r io.Reader) (err error) { 2168 + *t = CiTrigger_Manual{} 2169 + 2170 + cr := cbg.NewCborReader(r) 2171 + 2172 + maj, extra, err := cr.ReadHeader() 2173 + if err != nil { 2174 + return err 2175 + } 2176 + defer func() { 2177 + if err == io.EOF { 2178 + err = io.ErrUnexpectedEOF 2179 + } 2180 + }() 2181 + 2182 + if maj != cbg.MajMap { 2183 + return fmt.Errorf("cbor input should be of type map") 2184 + } 2185 + 2186 + if extra > cbg.MaxLength { 2187 + return fmt.Errorf("CiTrigger_Manual: map struct too large (%d)", extra) 2188 + } 2189 + 2190 + n := extra 2191 + 2192 + nameBuf := make([]byte, 5) 2193 + for i := uint64(0); i < n; i++ { 2194 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 2195 + if err != nil { 2196 + return err 2197 + } 2198 + 2199 + if !ok { 2200 + // Field doesn't exist on this type, so ignore it 2201 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 2202 + return err 2203 + } 2204 + continue 2205 + } 2206 + 2207 + switch string(nameBuf[:nameLen]) { 2208 + // t.LexiconTypeID (string) (string) 2209 + case "$type": 2210 + 2211 + { 2212 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2213 + if err != nil { 2214 + return err 2215 + } 2216 + 2217 + t.LexiconTypeID = string(sval) 2218 + } 2219 + 2220 + default: 2221 + // Field doesn't exist on this type, so ignore it 2222 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 2223 + return err 2224 + } 2225 + } 2226 + } 2227 + 2228 + return nil 2229 + } 2230 + func (t *CiTrigger_PullRequest) MarshalCBOR(w io.Writer) error { 2231 + if t == nil { 2232 + _, err := w.Write(cbg.CborNull) 2233 + return err 2234 + } 2235 + 2236 + cw := cbg.NewCborWriter(w) 2237 + fieldCount := 5 2238 + 2239 + if t.SourceBranch == nil { 2240 + fieldCount-- 2241 + } 2242 + 2243 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 2244 + return err 2245 + } 2246 + 2247 + // t.LexiconTypeID (string) (string) 2248 + if len("$type") > 1000000 { 2249 + return xerrors.Errorf("Value in field \"$type\" was too long") 2250 + } 2251 + 2252 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2253 + return err 2254 + } 2255 + if _, err := cw.WriteString(string("$type")); err != nil { 2256 + return err 2257 + } 2258 + 2259 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.trigger#pullRequest"))); err != nil { 2260 + return err 2261 + } 2262 + if _, err := cw.WriteString(string("sh.tangled.ci.trigger#pullRequest")); err != nil { 2263 + return err 2264 + } 2265 + 2266 + // t.Action (string) (string) 2267 + if len("action") > 1000000 { 2268 + return xerrors.Errorf("Value in field \"action\" was too long") 2269 + } 2270 + 2271 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("action"))); err != nil { 2272 + return err 2273 + } 2274 + if _, err := cw.WriteString(string("action")); err != nil { 2275 + return err 2276 + } 2277 + 2278 + if len(t.Action) > 1000000 { 2279 + return xerrors.Errorf("Value in field t.Action was too long") 2280 + } 2281 + 2282 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Action))); err != nil { 2283 + return err 2284 + } 2285 + if _, err := cw.WriteString(string(t.Action)); err != nil { 2286 + return err 2287 + } 2288 + 2289 + // t.SourceSha (string) (string) 2290 + if len("sourceSha") > 1000000 { 2291 + return xerrors.Errorf("Value in field \"sourceSha\" was too long") 2292 + } 2293 + 2294 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sourceSha"))); err != nil { 2295 + return err 2296 + } 2297 + if _, err := cw.WriteString(string("sourceSha")); err != nil { 2298 + return err 2299 + } 2300 + 2301 + if len(t.SourceSha) > 1000000 { 2302 + return xerrors.Errorf("Value in field t.SourceSha was too long") 2303 + } 2304 + 2305 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.SourceSha))); err != nil { 2306 + return err 2307 + } 2308 + if _, err := cw.WriteString(string(t.SourceSha)); err != nil { 2309 + return err 2310 + } 2311 + 2312 + // t.SourceBranch (string) (string) 2313 + if t.SourceBranch != nil { 2314 + 2315 + if len("sourceBranch") > 1000000 { 2316 + return xerrors.Errorf("Value in field \"sourceBranch\" was too long") 2317 + } 2318 + 2319 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sourceBranch"))); err != nil { 2320 + return err 2321 + } 2322 + if _, err := cw.WriteString(string("sourceBranch")); err != nil { 2323 + return err 2324 + } 2325 + 2326 + if t.SourceBranch == nil { 2327 + if _, err := cw.Write(cbg.CborNull); err != nil { 2328 + return err 2329 + } 2330 + } else { 2331 + if len(*t.SourceBranch) > 1000000 { 2332 + return xerrors.Errorf("Value in field t.SourceBranch was too long") 2333 + } 2334 + 2335 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.SourceBranch))); err != nil { 2336 + return err 2337 + } 2338 + if _, err := cw.WriteString(string(*t.SourceBranch)); err != nil { 2339 + return err 2340 + } 2341 + } 2342 + } 2343 + 2344 + // t.TargetBranch (string) (string) 2345 + if len("targetBranch") > 1000000 { 2346 + return xerrors.Errorf("Value in field \"targetBranch\" was too long") 2347 + } 2348 + 2349 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("targetBranch"))); err != nil { 2350 + return err 2351 + } 2352 + if _, err := cw.WriteString(string("targetBranch")); err != nil { 2353 + return err 2354 + } 2355 + 2356 + if len(t.TargetBranch) > 1000000 { 2357 + return xerrors.Errorf("Value in field t.TargetBranch was too long") 2358 + } 2359 + 2360 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.TargetBranch))); err != nil { 2361 + return err 2362 + } 2363 + if _, err := cw.WriteString(string(t.TargetBranch)); err != nil { 2364 + return err 2365 + } 2366 + return nil 2367 + } 2368 + 2369 + func (t *CiTrigger_PullRequest) UnmarshalCBOR(r io.Reader) (err error) { 2370 + *t = CiTrigger_PullRequest{} 2371 + 2372 + cr := cbg.NewCborReader(r) 2373 + 2374 + maj, extra, err := cr.ReadHeader() 2375 + if err != nil { 2376 + return err 2377 + } 2378 + defer func() { 2379 + if err == io.EOF { 2380 + err = io.ErrUnexpectedEOF 2381 + } 2382 + }() 2383 + 2384 + if maj != cbg.MajMap { 2385 + return fmt.Errorf("cbor input should be of type map") 2386 + } 2387 + 2388 + if extra > cbg.MaxLength { 2389 + return fmt.Errorf("CiTrigger_PullRequest: map struct too large (%d)", extra) 2390 + } 2391 + 2392 + n := extra 2393 + 2394 + nameBuf := make([]byte, 12) 2395 + for i := uint64(0); i < n; i++ { 2396 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 2397 + if err != nil { 2398 + return err 2399 + } 2400 + 2401 + if !ok { 2402 + // Field doesn't exist on this type, so ignore it 2403 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 2404 + return err 2405 + } 2406 + continue 2407 + } 2408 + 2409 + switch string(nameBuf[:nameLen]) { 2410 + // t.LexiconTypeID (string) (string) 2411 + case "$type": 2412 + 2413 + { 2414 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2415 + if err != nil { 2416 + return err 2417 + } 2418 + 2419 + t.LexiconTypeID = string(sval) 2420 + } 2421 + // t.Action (string) (string) 2422 + case "action": 2423 + 2424 + { 2425 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2426 + if err != nil { 2427 + return err 2428 + } 2429 + 2430 + t.Action = string(sval) 2431 + } 2432 + // t.SourceSha (string) (string) 2433 + case "sourceSha": 2434 + 2435 + { 2436 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2437 + if err != nil { 2438 + return err 2439 + } 2440 + 2441 + t.SourceSha = string(sval) 2442 + } 2443 + // t.SourceBranch (string) (string) 2444 + case "sourceBranch": 2445 + 2446 + { 2447 + b, err := cr.ReadByte() 2448 + if err != nil { 2449 + return err 2450 + } 2451 + if b != cbg.CborNull[0] { 2452 + if err := cr.UnreadByte(); err != nil { 2453 + return err 2454 + } 2455 + 2456 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2457 + if err != nil { 2458 + return err 2459 + } 2460 + 2461 + t.SourceBranch = (*string)(&sval) 2462 + } 2463 + } 2464 + // t.TargetBranch (string) (string) 2465 + case "targetBranch": 2466 + 2467 + { 2468 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2469 + if err != nil { 2470 + return err 2471 + } 2472 + 2473 + t.TargetBranch = string(sval) 2474 + } 2475 + 2476 + default: 2477 + // Field doesn't exist on this type, so ignore it 2478 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 2479 + return err 2480 + } 2481 + } 2482 + } 2483 + 2484 + return nil 2485 + } 2486 + func (t *CiTrigger_Push) MarshalCBOR(w io.Writer) error { 2487 + if t == nil { 2488 + _, err := w.Write(cbg.CborNull) 2489 + return err 2490 + } 2491 + 2492 + cw := cbg.NewCborWriter(w) 2493 + 2494 + if _, err := cw.Write([]byte{164}); err != nil { 2495 + return err 2496 + } 2497 + 2498 + // t.Ref (string) (string) 2499 + if len("ref") > 1000000 { 2500 + return xerrors.Errorf("Value in field \"ref\" was too long") 2501 + } 2502 + 2503 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil { 2504 + return err 2505 + } 2506 + if _, err := cw.WriteString(string("ref")); err != nil { 2507 + return err 2508 + } 2509 + 2510 + if len(t.Ref) > 1000000 { 2511 + return xerrors.Errorf("Value in field t.Ref was too long") 2512 + } 2513 + 2514 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Ref))); err != nil { 2515 + return err 2516 + } 2517 + if _, err := cw.WriteString(string(t.Ref)); err != nil { 2518 + return err 2519 + } 2520 + 2521 + // t.LexiconTypeID (string) (string) 2522 + if len("$type") > 1000000 { 2523 + return xerrors.Errorf("Value in field \"$type\" was too long") 2524 + } 2525 + 2526 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2527 + return err 2528 + } 2529 + if _, err := cw.WriteString(string("$type")); err != nil { 2530 + return err 2531 + } 2532 + 2533 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.trigger#push"))); err != nil { 2534 + return err 2535 + } 2536 + if _, err := cw.WriteString(string("sh.tangled.ci.trigger#push")); err != nil { 2537 + return err 2538 + } 2539 + 2540 + // t.NewSha (string) (string) 2541 + if len("newSha") > 1000000 { 2542 + return xerrors.Errorf("Value in field \"newSha\" was too long") 2543 + } 2544 + 2545 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("newSha"))); err != nil { 2546 + return err 2547 + } 2548 + if _, err := cw.WriteString(string("newSha")); err != nil { 2549 + return err 2550 + } 2551 + 2552 + if len(t.NewSha) > 1000000 { 2553 + return xerrors.Errorf("Value in field t.NewSha was too long") 2554 + } 2555 + 2556 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.NewSha))); err != nil { 2557 + return err 2558 + } 2559 + if _, err := cw.WriteString(string(t.NewSha)); err != nil { 2560 + return err 2561 + } 2562 + 2563 + // t.OldSha (string) (string) 2564 + if len("oldSha") > 1000000 { 2565 + return xerrors.Errorf("Value in field \"oldSha\" was too long") 2566 + } 2567 + 2568 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("oldSha"))); err != nil { 2569 + return err 2570 + } 2571 + if _, err := cw.WriteString(string("oldSha")); err != nil { 2572 + return err 2573 + } 2574 + 2575 + if len(t.OldSha) > 1000000 { 2576 + return xerrors.Errorf("Value in field t.OldSha was too long") 2577 + } 2578 + 2579 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.OldSha))); err != nil { 2580 + return err 2581 + } 2582 + if _, err := cw.WriteString(string(t.OldSha)); err != nil { 2583 + return err 2584 + } 2585 + return nil 2586 + } 2587 + 2588 + func (t *CiTrigger_Push) UnmarshalCBOR(r io.Reader) (err error) { 2589 + *t = CiTrigger_Push{} 2590 + 2591 + cr := cbg.NewCborReader(r) 2592 + 2593 + maj, extra, err := cr.ReadHeader() 2594 + if err != nil { 2595 + return err 2596 + } 2597 + defer func() { 2598 + if err == io.EOF { 2599 + err = io.ErrUnexpectedEOF 2600 + } 2601 + }() 2602 + 2603 + if maj != cbg.MajMap { 2604 + return fmt.Errorf("cbor input should be of type map") 2605 + } 2606 + 2607 + if extra > cbg.MaxLength { 2608 + return fmt.Errorf("CiTrigger_Push: map struct too large (%d)", extra) 2609 + } 2610 + 2611 + n := extra 2612 + 2613 + nameBuf := make([]byte, 6) 2614 + for i := uint64(0); i < n; i++ { 2615 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 2616 + if err != nil { 2617 + return err 2618 + } 2619 + 2620 + if !ok { 2621 + // Field doesn't exist on this type, so ignore it 2622 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 2623 + return err 2624 + } 2625 + continue 2626 + } 2627 + 2628 + switch string(nameBuf[:nameLen]) { 2629 + // t.Ref (string) (string) 2630 + case "ref": 2631 + 2632 + { 2633 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2634 + if err != nil { 2635 + return err 2636 + } 2637 + 2638 + t.Ref = string(sval) 2639 + } 2640 + // t.LexiconTypeID (string) (string) 2641 + case "$type": 2642 + 2643 + { 2644 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2645 + if err != nil { 2646 + return err 2647 + } 2648 + 2649 + t.LexiconTypeID = string(sval) 2650 + } 2651 + // t.NewSha (string) (string) 2652 + case "newSha": 2653 + 2654 + { 2655 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2656 + if err != nil { 2657 + return err 2658 + } 2659 + 2660 + t.NewSha = string(sval) 2661 + } 2662 + // t.OldSha (string) (string) 2663 + case "oldSha": 2664 + 2665 + { 2666 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2667 + if err != nil { 2668 + return err 2669 + } 2670 + 2671 + t.OldSha = string(sval) 2672 + } 2673 + 2674 + default: 2675 + // Field doesn't exist on this type, so ignore it 2676 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 2677 + return err 2678 + } 2679 + } 2680 + } 2681 + 2682 + return nil 2683 + } 665 2684 func (t *FeedComment) MarshalCBOR(w io.Writer) error { 666 2685 if t == nil { 667 2686 _, err := w.Write(cbg.CborNull)
+85
api/tangled/cidefs.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package tangled 4 + 5 + // schema: sh.tangled.ci.defs 6 + 7 + import ( 8 + "encoding/json" 9 + "fmt" 10 + 11 + "github.com/bluesky-social/indigo/lex/util" 12 + ) 13 + 14 + const () 15 + 16 + // CiDefs_Pipeline is a "pipeline" in the sh.tangled.ci.defs schema. 17 + type CiDefs_Pipeline struct { 18 + // commit: Commit Id this pipeline is running on 19 + Commit string `json:"commit" cborgen:"commit"` 20 + CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` 21 + // id: Spindle-local pipeline id 22 + Id string `json:"id" cborgen:"id"` 23 + // repo: Repository DID 24 + Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` 25 + // trigger: Trigger event metadata 26 + Trigger *CiDefs_Pipeline_Trigger `json:"trigger" cborgen:"trigger"` 27 + // workflows: Triggered workflows 28 + Workflows []*CiDefs_Workflow `json:"workflows" cborgen:"workflows"` 29 + } 30 + 31 + // Trigger event metadata 32 + type CiDefs_Pipeline_Trigger struct { 33 + CiTrigger_Push *CiTrigger_Push 34 + CiTrigger_PullRequest *CiTrigger_PullRequest 35 + CiTrigger_Manual *CiTrigger_Manual 36 + } 37 + 38 + func (t *CiDefs_Pipeline_Trigger) MarshalJSON() ([]byte, error) { 39 + if t.CiTrigger_Push != nil { 40 + t.CiTrigger_Push.LexiconTypeID = "sh.tangled.ci.trigger#push" 41 + return json.Marshal(t.CiTrigger_Push) 42 + } 43 + if t.CiTrigger_PullRequest != nil { 44 + t.CiTrigger_PullRequest.LexiconTypeID = "sh.tangled.ci.trigger#pullRequest" 45 + return json.Marshal(t.CiTrigger_PullRequest) 46 + } 47 + if t.CiTrigger_Manual != nil { 48 + t.CiTrigger_Manual.LexiconTypeID = "sh.tangled.ci.trigger#manual" 49 + return json.Marshal(t.CiTrigger_Manual) 50 + } 51 + return nil, fmt.Errorf("cannot marshal empty enum") 52 + } 53 + func (t *CiDefs_Pipeline_Trigger) UnmarshalJSON(b []byte) error { 54 + typ, err := util.TypeExtract(b) 55 + if err != nil { 56 + return err 57 + } 58 + 59 + switch typ { 60 + case "sh.tangled.ci.trigger#push": 61 + t.CiTrigger_Push = new(CiTrigger_Push) 62 + return json.Unmarshal(b, t.CiTrigger_Push) 63 + case "sh.tangled.ci.trigger#pullRequest": 64 + t.CiTrigger_PullRequest = new(CiTrigger_PullRequest) 65 + return json.Unmarshal(b, t.CiTrigger_PullRequest) 66 + case "sh.tangled.ci.trigger#manual": 67 + t.CiTrigger_Manual = new(CiTrigger_Manual) 68 + return json.Unmarshal(b, t.CiTrigger_Manual) 69 + 70 + default: 71 + return nil 72 + } 73 + } 74 + 75 + // CiDefs_Workflow is a "workflow" in the sh.tangled.ci.defs schema. 76 + type CiDefs_Workflow struct { 77 + FinishedAt *string `json:"finishedAt,omitempty" cborgen:"finishedAt,omitempty"` 78 + // id: Spindle-local workflow id. Used to fetch workflow logs 79 + Id int64 `json:"id" cborgen:"id"` 80 + // name: Name of the workflow 81 + Name string `json:"name" cborgen:"name"` 82 + StartedAt *string `json:"startedAt,omitempty" cborgen:"startedAt,omitempty"` 83 + // status: Workflow status 84 + Status string `json:"status" cborgen:"status"` 85 + }
+30
api/tangled/cigetPipeline.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package tangled 4 + 5 + // schema: sh.tangled.ci.getPipeline 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/lex/util" 11 + ) 12 + 13 + const ( 14 + CiGetPipelineNSID = "sh.tangled.ci.getPipeline" 15 + ) 16 + 17 + // CiGetPipeline calls the XRPC method "sh.tangled.ci.getPipeline". 18 + // 19 + // pipeline: Spindle-local pipeline id 20 + func CiGetPipeline(ctx context.Context, c util.LexClient, pipeline string) (*CiDefs_Pipeline, error) { 21 + var out CiDefs_Pipeline 22 + 23 + params := map[string]interface{}{} 24 + params["pipeline"] = pipeline 25 + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.ci.getPipeline", params, nil, &out); err != nil { 26 + return nil, err 27 + } 28 + 29 + return &out, nil 30 + }
+50
api/tangled/ciqueryPipelines.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package tangled 4 + 5 + // schema: sh.tangled.ci.queryPipelines 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/lex/util" 11 + ) 12 + 13 + const ( 14 + CiQueryPipelinesNSID = "sh.tangled.ci.queryPipelines" 15 + ) 16 + 17 + // CiQueryPipelines_Output is the output of a sh.tangled.ci.queryPipelines call. 18 + type CiQueryPipelines_Output struct { 19 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 20 + Pipelines []*CiDefs_Pipeline `json:"pipelines" cborgen:"pipelines"` 21 + // total: Maximum number of pipelines 22 + Total int64 `json:"total" cborgen:"total"` 23 + } 24 + 25 + // CiQueryPipelines calls the XRPC method "sh.tangled.ci.queryPipelines". 26 + // 27 + // commits: Filter pipelines by commits. When provided, maximum one pipeline per commit id will be returned. 28 + // cursor: Pagination cursor 29 + // limit: Maximum number of pipelines to return 30 + // repo: DID of the repository 31 + func CiQueryPipelines(ctx context.Context, c util.LexClient, commits []string, cursor string, limit int64, repo string) (*CiQueryPipelines_Output, error) { 32 + var out CiQueryPipelines_Output 33 + 34 + params := map[string]interface{}{} 35 + if len(commits) != 0 { 36 + params["commits"] = commits 37 + } 38 + if cursor != "" { 39 + params["cursor"] = cursor 40 + } 41 + if limit != 0 { 42 + params["limit"] = limit 43 + } 44 + params["repo"] = repo 45 + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.ci.queryPipelines", params, nil, &out); err != nil { 46 + return nil, err 47 + } 48 + 49 + return &out, nil 50 + }
+37
api/tangled/citrigger.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package tangled 4 + 5 + // schema: sh.tangled.ci.trigger 6 + 7 + const () 8 + 9 + // CiTrigger_Manual is a "manual" in the sh.tangled.ci.trigger schema. 10 + // 11 + // RECORDTYPE: CiTrigger_Manual 12 + type CiTrigger_Manual struct { 13 + LexiconTypeID string `json:"$type,const=sh.tangled.ci.trigger#manual" cborgen:"$type,const=sh.tangled.ci.trigger#manual"` 14 + } 15 + 16 + // CiTrigger_PullRequest is a "pullRequest" in the sh.tangled.ci.trigger schema. 17 + // 18 + // TODO: reference PR record with strongRef instead of embedding raw values 19 + // 20 + // RECORDTYPE: CiTrigger_PullRequest 21 + type CiTrigger_PullRequest struct { 22 + LexiconTypeID string `json:"$type,const=sh.tangled.ci.trigger#pullRequest" cborgen:"$type,const=sh.tangled.ci.trigger#pullRequest"` 23 + Action string `json:"action" cborgen:"action"` 24 + SourceBranch *string `json:"sourceBranch,omitempty" cborgen:"sourceBranch,omitempty"` 25 + SourceSha string `json:"sourceSha" cborgen:"sourceSha"` 26 + TargetBranch string `json:"targetBranch" cborgen:"targetBranch"` 27 + } 28 + 29 + // CiTrigger_Push is a "push" in the sh.tangled.ci.trigger schema. 30 + // 31 + // RECORDTYPE: CiTrigger_Push 32 + type CiTrigger_Push struct { 33 + LexiconTypeID string `json:"$type,const=sh.tangled.ci.trigger#push" cborgen:"$type,const=sh.tangled.ci.trigger#push"` 34 + NewSha string `json:"newSha" cborgen:"newSha"` 35 + OldSha string `json:"oldSha" cborgen:"oldSha"` 36 + Ref string `json:"ref" cborgen:"ref"` 37 + }
+2
api/tangled/pipelinestatus.go
··· 15 15 func init() { 16 16 util.RegisterType("sh.tangled.pipeline.status", &PipelineStatus{}) 17 17 } // 18 + // DEPRECATED: use sh.tangled.ci.defs#pipeline instead 19 + // 18 20 // RECORDTYPE: PipelineStatus 19 21 type PipelineStatus struct { 20 22 LexiconTypeID string `json:"$type,const=sh.tangled.pipeline.status" cborgen:"$type,const=sh.tangled.pipeline.status"`
+36
api/tangled/pipelinesubscribeLogs.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package tangled 4 + 5 + // schema: sh.tangled.ci.pipeline.subscribeLogs 6 + 7 + const ( 8 + CiPipelineSubscribeLogsNSID = "sh.tangled.ci.pipeline.subscribeLogs" 9 + ) 10 + 11 + // CiPipelineSubscribeLogs_Control is a "control" in the sh.tangled.ci.pipeline.subscribeLogs schema. 12 + type CiPipelineSubscribeLogs_Control struct { 13 + // command: Step command 14 + Command *string `json:"command,omitempty" cborgen:"command,omitempty"` 15 + Content string `json:"content" cborgen:"content"` 16 + // kind: Step kind 17 + Kind *string `json:"kind,omitempty" cborgen:"kind,omitempty"` 18 + // status: Step status 19 + Status *string `json:"status,omitempty" cborgen:"status,omitempty"` 20 + // step: Step ID 21 + Step int64 `json:"step" cborgen:"step"` 22 + Time string `json:"time" cborgen:"time"` 23 + // workflow: workflow name 24 + Workflow string `json:"workflow" cborgen:"workflow"` 25 + } 26 + 27 + // CiPipelineSubscribeLogs_Data is a "data" in the sh.tangled.ci.pipeline.subscribeLogs schema. 28 + type CiPipelineSubscribeLogs_Data struct { 29 + Content string `json:"content" cborgen:"content"` 30 + // step: Step ID 31 + Step int64 `json:"step" cborgen:"step"` 32 + Stream string `json:"stream" cborgen:"stream"` 33 + Time string `json:"time" cborgen:"time"` 34 + // workflow: workflow name 35 + Workflow string `json:"workflow" cborgen:"workflow"` 36 + }
+2
api/tangled/tangledpipeline.go
··· 15 15 func init() { 16 16 util.RegisterType("sh.tangled.pipeline", &Pipeline{}) 17 17 } // 18 + // DEPRECATED: use sh.tangled.ci.defs#pipeline instead 19 + // 18 20 // RECORDTYPE: Pipeline 19 21 type Pipeline struct { 20 22 LexiconTypeID string `json:"$type,const=sh.tangled.pipeline" cborgen:"$type,const=sh.tangled.pipeline"`
+8
cmd/cborgen/cborgen.go
··· 15 15 "api/tangled/cbor_gen.go", 16 16 "tangled", 17 17 tangled.ActorProfile{}, 18 + tangled.CiDefs_Pipeline{}, 19 + tangled.CiDefs_Pipeline_Trigger{}, 20 + tangled.CiDefs_Workflow{}, 21 + tangled.CiPipelineSubscribeLogs_Control{}, 22 + tangled.CiPipelineSubscribeLogs_Data{}, 23 + tangled.CiTrigger_Manual{}, 24 + tangled.CiTrigger_PullRequest{}, 25 + tangled.CiTrigger_Push{}, 18 26 tangled.FeedComment{}, 19 27 tangled.FeedReaction{}, 20 28 tangled.FeedStar{},
+85
lexicons/ci/defs.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.defs", 4 + "defs": { 5 + "pipeline": { 6 + "type": "object", 7 + "required": ["id", "trigger", "commit", "workflows"], 8 + "properties": { 9 + "id": { 10 + "type": "string", 11 + "format": "tid", 12 + "description": "Spindle-local pipeline id" 13 + }, 14 + "repo": { 15 + "type": "string", 16 + "format": "did", 17 + "description": "Repository DID" 18 + }, 19 + "trigger": { 20 + "type": "union", 21 + "refs": [ 22 + "sh.tangled.ci.trigger#push", 23 + "sh.tangled.ci.trigger#pullRequest", 24 + "sh.tangled.ci.trigger#manual" 25 + ], 26 + "description": "Trigger event metadata" 27 + }, 28 + "commit": { 29 + "type": "string", 30 + "description": "Commit Id this pipeline is running on" 31 + }, 32 + "createdAt": { 33 + "type": "string", 34 + "format": "datetime" 35 + }, 36 + "workflows": { 37 + "type": "array", 38 + "description": "Triggered workflows", 39 + "minLength": 1, 40 + "maxLength": 50, 41 + "items": { 42 + "type": "ref", 43 + "ref": "#workflow" 44 + } 45 + } 46 + } 47 + }, 48 + "workflow": { 49 + "type": "object", 50 + "required": ["id", "name", "status"], 51 + "properties": { 52 + "id": { 53 + "type": "integer", 54 + "description": "Spindle-local workflow id. Used to fetch workflow logs" 55 + }, 56 + "name": { 57 + "type": "string", 58 + "description": "Name of the workflow", 59 + "minGraphemes": 1, 60 + "maxGraphemes": 40 61 + }, 62 + "status": { 63 + "type": "string", 64 + "description": "Workflow status", 65 + "enum": [ 66 + "pending", 67 + "running", 68 + "failed", 69 + "timeout", 70 + "cancelled", 71 + "success" 72 + ] 73 + }, 74 + "startedAt": { 75 + "type": "string", 76 + "format": "datetime" 77 + }, 78 + "finishedAt": { 79 + "type": "string", 80 + "format": "datetime" 81 + } 82 + } 83 + } 84 + } 85 + }
+37
lexicons/ci/getPipeline.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.getPipeline", 4 + "defs": { 5 + "main": { 6 + "type": "query", 7 + "parameters": { 8 + "type": "params", 9 + "required": ["pipeline"], 10 + "properties": { 11 + "pipeline": { 12 + "type": "string", 13 + "format": "tid", 14 + "description": "Spindle-local pipeline id" 15 + } 16 + } 17 + }, 18 + "output": { 19 + "encoding": "application/json", 20 + "schema": { 21 + "type": "ref", 22 + "ref": "sh.tangled.ci.defs#pipeline" 23 + } 24 + }, 25 + "errors": [ 26 + { 27 + "name": "PipelineNotFound", 28 + "description": "Pipeline not found" 29 + }, 30 + { 31 + "name": "InvalidRequest", 32 + "description": "Invalid request parameters" 33 + } 34 + ] 35 + } 36 + } 37 + }
+37
lexicons/ci/pipeline/cancelPipeline.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.pipeline.cancelPipeline", 4 + "defs": { 5 + "main": { 6 + "type": "procedure", 7 + "description": "Cancel running pipeline or specific workflows", 8 + "input": { 9 + "encoding": "application/json", 10 + "schema": { 11 + "type": "object", 12 + "required": ["repo", "pipeline"], 13 + "properties": { 14 + "repo": { 15 + "type": "string", 16 + "format": "did", 17 + "description": "git repository DID" 18 + }, 19 + "pipeline": { 20 + "type": "string", 21 + "format": "tid", 22 + "description": "pipeline TID" 23 + }, 24 + "workflows": { 25 + "type": "array", 26 + "items": { 27 + "type": "string", 28 + "description": "workflow name" 29 + }, 30 + "description": "Workflow names to filter. When not provided, entire pipeline will be canceled." 31 + } 32 + } 33 + } 34 + } 35 + } 36 + } 37 + }
+77
lexicons/ci/pipeline/subscribeLogs.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.pipeline.subscribeLogs", 4 + "defs": { 5 + "main": { 6 + "type": "subscription", 7 + "description": "Pipeline logs stream", 8 + "parameters": { 9 + "type": "params", 10 + "required": ["pipeline"], 11 + "properties": { 12 + "pipeline": { 13 + "type": "string", 14 + "format": "tid", 15 + "description": "Pipeline ID" 16 + }, 17 + "workflows": { 18 + "type": "array", 19 + "items": { 20 + "type": "string", 21 + "description": "Workflow name" 22 + }, 23 + "description": "filter logs by specific workflows" 24 + } 25 + } 26 + }, 27 + "message": { 28 + "schema": { 29 + "type": "union", 30 + "refs": ["#control", "#data"] 31 + } 32 + }, 33 + "errors": [ 34 + { 35 + "name": "WorkflowNotFound", 36 + "description": "Workflow not found" 37 + }, 38 + { 39 + "name": "InvalidRequest", 40 + "description": "Invalid request parameters" 41 + } 42 + ] 43 + }, 44 + "control": { 45 + "type": "object", 46 + "required": ["time", "workflow", "step", "content"], 47 + "properties": { 48 + "time": { "type": "string", "format": "datetime" }, 49 + "workflow": { "type": "string", "description": "workflow name" }, 50 + "step": { "type": "integer", "description": "Step ID" }, 51 + "content": { "type": "string" }, 52 + "command": { "type": "string", "description": "Step command" }, 53 + "status": { 54 + "type": "string", 55 + "enum": ["start", "end"], 56 + "description": "Step status" 57 + }, 58 + "kind": { 59 + "type": "string", 60 + "enum": ["system", "user"], 61 + "description": "Step kind" 62 + } 63 + } 64 + }, 65 + "data": { 66 + "type": "object", 67 + "required": ["time", "workflow", "step", "content", "stream"], 68 + "properties": { 69 + "time": { "type": "string", "format": "datetime" }, 70 + "workflow": { "type": "string", "description": "workflow name" }, 71 + "step": { "type": "integer", "description": "Step ID" }, 72 + "content": { "type": "string" }, 73 + "stream": { "type": "string", "enum": [ "stdout", "stderr" ] } 74 + } 75 + } 76 + } 77 + }
+64
lexicons/ci/queryPipelines.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.queryPipelines", 4 + "defs": { 5 + "main": { 6 + "type": "query", 7 + "description": "Query pipelines in git repository", 8 + "parameters": { 9 + "type": "params", 10 + "required": ["repo"], 11 + "properties": { 12 + "repo": { 13 + "type": "string", 14 + "format": "did", 15 + "description": "DID of the repository" 16 + }, 17 + "commits": { 18 + "type": "array", 19 + "items": { 20 + "type": "string", 21 + "description": "commit id (SHA-1 or SHA-265)" 22 + }, 23 + "description": "Filter pipelines by commits. When provided, maximum one pipeline per commit id will be returned." 24 + }, 25 + "limit": { 26 + "type": "integer", 27 + "description": "Maximum number of pipelines to return", 28 + "minimum": 1, 29 + "maximum": 250, 30 + "default": 50 31 + }, 32 + "cursor": { 33 + "type": "string", 34 + "description": "Pagination cursor" 35 + } 36 + } 37 + }, 38 + "output": { 39 + "encoding": "application/json", 40 + "schema": { 41 + "type": "object", 42 + "required": ["total", "pipelines"], 43 + "properties": { 44 + "cursor": { "type": "string" }, 45 + "total": { 46 + "type": "integer", 47 + "description": "Maximum number of pipelines" 48 + }, 49 + "pipelines": { 50 + "type": "array", 51 + "items": { "type": "ref", "ref": "sh.tangled.ci.defs#pipeline" } 52 + } 53 + } 54 + } 55 + }, 56 + "errors": [ 57 + { 58 + "name": "InvalidRequest", 59 + "description": "Invalid request parameters" 60 + } 61 + ] 62 + } 63 + } 64 + }
+50
lexicons/ci/trigger.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.ci.trigger", 4 + "defs": { 5 + "push": { 6 + "type": "object", 7 + "required": ["ref", "newSha", "oldSha"], 8 + "properties": { 9 + "ref": { 10 + "type": "string" 11 + }, 12 + "newSha": { 13 + "type": "string", 14 + "minLength": 40, 15 + "maxLength": 40 16 + }, 17 + "oldSha": { 18 + "type": "string", 19 + "minLength": 40, 20 + "maxLength": 40 21 + } 22 + } 23 + }, 24 + "pullRequest": { 25 + "type": "object", 26 + "required": ["targetBranch", "sourceSha", "action"], 27 + "description": "TODO: reference PR record with strongRef instead of embedding raw values", 28 + "properties": { 29 + "sourceBranch": { 30 + "type": "string" 31 + }, 32 + "targetBranch": { 33 + "type": "string" 34 + }, 35 + "sourceSha": { 36 + "type": "string", 37 + "minLength": 40, 38 + "maxLength": 40 39 + }, 40 + "action": { 41 + "type": "string" 42 + } 43 + } 44 + }, 45 + "manual": { 46 + "type": "object", 47 + "properties": {} 48 + } 49 + } 50 + }
+1 -1
lexicons/pipeline/cancelPipeline.json
··· 4 4 "defs": { 5 5 "main": { 6 6 "type": "procedure", 7 - "description": "Cancel a running pipeline", 7 + "description": "DEPRECATED: use sh.tangled.ci.pipeline.cancelPipeline instead - Cancel a running pipeline", 8 8 "input": { 9 9 "encoding": "application/json", 10 10 "schema": {
+1
lexicons/pipeline/pipeline.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 + "description": "DEPRECATED: use sh.tangled.ci.defs#pipeline instead", 12 13 "required": [ 13 14 "triggerMetadata", 14 15 "workflows"
+1
lexicons/pipeline/status.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 + "description": "DEPRECATED: use sh.tangled.ci.defs#pipeline instead", 12 13 "required": ["pipeline", "workflow", "status", "createdAt"], 13 14 "properties": { 14 15 "pipeline": {