BuiltExtension Class Reference

Inherits from NSObject
Declared in BuiltExtension.h

Other Methods

  requestParams

Set parameter to pass in extension call

@property (nonatomic, strong) NSDictionary *requestParams

Discussion

//‘blt5d4sample2633b’ is a dummy Application API key

//Obj-C
BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
BuiltExtension *extensionObject = [builtApplication extension];
extensionObject.requestParams = @{@"name" : @"John"};

//Swift
var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
var extensionObject:BuiltExtension = builtApplication.extension()
extensionObject.requestParams = {"name" : "John"}

Declared In

BuiltExtension.h

execute

– execute:

Makes a call to an extension function asynchronously.

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltExtension *extensionObject = [builtApplication extension];
 [extensionObject execute:^(BuiltResponseType responseType, id responseObject, NSError *error) {

 }];

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var extensionObject:BuiltExtension = builtApplication.extension()
 extensionObject.execute { (responseType, responseObject, error) -> Void in

 }
- (void)execute:(void ( ^ ) ( BuiltResponseType responseType , id BUILT_NULLABLE_P responseObject , NSError *BUILT_NULLABLE_P error ))completionBlock

Parameters

dataParameters

any data that you want to pass to the function.

completion

this block will be called after network call if success responseObject will contain the response from the extension method or else nil. error object will contain error if any.

Declared In

BuiltExtension.h

– executeFunction:

Makes a call to an extension function asynchronously.

//'blt5d4sample2633b' is a dummy Application API key

//Obj-C
BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
BuiltExtension *extensionObject = [builtApplication extensionWithKey:@"new_extensionkey"];
[extensionObject executeFunction:^(BuiltResponseType responseType, id responseObject, NSError *error) {

}];

//Swift
var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
var extensionObject:BuiltExtension = builtApplication.extensionWithKey("new_extensionkey")
extensionObject.executeFunction { (responseType, responseObject, error) -> Void in

}

- (void)executeFunction:(void ( ^ ) ( BuiltResponseType responseType , id BUILT_NULLABLE_P responseObject , NSError *BUILT_NULLABLE_P error ))completionBlock

Parameters

completion

this block will be called after network call if success responseObject will contain the response from the extension method or else nil. error object will contain error if any.

Declared In

BuiltExtension.h

– setRequestURL:withRequestType:

set request url and request type.

//'blt5d4sample2633b' is a dummy Application API key

//Obj-C
BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
BuiltExtension *extensionObject = [builtApplication extensionWithKey:@"new_extensionkey"];
[extensionObject setRequestURL:@"v1/person" withRequestType:BuiltRequestTypeGET];

//Swift
var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
var extensionObject:BuiltExtension = builtApplication.extensionWithKey("new_extensionkey")
extensionObject.setRequestURL("v1/person", withRequestType:BuiltRequestTypeGET)
- (void)setRequestURL:(NSString *)url withRequestType:(BuiltRequestType)requestType

Parameters

requestType

requestMethod by which we are making call (GET, POST, PUT, DELETE)

requestURL

url to make call

Declared In

BuiltExtension.h

Manually set headers

– setHeader:forKey:

Set a header for an application

- (void)setHeader:(NSString *)headerValue forKey:(NSString *)headerKey

Parameters

headerValue

The header key

headerKey

The header value

Discussion

//Obj-C
BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
BuiltClass *projectClass = [builtApplication classWithUID:@"project"];
BuiltQuery *projectQuery = [projectClass query];
[projectQuery setHeader:@"MyHeaderValue" forKey:@"My-Custom-Header-Key"];


//Swift
var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
var projectClass:BuiltClass = builtApplication.classWithUID("project")
var projectQuery:BuiltQuery = projectClass.query()
projectQuery.setHeader("MyHeaderValue", forKey:"My-Custom-Header-Key")

Declared In

BuiltExtension.h

– addHeadersWithDictionary:

Set a header for an application

- (void)addHeadersWithDictionary:(NSDictionary *)headers

Parameters

headers

The headers as dictionary which needs to be added to the application

Discussion

//Obj-C
BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
BuiltClass *projectClass = [builtApplication classWithUID:@"project"];
BuiltQuery *projectQuery = [projectClass query];
[projectQuery addHeadersWithDictionary:@{@"My-Custom-Header-Key":@"MyHeaderValue"}];

//Swift
var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
var projectClass:BuiltClass = builtApplication.classWithUID("project")
var projectQuery:BuiltQuery = projectClass.query()
projectQuery.addHeadersWithDictionary(["My-Custom-Header-Key":"MyHeaderValue"])

Declared In

BuiltExtension.h

– removeHeaderForKey:

Removes a header from this application.

- (void)removeHeaderForKey:(NSString *)headerKey

Parameters

headerKey

The header key that needs to be removed

Discussion

//Obj-C
BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
BuiltClass *projectClass = [builtApplication classWithUID:@"project"];
BuiltQuery *projectQuery = [projectClass query];
[projectQuery removeHeaderForKey:@"My-Custom-Header-Key"];

//Swift
var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
var projectClass:BuiltClass = builtApplication.classWithUID("project")
var projectQuery:BuiltQuery = projectClass.query()
projectQuery.removeHeaderForKey("My-Custom-Header-Key")

Declared In

BuiltExtension.h

Cancel Network calls

– cancelRequest

Cancel if any network operation is running.

 //'blt5d4sample2633b' is a dummy Application API key

 //Obj-C
 BuiltApplication *builtApplication = [Built applicationWithAPIKey:@"blt5d4sample2633b"];
 BuiltExtension *extensionObject = [builtApplication extensionWithName:@"hello"];
 [extensionObject cancelRequest];

 //Swift
 var builtApplication:BuiltApplication = Built.applicationWithAPIKey("blt5d4sample2633b")
 var extensionObject:BuiltExtension = builtApplication.extensionWithName("hello")
 extensionObject.cancelRequest()
- (void)cancelRequest

Declared In

BuiltExtension.h