Source: managers/shield-information-barrier-segment-restrictions.generated.ts

  1. import BoxClient from '../box-client';
  2. import urlPath from '../util/url-path';
  3. import * as schemas from '../schemas';
  4. /**
  5. */
  6. class ShieldInformationBarrierSegmentRestrictionsManager {
  7. client: BoxClient;
  8. /**
  9. * @param {BoxClient} client The Box API Client that is responsible for making calls to the API
  10. */
  11. constructor(client: BoxClient) {
  12. this.client = client;
  13. }
  14. /**
  15. * Get shield information barrier segment restriction by ID
  16. *
  17. * Retrieves a shield information barrier segment
  18. * restriction based on provided ID.
  19. * @param {object} options Options for the request
  20. * @param {string} options.shield_information_barrier_segment_restriction_id The ID of the shield information barrier segment Restriction.
  21. * @param {Function} [callback] Passed the result if successful, error otherwise
  22. * @returns {Promise<schemas.ShieldInformationBarrierSegmentRestriction>} A promise resolving to the result or rejecting with an error
  23. */
  24. getById(
  25. options: {
  26. /**
  27. * The ID of the shield information barrier segment Restriction.
  28. */
  29. readonly shield_information_barrier_segment_restriction_id: string;
  30. },
  31. callback?: Function
  32. ): Promise<schemas.ShieldInformationBarrierSegmentRestriction> {
  33. const {
  34. shield_information_barrier_segment_restriction_id:
  35. shieldInformationBarrierSegmentRestrictionId,
  36. ...queryParams
  37. } = options,
  38. apiPath = urlPath(
  39. 'shield_information_barrier_segment_restrictions',
  40. shieldInformationBarrierSegmentRestrictionId
  41. ),
  42. params = {
  43. qs: queryParams,
  44. };
  45. return this.client.wrapWithDefaultHandler(this.client.get)(
  46. apiPath,
  47. params,
  48. callback
  49. );
  50. }
  51. /**
  52. * List shield information barrier segment restrictions
  53. *
  54. * Lists shield information barrier segment restrictions
  55. * based on provided segment ID.
  56. * @param {object} options Options for the request
  57. * @param {string} options.shield_information_barrier_segment_id The ID of the shield information barrier segment.
  58. * @param {string} [options.marker] Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`.
  59. * @param {number} [options.limit] The maximum number of items to return per page.
  60. * @param {Function} [callback] Passed the result if successful, error otherwise
  61. * @returns {Promise<schemas.ShieldInformationBarrierSegmentRestrictions>} A promise resolving to the result or rejecting with an error
  62. */
  63. getAll(
  64. options: {
  65. /**
  66. * The ID of the shield information barrier segment.
  67. */
  68. readonly shield_information_barrier_segment_id: string;
  69. /**
  70. * Defines the position marker at which to begin returning results. This is
  71. * used when paginating using marker-based pagination.
  72. *
  73. * This requires `usemarker` to be set to `true`.
  74. */
  75. readonly marker?: string;
  76. /**
  77. * The maximum number of items to return per page.
  78. */
  79. readonly limit?: number;
  80. },
  81. callback?: Function
  82. ): Promise<schemas.ShieldInformationBarrierSegmentRestrictions> {
  83. const { ...queryParams } = options,
  84. apiPath = urlPath('shield_information_barrier_segment_restrictions'),
  85. params = {
  86. qs: queryParams,
  87. };
  88. return this.client.wrapWithDefaultHandler(this.client.get)(
  89. apiPath,
  90. params,
  91. callback
  92. );
  93. }
  94. /**
  95. * Create shield information barrier segment restriction
  96. *
  97. * Creates a shield information barrier
  98. * segment restriction object.
  99. * @param {object} body
  100. * @param {object} [options] Options for the request
  101. * @param {Function} [callback] Passed the result if successful, error otherwise
  102. * @returns {Promise<schemas.ShieldInformationBarrierSegmentRestriction>} A promise resolving to the result or rejecting with an error
  103. */
  104. create(
  105. body: object,
  106. options?: {},
  107. callback?: Function
  108. ): Promise<schemas.ShieldInformationBarrierSegmentRestriction> {
  109. const { ...queryParams } = options,
  110. apiPath = urlPath('shield_information_barrier_segment_restrictions'),
  111. params = {
  112. qs: queryParams,
  113. body: body,
  114. };
  115. return this.client.wrapWithDefaultHandler(this.client.post)(
  116. apiPath,
  117. params,
  118. callback
  119. );
  120. }
  121. /**
  122. * Delete shield information barrier segment restriction by ID
  123. *
  124. * Delete shield information barrier segment restriction
  125. * based on provided ID.
  126. * @param {object} options Options for the request
  127. * @param {string} options.shield_information_barrier_segment_restriction_id The ID of the shield information barrier segment Restriction.
  128. * @param {Function} [callback] Passed the result if successful, error otherwise
  129. * @returns {Promise<void>} A promise resolving to the result or rejecting with an error
  130. */
  131. deleteById(
  132. options: {
  133. /**
  134. * The ID of the shield information barrier segment Restriction.
  135. */
  136. readonly shield_information_barrier_segment_restriction_id: string;
  137. },
  138. callback?: Function
  139. ): Promise<void> {
  140. const {
  141. shield_information_barrier_segment_restriction_id:
  142. shieldInformationBarrierSegmentRestrictionId,
  143. ...queryParams
  144. } = options,
  145. apiPath = urlPath(
  146. 'shield_information_barrier_segment_restrictions',
  147. shieldInformationBarrierSegmentRestrictionId
  148. ),
  149. params = {
  150. qs: queryParams,
  151. };
  152. return this.client.wrapWithDefaultHandler(this.client.del)(
  153. apiPath,
  154. params,
  155. callback
  156. );
  157. }
  158. }
  159. export = ShieldInformationBarrierSegmentRestrictionsManager;