-
Notifications
You must be signed in to change notification settings - Fork 445
/
DbxUserUsersRequests.java
197 lines (178 loc) · 7.65 KB
/
DbxUserUsersRequests.java
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/* DO NOT EDIT */
/* This file was generated from users.stone */
package com.dropbox.core.v2.users;
import com.dropbox.core.DbxApiException;
import com.dropbox.core.DbxException;
import com.dropbox.core.DbxWrappedException;
import com.dropbox.core.http.HttpRequestor;
import com.dropbox.core.v2.DbxRawClientV2;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Routes in namespace "users".
*/
public class DbxUserUsersRequests {
// namespace users (users.stone)
private final DbxRawClientV2 client;
public DbxUserUsersRequests(DbxRawClientV2 client) {
this.client = client;
}
//
// route 2/users/features/get_values
//
/**
* Get a list of feature values that may be configured for the current
* account.
*
*/
UserFeaturesGetValuesBatchResult featuresGetValues(UserFeaturesGetValuesBatchArg arg) throws UserFeaturesGetValuesBatchErrorException, DbxException {
try {
return this.client.rpcStyle(this.client.getHost().getApi(),
"2/users/features/get_values",
arg,
false,
UserFeaturesGetValuesBatchArg.Serializer.INSTANCE,
UserFeaturesGetValuesBatchResult.Serializer.INSTANCE,
UserFeaturesGetValuesBatchError.Serializer.INSTANCE);
}
catch (DbxWrappedException ex) {
throw new UserFeaturesGetValuesBatchErrorException("2/users/features/get_values", ex.getRequestId(), ex.getUserMessage(), (UserFeaturesGetValuesBatchError) ex.getErrorValue());
}
}
/**
* Get a list of feature values that may be configured for the current
* account.
*
* @param features A list of features in {@link UserFeature}. If the list
* is empty, this route will return {@link
* UserFeaturesGetValuesBatchError}. Must not contain a {@code null}
* item and not be {@code null}.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public UserFeaturesGetValuesBatchResult featuresGetValues(List<UserFeature> features) throws UserFeaturesGetValuesBatchErrorException, DbxException {
UserFeaturesGetValuesBatchArg _arg = new UserFeaturesGetValuesBatchArg(features);
return featuresGetValues(_arg);
}
//
// route 2/users/get_account
//
/**
* Get information about a user's account.
*
*
* @return Basic information about any account.
*/
BasicAccount getAccount(GetAccountArg arg) throws GetAccountErrorException, DbxException {
try {
return this.client.rpcStyle(this.client.getHost().getApi(),
"2/users/get_account",
arg,
false,
GetAccountArg.Serializer.INSTANCE,
BasicAccount.Serializer.INSTANCE,
GetAccountError.Serializer.INSTANCE);
}
catch (DbxWrappedException ex) {
throw new GetAccountErrorException("2/users/get_account", ex.getRequestId(), ex.getUserMessage(), (GetAccountError) ex.getErrorValue());
}
}
/**
* Get information about a user's account.
*
* @param accountId A user's account identifier. Must have length of at
* least 40, have length of at most 40, and not be {@code null}.
*
* @return Basic information about any account.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public BasicAccount getAccount(String accountId) throws GetAccountErrorException, DbxException {
GetAccountArg _arg = new GetAccountArg(accountId);
return getAccount(_arg);
}
//
// route 2/users/get_account_batch
//
/**
* Get information about multiple user accounts. At most 300 accounts may
* be queried per request.
*
*/
List<BasicAccount> getAccountBatch(GetAccountBatchArg arg) throws GetAccountBatchErrorException, DbxException {
try {
return this.client.rpcStyle(this.client.getHost().getApi(),
"2/users/get_account_batch",
arg,
false,
GetAccountBatchArg.Serializer.INSTANCE,
com.dropbox.core.stone.StoneSerializers.list(BasicAccount.Serializer.INSTANCE),
GetAccountBatchError.Serializer.INSTANCE);
}
catch (DbxWrappedException ex) {
throw new GetAccountBatchErrorException("2/users/get_account_batch", ex.getRequestId(), ex.getUserMessage(), (GetAccountBatchError) ex.getErrorValue());
}
}
/**
* Get information about multiple user accounts. At most 300 accounts may
* be queried per request.
*
* @param accountIds List of user account identifiers. Should not contain
* any duplicate account IDs. Must contain at least 1 items, not contain
* a {@code null} item, and not be {@code null}.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public List<BasicAccount> getAccountBatch(List<String> accountIds) throws GetAccountBatchErrorException, DbxException {
GetAccountBatchArg _arg = new GetAccountBatchArg(accountIds);
return getAccountBatch(_arg);
}
//
// route 2/users/get_current_account
//
/**
* Get information about the current user's account.
*
* @return Detailed information about the current user's account.
*/
public FullAccount getCurrentAccount() throws DbxApiException, DbxException {
try {
return this.client.rpcStyle(this.client.getHost().getApi(),
"2/users/get_current_account",
null,
false,
com.dropbox.core.stone.StoneSerializers.void_(),
FullAccount.Serializer.INSTANCE,
com.dropbox.core.stone.StoneSerializers.void_());
}
catch (DbxWrappedException ex) {
throw new DbxApiException(ex.getRequestId(), ex.getUserMessage(), "Unexpected error response for \"get_current_account\":" + ex.getErrorValue());
}
}
//
// route 2/users/get_space_usage
//
/**
* Get the space usage information for the current user's account.
*
* @return Information about a user's space usage and quota.
*/
public SpaceUsage getSpaceUsage() throws DbxApiException, DbxException {
try {
return this.client.rpcStyle(this.client.getHost().getApi(),
"2/users/get_space_usage",
null,
false,
com.dropbox.core.stone.StoneSerializers.void_(),
SpaceUsage.Serializer.INSTANCE,
com.dropbox.core.stone.StoneSerializers.void_());
}
catch (DbxWrappedException ex) {
throw new DbxApiException(ex.getRequestId(), ex.getUserMessage(), "Unexpected error response for \"get_space_usage\":" + ex.getErrorValue());
}
}
}