-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add WordAdsMetric and related APIs #25152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 30590 | |
| Version | PR #25152 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 223d195 | |
| Installation URL | 69scb91t3pho8 |
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 30590 | |
| Version | PR #25152 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 223d195 | |
| Installation URL | 5s8s7quugbnn0 |
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
95beb65 to
246d20b
Compare
246d20b to
223d195
Compare
|
|
|
||
| /// A legacy variant of `WordPressKit.StatsTimeIntervalData` API that supports | ||
| /// only support setting the target date and the quantity of periods to return. | ||
| func getData<TimeStatsType: WordPressKit.StatsTimeIntervalData>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this code was simply moved from the bottom of StatsService.swift. The only addition is the method:
/// A legacy variant of `WordPressKit.StatsTimeIntervalData` API that supports
/// only support setting the target date and the quantity of periods to return.
func getData<TimeStatsType: WordPressKit.StatsTimeIntervalData>(
date: Date,
unit: WordPressKit.StatsPeriodUnit,
quantity: Int
) async throws -> TimeStatsType where TimeStatsType: Sendable {
|
|
||
| func getWordAdsStats(date: Date, granularity: DateRangeGranularity) async throws -> WordAdsMetricsResponse { | ||
| // Check cache first | ||
| let cacheKey = WordAdsStatsCacheKey(date: date, granularity: granularity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a little bit of duplication, but it's still easy to read and understand, and I wanted to limit the impact on the existing code.





This PR is the first part of CMM-1132: Add WordAds revenue stats to Jetpack app.
Changes
/wordads/statsendpoint and the related types to parse it (WordPressKit) and to map for the Stats screen (WordAdsMetric)MetricTypeprotocol to generalize that code that previous supported onlyStatsMetric(views, visitors, etc)Testing Instructions
n/a (the relevant parts are covered by unit tests)