Skip to content

Commit

Permalink
Make Stats-related entities Equatable (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
staskus authored Apr 8, 2024
2 parents d149306 + 26818ba commit 7343890
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
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

0 comments on commit 7343890

Please sign in to comment.