Monorepo for Tangled
0

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>

authored by

Seongmin Lee and committed by
Tangled
(Jul 4, 2026, 8:12 AM +0300) 8b9f5a70 2b5b9bc7

+2607 -1
+2005
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 (string) (string) 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 len(t.Id) > 1000000 { 1233 + return xerrors.Errorf("Value in field t.Id was too long") 1234 + } 1235 + 1236 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Id))); err != nil { 1237 + return err 1238 + } 1239 + if _, err := cw.WriteString(string(t.Id)); err != nil { 1240 + return err 1241 + } 1242 + 1243 + // t.Name (string) (string) 1244 + if len("name") > 1000000 { 1245 + return xerrors.Errorf("Value in field \"name\" was too long") 1246 + } 1247 + 1248 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("name"))); err != nil { 1249 + return err 1250 + } 1251 + if _, err := cw.WriteString(string("name")); err != nil { 1252 + return err 1253 + } 1254 + 1255 + if len(t.Name) > 1000000 { 1256 + return xerrors.Errorf("Value in field t.Name was too long") 1257 + } 1258 + 1259 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Name))); err != nil { 1260 + return err 1261 + } 1262 + if _, err := cw.WriteString(string(t.Name)); err != nil { 1263 + return err 1264 + } 1265 + 1266 + // t.Status (string) (string) 1267 + if len("status") > 1000000 { 1268 + return xerrors.Errorf("Value in field \"status\" was too long") 1269 + } 1270 + 1271 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { 1272 + return err 1273 + } 1274 + if _, err := cw.WriteString(string("status")); err != nil { 1275 + return err 1276 + } 1277 + 1278 + if len(t.Status) > 1000000 { 1279 + return xerrors.Errorf("Value in field t.Status was too long") 1280 + } 1281 + 1282 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Status))); err != nil { 1283 + return err 1284 + } 1285 + if _, err := cw.WriteString(string(t.Status)); err != nil { 1286 + return err 1287 + } 1288 + 1289 + // t.StartedAt (string) (string) 1290 + if t.StartedAt != nil { 1291 + 1292 + if len("startedAt") > 1000000 { 1293 + return xerrors.Errorf("Value in field \"startedAt\" was too long") 1294 + } 1295 + 1296 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("startedAt"))); err != nil { 1297 + return err 1298 + } 1299 + if _, err := cw.WriteString(string("startedAt")); err != nil { 1300 + return err 1301 + } 1302 + 1303 + if t.StartedAt == nil { 1304 + if _, err := cw.Write(cbg.CborNull); err != nil { 1305 + return err 1306 + } 1307 + } else { 1308 + if len(*t.StartedAt) > 1000000 { 1309 + return xerrors.Errorf("Value in field t.StartedAt was too long") 1310 + } 1311 + 1312 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.StartedAt))); err != nil { 1313 + return err 1314 + } 1315 + if _, err := cw.WriteString(string(*t.StartedAt)); err != nil { 1316 + return err 1317 + } 1318 + } 1319 + } 1320 + 1321 + // t.FinishedAt (string) (string) 1322 + if t.FinishedAt != nil { 1323 + 1324 + if len("finishedAt") > 1000000 { 1325 + return xerrors.Errorf("Value in field \"finishedAt\" was too long") 1326 + } 1327 + 1328 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("finishedAt"))); err != nil { 1329 + return err 1330 + } 1331 + if _, err := cw.WriteString(string("finishedAt")); err != nil { 1332 + return err 1333 + } 1334 + 1335 + if t.FinishedAt == nil { 1336 + if _, err := cw.Write(cbg.CborNull); err != nil { 1337 + return err 1338 + } 1339 + } else { 1340 + if len(*t.FinishedAt) > 1000000 { 1341 + return xerrors.Errorf("Value in field t.FinishedAt was too long") 1342 + } 1343 + 1344 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.FinishedAt))); err != nil { 1345 + return err 1346 + } 1347 + if _, err := cw.WriteString(string(*t.FinishedAt)); err != nil { 1348 + return err 1349 + } 1350 + } 1351 + } 1352 + return nil 1353 + } 1354 + 1355 + func (t *CiDefs_Workflow) UnmarshalCBOR(r io.Reader) (err error) { 1356 + *t = CiDefs_Workflow{} 1357 + 1358 + cr := cbg.NewCborReader(r) 1359 + 1360 + maj, extra, err := cr.ReadHeader() 1361 + if err != nil { 1362 + return err 1363 + } 1364 + defer func() { 1365 + if err == io.EOF { 1366 + err = io.ErrUnexpectedEOF 1367 + } 1368 + }() 1369 + 1370 + if maj != cbg.MajMap { 1371 + return fmt.Errorf("cbor input should be of type map") 1372 + } 1373 + 1374 + if extra > cbg.MaxLength { 1375 + return fmt.Errorf("CiDefs_Workflow: map struct too large (%d)", extra) 1376 + } 1377 + 1378 + n := extra 1379 + 1380 + nameBuf := make([]byte, 10) 1381 + for i := uint64(0); i < n; i++ { 1382 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 1383 + if err != nil { 1384 + return err 1385 + } 1386 + 1387 + if !ok { 1388 + // Field doesn't exist on this type, so ignore it 1389 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 1390 + return err 1391 + } 1392 + continue 1393 + } 1394 + 1395 + switch string(nameBuf[:nameLen]) { 1396 + // t.Id (string) (string) 1397 + case "id": 1398 + 1399 + { 1400 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1401 + if err != nil { 1402 + return err 1403 + } 1404 + 1405 + t.Id = string(sval) 1406 + } 1407 + // t.Name (string) (string) 1408 + case "name": 1409 + 1410 + { 1411 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1412 + if err != nil { 1413 + return err 1414 + } 1415 + 1416 + t.Name = string(sval) 1417 + } 1418 + // t.Status (string) (string) 1419 + case "status": 1420 + 1421 + { 1422 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1423 + if err != nil { 1424 + return err 1425 + } 1426 + 1427 + t.Status = string(sval) 1428 + } 1429 + // t.StartedAt (string) (string) 1430 + case "startedAt": 1431 + 1432 + { 1433 + b, err := cr.ReadByte() 1434 + if err != nil { 1435 + return err 1436 + } 1437 + if b != cbg.CborNull[0] { 1438 + if err := cr.UnreadByte(); err != nil { 1439 + return err 1440 + } 1441 + 1442 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1443 + if err != nil { 1444 + return err 1445 + } 1446 + 1447 + t.StartedAt = (*string)(&sval) 1448 + } 1449 + } 1450 + // t.FinishedAt (string) (string) 1451 + case "finishedAt": 1452 + 1453 + { 1454 + b, err := cr.ReadByte() 1455 + if err != nil { 1456 + return err 1457 + } 1458 + if b != cbg.CborNull[0] { 1459 + if err := cr.UnreadByte(); err != nil { 1460 + return err 1461 + } 1462 + 1463 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1464 + if err != nil { 1465 + return err 1466 + } 1467 + 1468 + t.FinishedAt = (*string)(&sval) 1469 + } 1470 + } 1471 + 1472 + default: 1473 + // Field doesn't exist on this type, so ignore it 1474 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 1475 + return err 1476 + } 1477 + } 1478 + } 1479 + 1480 + return nil 1481 + } 1482 + func (t *CiPipelineSubscribeLogs_Control) MarshalCBOR(w io.Writer) error { 1483 + if t == nil { 1484 + _, err := w.Write(cbg.CborNull) 1485 + return err 1486 + } 1487 + 1488 + cw := cbg.NewCborWriter(w) 1489 + fieldCount := 7 1490 + 1491 + if t.Command == nil { 1492 + fieldCount-- 1493 + } 1494 + 1495 + if t.Kind == nil { 1496 + fieldCount-- 1497 + } 1498 + 1499 + if t.Status == nil { 1500 + fieldCount-- 1501 + } 1502 + 1503 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 1504 + return err 1505 + } 1506 + 1507 + // t.Kind (string) (string) 1508 + if t.Kind != nil { 1509 + 1510 + if len("kind") > 1000000 { 1511 + return xerrors.Errorf("Value in field \"kind\" was too long") 1512 + } 1513 + 1514 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("kind"))); err != nil { 1515 + return err 1516 + } 1517 + if _, err := cw.WriteString(string("kind")); err != nil { 1518 + return err 1519 + } 1520 + 1521 + if t.Kind == nil { 1522 + if _, err := cw.Write(cbg.CborNull); err != nil { 1523 + return err 1524 + } 1525 + } else { 1526 + if len(*t.Kind) > 1000000 { 1527 + return xerrors.Errorf("Value in field t.Kind was too long") 1528 + } 1529 + 1530 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Kind))); err != nil { 1531 + return err 1532 + } 1533 + if _, err := cw.WriteString(string(*t.Kind)); err != nil { 1534 + return err 1535 + } 1536 + } 1537 + } 1538 + 1539 + // t.Step (int64) (int64) 1540 + if len("step") > 1000000 { 1541 + return xerrors.Errorf("Value in field \"step\" was too long") 1542 + } 1543 + 1544 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("step"))); err != nil { 1545 + return err 1546 + } 1547 + if _, err := cw.WriteString(string("step")); err != nil { 1548 + return err 1549 + } 1550 + 1551 + if t.Step >= 0 { 1552 + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Step)); err != nil { 1553 + return err 1554 + } 1555 + } else { 1556 + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Step-1)); err != nil { 1557 + return err 1558 + } 1559 + } 1560 + 1561 + // t.Time (string) (string) 1562 + if len("time") > 1000000 { 1563 + return xerrors.Errorf("Value in field \"time\" was too long") 1564 + } 1565 + 1566 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("time"))); err != nil { 1567 + return err 1568 + } 1569 + if _, err := cw.WriteString(string("time")); err != nil { 1570 + return err 1571 + } 1572 + 1573 + if len(t.Time) > 1000000 { 1574 + return xerrors.Errorf("Value in field t.Time was too long") 1575 + } 1576 + 1577 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Time))); err != nil { 1578 + return err 1579 + } 1580 + if _, err := cw.WriteString(string(t.Time)); err != nil { 1581 + return err 1582 + } 1583 + 1584 + // t.Status (string) (string) 1585 + if t.Status != nil { 1586 + 1587 + if len("status") > 1000000 { 1588 + return xerrors.Errorf("Value in field \"status\" was too long") 1589 + } 1590 + 1591 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("status"))); err != nil { 1592 + return err 1593 + } 1594 + if _, err := cw.WriteString(string("status")); err != nil { 1595 + return err 1596 + } 1597 + 1598 + if t.Status == nil { 1599 + if _, err := cw.Write(cbg.CborNull); err != nil { 1600 + return err 1601 + } 1602 + } else { 1603 + if len(*t.Status) > 1000000 { 1604 + return xerrors.Errorf("Value in field t.Status was too long") 1605 + } 1606 + 1607 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Status))); err != nil { 1608 + return err 1609 + } 1610 + if _, err := cw.WriteString(string(*t.Status)); err != nil { 1611 + return err 1612 + } 1613 + } 1614 + } 1615 + 1616 + // t.Command (string) (string) 1617 + if t.Command != nil { 1618 + 1619 + if len("command") > 1000000 { 1620 + return xerrors.Errorf("Value in field \"command\" was too long") 1621 + } 1622 + 1623 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("command"))); err != nil { 1624 + return err 1625 + } 1626 + if _, err := cw.WriteString(string("command")); err != nil { 1627 + return err 1628 + } 1629 + 1630 + if t.Command == nil { 1631 + if _, err := cw.Write(cbg.CborNull); err != nil { 1632 + return err 1633 + } 1634 + } else { 1635 + if len(*t.Command) > 1000000 { 1636 + return xerrors.Errorf("Value in field t.Command was too long") 1637 + } 1638 + 1639 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Command))); err != nil { 1640 + return err 1641 + } 1642 + if _, err := cw.WriteString(string(*t.Command)); err != nil { 1643 + return err 1644 + } 1645 + } 1646 + } 1647 + 1648 + // t.Content (string) (string) 1649 + if len("content") > 1000000 { 1650 + return xerrors.Errorf("Value in field \"content\" was too long") 1651 + } 1652 + 1653 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("content"))); err != nil { 1654 + return err 1655 + } 1656 + if _, err := cw.WriteString(string("content")); err != nil { 1657 + return err 1658 + } 1659 + 1660 + if len(t.Content) > 1000000 { 1661 + return xerrors.Errorf("Value in field t.Content was too long") 1662 + } 1663 + 1664 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Content))); err != nil { 1665 + return err 1666 + } 1667 + if _, err := cw.WriteString(string(t.Content)); err != nil { 1668 + return err 1669 + } 1670 + 1671 + // t.Workflow (string) (string) 1672 + if len("workflow") > 1000000 { 1673 + return xerrors.Errorf("Value in field \"workflow\" was too long") 1674 + } 1675 + 1676 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflow"))); err != nil { 1677 + return err 1678 + } 1679 + if _, err := cw.WriteString(string("workflow")); err != nil { 1680 + return err 1681 + } 1682 + 1683 + if len(t.Workflow) > 1000000 { 1684 + return xerrors.Errorf("Value in field t.Workflow was too long") 1685 + } 1686 + 1687 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Workflow))); err != nil { 1688 + return err 1689 + } 1690 + if _, err := cw.WriteString(string(t.Workflow)); err != nil { 1691 + return err 1692 + } 1693 + return nil 1694 + } 1695 + 1696 + func (t *CiPipelineSubscribeLogs_Control) UnmarshalCBOR(r io.Reader) (err error) { 1697 + *t = CiPipelineSubscribeLogs_Control{} 1698 + 1699 + cr := cbg.NewCborReader(r) 1700 + 1701 + maj, extra, err := cr.ReadHeader() 1702 + if err != nil { 1703 + return err 1704 + } 1705 + defer func() { 1706 + if err == io.EOF { 1707 + err = io.ErrUnexpectedEOF 1708 + } 1709 + }() 1710 + 1711 + if maj != cbg.MajMap { 1712 + return fmt.Errorf("cbor input should be of type map") 1713 + } 1714 + 1715 + if extra > cbg.MaxLength { 1716 + return fmt.Errorf("CiPipelineSubscribeLogs_Control: map struct too large (%d)", extra) 1717 + } 1718 + 1719 + n := extra 1720 + 1721 + nameBuf := make([]byte, 8) 1722 + for i := uint64(0); i < n; i++ { 1723 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 1724 + if err != nil { 1725 + return err 1726 + } 1727 + 1728 + if !ok { 1729 + // Field doesn't exist on this type, so ignore it 1730 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 1731 + return err 1732 + } 1733 + continue 1734 + } 1735 + 1736 + switch string(nameBuf[:nameLen]) { 1737 + // t.Kind (string) (string) 1738 + case "kind": 1739 + 1740 + { 1741 + b, err := cr.ReadByte() 1742 + if err != nil { 1743 + return err 1744 + } 1745 + if b != cbg.CborNull[0] { 1746 + if err := cr.UnreadByte(); err != nil { 1747 + return err 1748 + } 1749 + 1750 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1751 + if err != nil { 1752 + return err 1753 + } 1754 + 1755 + t.Kind = (*string)(&sval) 1756 + } 1757 + } 1758 + // t.Step (int64) (int64) 1759 + case "step": 1760 + { 1761 + maj, extra, err := cr.ReadHeader() 1762 + if err != nil { 1763 + return err 1764 + } 1765 + var extraI int64 1766 + switch maj { 1767 + case cbg.MajUnsignedInt: 1768 + extraI = int64(extra) 1769 + if extraI < 0 { 1770 + return fmt.Errorf("int64 positive overflow") 1771 + } 1772 + case cbg.MajNegativeInt: 1773 + extraI = int64(extra) 1774 + if extraI < 0 { 1775 + return fmt.Errorf("int64 negative overflow") 1776 + } 1777 + extraI = -1 - extraI 1778 + default: 1779 + return fmt.Errorf("wrong type for int64 field: %d", maj) 1780 + } 1781 + 1782 + t.Step = int64(extraI) 1783 + } 1784 + // t.Time (string) (string) 1785 + case "time": 1786 + 1787 + { 1788 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1789 + if err != nil { 1790 + return err 1791 + } 1792 + 1793 + t.Time = string(sval) 1794 + } 1795 + // t.Status (string) (string) 1796 + case "status": 1797 + 1798 + { 1799 + b, err := cr.ReadByte() 1800 + if err != nil { 1801 + return err 1802 + } 1803 + if b != cbg.CborNull[0] { 1804 + if err := cr.UnreadByte(); err != nil { 1805 + return err 1806 + } 1807 + 1808 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1809 + if err != nil { 1810 + return err 1811 + } 1812 + 1813 + t.Status = (*string)(&sval) 1814 + } 1815 + } 1816 + // t.Command (string) (string) 1817 + case "command": 1818 + 1819 + { 1820 + b, err := cr.ReadByte() 1821 + if err != nil { 1822 + return err 1823 + } 1824 + if b != cbg.CborNull[0] { 1825 + if err := cr.UnreadByte(); err != nil { 1826 + return err 1827 + } 1828 + 1829 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1830 + if err != nil { 1831 + return err 1832 + } 1833 + 1834 + t.Command = (*string)(&sval) 1835 + } 1836 + } 1837 + // t.Content (string) (string) 1838 + case "content": 1839 + 1840 + { 1841 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1842 + if err != nil { 1843 + return err 1844 + } 1845 + 1846 + t.Content = string(sval) 1847 + } 1848 + // t.Workflow (string) (string) 1849 + case "workflow": 1850 + 1851 + { 1852 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1853 + if err != nil { 1854 + return err 1855 + } 1856 + 1857 + t.Workflow = string(sval) 1858 + } 1859 + 1860 + default: 1861 + // Field doesn't exist on this type, so ignore it 1862 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 1863 + return err 1864 + } 1865 + } 1866 + } 1867 + 1868 + return nil 1869 + } 1870 + func (t *CiPipelineSubscribeLogs_Data) MarshalCBOR(w io.Writer) error { 1871 + if t == nil { 1872 + _, err := w.Write(cbg.CborNull) 1873 + return err 1874 + } 1875 + 1876 + cw := cbg.NewCborWriter(w) 1877 + 1878 + if _, err := cw.Write([]byte{165}); err != nil { 1879 + return err 1880 + } 1881 + 1882 + // t.Step (int64) (int64) 1883 + if len("step") > 1000000 { 1884 + return xerrors.Errorf("Value in field \"step\" was too long") 1885 + } 1886 + 1887 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("step"))); err != nil { 1888 + return err 1889 + } 1890 + if _, err := cw.WriteString(string("step")); err != nil { 1891 + return err 1892 + } 1893 + 1894 + if t.Step >= 0 { 1895 + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Step)); err != nil { 1896 + return err 1897 + } 1898 + } else { 1899 + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Step-1)); err != nil { 1900 + return err 1901 + } 1902 + } 1903 + 1904 + // t.Time (string) (string) 1905 + if len("time") > 1000000 { 1906 + return xerrors.Errorf("Value in field \"time\" was too long") 1907 + } 1908 + 1909 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("time"))); err != nil { 1910 + return err 1911 + } 1912 + if _, err := cw.WriteString(string("time")); err != nil { 1913 + return err 1914 + } 1915 + 1916 + if len(t.Time) > 1000000 { 1917 + return xerrors.Errorf("Value in field t.Time was too long") 1918 + } 1919 + 1920 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Time))); err != nil { 1921 + return err 1922 + } 1923 + if _, err := cw.WriteString(string(t.Time)); err != nil { 1924 + return err 1925 + } 1926 + 1927 + // t.Stream (string) (string) 1928 + if len("stream") > 1000000 { 1929 + return xerrors.Errorf("Value in field \"stream\" was too long") 1930 + } 1931 + 1932 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("stream"))); err != nil { 1933 + return err 1934 + } 1935 + if _, err := cw.WriteString(string("stream")); err != nil { 1936 + return err 1937 + } 1938 + 1939 + if len(t.Stream) > 1000000 { 1940 + return xerrors.Errorf("Value in field t.Stream was too long") 1941 + } 1942 + 1943 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Stream))); err != nil { 1944 + return err 1945 + } 1946 + if _, err := cw.WriteString(string(t.Stream)); err != nil { 1947 + return err 1948 + } 1949 + 1950 + // t.Content (string) (string) 1951 + if len("content") > 1000000 { 1952 + return xerrors.Errorf("Value in field \"content\" was too long") 1953 + } 1954 + 1955 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("content"))); err != nil { 1956 + return err 1957 + } 1958 + if _, err := cw.WriteString(string("content")); err != nil { 1959 + return err 1960 + } 1961 + 1962 + if len(t.Content) > 1000000 { 1963 + return xerrors.Errorf("Value in field t.Content was too long") 1964 + } 1965 + 1966 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Content))); err != nil { 1967 + return err 1968 + } 1969 + if _, err := cw.WriteString(string(t.Content)); err != nil { 1970 + return err 1971 + } 1972 + 1973 + // t.Workflow (string) (string) 1974 + if len("workflow") > 1000000 { 1975 + return xerrors.Errorf("Value in field \"workflow\" was too long") 1976 + } 1977 + 1978 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("workflow"))); err != nil { 1979 + return err 1980 + } 1981 + if _, err := cw.WriteString(string("workflow")); err != nil { 1982 + return err 1983 + } 1984 + 1985 + if len(t.Workflow) > 1000000 { 1986 + return xerrors.Errorf("Value in field t.Workflow was too long") 1987 + } 1988 + 1989 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Workflow))); err != nil { 1990 + return err 1991 + } 1992 + if _, err := cw.WriteString(string(t.Workflow)); err != nil { 1993 + return err 1994 + } 1995 + return nil 1996 + } 1997 + 1998 + func (t *CiPipelineSubscribeLogs_Data) UnmarshalCBOR(r io.Reader) (err error) { 1999 + *t = CiPipelineSubscribeLogs_Data{} 2000 + 2001 + cr := cbg.NewCborReader(r) 2002 + 2003 + maj, extra, err := cr.ReadHeader() 2004 + if err != nil { 2005 + return err 2006 + } 2007 + defer func() { 2008 + if err == io.EOF { 2009 + err = io.ErrUnexpectedEOF 2010 + } 2011 + }() 2012 + 2013 + if maj != cbg.MajMap { 2014 + return fmt.Errorf("cbor input should be of type map") 2015 + } 2016 + 2017 + if extra > cbg.MaxLength { 2018 + return fmt.Errorf("CiPipelineSubscribeLogs_Data: map struct too large (%d)", extra) 2019 + } 2020 + 2021 + n := extra 2022 + 2023 + nameBuf := make([]byte, 8) 2024 + for i := uint64(0); i < n; i++ { 2025 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 2026 + if err != nil { 2027 + return err 2028 + } 2029 + 2030 + if !ok { 2031 + // Field doesn't exist on this type, so ignore it 2032 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 2033 + return err 2034 + } 2035 + continue 2036 + } 2037 + 2038 + switch string(nameBuf[:nameLen]) { 2039 + // t.Step (int64) (int64) 2040 + case "step": 2041 + { 2042 + maj, extra, err := cr.ReadHeader() 2043 + if err != nil { 2044 + return err 2045 + } 2046 + var extraI int64 2047 + switch maj { 2048 + case cbg.MajUnsignedInt: 2049 + extraI = int64(extra) 2050 + if extraI < 0 { 2051 + return fmt.Errorf("int64 positive overflow") 2052 + } 2053 + case cbg.MajNegativeInt: 2054 + extraI = int64(extra) 2055 + if extraI < 0 { 2056 + return fmt.Errorf("int64 negative overflow") 2057 + } 2058 + extraI = -1 - extraI 2059 + default: 2060 + return fmt.Errorf("wrong type for int64 field: %d", maj) 2061 + } 2062 + 2063 + t.Step = int64(extraI) 2064 + } 2065 + // t.Time (string) (string) 2066 + case "time": 2067 + 2068 + { 2069 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2070 + if err != nil { 2071 + return err 2072 + } 2073 + 2074 + t.Time = string(sval) 2075 + } 2076 + // t.Stream (string) (string) 2077 + case "stream": 2078 + 2079 + { 2080 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2081 + if err != nil { 2082 + return err 2083 + } 2084 + 2085 + t.Stream = string(sval) 2086 + } 2087 + // t.Content (string) (string) 2088 + case "content": 2089 + 2090 + { 2091 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2092 + if err != nil { 2093 + return err 2094 + } 2095 + 2096 + t.Content = string(sval) 2097 + } 2098 + // t.Workflow (string) (string) 2099 + case "workflow": 2100 + 2101 + { 2102 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2103 + if err != nil { 2104 + return err 2105 + } 2106 + 2107 + t.Workflow = string(sval) 2108 + } 2109 + 2110 + default: 2111 + // Field doesn't exist on this type, so ignore it 2112 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 2113 + return err 2114 + } 2115 + } 2116 + } 2117 + 2118 + return nil 2119 + } 2120 + func (t *CiTrigger_Manual) MarshalCBOR(w io.Writer) error { 2121 + if t == nil { 2122 + _, err := w.Write(cbg.CborNull) 2123 + return err 2124 + } 2125 + 2126 + cw := cbg.NewCborWriter(w) 2127 + 2128 + if _, err := cw.Write([]byte{161}); err != nil { 2129 + return err 2130 + } 2131 + 2132 + // t.LexiconTypeID (string) (string) 2133 + if len("$type") > 1000000 { 2134 + return xerrors.Errorf("Value in field \"$type\" was too long") 2135 + } 2136 + 2137 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2138 + return err 2139 + } 2140 + if _, err := cw.WriteString(string("$type")); err != nil { 2141 + return err 2142 + } 2143 + 2144 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.trigger#manual"))); err != nil { 2145 + return err 2146 + } 2147 + if _, err := cw.WriteString(string("sh.tangled.ci.trigger#manual")); err != nil { 2148 + return err 2149 + } 2150 + return nil 2151 + } 2152 + 2153 + func (t *CiTrigger_Manual) UnmarshalCBOR(r io.Reader) (err error) { 2154 + *t = CiTrigger_Manual{} 2155 + 2156 + cr := cbg.NewCborReader(r) 2157 + 2158 + maj, extra, err := cr.ReadHeader() 2159 + if err != nil { 2160 + return err 2161 + } 2162 + defer func() { 2163 + if err == io.EOF { 2164 + err = io.ErrUnexpectedEOF 2165 + } 2166 + }() 2167 + 2168 + if maj != cbg.MajMap { 2169 + return fmt.Errorf("cbor input should be of type map") 2170 + } 2171 + 2172 + if extra > cbg.MaxLength { 2173 + return fmt.Errorf("CiTrigger_Manual: map struct too large (%d)", extra) 2174 + } 2175 + 2176 + n := extra 2177 + 2178 + nameBuf := make([]byte, 5) 2179 + for i := uint64(0); i < n; i++ { 2180 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 2181 + if err != nil { 2182 + return err 2183 + } 2184 + 2185 + if !ok { 2186 + // Field doesn't exist on this type, so ignore it 2187 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 2188 + return err 2189 + } 2190 + continue 2191 + } 2192 + 2193 + switch string(nameBuf[:nameLen]) { 2194 + // t.LexiconTypeID (string) (string) 2195 + case "$type": 2196 + 2197 + { 2198 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2199 + if err != nil { 2200 + return err 2201 + } 2202 + 2203 + t.LexiconTypeID = string(sval) 2204 + } 2205 + 2206 + default: 2207 + // Field doesn't exist on this type, so ignore it 2208 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 2209 + return err 2210 + } 2211 + } 2212 + } 2213 + 2214 + return nil 2215 + } 2216 + func (t *CiTrigger_PullRequest) MarshalCBOR(w io.Writer) error { 2217 + if t == nil { 2218 + _, err := w.Write(cbg.CborNull) 2219 + return err 2220 + } 2221 + 2222 + cw := cbg.NewCborWriter(w) 2223 + fieldCount := 5 2224 + 2225 + if t.SourceBranch == nil { 2226 + fieldCount-- 2227 + } 2228 + 2229 + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 2230 + return err 2231 + } 2232 + 2233 + // t.LexiconTypeID (string) (string) 2234 + if len("$type") > 1000000 { 2235 + return xerrors.Errorf("Value in field \"$type\" was too long") 2236 + } 2237 + 2238 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2239 + return err 2240 + } 2241 + if _, err := cw.WriteString(string("$type")); err != nil { 2242 + return err 2243 + } 2244 + 2245 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.trigger#pullRequest"))); err != nil { 2246 + return err 2247 + } 2248 + if _, err := cw.WriteString(string("sh.tangled.ci.trigger#pullRequest")); err != nil { 2249 + return err 2250 + } 2251 + 2252 + // t.Action (string) (string) 2253 + if len("action") > 1000000 { 2254 + return xerrors.Errorf("Value in field \"action\" was too long") 2255 + } 2256 + 2257 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("action"))); err != nil { 2258 + return err 2259 + } 2260 + if _, err := cw.WriteString(string("action")); err != nil { 2261 + return err 2262 + } 2263 + 2264 + if len(t.Action) > 1000000 { 2265 + return xerrors.Errorf("Value in field t.Action was too long") 2266 + } 2267 + 2268 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Action))); err != nil { 2269 + return err 2270 + } 2271 + if _, err := cw.WriteString(string(t.Action)); err != nil { 2272 + return err 2273 + } 2274 + 2275 + // t.SourceSha (string) (string) 2276 + if len("sourceSha") > 1000000 { 2277 + return xerrors.Errorf("Value in field \"sourceSha\" was too long") 2278 + } 2279 + 2280 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sourceSha"))); err != nil { 2281 + return err 2282 + } 2283 + if _, err := cw.WriteString(string("sourceSha")); err != nil { 2284 + return err 2285 + } 2286 + 2287 + if len(t.SourceSha) > 1000000 { 2288 + return xerrors.Errorf("Value in field t.SourceSha was too long") 2289 + } 2290 + 2291 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.SourceSha))); err != nil { 2292 + return err 2293 + } 2294 + if _, err := cw.WriteString(string(t.SourceSha)); err != nil { 2295 + return err 2296 + } 2297 + 2298 + // t.SourceBranch (string) (string) 2299 + if t.SourceBranch != nil { 2300 + 2301 + if len("sourceBranch") > 1000000 { 2302 + return xerrors.Errorf("Value in field \"sourceBranch\" was too long") 2303 + } 2304 + 2305 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sourceBranch"))); err != nil { 2306 + return err 2307 + } 2308 + if _, err := cw.WriteString(string("sourceBranch")); err != nil { 2309 + return err 2310 + } 2311 + 2312 + if t.SourceBranch == nil { 2313 + if _, err := cw.Write(cbg.CborNull); err != nil { 2314 + return err 2315 + } 2316 + } else { 2317 + if len(*t.SourceBranch) > 1000000 { 2318 + return xerrors.Errorf("Value in field t.SourceBranch was too long") 2319 + } 2320 + 2321 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.SourceBranch))); err != nil { 2322 + return err 2323 + } 2324 + if _, err := cw.WriteString(string(*t.SourceBranch)); err != nil { 2325 + return err 2326 + } 2327 + } 2328 + } 2329 + 2330 + // t.TargetBranch (string) (string) 2331 + if len("targetBranch") > 1000000 { 2332 + return xerrors.Errorf("Value in field \"targetBranch\" was too long") 2333 + } 2334 + 2335 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("targetBranch"))); err != nil { 2336 + return err 2337 + } 2338 + if _, err := cw.WriteString(string("targetBranch")); err != nil { 2339 + return err 2340 + } 2341 + 2342 + if len(t.TargetBranch) > 1000000 { 2343 + return xerrors.Errorf("Value in field t.TargetBranch was too long") 2344 + } 2345 + 2346 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.TargetBranch))); err != nil { 2347 + return err 2348 + } 2349 + if _, err := cw.WriteString(string(t.TargetBranch)); err != nil { 2350 + return err 2351 + } 2352 + return nil 2353 + } 2354 + 2355 + func (t *CiTrigger_PullRequest) UnmarshalCBOR(r io.Reader) (err error) { 2356 + *t = CiTrigger_PullRequest{} 2357 + 2358 + cr := cbg.NewCborReader(r) 2359 + 2360 + maj, extra, err := cr.ReadHeader() 2361 + if err != nil { 2362 + return err 2363 + } 2364 + defer func() { 2365 + if err == io.EOF { 2366 + err = io.ErrUnexpectedEOF 2367 + } 2368 + }() 2369 + 2370 + if maj != cbg.MajMap { 2371 + return fmt.Errorf("cbor input should be of type map") 2372 + } 2373 + 2374 + if extra > cbg.MaxLength { 2375 + return fmt.Errorf("CiTrigger_PullRequest: map struct too large (%d)", extra) 2376 + } 2377 + 2378 + n := extra 2379 + 2380 + nameBuf := make([]byte, 12) 2381 + for i := uint64(0); i < n; i++ { 2382 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 2383 + if err != nil { 2384 + return err 2385 + } 2386 + 2387 + if !ok { 2388 + // Field doesn't exist on this type, so ignore it 2389 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 2390 + return err 2391 + } 2392 + continue 2393 + } 2394 + 2395 + switch string(nameBuf[:nameLen]) { 2396 + // t.LexiconTypeID (string) (string) 2397 + case "$type": 2398 + 2399 + { 2400 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2401 + if err != nil { 2402 + return err 2403 + } 2404 + 2405 + t.LexiconTypeID = string(sval) 2406 + } 2407 + // t.Action (string) (string) 2408 + case "action": 2409 + 2410 + { 2411 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2412 + if err != nil { 2413 + return err 2414 + } 2415 + 2416 + t.Action = string(sval) 2417 + } 2418 + // t.SourceSha (string) (string) 2419 + case "sourceSha": 2420 + 2421 + { 2422 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2423 + if err != nil { 2424 + return err 2425 + } 2426 + 2427 + t.SourceSha = string(sval) 2428 + } 2429 + // t.SourceBranch (string) (string) 2430 + case "sourceBranch": 2431 + 2432 + { 2433 + b, err := cr.ReadByte() 2434 + if err != nil { 2435 + return err 2436 + } 2437 + if b != cbg.CborNull[0] { 2438 + if err := cr.UnreadByte(); err != nil { 2439 + return err 2440 + } 2441 + 2442 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2443 + if err != nil { 2444 + return err 2445 + } 2446 + 2447 + t.SourceBranch = (*string)(&sval) 2448 + } 2449 + } 2450 + // t.TargetBranch (string) (string) 2451 + case "targetBranch": 2452 + 2453 + { 2454 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2455 + if err != nil { 2456 + return err 2457 + } 2458 + 2459 + t.TargetBranch = string(sval) 2460 + } 2461 + 2462 + default: 2463 + // Field doesn't exist on this type, so ignore it 2464 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 2465 + return err 2466 + } 2467 + } 2468 + } 2469 + 2470 + return nil 2471 + } 2472 + func (t *CiTrigger_Push) MarshalCBOR(w io.Writer) error { 2473 + if t == nil { 2474 + _, err := w.Write(cbg.CborNull) 2475 + return err 2476 + } 2477 + 2478 + cw := cbg.NewCborWriter(w) 2479 + 2480 + if _, err := cw.Write([]byte{164}); err != nil { 2481 + return err 2482 + } 2483 + 2484 + // t.Ref (string) (string) 2485 + if len("ref") > 1000000 { 2486 + return xerrors.Errorf("Value in field \"ref\" was too long") 2487 + } 2488 + 2489 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ref"))); err != nil { 2490 + return err 2491 + } 2492 + if _, err := cw.WriteString(string("ref")); err != nil { 2493 + return err 2494 + } 2495 + 2496 + if len(t.Ref) > 1000000 { 2497 + return xerrors.Errorf("Value in field t.Ref was too long") 2498 + } 2499 + 2500 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Ref))); err != nil { 2501 + return err 2502 + } 2503 + if _, err := cw.WriteString(string(t.Ref)); err != nil { 2504 + return err 2505 + } 2506 + 2507 + // t.LexiconTypeID (string) (string) 2508 + if len("$type") > 1000000 { 2509 + return xerrors.Errorf("Value in field \"$type\" was too long") 2510 + } 2511 + 2512 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { 2513 + return err 2514 + } 2515 + if _, err := cw.WriteString(string("$type")); err != nil { 2516 + return err 2517 + } 2518 + 2519 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("sh.tangled.ci.trigger#push"))); err != nil { 2520 + return err 2521 + } 2522 + if _, err := cw.WriteString(string("sh.tangled.ci.trigger#push")); err != nil { 2523 + return err 2524 + } 2525 + 2526 + // t.NewSha (string) (string) 2527 + if len("newSha") > 1000000 { 2528 + return xerrors.Errorf("Value in field \"newSha\" was too long") 2529 + } 2530 + 2531 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("newSha"))); err != nil { 2532 + return err 2533 + } 2534 + if _, err := cw.WriteString(string("newSha")); err != nil { 2535 + return err 2536 + } 2537 + 2538 + if len(t.NewSha) > 1000000 { 2539 + return xerrors.Errorf("Value in field t.NewSha was too long") 2540 + } 2541 + 2542 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.NewSha))); err != nil { 2543 + return err 2544 + } 2545 + if _, err := cw.WriteString(string(t.NewSha)); err != nil { 2546 + return err 2547 + } 2548 + 2549 + // t.OldSha (string) (string) 2550 + if len("oldSha") > 1000000 { 2551 + return xerrors.Errorf("Value in field \"oldSha\" was too long") 2552 + } 2553 + 2554 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("oldSha"))); err != nil { 2555 + return err 2556 + } 2557 + if _, err := cw.WriteString(string("oldSha")); err != nil { 2558 + return err 2559 + } 2560 + 2561 + if len(t.OldSha) > 1000000 { 2562 + return xerrors.Errorf("Value in field t.OldSha was too long") 2563 + } 2564 + 2565 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.OldSha))); err != nil { 2566 + return err 2567 + } 2568 + if _, err := cw.WriteString(string(t.OldSha)); err != nil { 2569 + return err 2570 + } 2571 + return nil 2572 + } 2573 + 2574 + func (t *CiTrigger_Push) UnmarshalCBOR(r io.Reader) (err error) { 2575 + *t = CiTrigger_Push{} 2576 + 2577 + cr := cbg.NewCborReader(r) 2578 + 2579 + maj, extra, err := cr.ReadHeader() 2580 + if err != nil { 2581 + return err 2582 + } 2583 + defer func() { 2584 + if err == io.EOF { 2585 + err = io.ErrUnexpectedEOF 2586 + } 2587 + }() 2588 + 2589 + if maj != cbg.MajMap { 2590 + return fmt.Errorf("cbor input should be of type map") 2591 + } 2592 + 2593 + if extra > cbg.MaxLength { 2594 + return fmt.Errorf("CiTrigger_Push: map struct too large (%d)", extra) 2595 + } 2596 + 2597 + n := extra 2598 + 2599 + nameBuf := make([]byte, 6) 2600 + for i := uint64(0); i < n; i++ { 2601 + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) 2602 + if err != nil { 2603 + return err 2604 + } 2605 + 2606 + if !ok { 2607 + // Field doesn't exist on this type, so ignore it 2608 + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { 2609 + return err 2610 + } 2611 + continue 2612 + } 2613 + 2614 + switch string(nameBuf[:nameLen]) { 2615 + // t.Ref (string) (string) 2616 + case "ref": 2617 + 2618 + { 2619 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2620 + if err != nil { 2621 + return err 2622 + } 2623 + 2624 + t.Ref = string(sval) 2625 + } 2626 + // t.LexiconTypeID (string) (string) 2627 + case "$type": 2628 + 2629 + { 2630 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2631 + if err != nil { 2632 + return err 2633 + } 2634 + 2635 + t.LexiconTypeID = string(sval) 2636 + } 2637 + // t.NewSha (string) (string) 2638 + case "newSha": 2639 + 2640 + { 2641 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2642 + if err != nil { 2643 + return err 2644 + } 2645 + 2646 + t.NewSha = string(sval) 2647 + } 2648 + // t.OldSha (string) (string) 2649 + case "oldSha": 2650 + 2651 + { 2652 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2653 + if err != nil { 2654 + return err 2655 + } 2656 + 2657 + t.OldSha = string(sval) 2658 + } 2659 + 2660 + default: 2661 + // Field doesn't exist on this type, so ignore it 2662 + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { 2663 + return err 2664 + } 2665 + } 2666 + } 2667 + 2668 + return nil 2669 + } 665 2670 func (t *FeedComment) MarshalCBOR(w io.Writer) error { 666 2671 if t == nil { 667 2672 _, 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. Unique per pipeline, usually same as name. 79 + Id string `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{},
+84
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 + "description": "Spindle-local pipeline id" 12 + }, 13 + "repo": { 14 + "type": "string", 15 + "format": "did", 16 + "description": "Repository DID" 17 + }, 18 + "trigger": { 19 + "type": "union", 20 + "refs": [ 21 + "sh.tangled.ci.trigger#push", 22 + "sh.tangled.ci.trigger#pullRequest", 23 + "sh.tangled.ci.trigger#manual" 24 + ], 25 + "description": "Trigger event metadata" 26 + }, 27 + "commit": { 28 + "type": "string", 29 + "description": "Commit Id this pipeline is running on" 30 + }, 31 + "createdAt": { 32 + "type": "string", 33 + "format": "datetime" 34 + }, 35 + "workflows": { 36 + "type": "array", 37 + "description": "Triggered workflows", 38 + "minLength": 1, 39 + "maxLength": 50, 40 + "items": { 41 + "type": "ref", 42 + "ref": "#workflow" 43 + } 44 + } 45 + } 46 + }, 47 + "workflow": { 48 + "type": "object", 49 + "required": ["id", "name", "status"], 50 + "properties": { 51 + "id": { 52 + "type": "string", 53 + "description": "Spindle-local workflow id. Unique per pipeline, usually same as name." 54 + }, 55 + "name": { 56 + "type": "string", 57 + "description": "Name of the workflow", 58 + "minGraphemes": 1, 59 + "maxGraphemes": 40 60 + }, 61 + "status": { 62 + "type": "string", 63 + "description": "Workflow status", 64 + "enum": [ 65 + "pending", 66 + "running", 67 + "failed", 68 + "timeout", 69 + "cancelled", 70 + "success" 71 + ] 72 + }, 73 + "startedAt": { 74 + "type": "string", 75 + "format": "datetime" 76 + }, 77 + "finishedAt": { 78 + "type": "string", 79 + "format": "datetime" 80 + } 81 + } 82 + } 83 + } 84 + }
+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": {