Skip to content

Commit

Permalink
get repository info
Browse files Browse the repository at this point in the history
  • Loading branch information
FranzBusch committed Nov 14, 2018
1 parent 9964081 commit f2073a4
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 29 deletions.
23 changes: 23 additions & 0 deletions Sources/Swoctokit/Models/Owner.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Owner.swift
// Swoctokit
//
// Created by Franz Busch on 14.11.18.
//

import Foundation


public struct Owner: Decodable {

public let login: String
public let id: Int
public let nodeId: String

private enum CodingKeys: String, CodingKey {
case login
case id
case nodeId = "node_id"
}

}
27 changes: 27 additions & 0 deletions Sources/Swoctokit/Models/PullRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// PullRequest.swift
// Swoctokit
//
// Created by Franz Busch on 14.11.18.
//

import Foundation

public struct PullRequest: Decodable {

public struct Head: Decodable {

public let label: String
public let ref: String
public let sha: String
public let repo: Repository
}

public let id: Int
public let number: Int
public let state: String
public let title: String
public let body: String
public let head: Head

}
25 changes: 25 additions & 0 deletions Sources/Swoctokit/Models/Repository.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Repository.swift
// Swoctokit
//
// Created by Franz Busch on 14.11.18.
//

import Foundation

public struct Repository: Decodable {

public let id: Int
public let nodeId: String
public let name: String
public let fullName: String
public let owner: Owner

private enum CodingKeys: String, CodingKey {
case id
case nodeId = "node_id"
case name
case fullName = "full_name"
case owner
}
}
1 change: 1 addition & 0 deletions Sources/Swoctokit/Webhook/IssueCommentEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public struct IssueCommentEvent: Decodable, WebhookEvent {

public let action: String
public let issue: Issue
public let repository: Repository

}

Expand Down
29 changes: 0 additions & 29 deletions Sources/Swoctokit/Webhook/PullRequestEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,4 @@ public struct PullRequestEvent: Decodable, WebhookEvent {

}

public struct PullRequest: Decodable {

public struct Head: Decodable {

public struct Repo: Decodable {
public let id: Int
public let name: String
public let fullName: String

private enum CodingKeys: String, CodingKey {
case id
case name
case fullName = "full_name"
}
}

public let label: String
public let ref: String
public let sha: String
public let repo: Repo
}

public let id: Int
public let number: Int
public let state: String
public let title: String
public let body: String
public let head: Head

}

0 comments on commit f2073a4

Please sign in to comment.