Requests

Requests

To make requests, you should create a TLRequest instance. A lot of requests are available in SDK. Please check TLApi/Generated/Requests package to for all available requests.

API

TPDApi is using to send requests to the backend.

Example for not-authorized users (no organization id provided):

TLRequest *req = [TLAuthRequests authorizeByOAuthWithType:oauthType
                                        authorizationCode:code
                                              redirectUrl:redirectUri];

TLOperation *op = [req operationForApi:TPDApi.sharedApi];

[op startWithTimeout:TPDCheckOnlyNetworkOperationTimeOutInterval successBlock:^(TLAuthorization *auth) {
//handle success
} failureBlock:^(NSError *error) {
//handle failure
}];

Example for authorized users (with organization id):

TLRequest *req = [TLPhotosRequests editProfilePhotoWithPhoto:photo crop:crop]; 
TLOperation *op = [req operationForApi:TPDApi.sharedApi organizationId:orgId];

[op startWithSuccessBlock:^(TLPhoto *tlPhoto) {
//handle success
} failureBlock:^(NSError *error) {
//handle error
}];

Last updated