Skip to content
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

Make Stats-related entities Equatable #751

Merged
merged 6 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct StatsLastPostInsight: Decodable {
public struct StatsLastPostInsight: Equatable, Decodable {
public let title: String
public let url: URL
public let publishedDate: Date
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct StatsPostingStreakInsight: Codable {
public struct StatsPostingStreakInsight: Equatable, Codable {
public let streaks: PostingStreaks
public let postingEvents: [PostingStreakEvent]

Expand Down Expand Up @@ -54,7 +54,7 @@ public struct StatsPostingStreakInsight: Codable {
}
}

public struct PostingStreakEvent: Codable {
public struct PostingStreakEvent: Equatable, Codable {
public let date: Date
public let postCount: Int

Expand All @@ -64,7 +64,7 @@ public struct PostingStreakEvent: Codable {
}
}

public struct PostingStreaks: Codable {
public struct PostingStreaks: Equatable, Codable {
public let long: PostingStreak?
public let current: PostingStreak?

Expand All @@ -76,7 +76,7 @@ public struct PostingStreaks: Codable {
}
}

public struct PostingStreak: Codable {
public struct PostingStreak: Equatable, Codable {
public let start: Date
public let end: Date
public let length: Int
Expand Down
6 changes: 3 additions & 3 deletions Sources/WordPressKit/Models/Stats/StatsPostDetails.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct StatsPostDetails {
public struct StatsPostDetails: Equatable {
public let fetchedDate: Date
public let totalViewsCount: Int

Expand All @@ -8,7 +8,7 @@ public struct StatsPostDetails {
public let lastTwoWeeks: [StatsPostViews]
}

public struct StatsWeeklyBreakdown {
public struct StatsWeeklyBreakdown: Equatable {
public let startDay: DateComponents
public let endDay: DateComponents

Expand All @@ -19,7 +19,7 @@ public struct StatsWeeklyBreakdown {
public let days: [StatsPostViews]
}

public struct StatsPostViews {
public struct StatsPostViews: Equatable {
public let period: StatsPeriodUnit
public let date: DateComponents
public let viewsCount: Int
Expand Down