-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathCOFileRequest.m
More file actions
executable file
·127 lines (92 loc) · 2.72 KB
/
COFileRequest.m
File metadata and controls
executable file
·127 lines (92 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//
// COFileRequest.m
// CodingModels
//
// Created by sunguanglei on 15/6/3.
// Copyright (c) 2015年 sgl. All rights reserved.
//
#import "COFileRequest.h"
#import "COFolder.h"
@implementation COFoldersRequest
- (void)prepareForRequest
{
self.path = [NSString stringWithFormat:@"/project/%ld/all_folders", (long)self.projectId];
}
- (CODataResponse *)getResponseParser:(id)response
{
return [[CODataResponse alloc] initWithResponse:response dataModleClass:[COFolder class] responseType:CODataResponseTypePage];
}
@end
@implementation COFoldersCountRequest
- (void)prepareForRequest
{
self.path = [NSString stringWithFormat:@"/project/%ld/folders/all_file_count", (long)self.projectId];
}
- (CODataResponse *)getResponseParser:(id)response
{
return [[CODataResponse alloc] initWithResponse:response dataModleClass:[COFileCount class] responseType:CODataResponseTypeList];
}
@end
@implementation COFolderFilesRequest
- (void)prepareForRequest
{
self.path = [NSString stringWithFormat:@"/project/%ld/files/%ld", (long)self.projectId, (long)self.folderId];
}
- (CODataResponse *)getResponseParser:(id)response
{
return [[CODataResponse alloc] initWithResponse:response dataModleClass:[COFile class] responseType:CODataResponseTypePage];
}
@end
@implementation COFileDetailRequest
- (void)prepareForRequest
{
self.path = [NSString stringWithFormat:@"/project/%@/files/%@/view", self.projectId, self.fileId];
}
- (CODataResponse *)getResponseParser:(id)response
{
return [[CODataResponse alloc] initWithResponse:response dataModleClass:[COFileView class] responseType:CODataResponseTypeDefault];
}
@end
@implementation COCreateFolderRequest
- (void)prepareForRequest
{
self.path = [NSString stringWithFormat:@"/project/%@/mkdir", self.projectId];
}
- (NSDictionary *)parametersMap
{
return @{@"name" : @"name",
@"parentId" : @"parentId"};
}
@end
@implementation CORenameFolderRequest
- (void)prepareForRequest
{
self.path = [NSString stringWithFormat:@"/project/%@/dir/%@/name/%@", self.projectId, self.folderId, self.name];
}
@end
@implementation COMoveFileRequest
- (void)prepareForRequest
{
self.path = [NSString stringWithFormat:@"/project/%@/files/moveto/%@", self.projectId, self.destFolderId];
}
- (NSDictionary *)parametersMap
{
return @{@"fileIds" : @"fileId"};
}
@end
@implementation CODeleteFolderRequest
- (void)prepareForRequest
{
self.path = [NSString stringWithFormat:@"/project/%@/rmdir/%@", self.projectId, self.folderId];
}
@end
@implementation CODeleteFileRequest
- (void)prepareForRequest
{
self.path = [NSString stringWithFormat:@"/project/%@/file/delete", self.projectId];
}
- (NSDictionary *)parametersMap
{
return @{@"fileIds" : @"fileIds"};
}
@end