Skip to content

Commit

Permalink
Add Sendable conformances
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsky committed Jun 25, 2022
1 parent 5aebac9 commit 4c5f2dd
Show file tree
Hide file tree
Showing 38 changed files with 119 additions and 116 deletions.
2 changes: 1 addition & 1 deletion Sources/Buildkite/Models/AccessToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct AccessToken: Codable, Equatable {
public struct AccessToken: Codable, Equatable, Hashable, Sendable {
public var uuid: UUID
public var scopes: [String]
}
2 changes: 1 addition & 1 deletion Sources/Buildkite/Models/Agent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct Agent: Codable, Equatable, Identifiable {
public struct Agent: Codable, Equatable, Hashable, Identifiable, Sendable {
public var id: UUID
public var url: Followable<Agent.Resources.Get>
public var webUrl: URL
Expand Down
8 changes: 4 additions & 4 deletions Sources/Buildkite/Models/AgentMetric.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ import Foundation
import FoundationNetworking
#endif

public struct AgentMetrics: Codable, Equatable {
public struct AgentMetrics: Codable, Equatable, Hashable, Sendable {
public var agents: AgentTotals
public var jobs: JobTotals
public var organization: Organization

public struct AgentTotals: Codable, Equatable {
public struct AgentTotals: Codable, Equatable, Hashable, Sendable {
public var idle: Int
public var busy: Int
public var total: Int
public var queues: [String: AgentTotals] = [:]
}

public struct JobTotals: Codable, Equatable {
public struct JobTotals: Codable, Equatable, Hashable, Sendable {
public var scheduled: Int
public var running: Int
public var waiting: Int
public var total: Int
public var queues: [String: JobTotals] = [:]
}

public struct Organization: Codable, Equatable {
public struct Organization: Codable, Equatable, Hashable, Sendable {
public var slug: String
}
}
4 changes: 2 additions & 2 deletions Sources/Buildkite/Models/Annotation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import Foundation
import FoundationNetworking
#endif

public struct Annotation: Codable, Equatable, Identifiable {
public enum Context: String, Codable {
public struct Annotation: Codable, Equatable, Hashable, Identifiable, Sendable {
public enum Context: String, Codable, Hashable, Sendable {
case success
case info
case warning
Expand Down
4 changes: 2 additions & 2 deletions Sources/Buildkite/Models/Artifact.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import Foundation
import FoundationNetworking
#endif

public struct Artifact: Codable, Equatable, Identifiable {
public enum State: String, Codable, Equatable {
public struct Artifact: Codable, Equatable, Hashable, Identifiable, Sendable {
public enum State: String, Codable, Equatable, Hashable, Sendable {
case new
case error
case finished
Expand Down
4 changes: 2 additions & 2 deletions Sources/Buildkite/Models/Build.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct Build: Codable, Equatable, Identifiable {
public struct Build: Codable, Equatable, Hashable, Identifiable, Sendable {
public var id: UUID
public var url: Followable<Build.Resources.Get>
public var webUrl: URL
Expand All @@ -34,7 +34,7 @@ public struct Build: Codable, Equatable, Identifiable {
public var pullRequest: [String: String?]?
public var pipeline: Pipeline

public enum State: String, Codable, Equatable {
public enum State: String, Codable, Equatable, Hashable, Sendable {
case running
case scheduled
case passed
Expand Down
2 changes: 1 addition & 1 deletion Sources/Buildkite/Models/Emoji.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct Emoji: Codable, Equatable {
public struct Emoji: Codable, Equatable, Hashable, Sendable {
public var name: String
public var url: URL
public var aliases: [String]? = []
Expand Down
18 changes: 9 additions & 9 deletions Sources/Buildkite/Models/Job.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public enum Job: Codable, Equatable {
public enum Job: Codable, Equatable, Hashable, Sendable {
case script(Command)
case waiter(Wait)
case manual(Block)
Expand Down Expand Up @@ -59,8 +59,8 @@ public enum Job: Codable, Equatable {
case type
}

public struct Command: Codable, Equatable, Identifiable {
public struct AgentRef: Codable, Equatable {
public struct Command: Codable, Equatable, Hashable, Identifiable, Sendable {
public struct AgentRef: Codable, Equatable, Hashable, Sendable {
public var id: UUID
public var name: String
public var url: URL
Expand Down Expand Up @@ -94,12 +94,12 @@ public enum Job: Codable, Equatable {
public var parallelGroupTotal: Int?
}

public struct Wait: Codable, Equatable, Identifiable {
public struct Wait: Codable, Equatable, Hashable, Identifiable, Sendable {
public var type = "waiter"
public var id: UUID
}

public struct Block: Codable, Equatable, Identifiable {
public struct Block: Codable, Equatable, Hashable, Identifiable, Sendable {
public var type = "manual"
public var id: UUID
public var label: String
Expand All @@ -111,8 +111,8 @@ public enum Job: Codable, Equatable {
public var unblockUrl: URL
}

public struct Trigger: Codable, Equatable {
public struct TriggeredBuild: Codable, Equatable, Identifiable {
public struct Trigger: Codable, Equatable, Hashable, Sendable {
public struct TriggeredBuild: Codable, Equatable, Hashable, Identifiable, Sendable {
public var id: UUID
public var number: Int
public var url: URL
Expand All @@ -131,14 +131,14 @@ public enum Job: Codable, Equatable {
public var triggeredBuild: TriggeredBuild?
}

public struct LogOutput: Codable, Equatable {
public struct LogOutput: Codable, Equatable, Hashable, Sendable {
public var url: Followable<Job.Resources.LogOutput>
public var content: String
public var size: Int
public var headerTimes: [Int]
}

public struct EnvironmentVariables: Codable, Equatable {
public struct EnvironmentVariables: Codable, Equatable, Hashable, Sendable {
public var env: [String: String]
}
}
2 changes: 1 addition & 1 deletion Sources/Buildkite/Models/Meta.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct Meta: Codable, Equatable {
public struct Meta: Codable, Equatable, Hashable, Sendable {
/// A list of IP addresses in CIDR notation that Buildkite uses to
/// send outbound traffic such as webhooks and commit statuses.
/// These are subject to change from time to time.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Buildkite/Models/Organization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct Organization: Codable, Equatable, Identifiable {
public struct Organization: Codable, Equatable, Hashable, Identifiable, Sendable {
public var id: UUID
public var url: Followable<Organization.Resources.Get>
public var webUrl: URL
Expand Down
16 changes: 8 additions & 8 deletions Sources/Buildkite/Models/Pipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct Pipeline: Codable, Equatable, Identifiable {
public struct Pipeline: Codable, Equatable, Hashable, Identifiable, Sendable {
public var id: UUID
public var url: Followable<Pipeline.Resources.Get>
public var webUrl: URL
Expand All @@ -38,15 +38,15 @@ public struct Pipeline: Codable, Equatable, Identifiable {
public var steps: [Step]
public var env: JSONValue?

public struct Provider: Codable, Equatable {
public struct Provider: Codable, Equatable, Hashable, Identifiable, Sendable {
public var id: String
public var webhookUrl: URL?
public var settings: Settings
}
}

extension Pipeline.Provider {
public struct Settings: Codable, Equatable {
public struct Settings: Codable, Equatable, Hashable, Sendable {
public var repository: String?
/// Whether to create builds for commits that are part of a Pull Request.
public var buildPullRequests: Bool?
Expand Down Expand Up @@ -80,7 +80,7 @@ extension Pipeline.Provider {
}

extension Pipeline {
public enum Step: Codable, Equatable {
public enum Step: Codable, Equatable, Hashable, Sendable {
case script(Command)
case waiter(Wait)
case manual(Block)
Expand Down Expand Up @@ -127,7 +127,7 @@ extension Pipeline {
case type
}

public struct Command: Codable, Equatable {
public struct Command: Codable, Equatable, Hashable, Sendable {
public var type = "script"
public var name: String?
public var command: String?
Expand All @@ -142,18 +142,18 @@ extension Pipeline {
public var parallelism: Int?
}

public struct Wait: Codable, Equatable {
public struct Wait: Codable, Equatable, Hashable, Sendable {
public var type = "waiter"
public var label: String?
public var continueAfterFailure: Bool?
}

public struct Block: Codable, Equatable {
public struct Block: Codable, Equatable, Hashable, Sendable {
public var type = "manual"
public var label: String?
}

public struct Trigger: Codable, Equatable {
public struct Trigger: Codable, Equatable, Hashable, Sendable {
public var type = "trigger"
public var triggerProjectSlug: String?
public var label: String?
Expand Down
4 changes: 2 additions & 2 deletions Sources/Buildkite/Models/Team.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct Team: Codable, Equatable, Identifiable {
public struct Team: Codable, Equatable, Hashable, Identifiable, Sendable {
/// ID of the team
public var id: UUID
/// Name of the team
Expand All @@ -30,7 +30,7 @@ public struct Team: Codable, Equatable, Identifiable {
/// User who created the team
public var createdBy: User?

public enum Visibility: String, Codable, Equatable {
public enum Visibility: String, Codable, Equatable, Hashable, Sendable {
case visible
case secret
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Buildkite/Models/Trace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct Trace: Codable, Equatable, Identifiable {
public struct Trace: Codable, Equatable, Hashable, Identifiable, Sendable {
/// a unique identifier for this test result
public var id: UUID
/// a group or topic for the test
Expand Down Expand Up @@ -67,7 +67,7 @@ public struct Trace: Codable, Equatable, Identifiable {
self.history = history
}

public struct Span: Codable, Equatable {
public struct Span: Codable, Equatable, Hashable, Sendable {
/// A section category for this span, e.g. `"http"`, `"sql"`, `"sleep"`, or `"annotation"`
public var section: String
/// A monotonically increasing number
Expand Down
2 changes: 1 addition & 1 deletion Sources/Buildkite/Models/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct User: Codable, Equatable, Identifiable {
public struct User: Codable, Equatable, Hashable, Identifiable, Sendable {
public var id: UUID
public var name: String
public var email: String
Expand Down
22 changes: 11 additions & 11 deletions Sources/Buildkite/Models/WebhookEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public enum WebhookEvent: Codable, Equatable {
public enum WebhookEvent: Codable, Equatable, Hashable, Sendable {
case ping(Ping)
case build(Build)
case job(Job)
Expand Down Expand Up @@ -68,22 +68,22 @@ public enum WebhookEvent: Codable, Equatable {
case event
}

public struct Service: Codable, Equatable, Identifiable {
public struct Service: Codable, Equatable, Hashable, Identifiable, Sendable {
public var id: UUID
public var provider: String
public var settings: Settings

public struct Settings: Codable, Equatable {
public struct Settings: Codable, Equatable, Hashable, Sendable {
public var url: URL
}
}

public struct Sender: Codable, Equatable, Identifiable {
public struct Sender: Codable, Equatable, Hashable, Identifiable, Sendable {
public var id: UUID
public var name: String
}

public struct Ping: Codable, Equatable {
public struct Ping: Codable, Equatable, Hashable, Sendable {
/// The notification service that sent this webhook
public var service: Service
/// The ``Organization`` this notification belongs to
Expand All @@ -92,7 +92,7 @@ public enum WebhookEvent: Codable, Equatable {
public var sender: Sender
}

public struct Build: Codable, Equatable {
public struct Build: Codable, Equatable, Hashable, Sendable {
public var event: Event
/// The ``Buildkite/Build`` this notification relates to
public var build: Buildkite.Build
Expand All @@ -101,7 +101,7 @@ public enum WebhookEvent: Codable, Equatable {
/// The user who created the webhook
public var sender: Sender

public enum Event: String, Codable, Equatable {
public enum Event: String, Codable, Equatable, Hashable, Sendable {
/// A build has been scheduled
case scheduled
/// A build has started running
Expand All @@ -111,7 +111,7 @@ public enum WebhookEvent: Codable, Equatable {
}
}

public struct Job: Codable, Equatable {
public struct Job: Codable, Equatable, Hashable, Sendable {
public var event: Event
/// The ``Buildkite/Job`` this notification relates to
public var job: Buildkite.Job
Expand All @@ -122,7 +122,7 @@ public enum WebhookEvent: Codable, Equatable {
/// The user who created the webhook
public var sender: Sender

public enum Event: String, Codable, Equatable {
public enum Event: String, Codable, Equatable, Hashable, Sendable {
/// A command step job has been scheduled to run on an agent
case scheduled
/// A command step job has started running on an agent
Expand All @@ -134,14 +134,14 @@ public enum WebhookEvent: Codable, Equatable {
}
}

public struct Agent: Codable, Equatable {
public struct Agent: Codable, Equatable, Hashable, Sendable {
public var event: Event
/// The ``Buildkite/Agent`` this notification relates to
public var agent: Buildkite.Agent
/// The user who created the webhook
public var sender: Sender

public enum Event: String, Codable, Equatable {
public enum Event: String, Codable, Equatable, Hashable, Sendable {
/// An agent has connected to the API
case connected
/// An agent has been marked as lost. This happens when Buildkite stops receiving pings from the agent
Expand Down
2 changes: 1 addition & 1 deletion Sources/Buildkite/Networking/APIVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct APIVersion: Equatable {
public struct APIVersion: Equatable, Hashable, Sendable {
public enum REST {
private static let baseURL = URL(string: "https://api.buildkite.com")!
public static let v2 = APIVersion(baseURL: baseURL, version: "v2")
Expand Down
2 changes: 1 addition & 1 deletion Sources/Buildkite/Networking/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
import FoundationNetworking
#endif

public struct Configuration {
public struct Configuration: Equatable, Hashable, Sendable {
public let userAgent = "buildkite-swift"
public var version: APIVersion
public var graphQLVersion: APIVersion
Expand Down
Loading

0 comments on commit 4c5f2dd

Please sign in to comment.