team_groups.stone 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. namespace team
  2. import async
  3. import team_common
  4. #
  5. # Common types.
  6. #
  7. union_closed GroupAccessType
  8. "Role of a user in group."
  9. member
  10. "User is a member of the group, but has no special permissions."
  11. owner
  12. "User can rename the group, and add/remove members."
  13. example default
  14. member = null
  15. union_closed GroupSelector
  16. "Argument for selecting a single group, either by group_id or by external group ID."
  17. group_id team_common.GroupId
  18. "Group ID."
  19. group_external_id team_common.GroupExternalId
  20. "External ID of the group."
  21. example default
  22. group_id = "g:e2db7665347abcd600000000001a2b3c"
  23. union GroupSelectorError
  24. "Error that can be raised when :type:`GroupSelector` is used."
  25. group_not_found
  26. "No matching group found. No groups match the specified group ID."
  27. union GroupSelectorWithTeamGroupError extends GroupSelectorError
  28. "Error that can be raised when :type:`GroupSelector` is used and team groups are disallowed from
  29. being used."
  30. system_managed_group_disallowed
  31. "This operation is not supported on system-managed groups."
  32. union_closed GroupsSelector
  33. "Argument for selecting a list of groups, either by group_ids, or external group IDs."
  34. group_ids List(team_common.GroupId)
  35. "List of group IDs."
  36. group_external_ids List(String)
  37. "List of external IDs of groups."
  38. example default
  39. group_ids = ["g:e2db7665347abcd600000000001a2b3c", "g:111111147abcd6000000000222222c"]
  40. struct GroupMemberSelector
  41. "Argument for selecting a group and a single user."
  42. group GroupSelector
  43. "Specify a group."
  44. user UserSelectorArg
  45. "Identity of a user that is a member of :field:`group`."
  46. example default
  47. group = default
  48. user = default
  49. union GroupMemberSelectorError extends GroupSelectorWithTeamGroupError
  50. "Error that can be raised when :type:`GroupMemberSelector` is used, and the user
  51. is required to be a member of the specified group."
  52. member_not_in_group
  53. "The specified user is not a member of this group."
  54. struct GroupMembersSelector
  55. "Argument for selecting a group and a list of users."
  56. group GroupSelector
  57. "Specify a group."
  58. users UsersSelectorArg
  59. "A list of users that are members of :field:`group`."
  60. union GroupMembersSelectorError extends GroupSelectorWithTeamGroupError
  61. "Error that can be raised when :type:`GroupMembersSelector` is used, and the users
  62. are required to be members of the specified group."
  63. member_not_in_group
  64. "At least one of the specified users is not a member of the group."
  65. struct IncludeMembersArg
  66. return_members Boolean = true
  67. "Whether to return the list of members in the group.
  68. Note that the default value will cause all the group members
  69. to be returned in the response. This may take a long time for large groups."
  70. ####################
  71. # Group Info methods
  72. ####################
  73. struct GroupMemberInfo
  74. "Profile of group member, and role in group."
  75. profile MemberProfile
  76. "Profile of group member."
  77. access_type GroupAccessType
  78. "The role that the user has in the group."
  79. example default
  80. profile = default
  81. access_type = default
  82. struct GroupFullInfo extends team_common.GroupSummary
  83. "Full description of a group."
  84. members List(GroupMemberInfo)?
  85. "List of group members."
  86. created UInt64
  87. "The group creation time as a UTC timestamp in milliseconds since the Unix epoch."
  88. example default
  89. group_name = "project launch"
  90. group_id = "g:e2db7665347abcd600000000001a2b3c"
  91. member_count = 5
  92. group_management_type = user_managed
  93. members = [default]
  94. created = 1447255518000
  95. #
  96. # route groups/list
  97. #
  98. struct GroupsListArg
  99. limit UInt32(min_value=1, max_value=1000) = 1000
  100. "Number of results to return per call."
  101. example default
  102. limit = 100
  103. struct GroupsListResult
  104. groups List(team_common.GroupSummary)
  105. cursor String
  106. "Pass the cursor into :route:`groups/list/continue` to obtain the additional groups."
  107. has_more Boolean
  108. "Is true if there are additional groups that have not been returned
  109. yet. An additional call to :route:`groups/list/continue` can retrieve them."
  110. example default
  111. groups = [default]
  112. cursor = "ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu"
  113. has_more = false
  114. route groups/list(GroupsListArg, GroupsListResult, Void)
  115. "Lists groups on a team.
  116. Permission : Team Information."
  117. attrs
  118. auth = "team"
  119. owner = "adminx"
  120. #
  121. # route groups/list/continue
  122. #
  123. struct GroupsListContinueArg
  124. cursor String
  125. "Indicates from what point to get the next set of groups."
  126. example default
  127. cursor = "ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu"
  128. union GroupsListContinueError
  129. invalid_cursor
  130. "The cursor is invalid."
  131. route groups/list/continue(GroupsListContinueArg, GroupsListResult, GroupsListContinueError)
  132. "Once a cursor has been retrieved from :route:`groups/list`, use this to paginate
  133. through all groups.
  134. Permission : Team Information."
  135. attrs
  136. auth = "team"
  137. owner = "adminx"
  138. #
  139. # route groups/get_info
  140. #
  141. union_closed GroupsGetInfoItem
  142. id_not_found String
  143. "An ID that was provided as a parameter to :route:`groups/get_info`, and
  144. did not match a corresponding group. The ID can be a group ID, or an external ID,
  145. depending on how the method was called."
  146. group_info GroupFullInfo
  147. "Info about a group."
  148. example default
  149. group_info = default
  150. alias GroupsGetInfoResult = List(GroupsGetInfoItem)
  151. union GroupsGetInfoError
  152. group_not_on_team
  153. "The group is not on your team."
  154. route groups/get_info(GroupsSelector, GroupsGetInfoResult, GroupsGetInfoError)
  155. "Retrieves information about one or more groups. Note that the optional field
  156. :field:`GroupFullInfo.members` is not returned for system-managed groups.
  157. Permission : Team Information."
  158. attrs
  159. auth = "team"
  160. owner = "adminx"
  161. ##########################
  162. # Group management methods
  163. ##########################
  164. #
  165. # route groups/create
  166. #
  167. struct GroupCreateArg
  168. group_name String
  169. "Group name."
  170. group_external_id team_common.GroupExternalId?
  171. "The creator of a team can associate an arbitrary external ID to the group."
  172. group_management_type team_common.GroupManagementType?
  173. "Whether the team can be managed by selected users, or only by team admins."
  174. example default
  175. group_name = "Europe sales"
  176. group_external_id = "group-134"
  177. union GroupCreateError
  178. group_name_already_used
  179. "The requested group name is already being used by another group."
  180. group_name_invalid
  181. "Group name is empty or has invalid characters."
  182. external_id_already_in_use
  183. "The requested external ID is already being used by another group."
  184. system_managed_group_disallowed
  185. "System-managed group cannot be manually created."
  186. route groups/create(GroupCreateArg, GroupFullInfo, GroupCreateError)
  187. "Creates a new, empty group, with a requested name.
  188. Permission : Team member management."
  189. attrs
  190. auth = "team"
  191. owner = "adminx"
  192. #
  193. # route groups/delete (async method)
  194. #
  195. union GroupDeleteError extends GroupSelectorWithTeamGroupError
  196. group_already_deleted
  197. "This group has already been deleted."
  198. route groups/delete(GroupSelector, async.LaunchEmptyResult, GroupDeleteError)
  199. "Deletes a group.
  200. The group is deleted immediately. However the revoking of group-owned resources
  201. may take additional time.
  202. Use the :route:`groups/job_status/get` to determine whether this process has completed.
  203. Permission : Team member management."
  204. attrs
  205. auth = "team"
  206. owner = "adminx"
  207. #
  208. # route groups/update
  209. #
  210. struct GroupUpdateArgs extends IncludeMembersArg
  211. group GroupSelector
  212. "Specify a group."
  213. new_group_name String?
  214. "Optional argument. Set group name to this if provided."
  215. new_group_external_id team_common.GroupExternalId?
  216. "Optional argument. New group external ID.
  217. If the argument is None, the group's external_id won't be updated.
  218. If the argument is empty string, the group's external id will be cleared."
  219. new_group_management_type team_common.GroupManagementType?
  220. "Set new group management type, if provided."
  221. example default
  222. group = default
  223. new_group_name = "Europe west sales"
  224. new_group_external_id = "sales-234"
  225. new_group_management_type = company_managed
  226. union GroupUpdateError extends GroupSelectorWithTeamGroupError
  227. group_name_already_used
  228. "The requested group name is already being used by another group."
  229. group_name_invalid
  230. "Group name is empty or has invalid characters."
  231. external_id_already_in_use
  232. "The requested external ID is already being used by another group."
  233. route groups/update(GroupUpdateArgs, GroupFullInfo, GroupUpdateError)
  234. "Updates a group's name and/or external ID.
  235. Permission : Team member management."
  236. attrs
  237. auth = "team"
  238. owner = "adminx"
  239. #
  240. # Structures common to groups/members/add and groups/members/remove
  241. #
  242. struct GroupMembersChangeResult
  243. "Result returned by :route:`groups/members/add` and :route:`groups/members/remove`."
  244. group_info GroupFullInfo
  245. "The group info after member change operation has been performed."
  246. async_job_id async.AsyncJobId
  247. "An ID that can be used to obtain the status of granting/revoking group-owned resources."
  248. example default
  249. group_info = default
  250. async_job_id = "99988877733388"
  251. #
  252. # route groups/members/add (async method)
  253. #
  254. struct MemberAccess
  255. "Specify access type a member should have when joined to a group."
  256. user UserSelectorArg
  257. "Identity of a user."
  258. access_type GroupAccessType
  259. "Access type."
  260. example default
  261. user = default
  262. access_type = default
  263. struct GroupMembersAddArg extends IncludeMembersArg
  264. group GroupSelector
  265. "Group to which users will be added."
  266. members List(MemberAccess)
  267. "List of users to be added to the group."
  268. example default
  269. group = default
  270. members = [default]
  271. union GroupMembersAddError extends GroupSelectorWithTeamGroupError
  272. duplicate_user
  273. "You cannot add duplicate users. One or more of the members
  274. you are trying to add is already a member of the group."
  275. group_not_in_team
  276. "Group is not in this team. You cannot add members to a
  277. group that is outside of your team."
  278. members_not_in_team List(String)
  279. "These members are not part of your team. Currently, you cannot add members
  280. to a group if they are not part of your team, though this
  281. may change in a subsequent version. To add new members to your Dropbox
  282. Business team, use the :route:`members/add` endpoint."
  283. users_not_found List(String)
  284. "These users were not found in Dropbox."
  285. user_must_be_active_to_be_owner
  286. "A suspended user cannot be added to a group as :field:`GroupAccessType.owner`."
  287. user_cannot_be_manager_of_company_managed_group List(String)
  288. "A company-managed group cannot be managed by a user."
  289. route groups/members/add(GroupMembersAddArg, GroupMembersChangeResult, GroupMembersAddError)
  290. "Adds members to a group.
  291. The members are added immediately. However the granting of group-owned resources
  292. may take additional time.
  293. Use the :route:`groups/job_status/get` to determine whether this process has completed.
  294. Permission : Team member management."
  295. attrs
  296. auth = "team"
  297. owner = "adminx"
  298. #
  299. # route groups/members/remove (async method)
  300. #
  301. struct GroupMembersRemoveArg extends IncludeMembersArg
  302. group GroupSelector
  303. "Group from which users will be removed."
  304. users List(UserSelectorArg)
  305. "List of users to be removed from the group."
  306. example default
  307. group = default
  308. users = [default]
  309. union GroupMembersRemoveError extends GroupMembersSelectorError
  310. group_not_in_team
  311. "Group is not in this team. You cannot remove members from a group
  312. that is outside of your team."
  313. members_not_in_team List(String)
  314. "These members are not part of your team."
  315. users_not_found List(String)
  316. "These users were not found in Dropbox."
  317. route groups/members/remove(GroupMembersRemoveArg, GroupMembersChangeResult, GroupMembersRemoveError)
  318. "Removes members from a group.
  319. The members are removed immediately. However the revoking of group-owned resources
  320. may take additional time.
  321. Use the :route:`groups/job_status/get` to determine whether this process has completed.
  322. This method permits removing the only owner of a group, even in cases where this is not
  323. possible via the web client.
  324. Permission : Team member management."
  325. attrs
  326. auth = "team"
  327. owner = "adminx"
  328. #
  329. # route groups/members/set_access_type
  330. #
  331. struct GroupMembersSetAccessTypeArg extends GroupMemberSelector
  332. access_type GroupAccessType
  333. "New group access type the user will have."
  334. return_members Boolean = true
  335. "Whether to return the list of members in the group.
  336. Note that the default value will cause all the group members
  337. to be returned in the response. This may take a long time for large groups."
  338. example default
  339. group = default
  340. user = default
  341. access_type = default
  342. union GroupMemberSetAccessTypeError extends GroupMemberSelectorError
  343. user_cannot_be_manager_of_company_managed_group
  344. "A company managed group cannot be managed by a user."
  345. route groups/members/set_access_type(GroupMembersSetAccessTypeArg, GroupsGetInfoResult, GroupMemberSetAccessTypeError)
  346. "Sets a member's access type in a group.
  347. Permission : Team member management."
  348. attrs
  349. auth = "team"
  350. owner = "adminx"
  351. #
  352. # route groups/members/list
  353. #
  354. struct GroupsMembersListArg
  355. group GroupSelector
  356. "The group whose members are to be listed."
  357. limit UInt32(min_value=1, max_value=1000) = 1000
  358. "Number of results to return per call."
  359. example default
  360. group = default
  361. limit = 100
  362. struct GroupsMembersListResult
  363. members List(GroupMemberInfo)
  364. cursor String
  365. "Pass the cursor into :route:`groups/members/list/continue` to obtain additional group members."
  366. has_more Boolean
  367. "Is true if there are additional group members that have not been returned
  368. yet. An additional call to :route:`groups/members/list/continue` can retrieve them."
  369. example default
  370. members = []
  371. cursor = "ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu"
  372. has_more = false
  373. route groups/members/list(GroupsMembersListArg, GroupsMembersListResult, GroupSelectorError)
  374. "Lists members of a group.
  375. Permission : Team Information."
  376. attrs
  377. auth = "team"
  378. owner = "adminx"
  379. #
  380. # route groups/members/list/continue
  381. #
  382. struct GroupsMembersListContinueArg
  383. cursor String
  384. "Indicates from what point to get the next set of groups."
  385. example default
  386. cursor = "ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu"
  387. union GroupsMembersListContinueError
  388. invalid_cursor
  389. "The cursor is invalid."
  390. route groups/members/list/continue(GroupsMembersListContinueArg, GroupsMembersListResult, GroupsMembersListContinueError)
  391. "Once a cursor has been retrieved from :route:`groups/members/list`, use this to paginate
  392. through all members of the group.
  393. Permission : Team information."
  394. attrs
  395. auth = "team"
  396. owner = "adminx"
  397. #
  398. # route groups/job_status/get
  399. #
  400. union GroupsPollError extends async.PollError
  401. access_denied
  402. "You are not allowed to poll this job."
  403. route groups/job_status/get(async.PollArg, async.PollEmptyResult, GroupsPollError)
  404. "Once an async_job_id is returned from :route:`groups/delete`,
  405. :route:`groups/members/add` , or :route:`groups/members/remove`
  406. use this method to poll the status of granting/revoking
  407. group members' access to group-owned resources.
  408. Permission : Team member management."
  409. attrs
  410. auth = "team"
  411. owner = "adminx"