Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement markdown endpoints.

  • Loading branch information...
commit 2e721216f333c05c81f3dd4e702a107ee14a14f6 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
4 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;
@@ -230,5 +231,6 @@ typedef enum UAGithubResponseType
UAGithubOrganizationsResponse, // One or more organizations
UAGithubOrganizationResponse, // Exactly one organization
UAGithubTeamsResponse, // One or more organization teams
- UAGithubTeamResponse, // Exactly one team
+ UAGithubTeamResponse, // Exactly one team
+ UAGithubMarkdownResponse, // HTML from Markdown
} UAGithubResponseType;
Please sign in to comment.
Something went wrong with that request. Please try again.