filerepository


filerepository 는 HSP 에서 기본으로 제공하는 API 로 별도의 설정 없이 사용 가능하며 미리 선언 해둔 특정 위치에 파일을 저장 / 삭제 / 검색의 기능을 가지고 있다.


save

save 는 로컬내 파일 이나 외부 (http link) 의 데이터를 HSP 에 지정된 경로에 저장할 때 사용할 수 있으며, 만약 저장하려는 파일이 zip 파일일때는 압축 해제까지 한번에 처리할 수 있으며, 올바르게 파일을 저장하였다면 NSDictionary 형태로 파일에 대한 정보를 반환 하게 되며 세부 내용은 하단의 표를 참고 한다.

options

필드설명M/O
originalURL원본 URLM
fileName파일 이름M
isCompresszip 파일압축여부 (압축파일이면 다운받은 후 압축을 해제)
해당 옵션은  압축된 경우에만 기술
true : 압축파일
false : 압축파일이 아님
M
   

Example

let infoParam = DAPFileRepositorySaveParam()
infoParam.originalURL = "https://m.hanwhacorp.co.kr/_resource/hanwha/images/ci_concept.png"
infoParam.fileName = "clogo.png"
infoParam.isCompress = false

DAPFileRepository.save(infoParam, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
DAPFileRepositorySaveParam *infoParam = [DAPFileRepositorySaveParam new];
infoParam.originalURL = @"https://m.hanwhacorp.co.kr/_resource/hanwha/images/ci_concept.png";
infoParam.fileName = @"clogo.png";
infoParam.isCompress = NO;

[DAPFileRepository save:infoParam completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

find

find 는 지정 위치에 파일 이름을 검색해 관련 파일 정보를 NSArray 형태로 전달 받는다.

options

필드설명M/O
fileName파일명M
   

Example

DAPFileRepository.find("clogo.png", completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
[DAPFileRepository find:@"clogo.png" completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

remove

파일의 대한 경로를 전달하여 해당 파일을 삭제 요청 한다. 

options

필드설명M/O
path로컬 파일 경로M
   

Example

let filePath = "filePath"
DAPFileRepository.remove(filePath, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
NSString *filePath = @"filePath";
[DAPFileRepository remove:filePath completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

Error Code

CodeCauseComment
E10400파라메터 값이 잘못되어 있을 경우 
E10401전달된 액션 값이 알 수 없는 액션일 경우 
E10402원본 URL 정보가 잘못되어 있을 경우 
E10403파일 이름이 잘못되어 있을 경우 
E10404로컬 파일 경로가 잘못되어 있을 경우 
E10450실행 중 오류가 발생 되었을 경우 
E10451실행 중 파일을 찾을 수 없는 경우 
E10452파일 저장시 저장 할 파일이 존재하는 경우 
E10453실행 중 압축 해제시 오류가 발생한 경우 
E10454서버로 부터 전달받은 응답 메시지가 없는 경우 
E10455서버로 부터 전달받은 응답 메시지가 잘못되어 있는 경우 
E10499알 수 없는 오류가 발생 되었을 경우