Rust API for Gitea, automatically generated https://git.exmods.org/swagger.v1.json
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

211 lines
5.1KB

  1. /*
  2. * Gitea API.
  3. *
  4. * This documentation describes the Gitea API.
  5. *
  6. * OpenAPI spec version: 1.1.1
  7. *
  8. * Generated by: https://github.com/swagger-api/swagger-codegen.git
  9. */
  10. /// UpdateFileOptions : UpdateFileOptions options for updating files Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
  11. #[allow(unused_imports)]
  12. use serde_json::Value;
  13. #[derive(Debug, Serialize, Deserialize)]
  14. pub struct UpdateFileOptions {
  15. #[serde(rename = "author")]
  16. author: Option<::models::Identity>,
  17. /// branch (optional) to base this file from. if not given, the default branch is used
  18. #[serde(rename = "branch")]
  19. branch: Option<String>,
  20. #[serde(rename = "committer")]
  21. committer: Option<::models::Identity>,
  22. /// content must be base64 encoded
  23. #[serde(rename = "content")]
  24. content: String,
  25. #[serde(rename = "dates")]
  26. dates: Option<::models::CommitDateOptions>,
  27. /// from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL
  28. #[serde(rename = "from_path")]
  29. from_path: Option<String>,
  30. /// message (optional) for the commit of this file. if not supplied, a default message will be used
  31. #[serde(rename = "message")]
  32. message: Option<String>,
  33. /// new_branch (optional) will make a new branch from `branch` before creating the file
  34. #[serde(rename = "new_branch")]
  35. new_branch: Option<String>,
  36. /// sha is the SHA for the file that already exists
  37. #[serde(rename = "sha")]
  38. sha: String
  39. }
  40. impl UpdateFileOptions {
  41. /// UpdateFileOptions options for updating files Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
  42. pub fn new(content: String, sha: String) -> UpdateFileOptions {
  43. UpdateFileOptions {
  44. author: None,
  45. branch: None,
  46. committer: None,
  47. content: content,
  48. dates: None,
  49. from_path: None,
  50. message: None,
  51. new_branch: None,
  52. sha: sha
  53. }
  54. }
  55. pub fn set_author(&mut self, author: ::models::Identity) {
  56. self.author = Some(author);
  57. }
  58. pub fn with_author(mut self, author: ::models::Identity) -> UpdateFileOptions {
  59. self.author = Some(author);
  60. self
  61. }
  62. pub fn author(&self) -> Option<&::models::Identity> {
  63. self.author.as_ref()
  64. }
  65. pub fn reset_author(&mut self) {
  66. self.author = None;
  67. }
  68. pub fn set_branch(&mut self, branch: String) {
  69. self.branch = Some(branch);
  70. }
  71. pub fn with_branch(mut self, branch: String) -> UpdateFileOptions {
  72. self.branch = Some(branch);
  73. self
  74. }
  75. pub fn branch(&self) -> Option<&String> {
  76. self.branch.as_ref()
  77. }
  78. pub fn reset_branch(&mut self) {
  79. self.branch = None;
  80. }
  81. pub fn set_committer(&mut self, committer: ::models::Identity) {
  82. self.committer = Some(committer);
  83. }
  84. pub fn with_committer(mut self, committer: ::models::Identity) -> UpdateFileOptions {
  85. self.committer = Some(committer);
  86. self
  87. }
  88. pub fn committer(&self) -> Option<&::models::Identity> {
  89. self.committer.as_ref()
  90. }
  91. pub fn reset_committer(&mut self) {
  92. self.committer = None;
  93. }
  94. pub fn set_content(&mut self, content: String) {
  95. self.content = content;
  96. }
  97. pub fn with_content(mut self, content: String) -> UpdateFileOptions {
  98. self.content = content;
  99. self
  100. }
  101. pub fn content(&self) -> &String {
  102. &self.content
  103. }
  104. pub fn set_dates(&mut self, dates: ::models::CommitDateOptions) {
  105. self.dates = Some(dates);
  106. }
  107. pub fn with_dates(mut self, dates: ::models::CommitDateOptions) -> UpdateFileOptions {
  108. self.dates = Some(dates);
  109. self
  110. }
  111. pub fn dates(&self) -> Option<&::models::CommitDateOptions> {
  112. self.dates.as_ref()
  113. }
  114. pub fn reset_dates(&mut self) {
  115. self.dates = None;
  116. }
  117. pub fn set_from_path(&mut self, from_path: String) {
  118. self.from_path = Some(from_path);
  119. }
  120. pub fn with_from_path(mut self, from_path: String) -> UpdateFileOptions {
  121. self.from_path = Some(from_path);
  122. self
  123. }
  124. pub fn from_path(&self) -> Option<&String> {
  125. self.from_path.as_ref()
  126. }
  127. pub fn reset_from_path(&mut self) {
  128. self.from_path = None;
  129. }
  130. pub fn set_message(&mut self, message: String) {
  131. self.message = Some(message);
  132. }
  133. pub fn with_message(mut self, message: String) -> UpdateFileOptions {
  134. self.message = Some(message);
  135. self
  136. }
  137. pub fn message(&self) -> Option<&String> {
  138. self.message.as_ref()
  139. }
  140. pub fn reset_message(&mut self) {
  141. self.message = None;
  142. }
  143. pub fn set_new_branch(&mut self, new_branch: String) {
  144. self.new_branch = Some(new_branch);
  145. }
  146. pub fn with_new_branch(mut self, new_branch: String) -> UpdateFileOptions {
  147. self.new_branch = Some(new_branch);
  148. self
  149. }
  150. pub fn new_branch(&self) -> Option<&String> {
  151. self.new_branch.as_ref()
  152. }
  153. pub fn reset_new_branch(&mut self) {
  154. self.new_branch = None;
  155. }
  156. pub fn set_sha(&mut self, sha: String) {
  157. self.sha = sha;
  158. }
  159. pub fn with_sha(mut self, sha: String) -> UpdateFileOptions {
  160. self.sha = sha;
  161. self
  162. }
  163. pub fn sha(&self) -> &String {
  164. &self.sha
  165. }
  166. }