Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implement markdown endpoints.

  • Loading branch information...
commit c5626fe39b7a1ed433281cd672e5dc0e15289b87 1 parent 406b8f1
Owain R Hunt authored
View
8 UAGithubEngine/UAGithubEngine.h
@@ -366,4 +366,12 @@ typedef void (^UAGithubEngineFailureBlock)(NSError *);
- (void)createRawCommit:(NSDictionary *)commitDictionary inRepository:(NSString *)repositoryPath success:(UAGithubEngineSuccessBlock)successBlock failure:(UAGithubEngineFailureBlock)failureBlock;
+#pragma mark -
+#pragma mark Markdown
+#pragma mark -
+
+- (void)renderAsMarkdown:(NSString *)string success:(UAGithubEngineSuccessBlock)successBlock failure:(UAGithubEngineFailureBlock)failureBlock;
+- (void)renderAsGitHubFlavoredMarkdown:(NSString *)string withRepositoryContext:(NSString *)repositoryPath success:(UAGithubEngineSuccessBlock)successBlock failure:(UAGithubEngineFailureBlock)failureBlock;
+
+
@end
View
26 UAGithubEngine/UAGithubEngine.m
@@ -1547,4 +1547,30 @@ - (void)createRawCommit:(NSDictionary *)commitDictionary inRepository:(NSString
[self invoke:^(id self){[self sendRequest:[NSString stringWithFormat:@"repos/%@/git/commits", repositoryPath] requestType:UAGithubRawCommitCreateRequest responseType:UAGithubRawCommitResponse withParameters:commitDictionary error:nil];} success:successBlock failure:failureBlock];
}
+
+#pragma mark -
+#pragma mark Markdown
+#pragma mark -
+
+- (void)renderAsMarkdown:(NSString *)string success:(UAGithubEngineSuccessBlock)successBlock failure:(UAGithubEngineFailureBlock)failureBlock
+{
+ NSDictionary *params = [@{ @"text" : string } copy];
+ [self invoke:^(id self){[self sendRequest:@"markdown" requestType:UAGithubMarkdownRequest responseType:UAGithubMarkdownResponse withParameters:params error:nil];} success:successBlock failure:failureBlock];
+}
+
+
+- (void)renderAsGitHubFlavoredMarkdown:(NSString *)string withRepositoryContext:(NSString *)repositoryPath success:(UAGithubEngineSuccessBlock)successBlock failure:(UAGithubEngineFailureBlock)failureBlock
+{
+ NSDictionary *params = [@{ @"text" : string, @"mode" : @"gfm" } copy];
+ if (repositoryPath)
+ {
+ NSMutableDictionary *mutableParams = [params mutableCopy];
+ [mutableParams setValue:repositoryPath forKey:@"context"];
+ params = [mutableParams copy];
+ }
+ [self invoke:^(id self){[self sendRequest:@"markdown" requestType:UAGithubMarkdownRequest responseType:UAGithubMarkdownResponse withParameters:params error:nil];} success:successBlock failure:failureBlock];
+
+}
+
+
@end
View
1  UAGithubEngine/UAGithubEngineRequestTypes.h
@@ -162,6 +162,7 @@ typedef enum UAGithubRequestType
UAGithubTeamRepositoryManagershipRemoveRequest, // Remove a specific repository from a team
UAGithubAssigneesRequest, // Get one or more assignees
UAGithubAssigneeRequest, // Get whether one user is an assignee on a repository
+ UAGithubMarkdownRequest, // Get a string as Markdown
} UAGithubRequestType;
Please sign in to comment.
Something went wrong with that request. Please try again.