Source: managers/shield-information-barrier-segments.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 ShieldInformationBarrierSegmentsManager {
  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 with specified ID
  16. *
  17. * Retrieves shield information barrier segment based on provided ID..
  18. * @param {object} options Options for the request
  19. * @param {string} options.shield_information_barrier_segment_id The ID of the shield information barrier segment.
  20. * @param {Function} [callback] Passed the result if successful, error otherwise
  21. * @returns {Promise<schemas.ShieldInformationBarrierSegment>} A promise resolving to the result or rejecting with an error
  22. */
  23. getById(
  24. options: {
  25. /**
  26. * The ID of the shield information barrier segment.
  27. */
  28. readonly shield_information_barrier_segment_id: string;
  29. },
  30. callback?: Function
  31. ): Promise<schemas.ShieldInformationBarrierSegment> {
  32. const {
  33. shield_information_barrier_segment_id:
  34. shieldInformationBarrierSegmentId,
  35. ...queryParams
  36. } = options,
  37. apiPath = urlPath(
  38. 'shield_information_barrier_segments',
  39. shieldInformationBarrierSegmentId
  40. ),
  41. params = {
  42. qs: queryParams,
  43. };
  44. return this.client.wrapWithDefaultHandler(this.client.get)(
  45. apiPath,
  46. params,
  47. callback
  48. );
  49. }
  50. /**
  51. * List shield information barrier segments
  52. *
  53. * Retrieves a list of shield information barrier segment objects
  54. * for the specified Information Barrier ID.
  55. * @param {object} options Options for the request
  56. * @param {string} options.shield_information_barrier_id The ID of the shield information barrier.
  57. * @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`.
  58. * @param {number} [options.limit] The maximum number of items to return per page.
  59. * @param {Function} [callback] Passed the result if successful, error otherwise
  60. * @returns {Promise<schemas.ShieldInformationBarrierSegments>} A promise resolving to the result or rejecting with an error
  61. */
  62. getAll(
  63. options: {
  64. /**
  65. * The ID of the shield information barrier.
  66. */
  67. readonly shield_information_barrier_id: string;
  68. /**
  69. * Defines the position marker at which to begin returning results. This is
  70. * used when paginating using marker-based pagination.
  71. *
  72. * This requires `usemarker` to be set to `true`.
  73. */
  74. readonly marker?: string;
  75. /**
  76. * The maximum number of items to return per page.
  77. */
  78. readonly limit?: number;
  79. },
  80. callback?: Function
  81. ): Promise<schemas.ShieldInformationBarrierSegments> {
  82. const { ...queryParams } = options,
  83. apiPath = urlPath('shield_information_barrier_segments'),
  84. params = {
  85. qs: queryParams,
  86. };
  87. return this.client.wrapWithDefaultHandler(this.client.get)(
  88. apiPath,
  89. params,
  90. callback
  91. );
  92. }
  93. /**
  94. * Create shield information barrier segment
  95. *
  96. * Creates a shield information barrier segment.
  97. * @param {object} body
  98. * @param {object} [options] Options for the request
  99. * @param {Function} [callback] Passed the result if successful, error otherwise
  100. * @returns {Promise<schemas.ShieldInformationBarrierSegment>} A promise resolving to the result or rejecting with an error
  101. */
  102. create(
  103. body: object,
  104. options?: {},
  105. callback?: Function
  106. ): Promise<schemas.ShieldInformationBarrierSegment> {
  107. const { ...queryParams } = options,
  108. apiPath = urlPath('shield_information_barrier_segments'),
  109. params = {
  110. qs: queryParams,
  111. body: body,
  112. };
  113. return this.client.wrapWithDefaultHandler(this.client.post)(
  114. apiPath,
  115. params,
  116. callback
  117. );
  118. }
  119. /**
  120. * Update shield information barrier segment with specified ID
  121. *
  122. * Updates the shield information barrier segment based on provided ID..
  123. * @param {object} body
  124. * @param {object} options Options for the request
  125. * @param {string} options.shield_information_barrier_segment_id The ID of the shield information barrier segment.
  126. * @param {Function} [callback] Passed the result if successful, error otherwise
  127. * @returns {Promise<schemas.ShieldInformationBarrierSegment>} A promise resolving to the result or rejecting with an error
  128. */
  129. update(
  130. body: object,
  131. options: {
  132. /**
  133. * The ID of the shield information barrier segment.
  134. */
  135. readonly shield_information_barrier_segment_id: string;
  136. },
  137. callback?: Function
  138. ): Promise<schemas.ShieldInformationBarrierSegment> {
  139. const {
  140. shield_information_barrier_segment_id:
  141. shieldInformationBarrierSegmentId,
  142. ...queryParams
  143. } = options,
  144. apiPath = urlPath(
  145. 'shield_information_barrier_segments',
  146. shieldInformationBarrierSegmentId
  147. ),
  148. params = {
  149. qs: queryParams,
  150. body: body,
  151. };
  152. return this.client.wrapWithDefaultHandler(this.client.put)(
  153. apiPath,
  154. params,
  155. callback
  156. );
  157. }
  158. /**
  159. * Delete shield information barrier segment
  160. *
  161. * Deletes the shield information barrier segment
  162. * based on provided ID.
  163. * @param {object} options Options for the request
  164. * @param {string} options.shield_information_barrier_segment_id The ID of the shield information barrier segment.
  165. * @param {Function} [callback] Passed the result if successful, error otherwise
  166. * @returns {Promise<void>} A promise resolving to the result or rejecting with an error
  167. */
  168. deleteById(
  169. options: {
  170. /**
  171. * The ID of the shield information barrier segment.
  172. */
  173. readonly shield_information_barrier_segment_id: string;
  174. },
  175. callback?: Function
  176. ): Promise<void> {
  177. const {
  178. shield_information_barrier_segment_id:
  179. shieldInformationBarrierSegmentId,
  180. ...queryParams
  181. } = options,
  182. apiPath = urlPath(
  183. 'shield_information_barrier_segments',
  184. shieldInformationBarrierSegmentId
  185. ),
  186. params = {
  187. qs: queryParams,
  188. };
  189. return this.client.wrapWithDefaultHandler(this.client.del)(
  190. apiPath,
  191. params,
  192. callback
  193. );
  194. }
  195. }
  196. export = ShieldInformationBarrierSegmentsManager;