Versions Compared

Key

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

...

Composition Setup

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

...

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

    // building the json object
    if (([emailString length] != 0) && ([passwordString length] != 0))
    {

        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
        NSString *requestURLString = [NSString stringWithFormat:@"%@authorize",[CSS getDefaultAPIURL]];
        [request setURL:[NSURL URLWithString:requestURLString]];
        [request setHTTPMethod:@"POST"];
        [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

        NSString *requestBodyString = [NSString stringWithFormat:@"{\"user_id\": \"%@\", \"password\": \"%@\", \"client_id\": \"%@\"}",emailString,passwordString,[[NSUserDefaults standardUserDefaults] objectForKey:@"ClientIdentificationForAuthorizationPurposes"]];
        [request setHTTPBody:[requestBodyString dataUsingEncoding:NSUTF8StringEncoding]];
        [request setTimeoutInterval:60];

        __block BOOL loginFailed = NO;

        __block BOOL invalidUser = NO;

        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(void){

            //build an info object and convert to json
            NSError *requestError;
            NSHTTPURLResponse *responseHTTP;

            NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:&responseHTTP error:&requestError];

            if ([responseHTTP statusCode] == 200)
            {
                NSDictionary *tempdict = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:&requestError];
                [CSS setUpAuthenticationForType:[tempdict valueForKey:@"token_type"] withID:[tempdict valueForKey:@"access_token"]];

                // authorization was successfull

            } else {

                loginFailed = YES;

                if (requestError.code == -1012) {

                    // Failed because it's an invalid user

                    invalidUser = YES;

                } else {

                    // check if project list stored on device.
                    // if yes, start offline mode
                }
            }
        });

    }

Card
labelC#

Find out how many teams I am part of

Deck of Cards
idhowManyTeamsCode
Card
labelObjectiveC
Code Block
borderColorGreen
langjava
titleJSON

CommunicationSingleton *CSS = [CommunicationSingleton sharedSingleton];
    
    //build an info object and convert to json
    NSError *requestError;
    NSHTTPURLResponse *responseHTTP;
    
    NSMutableURLRequest *requestForSlug = [[NSMutableURLRequest alloc] init];
    
    NSString *teamRequestString = [NSString stringWithFormat:@"%@teams",[CSS getDefaultAPIURL]];
    [requestForSlug setURL:[NSURL URLWithString:teamRequestString]];
    [requestForSlug setHTTPMethod:@"GET"];
    [requestForSlug setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [requestForSlug setValue:[CSS getAuthorization] forHTTPHeaderField:@"Authorization"];
    
    NSData *responseForSlug = [NSURLConnection sendSynchronousRequest:requestForSlug returningResponse:&responseHTTP error:&requestError];
    [requestForSlug release];
    
    if ([responseHTTP statusCode] == 200) {
        // Success. Team names array.
        NSArray *tempdictForSlug = [NSJSONSerialization JSONObjectWithData:responseForSlug options:NSJSONReadingMutableContainers error:&requestError];
        NSLog(@"How many teams I am part of: %d", [tempdictForSlug count]);
    }else{
        // Login Failed.
    }
Card
labelC#