octokit.objc是Objective-C的GitHubAPI客户端。
OctoKit是 CocoaadCocoaTouch框架,用来与GitHubAPI,进行交互,可使用AFNetworkig,Matle和ReactiveCocoa
发出请求:
为了与API进行交互,您必须实例化一个OCTCliet.这里有两种可创建无需验证客户端的方法。
-iitWithServer:这是实例化一个客户端的最基本的方法.它可以接收一个OCTServer,用来判断是否要连接到GitHub.com或者GitHubEterprise接口。
+uautheticatedClietWithUser:这种方法和上面的相似,但是它允许你设置一个active用户,这需要有特定的请求。
采用第二种方法,我们可以获得更多操作。创建一个连接到GitHub.com的客户端。
OCTUser *user = [OCTUser userWithRawLogi:userame server:OCTServer.dotComServer];OCTCliet *cliet = [OCTCliet uautheticatedClietWithUser:user];获得客户端后,我们便可以开始抓取数据。在OCTCliet的每个请求方法会返回一个ReactiveCocoa信号这类似于一个futureorpromise
// Prepares a request that will load all of the user's repositories, represeted// by `OCTRepository` objects.// Note that the request is ot actually _set_ util you use oe of the// -subscribe… methods below.RACSigal *request = [cliet fetchUserRepositories];
评论