SwiftCity 0.1.1

SwiftCity 0.1.1

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最新发布2016年7月
SPM支持 SPM

Tom Harvey 维护。



SwiftCity 0.1.1

SwiftCity

用 Swift 编写的 TeamCity API 客户端

这是一个 正在进行中 的项目 - 将很快添加更多端点。该项目灵感来源于 TeamCitySharp

 路线图 / 待办事项

  • [x] 只读端点
    • [x] 构建
    • [x] 构建代理
    • [x] 构建代理池
    • [x] 构建队列
    • [x] 项目
    • [x] 服务器信息
    • [x] 用户
    • [x] 用户组
    • [x] VCS 根

  • [ ] 可编辑端点
    • [ ] 构建
    • [ ] 构建代理
    • [ ] 构建代理池
    • [ ] 构建队列
    • [ ] 项目
    • [ ] 用户
    • [ ] 用户组
    • [ ] VCS 根

  • [ ] 正确的错误处理
  • [ ] 集成测试
  • [ ] Swift 包管理器支持
  • [x] Cocoapods 支持

许可证

MIT

贡献

发送合并请求,最好附带测试 :)

安装

我们使用 Cocoapods - 因此只需

pod 'SwiftCity', '0.1'

文档

请注意 TeamCity API 根据权限提供字段 - 因此如果您没有看到您预期中的字段,请先检查这里..

以访客用户打开连接

let connection = TeamCityConnection(server: "http://teamcity-server.example.com")
let client = TeamCityClient(connection: connection)
client.authenticate({ () -> () in
    print("Authenticated!")
}) { (error) -> () in
    print("Failed to Authenticate!")
}

 以指定用户打开连接

let connection = TeamCityConnection(server: "http://teamcity-server.example.com", username: "username", password: "password")
let client = TeamCityClient(connection: connection)
client.authenticate({ () -> () in
    print("Authenticated!")
}) { (error) -> () in
    print("Failed to Authenticate!")
}

列出所有项目

client.allProjects({ (projects) -> () in
    print("Projects: \(projects)")
}) { (error: NSError) -> () in
    print("Projects Error: \(error)")
}

通过 ID 获取项目

client.projectById("Example", successful: { (project) -> () in
    print("Project: \(project)")
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

 列出所有构建配置

client.allBuildTypes({ (types: BuildTypes) -> () in
    print(types)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

 构建配置详细信息

client.buildTypesById("Example_BuildConfig", successful: { (type: BuildType) -> () in
    print(type)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

列出构建队列

client.buildQueue({ (queue: BuildQueue) -> () in
    print(queue.queue)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

获取服务器信息

client.serverInformation({ (info: ServerInformation) -> () in
    print(info)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

列出所有VCS根

client.allVcsRoots({ (roots: VCSRoots) -> () in
    print(roots)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

 根据ID获取VCS根

client.vcsRootById("Puppet_Github", successful: { (root: VCSRoot?) -> () in
    print(root)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

 列出所有用户

client.allUsers({ (users: Users) -> () in
    print(users)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

根据用户名获取用户

client.userByName("example_api_user", successful: { (user: User?) -> () in
    print(user)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

根据ID获取用户

client.userById(2, successful: { (user: User?) -> () in
    print(user)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

 列出所有组

client.allGroups({ (groups: Groups) -> () in
    print(groups)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

 根据键值获取组

client.groupByKey("MIDDLE_GROUP", successful: { (group: Group?) -> () in
    print(group)
}) { (error:NSError) -> () in
    print("Error: \(error)")
}

 列出所有构建代理

client.allBuildAgents({ (agents: BuildAgents) -> () in
    print(agents)
}) { (error:NSError) -> () in
    print("Error: \(error)")
}

 根据ID获取构建代理

client.buildAgentById(1, successful: { (agent: BuildAgent?) -> () in
    print(agent)
}) { (error:NSError) -> () in
    print("Error: \(error)")
}

 根据名称获取构建代理

client.buildAgentByName("tc-buildagent-01", successful: { (agent: BuildAgent?) -> () in
    print(agent)
}) { (error:NSError) -> () in
    print("Error: \(error)")
}

列出所有构建代理池

client.allBuildAgentPools({ (pools: BuildAgentPools) -> () in
    print(pools)
}) { (error: NSError) -> () in
    print(error)
}

 根据ID获取构建代理池

client.buildAgentPoolById(1, successful: { (agent: BuildAgentPool?) -> () in
    print(agent)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

 列出所有构建

let start = 10
let count = 10
client.allBuilds(start, count: count, successful: { (builds: Builds) -> () in
    print(builds)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}

根据ID获取构建

client.buildById(1561, successful: { (build: Build?) -> () in
    print(build)
}) { (error: NSError) -> () in
    print("Error: \(error)")
}