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

add some more fields to repo, and structure for organization #191

Merged
18 changes: 18 additions & 0 deletions OctoKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@
721F73E929889A040064B11A /* latest_release.json in Resources */ = {isa = PBXBuildFile; fileRef = 721F73E829889A040064B11A /* latest_release.json */; };
721F73EA29889A040064B11A /* latest_release.json in Resources */ = {isa = PBXBuildFile; fileRef = 721F73E829889A040064B11A /* latest_release.json */; };
721F73EB29889A040064B11A /* latest_release.json in Resources */ = {isa = PBXBuildFile; fileRef = 721F73E829889A040064B11A /* latest_release.json */; };
84B89D012C814DBC00273C68 /* Organization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B89D002C814DBC00273C68 /* Organization.swift */; };
84B89D032C814DE400273C68 /* forked_repo.json in Resources */ = {isa = PBXBuildFile; fileRef = 84B89D022C814DE400273C68 /* forked_repo.json */; };
84B89D042C814DED00273C68 /* forked_repo.json in Resources */ = {isa = PBXBuildFile; fileRef = 84B89D022C814DE400273C68 /* forked_repo.json */; };
84B89D052C814DEE00273C68 /* forked_repo.json in Resources */ = {isa = PBXBuildFile; fileRef = 84B89D022C814DE400273C68 /* forked_repo.json */; };
84B89D0A2C81587100273C68 /* Organization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B89D002C814DBC00273C68 /* Organization.swift */; };
84B89D0B2C81587100273C68 /* Organization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B89D002C814DBC00273C68 /* Organization.swift */; };
84B89D0C2C81587200273C68 /* Organization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B89D002C814DBC00273C68 /* Organization.swift */; };
9D9ADDDF23EEFD4A000AC34D /* ReviewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D9ADDDE23EEFD4A000AC34D /* ReviewTests.swift */; };
9D9ADDE123EEFDE0000AC34D /* Review.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D9ADDE023EEFDE0000AC34D /* Review.swift */; };
BF8C719220F02AC04EF3D137 /* PullRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8C76EB002802C14A08F63E /* PullRequestTests.swift */; };
Expand Down Expand Up @@ -333,6 +340,8 @@
665D5D5E24A639D70045E3B4 /* statuses.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = statuses.json; path = Fixtures/statuses.json; sourceTree = "<group>"; };
665D5D5F24A639D70045E3B4 /* status.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = status.json; path = Fixtures/status.json; sourceTree = "<group>"; };
721F73E829889A040064B11A /* latest_release.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = latest_release.json; path = Fixtures/latest_release.json; sourceTree = "<group>"; };
84B89D002C814DBC00273C68 /* Organization.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Organization.swift; sourceTree = "<group>"; };
84B89D022C814DE400273C68 /* forked_repo.json */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = text.json; name = forked_repo.json; path = Fixtures/forked_repo.json; sourceTree = "<group>"; };
9D9ADDDE23EEFD4A000AC34D /* ReviewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewTests.swift; sourceTree = "<group>"; };
9D9ADDE023EEFDE0000AC34D /* Review.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Review.swift; sourceTree = "<group>"; };
BF8C72B985869B84F46B4E9D /* Parameters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Parameters.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -454,6 +463,7 @@
children = (
721F73E829889A040064B11A /* latest_release.json */,
03CCD2512453A9AA007D5CB3 /* users.json */,
84B89D022C814DE400273C68 /* forked_repo.json */,
515337F92252A0410024544D /* gist.json */,
515337F522529E7B0024544D /* gists.json */,
5090ED7123E483820062C763 /* issue_comment.json */,
Expand Down Expand Up @@ -486,6 +496,7 @@
isa = PBXGroup;
children = (
239BE7CD1B8C47A100D2CE22 /* OctoKit.h */,
84B89D002C814DBC00273C68 /* Organization.swift */,
23B267851BDDD756003887E3 /* Configuration.swift */,
515337C3225179FB0024544D /* File.swift */,
E7EE59DB1BE119110012E3D2 /* Follow.swift */,
Expand Down Expand Up @@ -826,6 +837,7 @@
234F4BE01BDDE44600A58EF7 /* user_mietzmithut.json in Resources */,
23EA61AB25EAE31A001B0964 /* reviews.json in Resources */,
23EA61AE25EAE31A001B0964 /* releases.json in Resources */,
84B89D032C814DE400273C68 /* forked_repo.json in Resources */,
515337F622529E7B0024544D /* gists.json in Resources */,
721F73E929889A040064B11A /* latest_release.json in Resources */,
23EA61B125EAE31A001B0964 /* pull_request.json in Resources */,
Expand Down Expand Up @@ -874,6 +886,7 @@
23F6434C1C7AEF6C000427B3 /* user_mietzmithut.json in Resources */,
23EA61AC25EAE31A001B0964 /* reviews.json in Resources */,
23EA61AF25EAE31A001B0964 /* releases.json in Resources */,
84B89D042C814DED00273C68 /* forked_repo.json in Resources */,
515337F722529E7B0024544D /* gists.json in Resources */,
721F73EA29889A040064B11A /* latest_release.json in Resources */,
23EA61B225EAE31A001B0964 /* pull_request.json in Resources */,
Expand Down Expand Up @@ -914,6 +927,7 @@
23F6434D1C7AEF6D000427B3 /* user_mietzmithut.json in Resources */,
23EA61AD25EAE31A001B0964 /* reviews.json in Resources */,
23EA61B025EAE31A001B0964 /* releases.json in Resources */,
84B89D052C814DEE00273C68 /* forked_repo.json in Resources */,
515337F822529E7B0024544D /* gists.json in Resources */,
721F73EB29889A040064B11A /* latest_release.json in Resources */,
23EA61B325EAE31A001B0964 /* pull_request.json in Resources */,
Expand Down Expand Up @@ -978,6 +992,7 @@
23B2678D1BDDD756003887E3 /* Repositories.swift in Sources */,
5090ED7423E48AA80062C763 /* Releases.swift in Sources */,
F8711EA21BFCAE9F005DDACA /* Time.swift in Sources */,
84B89D012C814DBC00273C68 /* Organization.swift in Sources */,
515337C4225179FB0024544D /* File.swift in Sources */,
515337C2225166600024544D /* Gist.swift in Sources */,
23B2678C1BDDD756003887E3 /* PublicKey.swift in Sources */,
Expand Down Expand Up @@ -1008,6 +1023,7 @@
23B2F9C125B1DF6F000A8CE1 /* Review.swift in Sources */,
23CAF2A21C7AB6BE005011C4 /* Configuration.swift in Sources */,
50AFBB1E23EAC89E004D30A8 /* Releases.swift in Sources */,
84B89D0A2C81587100273C68 /* Organization.swift in Sources */,
23CAF2B71C7AB6EB005011C4 /* Time.swift in Sources */,
23CAF2B41C7AB6D4005011C4 /* Stars.swift in Sources */,
23CAF2AB1C7AB6C9005011C4 /* PublicKey.swift in Sources */,
Expand Down Expand Up @@ -1064,6 +1080,7 @@
23B2F9C925B1DF70000A8CE1 /* Review.swift in Sources */,
23CAF2A31C7AB6BF005011C4 /* Configuration.swift in Sources */,
50AFBB1F23EAC89F004D30A8 /* Releases.swift in Sources */,
84B89D0B2C81587100273C68 /* Organization.swift in Sources */,
23CAF2B81C7AB6EB005011C4 /* Time.swift in Sources */,
23CAF2B51C7AB6D5005011C4 /* Stars.swift in Sources */,
23CAF2AC1C7AB6CA005011C4 /* PublicKey.swift in Sources */,
Expand Down Expand Up @@ -1120,6 +1137,7 @@
23B2F9CA25B1DF70000A8CE1 /* Review.swift in Sources */,
23CAF2A41C7AB6BF005011C4 /* Configuration.swift in Sources */,
50AFBB2023EAC8A0004D30A8 /* Releases.swift in Sources */,
84B89D0C2C81587200273C68 /* Organization.swift in Sources */,
23CAF2B91C7AB6EC005011C4 /* Time.swift in Sources */,
23CAF2B61C7AB6D5005011C4 /* Stars.swift in Sources */,
23CAF2AD1C7AB6CA005011C4 /* PublicKey.swift in Sources */,
Expand Down
25 changes: 25 additions & 0 deletions OctoKit/Organization.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Foundation

open class Organization: Codable {
public let login: String
public let id: Int
public let node_id: String
public let avatar_url: String
public let url: String
public let html_url: String
public let repos_url: String
public let events_url: String
public let type: String

enum CodingKeys: String, CodingKey {
case login
case id
case node_id
case avatar_url
case url
case html_url
case repos_url
case events_url
case type
}
}
14 changes: 13 additions & 1 deletion OctoKit/Repositories.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ open class Repository: Codable {
open private(set) var size: Int?
open var lastPush: Date?
open var stargazersCount: Int?
open var hasWiki: Bool?
open var language: String?
open var organization: Organization?
open var parent: Repository?

public init(id: Int = -1,
owner: User = User(),
Expand All @@ -35,7 +39,9 @@ open class Repository: Codable {
htmlURL: String? = nil,
size: Int? = -1,
lastPush: Date? = nil,
stargazersCount: Int? = nil) {
stargazersCount: Int? = nil,
hasWiki: Bool = false,
language: String? = nil) {
self.id = id
self.owner = owner
self.name = name
Expand All @@ -50,6 +56,8 @@ open class Repository: Codable {
self.size = size
self.lastPush = lastPush
self.stargazersCount = stargazersCount
self.hasWiki = hasWiki
self.language = language
}

enum CodingKeys: String, CodingKey {
Expand All @@ -67,6 +75,10 @@ open class Repository: Codable {
case size
case lastPush = "pushed_at"
case stargazersCount = "stargazers_count"
case hasWiki = "has_wiki"
case language
case organization
case parent
}
}

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:4.0
// swift-tools-version:5.5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
Loading
Loading