cricinfo-cli-go 0.1.1 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,8 @@ const (
16
16
  EntityMatch EntityKind = "match"
17
17
  EntityMatchScorecard EntityKind = "match_scorecard"
18
18
  EntityMatchSituation EntityKind = "match_situation"
19
+ EntityMatchDuel EntityKind = "match_duel"
20
+ EntityMatchPhases EntityKind = "match_phases"
19
21
  EntityCompetition EntityKind = "competition"
20
22
  EntityCompOfficial EntityKind = "competition_official"
21
23
  EntityCompBroadcast EntityKind = "competition_broadcast"
@@ -118,6 +120,43 @@ type MatchScorecard struct {
118
120
  Extensions map[string]any `json:"extensions,omitempty"`
119
121
  }
120
122
 
123
+ // MatchPhases is a fan-oriented phase/momentum breakdown for each innings.
124
+ type MatchPhases struct {
125
+ MatchID string `json:"matchId,omitempty"`
126
+ LeagueID string `json:"leagueId,omitempty"`
127
+ EventID string `json:"eventId,omitempty"`
128
+ CompetitionID string `json:"competitionId,omitempty"`
129
+ Fixture string `json:"fixture,omitempty"`
130
+ Result string `json:"result,omitempty"`
131
+ Innings []MatchPhaseInning `json:"innings,omitempty"`
132
+ }
133
+
134
+ // MatchPhaseInning captures phase splits and momentum points for one innings.
135
+ type MatchPhaseInning struct {
136
+ TeamID string `json:"teamId,omitempty"`
137
+ TeamName string `json:"teamName,omitempty"`
138
+ InningsNumber int `json:"inningsNumber,omitempty"`
139
+ Period int `json:"period,omitempty"`
140
+ Score string `json:"score,omitempty"`
141
+ Target int `json:"target,omitempty"`
142
+ Powerplay PhaseSummary `json:"powerplay,omitempty"`
143
+ Middle PhaseSummary `json:"middle,omitempty"`
144
+ Death PhaseSummary `json:"death,omitempty"`
145
+ BestScoringOver int `json:"bestScoringOver,omitempty"`
146
+ BestScoringOverRuns int `json:"bestScoringOverRuns,omitempty"`
147
+ CollapseOver int `json:"collapseOver,omitempty"`
148
+ CollapseWickets int `json:"collapseWickets,omitempty"`
149
+ }
150
+
151
+ // PhaseSummary is a normalized run/wicket split across a phase bucket.
152
+ type PhaseSummary struct {
153
+ Name string `json:"name,omitempty"`
154
+ Runs int `json:"runs,omitempty"`
155
+ Wickets int `json:"wickets,omitempty"`
156
+ Overs float64 `json:"overs,omitempty"`
157
+ RunRate float64 `json:"runRate,omitempty"`
158
+ }
159
+
121
160
  // BattingCard is a normalized batting card section from matchcards.
122
161
  type BattingCard struct {
123
162
  InningsNumber int `json:"inningsNumber,omitempty"`
@@ -188,9 +227,78 @@ type MatchSituation struct {
188
227
  MatchID string `json:"matchId,omitempty"`
189
228
  OddsRef string `json:"oddsRef,omitempty"`
190
229
  Data map[string]any `json:"data,omitempty"`
230
+ Live *MatchLiveView `json:"live,omitempty"`
191
231
  Extensions map[string]any `json:"extensions,omitempty"`
192
232
  }
193
233
 
234
+ // MatchLiveView is a synthesized fan-first live snapshot when upstream situation payload is sparse.
235
+ type MatchLiveView struct {
236
+ Fixture string `json:"fixture,omitempty"`
237
+ Status string `json:"status,omitempty"`
238
+ Score string `json:"score,omitempty"`
239
+ Overs string `json:"overs,omitempty"`
240
+ CurrentOver int `json:"currentOver,omitempty"`
241
+ BallInOver int `json:"ballInOver,omitempty"`
242
+ BattingTeam string `json:"battingTeam,omitempty"`
243
+ BowlingTeam string `json:"bowlingTeam,omitempty"`
244
+ Batters []LiveBatterView `json:"batters,omitempty"`
245
+ Bowlers []LiveBowlerView `json:"bowlers,omitempty"`
246
+ RecentBalls []DeliveryEvent `json:"recentBalls,omitempty"`
247
+ CurrentBalls []DeliveryEvent `json:"currentOverBalls,omitempty"`
248
+ LastDetailID string `json:"lastDetailId,omitempty"`
249
+ LastUpdateMS int64 `json:"lastUpdateMs,omitempty"`
250
+ SnapshotAt string `json:"snapshotAt,omitempty"`
251
+ SourceRoute string `json:"sourceRoute,omitempty"`
252
+ Stale bool `json:"stale"`
253
+ StaleReason string `json:"staleReason,omitempty"`
254
+ }
255
+
256
+ // LiveBatterView captures in-progress batter figures.
257
+ type LiveBatterView struct {
258
+ PlayerID string `json:"playerId,omitempty"`
259
+ PlayerName string `json:"playerName,omitempty"`
260
+ Runs int `json:"runs,omitempty"`
261
+ Balls int `json:"balls,omitempty"`
262
+ Fours int `json:"fours,omitempty"`
263
+ Sixes int `json:"sixes,omitempty"`
264
+ StrikeRate float64 `json:"strikeRate,omitempty"`
265
+ OnStrike bool `json:"onStrike"`
266
+ }
267
+
268
+ // LiveBowlerView captures in-progress bowler figures.
269
+ type LiveBowlerView struct {
270
+ PlayerID string `json:"playerId,omitempty"`
271
+ PlayerName string `json:"playerName,omitempty"`
272
+ Overs float64 `json:"overs,omitempty"`
273
+ Balls int `json:"balls,omitempty"`
274
+ Maidens int `json:"maidens,omitempty"`
275
+ Conceded int `json:"conceded,omitempty"`
276
+ Wickets int `json:"wickets,omitempty"`
277
+ Economy float64 `json:"economy,omitempty"`
278
+ }
279
+
280
+ // MatchDuel summarizes a batter-vs-bowler matchup in one match.
281
+ type MatchDuel struct {
282
+ MatchID string `json:"matchId,omitempty"`
283
+ Fixture string `json:"fixture,omitempty"`
284
+ Score string `json:"score,omitempty"`
285
+ BatterID string `json:"batterId,omitempty"`
286
+ BatterName string `json:"batterName,omitempty"`
287
+ BowlerID string `json:"bowlerId,omitempty"`
288
+ BowlerName string `json:"bowlerName,omitempty"`
289
+ Balls int `json:"balls,omitempty"`
290
+ Runs int `json:"runs,omitempty"`
291
+ Dots int `json:"dots,omitempty"`
292
+ Fours int `json:"fours,omitempty"`
293
+ Sixes int `json:"sixes,omitempty"`
294
+ Wickets int `json:"wickets,omitempty"`
295
+ StrikeRate float64 `json:"strikeRate,omitempty"`
296
+ RecentBalls []DeliveryEvent `json:"recentBalls,omitempty"`
297
+ LastUpdateMS int64 `json:"lastUpdateMs,omitempty"`
298
+ SnapshotAt string `json:"snapshotAt,omitempty"`
299
+ SourceRoute string `json:"sourceRoute,omitempty"`
300
+ }
301
+
194
302
  // Competition is the normalized competition metadata root view.
195
303
  type Competition struct {
196
304
  Ref string `json:"ref,omitempty"`
@@ -450,6 +558,7 @@ type TeamRosterEntry struct {
450
558
  PlayerRef string `json:"playerRef,omitempty"`
451
559
  DisplayName string `json:"displayName,omitempty"`
452
560
  TeamID string `json:"teamId,omitempty"`
561
+ TeamName string `json:"teamName,omitempty"`
453
562
  TeamRef string `json:"teamRef,omitempty"`
454
563
  MatchID string `json:"matchId,omitempty"`
455
564
  Scope TeamScope `json:"scope,omitempty"`
@@ -654,43 +763,67 @@ type InningsWicket struct {
654
763
 
655
764
  // DeliveryEvent is the normalized ball-level event shape.
656
765
  type DeliveryEvent struct {
657
- Ref string `json:"ref,omitempty"`
658
- ID string `json:"id,omitempty"`
659
- LeagueID string `json:"leagueId,omitempty"`
660
- EventID string `json:"eventId,omitempty"`
661
- CompetitionID string `json:"competitionId,omitempty"`
662
- MatchID string `json:"matchId,omitempty"`
663
- TeamID string `json:"teamId,omitempty"`
664
- Period int `json:"period,omitempty"`
665
- PeriodText string `json:"periodText,omitempty"`
666
- OverNumber int `json:"overNumber,omitempty"`
667
- BallNumber int `json:"ballNumber,omitempty"`
668
- ScoreValue int `json:"scoreValue,omitempty"`
669
- ShortText string `json:"shortText,omitempty"`
670
- Text string `json:"text,omitempty"`
671
- HomeScore string `json:"homeScore,omitempty"`
672
- AwayScore string `json:"awayScore,omitempty"`
673
- BatsmanRef string `json:"batsmanRef,omitempty"`
674
- BowlerRef string `json:"bowlerRef,omitempty"`
675
- BatsmanPlayerID string `json:"batsmanPlayerId,omitempty"`
676
- BowlerPlayerID string `json:"bowlerPlayerId,omitempty"`
677
- FielderPlayerID string `json:"fielderPlayerId,omitempty"`
678
- AthletePlayerIDs []string `json:"athletePlayerIds,omitempty"`
679
- Involvement []string `json:"involvement,omitempty"`
680
- PlayType map[string]any `json:"playType,omitempty"`
681
- Dismissal map[string]any `json:"dismissal,omitempty"`
682
- DismissalType string `json:"dismissalType,omitempty"`
683
- DismissalName string `json:"dismissalName,omitempty"`
684
- DismissalCard string `json:"dismissalCard,omitempty"`
685
- DismissalText string `json:"dismissalText,omitempty"`
686
- SpeedKPH float64 `json:"speedKPH,omitempty"`
687
- XCoordinate *float64 `json:"xCoordinate"`
688
- YCoordinate *float64 `json:"yCoordinate"`
689
- BBBTimestamp int64 `json:"bbbTimestamp"`
690
- CoordinateX *float64 `json:"coordinateX,omitempty"`
691
- CoordinateY *float64 `json:"coordinateY,omitempty"`
692
- Timestamp int64 `json:"timestamp,omitempty"`
693
- Extensions map[string]any `json:"extensions,omitempty"`
766
+ Ref string `json:"ref,omitempty"`
767
+ ID string `json:"id,omitempty"`
768
+ LeagueID string `json:"leagueId,omitempty"`
769
+ EventID string `json:"eventId,omitempty"`
770
+ CompetitionID string `json:"competitionId,omitempty"`
771
+ MatchID string `json:"matchId,omitempty"`
772
+ TeamID string `json:"teamId,omitempty"`
773
+ Period int `json:"period,omitempty"`
774
+ PeriodText string `json:"periodText,omitempty"`
775
+ OverNumber int `json:"overNumber,omitempty"`
776
+ BallNumber int `json:"ballNumber,omitempty"`
777
+ ScoreValue int `json:"scoreValue,omitempty"`
778
+ ShortText string `json:"shortText,omitempty"`
779
+ Text string `json:"text,omitempty"`
780
+ HomeScore string `json:"homeScore,omitempty"`
781
+ AwayScore string `json:"awayScore,omitempty"`
782
+ BatsmanRef string `json:"batsmanRef,omitempty"`
783
+ BowlerRef string `json:"bowlerRef,omitempty"`
784
+ OtherBatsmanRef string `json:"otherBatsmanRef,omitempty"`
785
+ OtherBowlerRef string `json:"otherBowlerRef,omitempty"`
786
+ BatsmanPlayerID string `json:"batsmanPlayerId,omitempty"`
787
+ BowlerPlayerID string `json:"bowlerPlayerId,omitempty"`
788
+ OtherBatsmanID string `json:"otherBatsmanPlayerId,omitempty"`
789
+ OtherBowlerID string `json:"otherBowlerPlayerId,omitempty"`
790
+ FielderPlayerID string `json:"fielderPlayerId,omitempty"`
791
+ AthletePlayerIDs []string `json:"athletePlayerIds,omitempty"`
792
+ Involvement []string `json:"involvement,omitempty"`
793
+ BatsmanRuns int `json:"batsmanRuns,omitempty"`
794
+ BatsmanTotalRuns int `json:"batsmanTotalRuns,omitempty"`
795
+ BatsmanBalls int `json:"batsmanBalls,omitempty"`
796
+ BatsmanFours int `json:"batsmanFours,omitempty"`
797
+ BatsmanSixes int `json:"batsmanSixes,omitempty"`
798
+ OtherBatterRuns int `json:"otherBatterRuns,omitempty"`
799
+ OtherBatterBalls int `json:"otherBatterBalls,omitempty"`
800
+ OtherBatterFours int `json:"otherBatterFours,omitempty"`
801
+ OtherBatterSixes int `json:"otherBatterSixes,omitempty"`
802
+ BowlerOvers float64 `json:"bowlerOvers,omitempty"`
803
+ BowlerBalls int `json:"bowlerBalls,omitempty"`
804
+ BowlerMaidens int `json:"bowlerMaidens,omitempty"`
805
+ BowlerConceded int `json:"bowlerConceded,omitempty"`
806
+ BowlerWickets int `json:"bowlerWickets,omitempty"`
807
+ OtherBowlerOvers float64 `json:"otherBowlerOvers,omitempty"`
808
+ OtherBowlerBalls int `json:"otherBowlerBalls,omitempty"`
809
+ OtherBowlerMaidens int `json:"otherBowlerMaidens,omitempty"`
810
+ OtherBowlerConceded int `json:"otherBowlerConceded,omitempty"`
811
+ OtherBowlerWickets int `json:"otherBowlerWickets,omitempty"`
812
+ Sequence int `json:"sequence,omitempty"`
813
+ PlayType map[string]any `json:"playType,omitempty"`
814
+ Dismissal map[string]any `json:"dismissal,omitempty"`
815
+ DismissalType string `json:"dismissalType,omitempty"`
816
+ DismissalName string `json:"dismissalName,omitempty"`
817
+ DismissalCard string `json:"dismissalCard,omitempty"`
818
+ DismissalText string `json:"dismissalText,omitempty"`
819
+ SpeedKPH float64 `json:"speedKPH,omitempty"`
820
+ XCoordinate *float64 `json:"xCoordinate"`
821
+ YCoordinate *float64 `json:"yCoordinate"`
822
+ BBBTimestamp int64 `json:"bbbTimestamp"`
823
+ CoordinateX *float64 `json:"coordinateX,omitempty"`
824
+ CoordinateY *float64 `json:"coordinateY,omitempty"`
825
+ Timestamp int64 `json:"timestamp,omitempty"`
826
+ Extensions map[string]any `json:"extensions,omitempty"`
694
827
  }
695
828
 
696
829
  // StatCategory is the normalized grouped statistics shape.
@@ -774,18 +907,18 @@ type FallOfWicket struct {
774
907
 
775
908
  // AnalysisScope captures the resolved analysis traversal scope.
776
909
  type AnalysisScope struct {
777
- Mode string `json:"mode"`
778
- RequestedLeagueID string `json:"requestedLeagueId,omitempty"`
779
- LeagueID string `json:"leagueId,omitempty"`
780
- LeagueName string `json:"leagueName,omitempty"`
781
- Seasons []string `json:"seasons,omitempty"`
782
- MatchIDs []string `json:"matchIds,omitempty"`
783
- MatchCount int `json:"matchCount"`
784
- DateFrom string `json:"dateFrom,omitempty"`
785
- DateTo string `json:"dateTo,omitempty"`
786
- TypeQuery string `json:"type,omitempty"`
787
- GroupQuery string `json:"group,omitempty"`
788
- HydrationMetric HydrationMetrics `json:"hydrationMetrics,omitempty"`
910
+ Mode string `json:"mode"`
911
+ RequestedLeagueID string `json:"requestedLeagueId,omitempty"`
912
+ LeagueID string `json:"leagueId,omitempty"`
913
+ LeagueName string `json:"leagueName,omitempty"`
914
+ Seasons []string `json:"seasons,omitempty"`
915
+ MatchIDs []string `json:"matchIds,omitempty"`
916
+ MatchCount int `json:"matchCount"`
917
+ DateFrom string `json:"dateFrom,omitempty"`
918
+ DateTo string `json:"dateTo,omitempty"`
919
+ TypeQuery string `json:"type,omitempty"`
920
+ GroupQuery string `json:"group,omitempty"`
921
+ HydrationMetric HydrationMetrics `json:"hydrationMetrics,omitempty"`
789
922
  }
790
923
 
791
924
  // AnalysisFilters captures user-level row filters.
@@ -924,6 +1057,10 @@ func kindPlural(kind EntityKind) string {
924
1057
  return "match scorecards"
925
1058
  case EntityMatchSituation:
926
1059
  return "match situations"
1060
+ case EntityMatchDuel:
1061
+ return "match duels"
1062
+ case EntityMatchPhases:
1063
+ return "match phase reports"
927
1064
  case EntityCompetition:
928
1065
  return "competitions"
929
1066
  case EntityCompOfficial:
@@ -999,11 +1136,16 @@ func kindPlural(kind EntityKind) string {
999
1136
 
1000
1137
  func compactWarnings(warnings []string) []string {
1001
1138
  out := make([]string, 0, len(warnings))
1139
+ seen := map[string]struct{}{}
1002
1140
  for _, warning := range warnings {
1003
1141
  warning = strings.TrimSpace(warning)
1004
1142
  if warning == "" {
1005
1143
  continue
1006
1144
  }
1145
+ if _, ok := seen[warning]; ok {
1146
+ continue
1147
+ }
1148
+ seen[warning] = struct{}{}
1007
1149
  out = append(out, warning)
1008
1150
  }
1009
1151
  if len(out) == 0 {