pod install.pod"QCloudCOSSMH/Api"
#import <QCloudCOSSMHApi.h>
// Publish the configuration domain name[QCloudSMHBaseRequest setBaseRequestHost:@"<libraryId>.api.tencentsmh.cn" targetType:QCloudECDTargetRelease];[QCloudSMHBaseRequest setTargetType:QCloudECDTargetRelease];

- (void)accessTokenWithRequest:(QCloudSMHBizRequest *)requesturlRequest:(NSURLRequest *)urlRequstcompelete:(QCloudSMHAuthentationContinueBlock)continueBlock {// First get the response containing access token information from your access token serverQCloudSMHSpaceInfo * spaceInfo = [QCloudSMHSpaceInfo new];spaceInfo.accessToken = @""; // Access tokenspaceInfo.expiresIn = @""; // Access token valid duration in secondsspaceInfo.libraryId = @""; //spaceInfo.spaceId = @"";continueBlock(sapceInfo, nil);}
QCloudAccessTokenFenceQueueDelegate protocol.@property (nonatomic) QCloudSMHAccessTokenFenceQueue *fenceQueue;self.fenceQueue = [QCloudSMHAccessTokenFenceQueue new];self.fenceQueue.delegate = self;
QCloudAccessTokenFenceQueueDelegate.- (void)fenceQueue:(QCloudSMHAccessTokenFenceQueue *)queuerequest:(QCloudSMHBizRequest *)requestrequestCreatorWithContinue:(QCloudAccessTokenFenceQueueContinue)continueBlock {// First get the response containing access token information from your access token serverQCloudSMHSpaceInfo * spaceInfo = [QCloudSMHSpaceInfo new];spaceInfo.accessToken = @""; // Access tokenspaceInfo.expiresIn = @""; // Access token valid duration in secondsspaceInfo.libraryId = @""; //spaceInfo.spaceId = @"";continueBlock(sapceInfo, nil);}// In this method, use scaffold to handle request with sdk internal cache accessToken and use continueBlock callback to sdk. If// If the accessToken cached in the sdk expires or is not available, redirect to the above method to request the latest accessToken and cache it in the sdk.- (void)accessTokenWithRequest:(QCloudSMHBizRequest *)requesturlRequest:(NSURLRequest *)urlRequstcompelete:(QCloudSMHAuthentationContinueBlock)continueBlock {[self.fenceQueue performRequest:requestwithAction:^(QCloudSMHSpaceInfo *_Nonnull accessToken, NSError *_Nonnull error) {if (error) {continueBlock(nil, error);} else {continueBlock(accessToken, nil);}}];}
QCloudSMHListContentsRequest *req = [QCloudSMHListContentsRequest new];// The user's Space IDreq.spaceId = @"spaceId";// The user's library IDreq.libraryId = @"libraryId";// Directory path or album name. For multi-level directories, use slashes (/) to separate, such as foo/bar. For the root directory, leave this parameter blank.req.dirPath = @"dirpath";[req setFinishBlock:^(QCloudSMHContentListInfo *_Nullable result, NSError *_Nullable error) {// result file list data// error message}];// Initiate a request[[QCloudSMHService defaultSMHService] listContents:req];
Feedback