IAttachment.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Mail\Provider;
  8. /**
  9. * Mail Attachment Interface
  10. *
  11. * This interface is used for defining individual attachments that are attached to a message
  12. *
  13. * @since 30.0.0
  14. *
  15. */
  16. interface IAttachment {
  17. /**
  18. * sets the attachment file name
  19. *
  20. * @since 30.0.0
  21. *
  22. * @param string $value file name (e.g example.txt)
  23. *
  24. * @return self return this object for command chaining
  25. */
  26. public function setName(string $value): self;
  27. /**
  28. * gets the attachment file name
  29. *
  30. * @since 30.0.0
  31. *
  32. * @return string | null returns the attachment file name or null if one is not set
  33. */
  34. public function getName(): string|null;
  35. /**
  36. * sets the attachment mime type
  37. *
  38. * @since 30.0.0
  39. *
  40. * @param string $value mime type (e.g. text/plain)
  41. *
  42. * @return self return this object for command chaining
  43. */
  44. public function setType(string $value): self;
  45. /**
  46. * gets the attachment mime type
  47. *
  48. * @since 30.0.0
  49. *
  50. * @return string | null returns the attachment mime type or null if not set
  51. */
  52. public function getType(): string|null;
  53. /**
  54. * sets the attachment contents (actual data)
  55. *
  56. * @since 30.0.0
  57. *
  58. * @param string $value binary contents of file
  59. *
  60. * @return self return this object for command chaining
  61. */
  62. public function setContents(string $value): self;
  63. /**
  64. * gets the attachment contents (actual data)
  65. *
  66. * @since 30.0.0
  67. *
  68. * @return string | null returns the attachment contents or null if not set
  69. */
  70. public function getContents(): string|null;
  71. /**
  72. * sets the embedded status of the attachment
  73. *
  74. * @since 30.0.0
  75. *
  76. * @param bool $value true - embedded / false - not embedded
  77. *
  78. * @return self return this object for command chaining
  79. */
  80. public function setEmbedded(bool $value): self;
  81. /**
  82. * gets the embedded status of the attachment
  83. *
  84. * @since 30.0.0
  85. *
  86. * @return bool embedded status of the attachment
  87. */
  88. public function getEmbedded(): bool;
  89. }