files_properties.stone 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. namespace files
  2. #
  3. # Property Group routes
  4. #
  5. route properties/add(PropertyGroupWithPath, Void, AddPropertiesError)
  6. "Add custom properties to a file using a filled property template.
  7. See properties/template/add to create new property templates."
  8. attrs
  9. api_group="properties"
  10. is_preview=true
  11. allow_app_folder_app = true
  12. route properties/overwrite(PropertyGroupWithPath, Void, InvalidPropertyGroupError)
  13. "Overwrite custom properties from a specified template
  14. associated with a file."
  15. attrs
  16. api_group="properties"
  17. is_preview=true
  18. allow_app_folder_app = true
  19. route properties/update(UpdatePropertyGroupArg, Void, UpdatePropertiesError)
  20. "Add, update or remove custom properties from a specified template
  21. associated with a file. Fields that already exist and not described in
  22. the request will not be modified."
  23. attrs
  24. api_group="properties"
  25. is_preview=true
  26. allow_app_folder_app = true
  27. route properties/remove(RemovePropertiesArg, Void, RemovePropertiesError)
  28. "Remove all custom properties from a specified template associated with a file.
  29. To remove specific property key value pairs, see :route:`properties/update`.
  30. To update a property template, see properties/template/update.
  31. Property templates can't be removed once created."
  32. attrs
  33. api_group="properties"
  34. is_preview=true
  35. allow_app_folder_app = true
  36. route properties/template/get(properties.GetPropertyTemplateArg, properties.GetPropertyTemplateResult, properties.PropertyTemplateError)
  37. "Get the schema for a specified template."
  38. attrs
  39. api_group="properties"
  40. is_preview=true
  41. allow_app_folder_app = true
  42. route properties/template/list(Void, properties.ListPropertyTemplateIds, properties.PropertyTemplateError)
  43. "Get the property template identifiers for a user. To get the schema of
  44. each template use :route:`properties/template/get`."
  45. attrs
  46. api_group="properties"
  47. is_preview=true
  48. allow_app_folder_app = true
  49. struct RemovePropertiesArg
  50. path PathOrId
  51. "A unique identifier for the file."
  52. property_template_ids List(properties.TemplateId)
  53. "A list of identifiers for a property template created by route properties/template/add."
  54. example default
  55. path = "/my_awesome/word.docx"
  56. property_template_ids = ["ptid:1a5n2i6d3OYEAAAAAAAAAYa"]
  57. struct PropertyGroupWithPath
  58. path PathOrId
  59. "A unique identifier for the file."
  60. property_groups List(properties.PropertyGroup)
  61. "Filled custom property templates associated with a file."
  62. example default
  63. path = "/my_awesome/word.docx"
  64. property_groups = [default]
  65. struct UpdatePropertyGroupArg
  66. path PathOrId
  67. "A unique identifier for the file."
  68. update_property_groups List(PropertyGroupUpdate)
  69. "Filled custom property templates associated with a file."
  70. example default
  71. path = "/my_awesome/word.docx"
  72. update_property_groups = [default]
  73. struct PropertyGroupUpdate
  74. template_id properties.TemplateId
  75. "A unique identifier for a property template."
  76. add_or_update_fields List(properties.PropertyField)?
  77. "List of property fields to update if the field already exists. If the field doesn't exist,
  78. add the field to the property group."
  79. remove_fields List(String)?
  80. "List of property field names to remove from property group if the field exists."
  81. example default
  82. template_id = "ptid:1a5n2i6d3OYEAAAAAAAAAYa"
  83. add_or_update_fields = [default]
  84. remove_fields = []
  85. union AddPropertiesError extends InvalidPropertyGroupError
  86. property_group_already_exists
  87. "This property group already exists for this file."
  88. union UpdatePropertiesError extends InvalidPropertyGroupError
  89. property_group_lookup LookUpPropertiesError
  90. union RemovePropertiesError extends PropertiesError
  91. property_group_lookup LookUpPropertiesError
  92. union_closed LookUpPropertiesError
  93. property_group_not_found
  94. "This property group does not exist for this file."
  95. union InvalidPropertyGroupError extends PropertiesError
  96. property_field_too_large
  97. "A field value in this property group is too large."
  98. does_not_fit_template
  99. "The property group specified does not conform to the property template."
  100. union PropertiesError extends properties.PropertyTemplateError
  101. path LookupError
  102. #
  103. # Patched /get_metadata that can return properties
  104. #
  105. route alpha/get_metadata (AlphaGetMetadataArg, Metadata, AlphaGetMetadataError)
  106. "Returns the metadata for a file or folder. This is an alpha endpoint
  107. compatible with the properties API.
  108. Note: Metadata for the root folder is unsupported."
  109. attrs
  110. api_group="properties"
  111. is_preview=true
  112. allow_app_folder_app = true
  113. struct AlphaGetMetadataArg extends GetMetadataArg
  114. include_property_templates List(properties.TemplateId)?
  115. "If set to a valid list of template IDs,
  116. :field:`FileMetadata.property_groups` is set for files with custom
  117. properties."
  118. example default
  119. path = "/Homework/math"
  120. example id
  121. path = "id:a4ayc_80_OEAAAAAAAAAYa"
  122. example rev
  123. path = "rev:a1c10ce0dd78"
  124. union_closed AlphaGetMetadataError extends GetMetadataError
  125. properties_error LookUpPropertiesError
  126. #
  127. # Patched /upload that accepts properties
  128. #
  129. route alpha/upload (CommitInfoWithProperties, FileMetadata, UploadErrorWithProperties)
  130. "Create a new file with the contents provided in the request. Note that this
  131. endpoint is part of the properties API alpha and is slightly different from
  132. :route:`upload`.
  133. Do not use this to upload a file larger than 150 MB. Instead, create an
  134. upload session with :route:`upload_session/start`."
  135. attrs
  136. host="content"
  137. style="upload"
  138. api_group="properties"
  139. is_preview=true
  140. allow_app_folder_app = true
  141. struct CommitInfoWithProperties extends CommitInfo
  142. property_groups List(properties.PropertyGroup)?
  143. "List of custom properties to add to file."
  144. example default
  145. path = "/Homework/math/Matrices.txt"
  146. autorename = true
  147. property_groups = [default]
  148. union UploadErrorWithProperties extends UploadError
  149. properties_error InvalidPropertyGroupError