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.

172 lines
4.2KB

  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. /// CreateFileOptions : CreateFileOptions options for creating 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 CreateFileOptions {
  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. /// message (optional) for the commit of this file. if not supplied, a default message will be used
  28. #[serde(rename = "message")]
  29. message: Option<String>,
  30. /// new_branch (optional) will make a new branch from `branch` before creating the file
  31. #[serde(rename = "new_branch")]
  32. new_branch: Option<String>
  33. }
  34. impl CreateFileOptions {
  35. /// CreateFileOptions options for creating 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)
  36. pub fn new(content: String) -> CreateFileOptions {
  37. CreateFileOptions {
  38. author: None,
  39. branch: None,
  40. committer: None,
  41. content: content,
  42. dates: None,
  43. message: None,
  44. new_branch: None
  45. }
  46. }
  47. pub fn set_author(&mut self, author: ::models::Identity) {
  48. self.author = Some(author);
  49. }
  50. pub fn with_author(mut self, author: ::models::Identity) -> CreateFileOptions {
  51. self.author = Some(author);
  52. self
  53. }
  54. pub fn author(&self) -> Option<&::models::Identity> {
  55. self.author.as_ref()
  56. }
  57. pub fn reset_author(&mut self) {
  58. self.author = None;
  59. }
  60. pub fn set_branch(&mut self, branch: String) {
  61. self.branch = Some(branch);
  62. }
  63. pub fn with_branch(mut self, branch: String) -> CreateFileOptions {
  64. self.branch = Some(branch);
  65. self
  66. }
  67. pub fn branch(&self) -> Option<&String> {
  68. self.branch.as_ref()
  69. }
  70. pub fn reset_branch(&mut self) {
  71. self.branch = None;
  72. }
  73. pub fn set_committer(&mut self, committer: ::models::Identity) {
  74. self.committer = Some(committer);
  75. }
  76. pub fn with_committer(mut self, committer: ::models::Identity) -> CreateFileOptions {
  77. self.committer = Some(committer);
  78. self
  79. }
  80. pub fn committer(&self) -> Option<&::models::Identity> {
  81. self.committer.as_ref()
  82. }
  83. pub fn reset_committer(&mut self) {
  84. self.committer = None;
  85. }
  86. pub fn set_content(&mut self, content: String) {
  87. self.content = content;
  88. }
  89. pub fn with_content(mut self, content: String) -> CreateFileOptions {
  90. self.content = content;
  91. self
  92. }
  93. pub fn content(&self) -> &String {
  94. &self.content
  95. }
  96. pub fn set_dates(&mut self, dates: ::models::CommitDateOptions) {
  97. self.dates = Some(dates);
  98. }
  99. pub fn with_dates(mut self, dates: ::models::CommitDateOptions) -> CreateFileOptions {
  100. self.dates = Some(dates);
  101. self
  102. }
  103. pub fn dates(&self) -> Option<&::models::CommitDateOptions> {
  104. self.dates.as_ref()
  105. }
  106. pub fn reset_dates(&mut self) {
  107. self.dates = None;
  108. }
  109. pub fn set_message(&mut self, message: String) {
  110. self.message = Some(message);
  111. }
  112. pub fn with_message(mut self, message: String) -> CreateFileOptions {
  113. self.message = Some(message);
  114. self
  115. }
  116. pub fn message(&self) -> Option<&String> {
  117. self.message.as_ref()
  118. }
  119. pub fn reset_message(&mut self) {
  120. self.message = None;
  121. }
  122. pub fn set_new_branch(&mut self, new_branch: String) {
  123. self.new_branch = Some(new_branch);
  124. }
  125. pub fn with_new_branch(mut self, new_branch: String) -> CreateFileOptions {
  126. self.new_branch = Some(new_branch);
  127. self
  128. }
  129. pub fn new_branch(&self) -> Option<&String> {
  130. self.new_branch.as_ref()
  131. }
  132. pub fn reset_new_branch(&mut self) {
  133. self.new_branch = None;
  134. }
  135. }