Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Authentication
Find out how many teams I am part of
Get team project list
Get project details
Get project topology
Get project disciplines
Upload project thumbnail
Create an issue in the project
Get the issue list from the project
Delete all the issues from the project
Create a new pin for the issue
Get all the pins of the issue
Create/Upload a new attachment for the issue
Get the attachment list from the issue

Anchor
authenticationCode
authenticationCode

...

Create a new pin for the issue

Deck of Cards
iddeleteIssueListCodecreateNewPinCode
Card
labelObjectiveC
Code Block
borderColorGreen
langjava
titleJSON
CommunicationSingleton *CSS = [CommunicationSingleton sharedSingleton];

	NSMutableDictionary *pinData = [self getPinDataForPinId:PIN_ID inIssue:ISSUE_ID];
	
	//remove the id and the objectsparent id since they are unrequired data for the server:
	NSString *oldObjectsParentID = [pinData objectForKey:@"objectsParentId"];
	[pinData removeObjectForKey:@"objectsParentId"];
	NSString *oldPinId = [pinData objectForKey:@"id"];
	[pinData removeObjectForKey:@"id"];
	
	//set the new issue id:
	[pinData setObject:newCurrentIssueId forKey:@"issueId"];
	
	//create nsdata for uploading:
	NSData *dataForCurrentPin = [NSJSONSerialization dataWithJSONObject:pinData options:NSJSONWritingPrettyPrinted error:&error];
                
	//create pin request:
	NSMutableURLRequest *uploadRequestForCurrentPin;
	uploadRequestForCurrentPin = [[NSMutableURLRequest alloc] init];
                
	NSString *urlStringForPin = [NSString stringWithFormat:@"%@%@/issues/%@/pins",
                                   [CSS getDefaultAPIURL],
                                   [CSS getSlug],
                                   self.newCurrentIssueID];
	
	[uploadRequestForCurrentPin setURL:[NSURL URLWithString:urlStringForPin]];
	[uploadRequestForCurrentPin setHTTPMethod:@"POST"];
	[uploadRequestForCurrentPin setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
	[uploadRequestForCurrentPin setValue:[CSS getAuthorization] forHTTPHeaderField:@"Authorization"];
	[uploadRequestForCurrentPin setHTTPBody:dataForCurrentPin];
NSHTTPURLResponse *responseHTTPForCurrentPin;
                
	NSData *responseForCurrentPin = [NSURLConnection sendSynchronousRequest:uploadRequestForCurrentPin returningResponse:&responseHTTPForCurrentPin error:&error];
	[uploadRequestForCurrentPin release];
                
	if ([responseHTTPForCurrentPin statusCode] == 201) {
		// success
	} else {
		// Upload Failed
	}

Card
labelC#


Anchor
getPinListCode
getPinListCode

Get all the pins of the issue

Deck of Cards
idgetPinListCode
Card
labelObjectiveC
Code Block
borderColorGreen
langjava
titleJSON

CommunicationSingleton *CSS = [CommunicationSingleton sharedSingleton];
    //create issue request:
    NSMutableURLRequest *pinListRequest;
    pinListRequest = [[NSMutableURLRequest alloc] init];
    
    NSString *urlStringForIssue = [NSString stringWithFormat:@"%@%@/issues/%@/pins",
                                   [CSS getDefaultAPIURL],
                                   [CSS getSlug],
                                   issueid];
    DLog(@"%@",urlStringForIssue);
    [pinListRequest setURL:[NSURL URLWithString:urlStringForIssue]];
    [pinListRequest setHTTPMethod:@"GET"];
    [pinListRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [pinListRequest setValue:[CSS getAuthorization] forHTTPHeaderField:@"Authorization"];
    
    NSHTTPURLResponse *responseHTTPForPinList;
    NSError *error;
    
    NSData *rawPinList = [NSURLConnection sendSynchronousRequest:pinListRequest returningResponse:&responseHTTPForPinList error:&error];
    [pinListRequest release];
    
    if ([responseHTTPForPinList statusCode] == 200) {
        NSMutableArray *pinList = [NSJSONSerialization JSONObjectWithData:rawPinList options:NSJSONReadingMutableContainers error:&error];
        return  pinList;
    }else{
        return NULL;
    }
Card
labelC#


Anchor
createAttachmentForIssueCode
createAttachmentForIssueCode

Create/Upload a new attachment for the issue

Deck of Cards
idcreateAttachmentForIssueCode
Card
labelObjectiveC
Code Block
borderColorGreen
langjava
titleJSON

NSString *attachmentURL = [[CSS getDefaultAPIURL] stringByAppendingFormat:@"%@/issues/%@/attachments", [CSS getSlug],currentIssueId];
	MultIPartFormCommunication *MPC = [MultIPartFormCommunication sharedSingleton];
	NSString *imageName = [NSString stringWithFormat:@"issueImage%f",[[NSDate date] timeIntervalSince1970]];
	if ([MPC uploadImage:issueImage withExtension:@"jpeg" withFileName:imageName ToURLString:attachmentURL]){
                //succesful uploading
            }else{
                //unsuccesful uploading store the issue image in a list:
            }

Card
labelC#


Anchor
getAttachmentListFromIssueCode
getAttachmentListFromIssueCode

Get the attachment list from the issue

Deck of Cards
idgetAttachmentListFromIssueCode
Card
labelObjectiveC
Code Block
borderColorGreen
langjava
titleJSON

CommunicationSingleton *CSS = [CommunicationSingleton sharedSingleton];
    NSMutableURLRequest *attachmentsRequest;
    attachmentsRequest = [[NSMutableURLRequest alloc] init];
    
    NSString *urlStringForIssue = [NSString stringWithFormat:@"%@%@/issues/%@/attachments",
                                   [CSS getDefaultAPIURL],
                                   [CSS getSlug],
                                   issueid];
    DLog(@"%@",urlStringForIssue);
    [attachmentsRequest setURL:[NSURL URLWithString:urlStringForIssue]];
    [attachmentsRequest setHTTPMethod:@"GET"];
    [attachmentsRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [attachmentsRequest setValue:[CSS getAuthorization] forHTTPHeaderField:@"Authorization"];
    
    NSHTTPURLResponse *responseHTTPForAttachments;
    NSError *error;
    
    NSData *rawAttachmentsList = [NSURLConnection sendSynchronousRequest:attachmentsRequest returningResponse:&responseHTTPForAttachments error:&error];
    [attachmentsRequest release];
    
    if ([responseHTTPForAttachments statusCode] == 200) {
        NSMutableArray *attachmentsList = [NSJSONSerialization JSONObjectWithData:rawAttachmentsList options:NSJSONReadingMutableContainers error:&error];
        if ([attachmentsList count] > 0) {
            return attachmentsList;
        }else{
            return NULL;
        }
    }else{
        return NULL;
    }
Card
labelC#